Skip to content

Fix Grid-Diag bug when reading the same variable name from multiple data sources. #1694

@JohnHalleyGotway

Description

@JohnHalleyGotway

Describe the Problem

This is a bug in Grid-Diag reported via met-help by the UK MetOffice:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=97766

When reading the same variable name from two input data sources, the resulting joint 2D histogram is correct, but the 1D histograms are exactly the same in the output. When changing the variable name for one of the data sources to something else, then the 1D histograms are no longer duplicated. I suspect that this issue is related to the same variable name being used in both input data sources. The code is likely keeping track of the histogram using some string and that's the source of the confusion. Recommend looking there to debug.

Recommend making two more changes for this as well:

  • Update the grid_diag log messages to report the set_attr_name/set_attr_level strings instead of the requested variable name/level. If the user has provided name/level overrides, we should report them in the log messages.
  • I also found that running with a very small number of bins (10 and 5), some of the resulting histogram counts were not initialized to 0. So we got bogus output values! Should also find/fix that issue.

Expected Behavior

Grid-Diag should produce the same 1D histograms whether the input data is run separately for each data source or once for both. Be sure to add a new unit test which reproduces this bug and verifies that it is fixed.

Environment

Describe your runtime environment:
1. Machine: reproduced on kiowa
2. OS: Linux
3. Software version number(s): MET version 9.1

To Reproduce

Describe the steps to reproduce the behavior:
1. On 'kiowa'
2. Run grid_diag:

cd /d1/projects/MET/MET_Help/mittermaier_data_20210215
/d1/projects/MET/MET_releases/met-9.1.1/bin/grid_diag \
-data glosea_2019060100_d001_001.nc -data gpm_2019060100_2019060200.nc \
-config GridDiag.glosea -out grid_diag_joint.nc -v 3 -log run_gd.log 
ncdump grid_diag_joint.nc > grid_diag_joint.ncdump

3. Inspect grid_diag_joint.ncdump
4. Note that the counts for hist_glosea_precip_sfc and hist_gpm_precip_sfc are duplicated!

Relevant Deadlines

met-10.0.0

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: Marion

Labels

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

Projects and Milestone

  • Review projects and select relevant Repository and Organization ones or add "alert:NEED PROJECT ASSIGNMENT" label
  • Select milestone to relevant 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), Project(s), Milestone, and Linked issues
  • 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>
  • Close this issue.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions