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

Feature 1823 global #1928

Merged
merged 27 commits into from
Oct 1, 2021
Merged

Feature 1823 global #1928

merged 27 commits into from
Oct 1, 2021

Conversation

JohnHalleyGotway
Copy link
Collaborator

@JohnHalleyGotway JohnHalleyGotway commented Sep 29, 2021

Pull Request Testing

  • Describe testing already performed for these changes:

    Manually tested to confirm that wrapping the longitudes works correctly both when processing gridded data as well as interpolating to point locations. See issue comment for an example.

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

    Please review the code changes.

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]

I made no documentation updates since I couldn't find any existing references for special handling of "global" datasets. There is a related discussion of the MODE shift_right option which we should update after making MODE fully support the wrapping of longitudes.

However the LatLon and RotLatLon do include the wrapLon = true/false in their output. So this will show up in the log output when running at high enough verbosity level. For example:

DEBUG 2: Input grid: Projection: Lat/Lon Nx: 72 Ny: 72 lat_ll: -88.750 lon_ll: 177.500 delta_lat: 2.500 delta_lon: 5.000 wrapLon: true

Also, I added a DEBUG(4) log message when the grid covers 360 degrees but the longitude spacing doesn't evenly divide it:

DEBUG 4: Cannot wrap longitudes since 360 is not evenly divisible by delta_lon = 7.
  • Do these changes include sufficient testing updates? [Yes]

See testing updates/additions below.

  • Will this PR result in changes to the test suite? [Yes]

    If yes, describe the new output and/or changes to the existing output:

    One file is added:
ERROR: folder MET-develop/test_output missing 1 files
    regrid/regrid_data_plane_WRAP_LON.nc 

Running this command in earlier versions results in a vertical line of missing data and it's clear that the data is not smoothed over the wrap point, like this:
Screen Shot 2021-10-01 at 10 00 56 AM

But here's what you get with the changes on this branch:
Screen Shot 2021-10-01 at 10 02 21 AM
No vertical line and clearly the smoothing over the wrap longitude is working.
Several files are modified:

egrep -i "file1:|ERROR:" test_regression.log | egrep -B 1 "ERROR:" | grep file1
file1: MET-feature_1823_global/test_output/grid_stat/grid_stat_GRIB_lvl_typ_val_180000L_20170610_180000V.stat
file1: MET-feature_1823_global/test_output/grid_stat/grid_stat_GRIB_set_attr_120000L_20170807_120000V.stat
file1: MET-feature_1823_global/test_output/grid_stat/grid_stat_MPR_THRESH_120000L_20120409_120000V.stat
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_cnt.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_ctc.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_cts.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_eclv.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_fho.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V_sl1l2.txt
file1: MET-feature_1823_global/test_output/point_stat/point_stat_NCPINT_TRMM_240000L_20080808_120000V.stat
  • The diffs in all the Grid-Stat output see are caused by differences in the TOTAL number of matched pairs. In all cases, the TOTAL number has increased as wrapping the input global grid enables more data to be processed.
  • The diffs in the Point-Stat output are also caused by differences in the TOTAL column. In develop, TOTAL = 25061 for all interpolation methods and widths. In this feature branch, TOTAL = 25061 for nearest neighbor, 25008 for INTERP_PNTS = 9, and 24950 for INTERP_PNTS = 25. Note that this is NOT a global grid. It's a Lambert Conformal CONUS domain. There are 26,624 input point observations, and 1563 of them are off the verification grid. The reduction in counts are all due to:
DEBUG 3: Rejected: bad fcst value  = 53

So why are we getting these bad forecast values with these changes? Here's a picture of the point data on this grid:
Screen Shot 2021-10-01 at 10 35 08 AM
The PointStatConfig_APCP config file specifies a valid data threshold of 1.0:

interp = {
   vld_thresh = 1.0;
...

For a 3x3 or 5x5 box along the edge of the domain, clearly some of the forecast values fall off the edge of the grid. Debugging reveals that the older version has vld_thresh set to 0.0 in interp_util.cc while the new version has it set to 1.0, as requested in the config file! Here's the line of code that was added to fix this issue:

vx_pd.set_interp_thresh(interp_info.vld_thresh);

  • Please complete this pull request review by [Friday 10/1/2021].

Pull Request Checklist

See the METplus Workflow for details.

  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s)
    Select: Organization level software support Project or Repository level development cycle Project
    Select: Milestone as the version that will include these changes
  • After submitting the PR, select Linked issues with the original issue number.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

… consistent. This issue will require modifying these classes to wrap global grids.
… the mechanics, passing around the is_global boolean. I still need to actually update the logic to do the wrapping. I also need to update the rest of the codebase for these changes. Perhaps the grid template info should be a struct instead of several args?
…'s where it's applied to the logic... which I still need to do!
…setting was NOT getting set properly in Point-Stat and Ensemble-Stat. Need to add a call to set_interp_thresh instead of using the default >0 threshold.
…ther than updating it to handle global grids.
… utility functions for point_stat, grid_stat, ensemble_stat, and shift_data_plane.
…for skipping observations due to a bad interpolated forecast value.
…c the modulo functionality within python. This is needed to wrap negative X indices back to positive for global grids.
…e point here is whether or not the longitudes span 0 to 360 and has nothing to do with the extent of the latitudes. Using is_global incorrectly implies that the latitudes span -90 to 90.
….0.0 has a vertical stripe of missing data that is gone in this feature branch.
…ta rather than having to add new inputs. In MET version 10.0.0, this results in a vertical line at the wrap longitude point. But feature 1823 fixes and that demonstrates that smoothing across the wrap point works well.
@JohnHalleyGotway JohnHalleyGotway marked this pull request as ready for review October 1, 2021 17:15
Copy link
Collaborator

@georgemccabe georgemccabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes appear to add logic to properly handle wrapping longitudes so that data is interpolated and not lost on the edges.

There are many changes throughout the code base to support this new functionality. I don't fully appreciate all of the details of the changes, but I don't see anything that looks obviously wrong. The images that were generated with these changes included look much better that the previously generated images. New tests were added to demonstrate this new behavior.

Given that these changes do not break any of the automated tests, I approve of this pull request.

Many of the other changes appear to be formatting updates (comment blocks, indentation, opening curly brace location, etc.) and renaming of ifdef blocks to be consistent with the rest of the code base.

@JohnHalleyGotway JohnHalleyGotway removed the request for review from j-opatz October 1, 2021 18:17
Copy link
Collaborator

@hsoh-u hsoh-u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed unit test and there are some differences .

The differences are available at kiowa:/dev/shm/hsoh/met_comp_20211001_1439.log . I do not have enough information to verify the differences.

@JohnHalleyGotway
Copy link
Collaborator Author

Thanks for the review @hsoh-u and @georgemccabe. Howard, I had already run a full regression test, as listed in the initial PR. And I included an explanation for all of the diffs. I checked, and all the diffs flagged in your log file (/dev/shm/hsoh/met_comp_20211001_1439.log) match the explanations I already provided.

I'll proceed with the merge.

@JohnHalleyGotway JohnHalleyGotway merged commit 5e8cc05 into develop Oct 1, 2021
@JohnHalleyGotway JohnHalleyGotway deleted the feature_1823_global branch October 1, 2021 21:49
JohnHalleyGotway added a commit that referenced this pull request Oct 4, 2021
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: Howard Soh <[email protected]>
Co-authored-by: johnhg <[email protected]>
Co-authored-by: Julie.Prestopnik <[email protected]>
Co-authored-by: ericgilleland <[email protected]>
Co-authored-by: George McCabe <[email protected]>
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: jprestop <[email protected]>
Co-authored-by: Julie Prestopnik <[email protected]>
Co-authored-by: hsoh-u <[email protected]>
Co-authored-by: Keith Searight <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: MET Tools Test Account <[email protected]>
Co-authored-by: lisagoodrich <[email protected]>
Co-authored-by: MET Tools Test Account <[email protected]>
Co-authored-by: j-opatz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance MET to use point observations falling between the first and last columns of a global grid.
3 participants