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

Bug in the autoregridding of masking regions. #1163

Closed
JohnHalleyGotway opened this issue Jul 15, 2019 · 3 comments
Closed

Bug in the autoregridding of masking regions. #1163

JohnHalleyGotway opened this issue Jul 15, 2019 · 3 comments
Assignees
Labels
requestor: NOAA/EMC NOAA Environmental Modeling Center type: bug Fix something that is not working

Comments

@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented Jul 15, 2019

This issue was raised via met-help:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=91026

Mallory found that the behavior of Grid-Stat changed from met-7.0 to met-8.0 (and still persists in met-8.1). Use the NetCDF output gen_vx_mask on Grid 104 for the NAO. Then run Grid-Stat with auto-regridding of masks and see that the number of matched pairs differ. In met-7.0 the NA points are excluded and in met-8.0 they are included (met-8.0 and met-8.1).

In met-7.0, the auto-regridding of NAO results in 4805 pairs on Grid 4, but in met-8.1, it results in 209032 pairs!

@JohnHalleyGotway JohnHalleyGotway added type: bug Fix something that is not working component: application code requestor: NOAA/EMC NOAA Environmental Modeling Center labels Jul 15, 2019
@JohnHalleyGotway JohnHalleyGotway added this to the MET 8.1.2 (bugfix) milestone Jul 15, 2019
@JohnHalleyGotway JohnHalleyGotway self-assigned this Jul 15, 2019
@JohnHalleyGotway
Copy link
Collaborator Author

I tested this by running Grid-Stat to compare a GFS file to itself on NCEP Grid 4 with masks defined by "NAO.poly" and "NAO_mask.nc" (on Grid 104). I ran met-7.0 and met-8.1:

setenv VERSION 7.0 // or 8.1
/usr/local/met-${VERSION}/bin/grid_stat
gfs_2012040900_F012.grib gfs_2012040900_F012.grib GridStatConfig
-outdir out-${VERSION} -log run_gs_${VERSION}.log

met-7.0 with NAO poly = 4610 pairs
met-7.0 with NAO mask = 4805 pairs
met-8.1 with NAO poly = 4610 pairs
met-8.1 with NAO mask = 209032 pairs

I checked the NetCDF matched pairs files and found that they are identical. The NAO_poly output includes only the northern Atlantic data. But the NOA mask data includes that AND all points of Grid 4 outside of Grid 104. So this symptom of the bug exists in both met-7.0 and met-8.1.

@JohnHalleyGotway
Copy link
Collaborator Author

This bug was introduced when switching to boolean MaskPlane objects instead of floating point DataPlane objects. In the DataPlane::mask_plane() member function, we fail to check for bad data. So values of -9999 are stored as a boolean value of TRUE, when they should be FALSE.

The reason that the NetCDF matched pairs file has so many points turned on for the NAO mask is found in the met_regrid_generic() function, which fails to initialize the output to bad data values. We could easily do that, but I worry about unintended consequences because this code is called by many, many MET tools...
to_data.set_constant(bad_data_double);

@JohnHalleyGotway
Copy link
Collaborator Author

The one line change in DataPlane::mask_plane() to check for bad data values fixed both of the issues listed above. The number of matched pairs now matches met-7.0. In addition, the NetCDF matched pairs output is now correctly limited to the NAO region. The MaskPlane object must be used different than the DataPlane object was in met-7.0.

Committed fix in both the develop and master_v8.1 branches.

@JohnHalleyGotway JohnHalleyGotway changed the title Bug in the autoregridding of masking regions in met-8.0 and met-8.1. Bug in the autoregridding of masking regions. Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requestor: NOAA/EMC NOAA Environmental Modeling Center type: bug Fix something that is not working
Projects
None yet
Development

No branches or pull requests

1 participant