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

Fix Gen-Vx-Mask to handle named grids and grid specification strings for -type grid #1993

Closed
16 of 20 tasks
JohnHalleyGotway opened this issue Dec 13, 2021 · 1 comment · Fixed by #1994 or #1995
Closed
16 of 20 tasks
Assignees
Labels
component: code cleanup Code cleanup and maintenance issue MET: Masking priority: medium Medium Priority reporting: DTC NCAR Base NCAR Base DTC Project reporting: DTC NOAA BASE NOAA Office of Atmospheric Research DTC Project requestor: METplus Team METplus Development Team type: enhancement Improve something that it is currently doing
Milestone

Comments

@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented Dec 13, 2021

Describe the Enhancement

While developing commands to enhance the online tutorial for gen_vx_mask, we ran into two commands that we expected to work that do not. The usage statement indicates that calling gen_vx_mask in this way should work. This issue is to fix gen_vx_mask to handle the following:

  • Run with "-type grid" where "mask_file" is set to a named grid.
gen_vx_mask G004 G130 named_grid_mask.nc -type grid
ERROR  : grd_file_type() -> file does not exist "G130"
  • Run with "-type grid" where "mask_file" is set to a grid specification string.
gen_vx_mask G004 "latlon 200 100 -40 -50 0.5 0.5" grid_spec_mask.nc -type grid
ERROR  : grd_file_type() -> file does not exist "latlon 200 100 -40 -50 0.5 0.5"

Here's a selection from the gen_vx_mask usage statement:

"mask_file" defines the masking information (required).
...
For "grid" masking, specify a named grid, the path to a gridded data file, or an explicit grid specification.

So the two examples listed above should work! Once fixed, be sure to update unit_gen_vx_mask.xml to include these new variations.

Time Estimate

1 day.

Sub-Issues

Consider breaking the enhancement down into sub-issues.
None 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: @JohnHalleyGotway
  • Select scientist(s) or no scientist required: no scientist needed

Labels

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

Projects and Milestone

  • Select Repository and/or Organization level Project(s) or add alert: NEED PROJECT 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 Linked 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.
@JohnHalleyGotway JohnHalleyGotway added type: enhancement Improve something that it is currently doing component: code cleanup Code cleanup and maintenance issue priority: medium Medium Priority alert: NEED ACCOUNT KEY Need to assign an account key to this issue requestor: METplus Team METplus Development Team MET: Masking labels Dec 13, 2021
@JohnHalleyGotway JohnHalleyGotway added this to the MET 10.1.0 milestone Dec 13, 2021
@JohnHalleyGotway JohnHalleyGotway self-assigned this Dec 13, 2021
@JohnHalleyGotway
Copy link
Collaborator Author

JohnHalleyGotway commented Dec 13, 2021

I tweaked the logic in gen_vx_mask to support this. The 2 commands listed in the issue now run fine:

  1. Using a named grid:
gen_vx_mask G004 G130 named_grid_mask.nc -type grid -v 3
DEBUG 1: Input Grid:		G004
DEBUG 1: Mask File:		G130
DEBUG 3: Use input grid named "G004".
DEBUG 2: Parsed Input Grid:	G004 (720 x 361)
DEBUG 3: Use mask grid named "G130".
DEBUG 2: Parsed Mask Grid:	G130 (451 x 337)
DEBUG 3: Grid Masking:		10716 of 259920 points inside
DEBUG 1: Output File:		named_grid_mask.nc

Screen Shot 2021-12-13 at 12 06 00 PM

2. Using a grid spec string:
gen_vx_mask G004 "latlon 200 100 -40 -50 0.5 0.5" grid_spec_mask.nc -type grid -v 3
DEBUG 1: Input Grid:		G004
DEBUG 1: Mask File:		latlon 200 100 -40 -50 0.5 0.5
DEBUG 3: Use input grid named "G004".
DEBUG 2: Parsed Input Grid:	G004 (720 x 361)
DEBUG 3: Use mask grid defined by string "latlon 200 100 -40 -50 0.5 0.5".
DEBUG 2: Parsed Mask Grid:	To (latlon) (200 x 100)
DEBUG 3: Grid Masking:		20000 of 259920 points inside
DEBUG 1: Output File:		grid_spec_mask.nc

Screen Shot 2021-12-13 at 12 06 48 PM

JohnHalleyGotway added a commit that referenced this issue Dec 13, 2021
@JohnHalleyGotway JohnHalleyGotway linked a pull request Dec 13, 2021 that will close this issue
14 tasks
@JohnHalleyGotway JohnHalleyGotway linked a pull request Dec 14, 2021 that will close this issue
12 tasks
@TaraJensen TaraJensen added reporting: DTC NCAR Base NCAR Base DTC Project reporting: DTC NOAA BASE NOAA Office of Atmospheric Research DTC Project and removed alert: NEED ACCOUNT KEY Need to assign an account key to this issue labels Dec 16, 2021
@JohnHalleyGotway JohnHalleyGotway changed the title Fix gen_vx_mask to handle named grids and grid specification strings for the grid type mask. Fix GenVxMask to handle named grids and grid specification strings for -type grid Jan 15, 2022
@JohnHalleyGotway JohnHalleyGotway changed the title Fix GenVxMask to handle named grids and grid specification strings for -type grid Fix Gen-Vx-Mask to handle named grids and grid specification strings for -type grid Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: code cleanup Code cleanup and maintenance issue MET: Masking priority: medium Medium Priority reporting: DTC NCAR Base NCAR Base DTC Project reporting: DTC NOAA BASE NOAA Office of Atmospheric Research DTC Project requestor: METplus Team METplus Development Team type: enhancement Improve something that it is currently doing
Projects
None yet
2 participants