From f2498bf09d77044c46ae91ea9523736841bd3042 Mon Sep 17 00:00:00 2001 From: johnhg Date: Mon, 16 Nov 2020 16:16:09 -0700 Subject: [PATCH] Bugfix 1562 develop grid_diag (#1564) * Per #1562, add the same grid_diag fix for the develop branch. * Per #1562, removing the poly = CONUS.poly mask from GridDiagConfig_TMP. That settting masked a problem in the handling of missing data. Exercising the mask.poly option is tested in another unit test. This will change the output and break the nightly build, but that's good since we'll do more thorough testing. --- met/src/libcode/vx_series_data/series_pdf.cc | 9 ++++++--- test/config/GridDiagConfig_TMP | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/met/src/libcode/vx_series_data/series_pdf.cc b/met/src/libcode/vx_series_data/series_pdf.cc index 8f7eeb0bf6..15f1c8cf15 100644 --- a/met/src/libcode/vx_series_data/series_pdf.cc +++ b/met/src/libcode/vx_series_data/series_pdf.cc @@ -66,8 +66,9 @@ void update_pdf( for(int i = 0; i < dp.nx(); i++) { for(int j = 0; j < dp.ny(); j++) { - if(!mp.s_is_on(i, j)) continue; double value = dp.get(i, j); + if(!mp.s_is_on(i, j) || + is_bad_data(value)) continue; int k = floor((value - min) / delta); if(k < 0) k = 0; if(k >= pdf.size()) k = pdf.size() - 1; @@ -92,12 +93,14 @@ void update_joint_pdf( for(int i = 0; i < dp_A.nx(); i++) { for(int j = 0; j < dp_A.ny(); j++) { - if(!mp.s_is_on(i, j)) continue; double value_A = dp_A.get(i, j); + double value_B = dp_B.get(i, j); + if(!mp.s_is_on(i, j) || + is_bad_data(value_A) || + is_bad_data(value_B)) continue; int k_A = floor((value_A - min_A) / delta_A); if(k_A < 0) k_A = 0; if(k_A >= n_A) k_A = n_A - 1; - double value_B = dp_B.get(i, j); int k_B = floor((value_B - min_B) / delta_B); if(k_B < 0) k_B = 0; if(k_B >= n_B) k_B = n_B - 1; diff --git a/test/config/GridDiagConfig_TMP b/test/config/GridDiagConfig_TMP index fd451d5dd3..eb5d4650e8 100644 --- a/test/config/GridDiagConfig_TMP +++ b/test/config/GridDiagConfig_TMP @@ -62,7 +62,7 @@ data = { mask = { grid = ""; - poly = "MET_BASE/poly/CONUS.poly"; + poly = ""; } ////////////////////////////////////////////////////////////////////////////////