Repository navigation
Upload disturbance polygons as a feature - #746
Open
lindsaywiard wants to merge 2 commits into
Open
lindsaywiard wants to merge 2 commits into
lindsaywiard wants to merge 2 commits into
Conversation
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.
A user with a fire perimeter or treatment units, and no FDist raster, had to rasterize the polygons before the API could use them as a disturbance. This adds a
disturbancefeature: the user uploads a file of polygons, each carrying an FDist code. A later change lets a fuel model request point at the feature.Changes
lib/landfire/config.py: addVALID_FDIST_CODES, every code100 * D_TYPE + 10 * D_SEVERITY + D_TIMEwith D_TYPE 1-7, D_SEVERITY 1-3 and D_TIME 1-3, and export it fromlib.landfire.features/schema.py,features/router.py: adddisturbancetoFeatureTypeand mount the new router at/disturbance.features/disturbance/schema.py: the request body is a GeoJSON FeatureCollection of Polygon and MultiPolygon features with at least one feature.properties.fdistthat is a valid code; 0 is not accepted.name,type,yearandseverityare optional labels, stored as given and never checked against the code. Other properties are ignored.mapping_year(1900 to 2100), the year the last digit of each FDist code is counted back from. It is stored in the feature'ssource.features/disturbance/validate.py: reads the CRS from thecrsblock (any CRS is accepted,EPSG:4326when there is none, 422 if it can't be parsed), builds the GeoDataFrame, and ensures at least one polygon intersects the domain. It also computes the bounds in the file's own CRS.features/disturbance/router.py:POST /domains/{domain_id}/features/disturbance/geojson. As with layerset, it writes synchronously with no worker job or weekly dispatch budget. It saves the GeoParquet to{domain_id}/{feature_id}.parquetin the features bucket and a feature record with statuscompletedand a georeference.features/disturbance/examples.py: documented examples (minimal, with labels, with metadata) over the Blackfoot test domain.mapping_year(1 for that year, 2 for the previous four years, 3 for five to nine years earlier). Where polygons overlap, the more recent disturbance wins and the later feature in the file wins a tie.Tests
mapping_yearrange, geometry types, and the documented examples parsing.make_domain_datadomain): URN and bare CRS forms, the lat/lon default, a different UTM zone, an unparseable CRS, bounds in the file's CRS, no overlap, partial overlap, one polygon inside, and the nullableyearcolumn.owner_idin the response, the georeference, lat/lon input, and 422 for an empty collection, a missing or out-of-rangemapping_year, an invalidfdistand no overlap. The documented examples are translated onto the test domain and each creates a feature.