Skip to content
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

Enhance Gen-Vx-Mask shapefile masking to support multiple shapes and specify shape metadata. #1060

Closed
7 of 20 tasks
dwfncar opened this issue Oct 3, 2018 · 2 comments · Fixed by #2537
Closed
7 of 20 tasks
Assignees
Labels
MET: Masking priority: high High Priority requestor: NOAA/EMC NOAA Environmental Modeling Center type: enhancement Improve something that it is currently doing
Milestone

Comments

@dwfncar
Copy link
Contributor

dwfncar commented Oct 3, 2018

Describe the Enhancement

This issue arose again via dtcenter/METplus#2155. Recommend at least supporting the specification of multiple -shapeno values. That would make the commands for this discussion MUCH easier.

In met-8.0, the gen_vx_mask tool can read shapefiles to define masking regions. The shape to be used is defined by the -shapeno command line option. Suggest making this more user friendly by...

  1. Add support multiple shape numbers being specified. For example -shapeno 1,2 or -shapeno 1 -shapeno 2.
  2. The gis_dump_dbf tool dumps metadata to the screen, including key=value pairs such as:
BASIN_ID = "MBRFC"

Consider adding a command line option to support specifying this metadata, such as:

-shape 'key="BASIN_ID"; val="MBRFC";'

And support multiple values as:

-shape 'key="BASIN_ID"; val="MBRFC,AKRFC";'

If multiple vals are specified for a given key, use all records whose value appears in the list.
If multiple keys are specified, only use records that match all of them.

Note that these 'key = ...; val = ...; settings can be parsed similar to the parse_conf_key_value_map() function. This map should be a mapping of unique ConcatString keys (BASIN_ID) to a StringArray of values (MBRFC,AKRFC,CNRFC).

Be sure to add detailed debug messages to the let the user know what the tool is doing.

Note that this will require reading the .dbf file.

The -shape option is really just a fancy/convenient way of setting the -shapeno setting. If both -shape and -shapeno are specified, use all unique records that are specified.

Time Estimate

Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.

Sub-Issues

Consider breaking the enhancement down into sub-issues.
No sub-issues needed

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required: John HG
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Select Repository and/or Organization level Project(s) or add alert: NEED CYCLE ASSIGNMENT label
  • Select Milestone as the next official version or Future Versions

Define Related Issue(s)

Consider the impact to the other METplus components.

Enhancement Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of develop.
    Branch name: feature_<Issue Number>_<Description>
  • Complete the development and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into develop.
    Pull request: feature <Issue Number> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Development issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.
@dwfncar dwfncar added this to the MET 4.0 patch milestone Apr 30, 2019
@JohnHalleyGotway JohnHalleyGotway added priority: high requestor: NOAA/EMC NOAA Environmental Modeling Center type: enhancement Improve something that it is currently doing labels Feb 24, 2020
@JohnHalleyGotway JohnHalleyGotway modified the milestones: MET 9.0, MET 9.1 Feb 24, 2020
@JohnHalleyGotway
Copy link
Collaborator

This issue resurfaced during the NOAA telecon on 2/24/2020:
https://docs.google.com/document/d/1LNV1dkGF0pzOECqDdR8De6U-dRClHGt0ZYN6uujzx6A

========================================================

Logan, that’s a great example.  And yes, you’re correct. MET would write output for that same mask name 3 times.  There would be no way of differentiating the output. As for the impact on event equalization, I suppose you’re right.  When creating the scorecard, METviewer computes pairwise differences. And it would expect a single set of stats for the 2 input models.  And in your example, it’d get 3 for each model, which would result in an error.

One option would be computing stats over the UNION of the MRGL regions instead of processing them separately.  This is doable, but would just require the pre-processing calls to gen_vx_mask to be more sophisticated. You can run gen_vx_mask iteratively to compute the union of those 3 areas.

If we enhanced gen_vx_mask to enable the “-shapeno” command line option to support multiple arguments, that’d make this a lot easier.  You’d just say “-shapeno 0,3,4” assuming the MRGL areas are the 1st, 4,th, and 5th records (0-based). Or better yet, support “-shaperx MRGL” and have gen_vx_mask use regular expressions to figure out which records you want by reading the dbf file… or both.

@JohnHalleyGotway JohnHalleyGotway added priority: high High Priority and removed priority: high labels May 9, 2022
@JohnHalleyGotway JohnHalleyGotway self-assigned this May 3, 2023
@JohnHalleyGotway JohnHalleyGotway moved this from 📋 Backlog to 🏗 In progress in MET-11.1.0 Development May 3, 2023
@JohnHalleyGotway JohnHalleyGotway changed the title Enhance gen_vx_mask shapefile masking to make it more user friendly. Enhance gen_vx_mask shapefile masking to support multiple shapes and specify shape metadata. May 3, 2023
@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented May 3, 2023

FYI, @Deba57 I'm working on this feature_1060_shapes branch for issue #1060 and have been able to get gen_vx_mask to support setting multiple shapes in a single run:

gen_vx_mask 'latlon 720 361 -90 -130 0.5 0.5' \
  ne_110m_admin_0_countries.shp mask.nc \
  -name Europe -type shape \
  -shapeno 18,21,43,110,111,112,113,114,115,116,117,118,119,120,121,122,123,125,126,127,128,129,130,131,132,133,141,142,143,144,150,151,152,153,170,171,172,173,174

Screen Shot 2023-05-03 at 12 38 11 PM

The next task is further simplifying this to use all records where "CONTINENT = Europe".

JohnHalleyGotway added a commit that referenced this issue May 5, 2023
JohnHalleyGotway added a commit that referenced this issue May 5, 2023
…is NOT used. However, do case-insensitive matching. Also work on the log, warning, and error messages.
JohnHalleyGotway added a commit that referenced this issue May 5, 2023
…ecommend single quotes for embedded whitespace.
JohnHalleyGotway added a commit that referenced this issue May 5, 2023
JohnHalleyGotway added a commit that referenced this issue May 5, 2023
…ne file example and then update gen_vx_mask to point to that example.
@JohnHalleyGotway JohnHalleyGotway linked a pull request May 5, 2023 that will close this issue
15 tasks
@JohnHalleyGotway JohnHalleyGotway moved this from 🏗 In progress to 👀 In review in MET-11.1.0 Development May 5, 2023
JohnHalleyGotway added a commit that referenced this issue May 10, 2023
Co-authored-by: Daniel Adriaansen <dadriaan@ucar.edu>
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in MET-11.1.0 Development May 11, 2023
@JohnHalleyGotway JohnHalleyGotway changed the title Enhance gen_vx_mask shapefile masking to support multiple shapes and specify shape metadata. Enhance Gen-Vx-Mask shapefile masking to support multiple shapes and specify shape metadata. Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MET: Masking priority: high High Priority requestor: NOAA/EMC NOAA Environmental Modeling Center type: enhancement Improve something that it is currently doing
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants