-
Notifications
You must be signed in to change notification settings - Fork 67
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
UFRM: preserve source AOI fields in output vector #1626
Open
emilyanndavis
wants to merge
4
commits into
natcap:main
Choose a base branch
from
emilyanndavis:bugfix/1600-ufrm-preserve-source-aoi-fields
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6b9d56c
Copies existing fields in UFRM source aoi vector to target vector
emilyanndavis 2797c4c
Update HISTORY.rst
emilyanndavis 3ec1485
Update UFRM to use CreateCopy when generating summary vector
emilyanndavis 51660ad
Merge branch 'main' of github.com:natcap/invest into bugfix/1600-ufrm…
emilyanndavis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for researching into this difference between Geopackage and Shapefile! This solves the problem of converting from SHP to GPKG specifically, but I'm concerned that it's not generalizable to other combinations of formats.
One solution we've used in other models is to add a unique ID attribute that we can rely on being consistent, unlike the FID, and use that as the stat key.
Another solution might be to keep the original structure of iterating over features in the source layer (like on original line 583) and creating the new fields manually (forgive me if you've already tried this). The following seems to work for me:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point, but I wonder if we need to worry about generalizability here? The formats for these particular vectors are not user-defined; they're constrained by the model itself. The target vector is a shapefile, because it is generated with the ESRI Shapefile driver. In this version, that's via
CreateCopy
(line 557); on main, it's viaCreate
(line 564). Meanwhile, the "source" vector is actually the reprojection, which is a Geopackage generated by invokingpygeoprocessing.reproject_vector
with the GPKG driver (see theexecute
method, lines 413 and 462). So, as long as we don't change those implementation details, we should be OK (and if we do change them, the regression tests should let us know if there's a problem).What do you think? Happy to go back to adding the fields manually if you still think that's a better approach here.