r.geomorphon: use gjson/parson for JSON profile output#6984
r.geomorphon: use gjson/parson for JSON profile output#6984Abhi-d-gr8 wants to merge 4 commits intoOSGeo:mainfrom
Conversation
|
Hi, was looking at the CI results, the failures seem to be isolated to certain builds, it looks more like a CMake or parson/gjson linkage or avaliability issue in the minimal builds, rather than a problem with the JSON generation logic itself. I am familiar with the r.kappa json path and the cmake setup, would be glad to help or debug if that is useful. |
4ff2e5c to
845e85a
Compare
|
Hi ! @pahalsrivastava |
wenzeslaus
left a comment
There was a problem hiding this comment.
The test will need to go in first in a separate PR. Then this PR should follow it. Get a good test in, then we can back to this PR.
| fd, tmp = tempfile.mkstemp(prefix="rgeom_profile_", suffix=".json") | ||
| os.close(fd) |
There was a problem hiding this comment.
Why are you creating it here?
| # basic sanity checks on JSON structure | ||
| self.assertIn("final_results", data) | ||
| self.assertIn("computation_parameters", data) | ||
| self.assertIsInstance(data["final_results"], dict) | ||
| self.assertIsInstance(data["computation_parameters"], dict) |
There was a problem hiding this comment.
Actual (current) values will need to be checked.
Fixes #6970
This updates r.geomorphon JSON profile output to use the GRASS JSON wrapper (gjson, backed by parson) instead of manual string formatting.
Changes :
profile.c: build the JSON output via gjson (G_json_* API) and serialize pretty
Makefile: link against$(PARSONLIB) and add $ (PARSONDEP)
testsuite/test_r_geom.py: add test_profile_json to confirm the output file is created and contains expected top-level keys
YAML/XML output paths are unchanged (per guidance to keep the PR focused on JSON).
Goal is a pure refactor of JSON generation with the same external behavior/structure.
AI usage note :
I used AI assistance while working on this because I was hitting repeated syntax/build issues and initially couldn’t locate the GRASS JSON wrapper. It helped point me to gjson and the general direction, but I implemented the final changes and validated with local build + pre-commit.