dtcenter/MET

Enhance MET to parse the `set_attr` options prior reading data from gridded data files

Closed this issue · 2 comments

Describe the Enhancement

This enhancement request arose via GitHub discussion dtcenter/METplus#2507. The user provided a NetCDF file where the grid information is formatted in a way that MET does not expect. The set_attr options, including set_attr_grid are provided to enable the user to override the metadata defined in the input gridded data files. However, the current order of processing logic makes them less useful than they could be.

Please see a sample input file in seneca:/d1/projects/METplus/discussions/2507/phyf000.nc. Running this through plot_data_plane with file_type=NETCDF_NCCF; produces this error message:

ERROR  : NcCfFile::read_netcdf_grid() -> Couldn't figure out projection from information in netCDF file.

Adding the set_attr_grid option to explicitly define the grid for the data still produces the same error message.

This issue is to update the processing logic for reading data from gridded input file. Currently, MET opens the file, parses the metadata, and then updates the metadata based on the set_attr options. If errors are encountered when parsing the metadata from the file, MET exits with bad status prior to handling the set_attr options. Modify this logic so that if set_attr options are defined, the code doesn't even try to parse that metadata from the file.

Of course, such data could also be handled via Python embedding. But supporting it via the set_atttr options may be easier for some users.

Time Estimate

3 days?

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
  • 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 the next official version or Backlog of Development Ideas
  • For the next official version, select the MET-X.Y.Z 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.Z Development project for development toward the next official release
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.

Grid definition does not include the north to south latitude. How about using the negative dy value to swap data for north to south?

This was fixed by Enhance the set_attr_grid processing logic.

The grid definition of rotlatlon:

rotlatlon Nx Ny lat_ll lon_ll delta_lat delta_lon true_lat_sp true_lon_sp aux_rotation

Here is a command with set_attr_grid at seneca:

/d1/projects/MET/MET_regression/develop/NB20241108/MET-develop/bin/plot_data_plane  \
  /d1/projects/METplus/discussions/2507/phyf000.nc test.ps \
  'name="ext550"; level="(0,64,*,*)"; file_type=NETCDF_NCCF; set_attr_grid="rotlatlon 4881 2961 -37.0 299.0 0.025 0.025 -35.0 247.0 0.0";' \
  -v 4

This produce the same plot by python embedding at dtcenter/METplus#2507