Skip to content

Conversation

@douglasjacobsen
Copy link
Member

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

Fixes #65

@douglasjacobsen
Copy link
Member Author

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.

@pwolfram
Copy link
Contributor

pwolfram commented Oct 5, 2016

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.

@douglasjacobsen
Copy link
Member Author

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).

@milenaveneziani
Copy link
Collaborator

Thanks @douglasjacobsen for doing this.
I think I can test this by running some driver_scripts, right?
Also, I don't think I understood the last 3 lines of Doug's comment: is it something we need to do before merging this PR?

@douglasjacobsen
Copy link
Member Author

@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.

@milenaveneziani
Copy link
Collaborator

milenaveneziani commented Oct 5, 2016

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.

@milenaveneziani
Copy link
Collaborator

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.

@pwolfram
Copy link
Contributor

pwolfram commented Oct 5, 2016

@milenaveneziani, I think we will ultimately want "enterGroupName" to be specified via a command line argument, e.g., -g groupName in each of the scripts. I'm happy to make this change or you can, please let me know either way.

@milenaveneziani
Copy link
Collaborator

@pwolfram: I thought of adding the -g option too. Here is my attempt. Let me know if you have comments.
I also added a specific groupName for MOC and Basins regions in setup_MOC_basins and setup_ocean_basins. Not sure if this should be made an option. I thought against it being an option to reduce degrees of freedom when writing the plotting/analysis script.

@milenaveneziani
Copy link
Collaborator

milenaveneziani commented Oct 6, 2016

Also, I ran split_feature on all *_Basin_separate feature files I had created with setup_ocean_basins and setup_MOC_basins, so that 1) I made sure that groupName was not an attribute in the resulting split features, and 2) I changed the format to most of the features in ocean/region. I ran split_features also on the remaining (11) ocean/region/geojson files that were left with the old format, so now all features on my local branch have the new format.
I am not committing these new features quite yet, though, to double check with you if this is OK.

@pwolfram
Copy link
Contributor

pwolfram commented Oct 6, 2016

@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

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).

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.

Copy link
Contributor

@pwolfram pwolfram left a 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.

del paths

#if ( 'groupName' not in all_features.keys() ):
# all_features['groupName'] = "enterGroupName"
Copy link
Contributor

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.

options, args = parser.parse_args()

groupNameMOC = 'MOCRegionsGroup'
groupNameBasins = 'BasinRegionsGroup'
Copy link
Contributor

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.

Copy link
Collaborator

@milenaveneziani milenaveneziani Oct 6, 2016

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To summarize:

  1. groupNames should be unique from each script
  2. I would include elements like MOC, Global, etc. as well as Regions and Transects for greater specificity in groupNames

metavar="NAME", required=True)
parser.add_argument("-g", "--groupName", dest="groupName",
help="Feature group name.",
metavar="GROUPNAME", default="enterGroupName")
Copy link
Contributor

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.

metavar="FILE2", required=True)
parser.add_argument("-g", "--groupName", dest="groupName",
help="Feature group name.",
metavar="GROUPNAME", default="enterGroupName")
Copy link
Contributor

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.


options, args = parser.parse_args()

groupName = 'BasinRegionsGroup'
Copy link
Contributor

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.

Copy link
Collaborator

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?

Copy link
Contributor

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"')
Copy link
Contributor

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.

@xylar
Copy link
Collaborator

xylar commented Oct 6, 2016

What was the purpose of the change to ocean/region/Southern_Ocean/region.geojson?

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.

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.

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.

@pwolfram
Copy link
Contributor

pwolfram commented Oct 6, 2016

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.

@milenaveneziani
Copy link
Collaborator

@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.
If you prefer these changes to go in a different PR, could you please suggest how to undo the current change in the SO geojson file?

@pwolfram
Copy link
Contributor

pwolfram commented Oct 6, 2016

@milenaveneziani, I'll take care of removing the SO geojson file as we discussed.

milenaveneziani added a commit to douglasjacobsen/geometric_features that referenced this pull request Oct 6, 2016
@pwolfram
Copy link
Contributor

pwolfram commented Oct 6, 2016

@milenaveneziani, we observe the problem with Atlantic_Basin.geojson produced by setup_ocean_basins.py and setup_MOC_basins.py yielding different output but having the same groupName.
screenshot 2016-10-06 11 45 01

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 groupName point to different features is dangerous long term.

The more I think about it we need to have a different groupName for each script and I would argue that this has to happen in this PR, not another one, because we are grappling with the groupName issue here.

@pwolfram
Copy link
Contributor

pwolfram commented Oct 6, 2016

In summary, one of OceanBasinRegionsGroup needs renamed.

@milenaveneziani
Copy link
Collaborator

@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.

@milenaveneziani
Copy link
Collaborator

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants