Open
Conversation
Contributor
|
Let's first discuss the JSON structure... Here is a suggestions that mimicks the plain ascii: {
"project": "spearfish",
"created": "2025-06-01T...",
"region": {
"north": 4928000.00,
"south": 4914000.00,
"east": 609000.00,
"west": 590000.00,
"ewres": 30,
"nsres": 30
},
"mask": null,
"maps": [
{"name": "owner", "title": "Ownership", "type": "raster"},
{"name": "roads", "title": "Roads", "type": "raster"}
],
"unit": "square miles",
"row_cats": [0, 1, 2, 3, 4, 5],
"col_cats": [1, 2],
"matrix": [
[50.63, 37.49],
[ 1.53, 0.68],
[ 2.92, 0.72],
[ 3.97, 2.57],
[ 0.65, 1.36],
[ 0.19, 0.00]
],
"row_totals": [88.12, 2.21, 3.64, 6.54, 2.00, 0.19],
"row_totals_without_zero": [88.12, 2.21, 3.64, 6.54, 2.00, 0.19],
"col_totals": [59.90, 42.80],
"col_totals_without_zero": [9.27, 5.32],
"totals": {"value": 102.70, "value_without_zero": 14.58}
}Note there are very similar tools - r.kappa and r.report, r.report has nested schema while r.kappa provide a value matrix. It seems r.coin is more similar to r.kappa in this regard, so hence I suggest the JSON above. |
Contributor
Author
|
Noted on the JSON format. Will come up with a fix soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds JSON output support for r.coin module.
Comprehensive unit tests are added to verify:
This improves machine-readability and prevents regressions in JSON output behavior.
Below is an example of JSON Output for r.coin: