Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.describe: Add JSON support #4918

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NishantBansal2003
Copy link
Contributor

fixes: #4903
Use parson to add json output format support to the r.describe module.
The JSON output looks like as follows:

[
	{
		"value": "*"
	},
	{
		"value": "-5.000000 thru -4.960784"
	},
	{
		"value": "-4.529412 thru -4.490196"
	},
	{
		"value": "-4.019608 thru -3.980392"
	},
	{
		"value": "-3.509804 thru -3.470588"
	},
	{
		"value": "-3.039216 thru -3.000000"
	},
	{
		"value": "-2.529412 thru -2.490196"
	},
	{
		"value": "-2.019608 thru -1.980392"
	},
	{
		"value": "-1.549020 thru -1.509804"
	},
	{
		"value": "-1.039216 thru -1.000000"
	},
	{
		"value": "-0.529412 thru -0.490196"
	},
	{
		"value": "0.450980 thru 0.490196"
	},
	{
		"value": "0.960784 thru 1.000000"
	},
	{
		"value": "1.470588 thru 1.509804"
	},
	{
		"value": "1.941176 thru 1.980392"
	},
	{
		"value": "2.450980 thru 2.490196"
	},
	{
		"value": "2.960784 thru 3.000000"
	},
	{
		"value": "3.431373 thru 3.470588"
	},
	{
		"value": "3.941176 thru 3.980392"
	},
	{
		"value": "4.450980 thru 4.490196"
	},
	{
		"value": "4.960784 thru 5.000000"
	}
]

Signed-off-by: Nishant Bansal <[email protected]>
Signed-off-by: Nishant Bansal <[email protected]>
@github-actions github-actions bot added raster Related to raster data processing Python Related code is in Python C Related code is in C module tests Related to Test Suite labels Jan 5, 2025
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
raster/r.describe/testsuite/test_r_describe.py Outdated Show resolved Hide resolved
Signed-off-by: Nishant Bansal <[email protected]>
@NishantBansal2003
Copy link
Contributor Author

Hi everyone, could someone please review this PR when you have a moment? Thank you!

@echoix
Copy link
Member

echoix commented Jan 10, 2025

About the format shown in the body of your PR: Does this mean that the root of the json output is an array instead of an object (like {})? I didn't know it was valid json. I see that the similat shape is used in the test.

For your PR, I don't think I'm able to judge about the C part. But for the Python and test part I could check out.

@NishantBansal2003
Copy link
Contributor Author

About the format shown in the body of your PR: Does this mean that the root of the json output is an array instead of an object (like {})? I didn't know it was valid json. I see that the similat shape is used in the test.

For your PR, I don't think I'm able to judge about the C part. But for the Python and test part I could check out.

Yes, the format will be an array of objects, each containing a category value (originally separated by newlines in the plain format). However, if this format is not appropriate, we can discuss and consider a new output format.
Sure, please take a look at the Python and test parts.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C module Python Related code is in Python raster Related to raster data processing tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Add JSON output to r.describe
2 participants