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 the MET library code to correctly parse timing information from Grid-Stat NetCDF matched pairs output files. #2040

Closed
22 tasks
JohnHalleyGotway opened this issue Feb 4, 2022 · 2 comments · Fixed by #2048 or #2053
Assignees
Labels
MET: Library Code priority: blocker Blocker reporting: DTC NCAR Base NCAR Base DTC Project reporting: DTC NOAA BASE NOAA Office of Atmospheric Research DTC Project requestor: NOAA/EMC NOAA Environmental Modeling Center required: FOR OFFICIAL RELEASE Required to be completed in the official release for the assigned milestone type: bug Fix something that is not working
Milestone

Comments

@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented Feb 4, 2022

Describe the Problem

This issue arose via GitHub discussions in dtcenter/METplus#1400. The MET library code is not correctly parsing the timing information from the NetCDF matched pairs output files generated by Grid-Stat. While the valid time is consistently correct, the initialization and lead times are not.

Recommend reviewing and revising the MET NetCDF library code logic.

Expected Behavior

The MET tools should parsing timing information from each variable which matches the timing information visible by running ncdump -h.

Environment

Describe your runtime environment:
1. Machine: First found on Linux but repeated on a Mac laptop
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s): identified with MET version 10.0.0 as well as the latest version of the develop branch

To Reproduce

Describe the steps to reproduce the behavior:
1. Use a NetCDF matched pairs file generated by running "make test" to demonstrate
2. Do a NetCDF header dump to see the forecast variable timing info:

ncdump -h out/grid_stat/grid_stat_120000L_20050807_120000V_pairs.nc 

3. Note this timing info:

                FCST_TMP_Z2_DTC165:init_time = "20050807_000000" ;
                FCST_TMP_Z2_DTC165:init_time_ut = "1123372800" ;
                FCST_TMP_Z2_DTC165:valid_time = "20050807_120000" ;
                FCST_TMP_Z2_DTC165:valid_time_ut = "1123416000" ;

4. Plot this variable with plot_data_plane and -v 4:

plot_data_plane out/grid_stat/grid_stat_120000L_20050807_120000V_pairs.nc fcst.ps 'name="FCST_TMP_Z2_DTC165"; level="(*,*)";' -v 4

5. Note that the timing info DOES NOT match the header dump above. The init and lead times are wrong:

DEBUG 4:      valid time: 20050807_120000
DEBUG 4:       lead time: 000000
DEBUG 4:       init time: 20050807_120000

Relevant Deadlines

Fix for MET version 10.1.0. Ideally, also provide a bugfix for 10.0.0 in the main_v10.0 branch.

Funding Source

2792541 and 2702691

Define the Metadata

Assignee

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

Labels

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

Projects and Milestone

  • Select Organization level Project for support of the current coordinated release
  • Select Repository level Project for development toward the next official release or add alert: NEED PROJECT ASSIGNMENT label
  • Select Milestone as the next bugfix version

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix 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 main_<Version>.
    Branch name: bugfix_<Issue Number>_main_<Version>_<Description>
  • Fix the bug 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 main_<Version>.
    Pull request: bugfix <Issue Number> main_<Version> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Linked issues
    Select: Organization level software support Project for the current coordinated release
    Select: Milestone as the next bugfix version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Complete the steps above to fix the bug on the develop branch.
    Branch name: bugfix_<Issue Number>_develop_<Description>
    Pull request: bugfix <Issue Number> develop <Description>
    Select: Reviewer(s) and Linked issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Close this issue.
@JohnHalleyGotway JohnHalleyGotway added type: bug Fix something that is not working requestor: NOAA/EMC NOAA Environmental Modeling Center priority: blocker Blocker alert: NEED ACCOUNT KEY Need to assign an account key to this issue required: FOR OFFICIAL RELEASE Required to be completed in the official release for the assigned milestone MET: Library Code labels Feb 4, 2022
@JohnHalleyGotway JohnHalleyGotway added this to the MET 10.1.0 milestone Feb 4, 2022
@JohnHalleyGotway
Copy link
Collaborator Author

Currently, the MetNcFile class defined in met_file.h defines a single Init and Valid time for each file:

         //
         //  time
         //

      unixtime ValidTime;

      unixtime InitTime;

      int      lead_time () const;   //  seconds

And these values are set on lines 302/303 of met_file.cc when reading each variable. So the timing info for the variable that is read LAST will be used for all variables in the file. And that's the bug.

Recommend removing InitTime, ValidTiem, and lead_time() from the MetNc
File class. Recommend adding them to the NcVarInfo class in nc_var_info.h instead (e.g. AccumTime is already there!).

@TaraJensen TaraJensen added 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 Feb 4, 2022
@JohnHalleyGotway
Copy link
Collaborator Author

@jprestop when this issue is complete and merged into develop, please update METplus Discussion dtcenter/METplus#1400 to let Mallory know. And then you can mark that discussion as being answered and lock it.

jprestop pushed a commit that referenced this issue Feb 10, 2022
JohnHalleyGotway added a commit that referenced this issue Feb 11, 2022
@JohnHalleyGotway JohnHalleyGotway linked a pull request Feb 11, 2022 that will close this issue
14 tasks
JohnHalleyGotway added a commit that referenced this issue Feb 11, 2022
…ter. No need to actually READ the data, just find the variable name and access the timing info that has already been parsed into it when MetNcFile::open() was called previously.
@JohnHalleyGotway JohnHalleyGotway linked a pull request Feb 15, 2022 that will close this issue
14 tasks
@TaraJensen TaraJensen added the reporting: DTC NCAR Base NCAR Base DTC Project label Feb 17, 2022
@JohnHalleyGotway JohnHalleyGotway changed the title Fix MET to correctly parse timing information from Grid-Stat NetCDF matched pairs output files. Fix the MET library code to correctly parse timing information from Grid-Stat NetCDF matched pairs output files. Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MET: Library Code priority: blocker Blocker reporting: DTC NCAR Base NCAR Base DTC Project reporting: DTC NOAA BASE NOAA Office of Atmospheric Research DTC Project requestor: NOAA/EMC NOAA Environmental Modeling Center required: FOR OFFICIAL RELEASE Required to be completed in the official release for the assigned milestone type: bug Fix something that is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants