Conversation
Although original code lacks any explanation why NA should not be printed for the first raster category, I do suspect it stems from idea that the first cat is 0 and before proper NULL support 0 was "no data" value.
nilason
left a comment
There was a problem hiding this comment.
Looks fine to me, tests succeeds and I found no regressions (tested with example in manual).
I have some minor suggestions I noted here and there, I attach patch here:
PR2666_fixes.diff.txt.
With that patch the source code for r.kappa passes -Wall -Wextra on clang without warnings, and cppcheck and scan-build are also happy.
I do miss your name in the head of main.c, and while you're there also update (c) date :-).
wenzeslaus
left a comment
There was a problem hiding this comment.
I'm excited to see another JSON output. I think that especially the JSON output would be better with full words rather than various abbreviations. -999 does not seem needed when we have NaN in the "common" (not standard) JSON. (C99 has INFINITY, but NAN may not be available in general, but it is a GNU extension.) Can you please sync the names with docs and interface too?
nilason
left a comment
There was a problem hiding this comment.
Great work, looks good to me!
Re.: -999, it is probably the safest solution.
Output - JSON: Generally, if people write in Python, chances are that JSON outputs will contain NaN without even making a decision to actually do that. A lot of reading will likely happen in Python where NaN will be accepted (read as Output - consistency: Using -999 for NaN would mean that also other places which output that should use the same number, but that's of course neither ensured nor feasible. ...the old NULL/no-data debate. Code: #2681 now introduces NAN to the C code base, but I'm more concerned with outputs. Possibly, infinity may work everywhere? |
No. Then null it is. I'll change the PR & merge it. |
All requested changes are implemented.
The old output mode is kept as a default to not break any of existing scripts.
The old output mode is kept as a default to not break any of existing scripts.
Current output of r.kappa is not machine readable. This PR adds a new flag to print out all data in a json format for greater reusability.