-
Notifications
You must be signed in to change notification settings - Fork 25
Add groupName as an attribute to merged feature files #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
Conversation
|
See #66 (comment) about a conversation related to the motivation / use of groupName. Note, this doesn't update the driver scripts to automatically set unique / useful groupNames for the resulting feature group files. |
|
Note, following the group meeting today, @douglasjacobsen mentioned that this should not be as general as in this PR but instead should be included when using the merge script. |
f5a74b1 to
b81c487
Compare
|
I just pushed an updated version of this branch that does what I think it should in terms of adding groupName to features files. Note, with the change to json.dump, you'll have to re-merge / dump all of the existing features to prevent people from thinking the scripts have changed them (for example, if you merge any ocean region, and then split it, the entire file is different). |
|
Thanks @douglasjacobsen for doing this. |
|
@milenaveneziani You can test this with two things. 1) run a driver script, and make sure groupName is an attribute. 2) Split some features to where they are supposed to go, and make sure groupName is not an attribute. You don't need to do anything else for this specific PR, I was just saying that when you do (2) above, the entire file will look like it's changed (because the formatting has changed) so it might be confusing. At some point you guys should re-merge / split all of the features within this repo, to make sure their formatting is consistent with the output format. This is one of the negative side effects of changing the output format. |
|
I see now. I am hoping @xylar will have a better idea of what features will be impacted by this PR. I ran the setup_MOC_basins driver and the groupName is included in the *_Basin geojson files (which are created with merge_features), but not in the *_MOC geojson's, because those are created with combine_features.py. I can add a similar modification to this script. |
|
Ok, so I added the groupName to the other 2 scripts that are used to create the MOC basins: combine_features and difference_features. Now, if I run setup_MOC_basins, all resulting features have the groupName in them. Same goes for setup_ocean_basins, as it should be. I will let @xylar take a look at this though before merging. |
|
@milenaveneziani, I think we will ultimately want |
|
@pwolfram: I thought of adding the -g option too. Here is my attempt. Let me know if you have comments. |
|
Also, I ran split_feature on all |
|
@milenaveneziani, I think this makes sense and if something seems like it could be improved I commented on it in the review. Note, we need to do the
step @douglasjacobsen recommended (reprinted above for clarity). Note this is up for debate as to whether this should be done here or in a later PR, but I think we want to make this a giant merge for clarity. @xylar, please feel free to comment on this if you disagree. |
pwolfram
left a comment
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.
What was the purpose of the change to ocean/region/Southern_Ocean/region.geojson? We eventually need to update all the files to correspond to the changes with this script but need to discuss whether this should be now or in a later PR. I'm leaning toward now as opposed to later because then all the changes in this PR are consistent and not inter-dependent on another PR but my initial reaction was the opposite. What do you think about this @milenaveneziani?
If you agree, you should push the changes to this repo for review. However, we have already changed the output format in #52 so it wouldn't be a big deal to submit all the changes in a separate PR. In hindsight, I think @xylar and I should have updated all the geojson files when we completed #52.
merge_features.py
Outdated
| del paths | ||
|
|
||
| #if ( 'groupName' not in all_features.keys() ): | ||
| # all_features['groupName'] = "enterGroupName" |
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.
Please remove commented text because it is not needed.
driver_scripts/setup_MOC_basins.py
Outdated
| options, args = parser.parse_args() | ||
|
|
||
| groupNameMOC = 'MOCRegionsGroup' | ||
| groupNameBasins = 'BasinRegionsGroup' |
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.
I'm wondering if there isn't a choice of better name for groupNameBasins. We probably want to make sure the group names are unique throughout the repo too.
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.
What about OceanBasinsGroup?
I wanted to leave Regions in groupNameMOC because at some point we will also have MOCTransectsGroup.
Also, this is the only place where we define specific groups for now.
Another 2 regions that should fall in the OceanBasinsGroup are the GlobalOcean_* features: any suggestion in whether this should be done by hand or within the setup_ocean_basins driver?
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.
I think the group name needs to be different than in driver_scripts/setup_ocean_basins.py and other files. Maybe groupNameBasins = 'BasinRegionsGroup' to groupNameBasins = 'MOCBasinRegionsGroup'?
I think the files should be entirely produced by the scripts to document how they are created.
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.
To summarize:
groupNamesshould be unique from each script- I would include elements like
MOC,Global, etc. as well asRegionsandTransectsfor greater specificity ingroupNames
combine_features.py
Outdated
| metavar="NAME", required=True) | ||
| parser.add_argument("-g", "--groupName", dest="groupName", | ||
| help="Feature group name.", | ||
| metavar="GROUPNAME", default="enterGroupName") |
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.
Instead of "enterGroupName" I think we want something like "unspecifiedGroupName" and this should be a default throughout the changes to this repo.
difference_features.py
Outdated
| metavar="FILE2", required=True) | ||
| parser.add_argument("-g", "--groupName", dest="groupName", | ||
| help="Feature group name.", | ||
| metavar="GROUPNAME", default="enterGroupName") |
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.
Please see previous comment about changing default.
driver_scripts/setup_ocean_basins.py
Outdated
|
|
||
| options, args = parser.parse_args() | ||
|
|
||
| groupName = 'BasinRegionsGroup' |
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.
This groupName is not unique with respect to setup_MOC_basins.py.
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.
Why do you think it is not unique?
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.
The name sounded too generic and not specific enough. Maybe something like GlobalOceanBasinRegionsGroup would be better?
| parser.add_argument("-f", "--feature_file", dest="feature_file", help="Single feature file to append to features.geojson", metavar="FILE") | ||
| parser.add_argument("-d", "--features_directory", dest="features_dir", help="Directory containing multiple feature files, each will be appended to features.geojson", metavar="PATH") | ||
| parser.add_argument("-g", "--group", dest="groupName", help="Feature group name.", metavar="GROUPNAME", default="enterGroupName") | ||
| parser.add_argument("-t", "--tags", dest="tags", help="Semicolon separated list of tags to match features against.", metavar='"TAG1;TAG2;TAG3"') |
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.
Please see previous comment about changing default.
I am wondering the same. @douglasjacobsen included this in his commit, but I'm wondering if that was by mistake and should be undone. @milenaveneziani has also undone @douglasjacobsen's only other change, so maybe the first commit on this branch should be rebased out.
I strongly feel like this needs to be a separate PR. I really dislike when PRs creep way beyond their initial intended purpose just because there is a need for other clean up. While I suppose this cleanup should have happened as part of #52, I don't think we split features very often at this point because most of the features we want to define are now in the repo, so I didn't see much urgency in performing this update when I posted #52. |
|
Following @xylar's comments I propose we don't change any geojson files in this repo and move that we save geojson changes to a fresh PR. |
|
@pwolfram and @xylar: about the Souther_Ocean geojson file change, I was also puzzled by why that happened. But I did mention in one of my comments that I have run split_features (as Doug suggested) on the *_Basin_separated files and all the remaining features, so I now have the newer format on my local branch. |
|
@milenaveneziani, I'll take care of removing the SO geojson file as we discussed. |
f6f5f76 to
70c3256
Compare
|
@milenaveneziani, we observe the problem with The coordinates are also very different. This is something to keep in mind when using these results in the model because I would say that having the same The more I think about it we need to have a different |
|
In summary, one of |
|
@pwolfram: now this is confusing to me too.. I really thought the two Atlantic_Basin features generated by the 2 drivers were the same. I would say let us have a unique groupName for this PR, but we need to address this asap. I was just about to open an issue about this. |
|
@pwolfram: would you mind making the change and pushing, since you are already doing some clean up on your side? thanks. |
Added groupName and option to specify groupName in merge_, combine_ and difference_features
70c3256 to
57a6a31
Compare

This merge adds groupName to the merged feature files, to allow feature
groups to be created by subsequent tools.
Fixes #65