Skip to content

Enhance @value NetCDF dimension lookup logic to support negative values #3406

Description

@JohnHalleyGotway

Describe the Enhancement

@georgemccabe ran into an issue with the @value lookup logic when reading a WRF NetCDF file into MET. Attempting @value dimension lookup fails when the value is negative.

Run the following on seneca:

/d1/projects/MET/MET_regression/develop/latest/bin/plot_data_plane \
/d1/personal/mccabe/wrf_renewable/wrf/20250406_06/wrfout/wrfout_zlev_d01_2025-04-07_12:00:00 \
plot.ps \
'name="S_ZL"; level="(0,@-100,*,*)";'

And note the runtime error:

DEBUG 1: Opening data file: wrfout_zlev_d01_2025-04-07_12:00:00
WARNING: 
WARNING: WrfFile::data(NcVar *, const LongArray &, DataPlane &, double &) const -> bad arguments:
Nelements = 4
Nalloc    = 4
AllocInc  = 10
Element # 0 = 0
Element # 1 = -9999
Element # 2 = -12345
Element # 3 = -12345
ERROR  : 
ERROR  : LongArray::operator[](int) -> range check error ... -1
ERROR  : 

Then run ncdump and ncgen to replace all the Z_ZL values from negative to positive and rerun:

/d1/projects/MET/MET_regression/develop/latest/bin/plot_data_plane \
/d1/personal/mccabe/wrf_renewable/wrf/20250406_06/wrfout/wrfout_zlev_d01_2025-04-07_12:00:00 \
plot.ps \
'name="S_ZL"; level="(0,@-100,*,*)";' 

Which runs successfully:
Image

This issue is to update the MET WRF NetCDF library (as well as other NetCDF libraries) to support @value lookup logic for values < 0.

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.

  • Add a checkbox for each sub-issue here.

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

PRJ014651 -- code maintenance

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Review default alert labels
  • Select component(s)
  • Select priority
  • Select requestor(s)

Milestone and Projects

  • Select Milestone as a MET-X.Y.Z version, Consider for Next Release, or Backlog of Development Ideas
  • For a MET-X.Y.Z version, select the MET-X.Y Development project

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 issue
    Select: Milestone as the next official version
    Select: MET-X.Y Development project for development toward the next coordinated release
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.

Metadata

Metadata

Assignees

Type

No type

Projects

Status
🏁 Done

Relationships

None yet

Development

No branches or pull requests

Issue actions