Repository navigation
Compose: decode stored geometry coordinates; fix cell-target description and unit example - #736
Merged
Merged
Conversation
… and unit example (#735) Grid now decodes stringified inline-geometry coordinates in source.operations, so compose grids with geometry conditions return nested-list GeoJSON on create, GET and list. The spatial target description says what cell does for each operator: intersects matches any touched cell, within only cells entirely inside, outside only untouched cells. The unit_override compose example wrote fuel_load.1hr in g/m**2, which the output-key check rejects; it now scales a live herb load by a percent literal and writes kg/m**2.
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.
Closes #735
Changes
Griddecodessource.operations(grids/schema.py). Compose stores inline-geometry conditioncoordinatesJSON-encoded for Firestore.Griddecoded them only for top-levelmodifications, so a compose grid with a geometry condition returned"coordinates": "[[[...]]]"as a string insourceon create, GET and list. It now decodessource.operationsthe same way inventories decodesource.modifications. The worker already handles both forms (griddle/modifications.py), so it doesn't change.targetdescription (grids/modification_models.py, both spatial condition models):celldoesn't mean "any overlap matches" for every operator.intersectsmatches any cell the geometry touches,withinonly cells entirely inside it, andoutsideonly cells it doesn't touch. This matches the griddle mask logic.unit_overridecompose example (grids/compose/examples.py): it wrotefuel_load.1hring/m**2, which the output-key check rejects with a 422. It now multiplies a live herb load by a 67%literal (derivedkg*%/m**2) and writes it askg/m**2.Contract
Response shape fix: compose
source.operations[*].conditions[*].geometry.coordinatesis now a nested list, not a string. This is a bug fix, but clients reading the string form would see the change. The SDK keepssourceas a dict, so it's unaffected.Ripples
compose_grids/responses/geometry_condition_created.jsonafter this deploys.Verification
Gridschema test: decodessource.operationsgeometry. It fails without the fix.pytest tests/resources/grids/compose/ tests/resources/grids/test_schema.pyagainst a local server: 141 passedpytest tests/resources/grids/test_modifications_router.pyplus compose: 129 passed