From 0e21fa69ba8463498cc01b9a8184b691ffe9ffa2 Mon Sep 17 00:00:00 2001 From: MET Tools Test Account Date: Thu, 5 Sep 2024 19:38:41 +0000 Subject: [PATCH] Per #2924, update the parsing logic for the climatology regrid dictionary. Use config.fcst.climo_mean.regrid first, config.fcst.regrid second, and config.climo_mean.regrid third. Notably, DO NOT use config.regrid. This is definitely the problem with having regrid specified at mutliple config file context levels. It makes the logic for which to use when very messy. --- ...nfig_climo_FCST_NCEP_1.0DEG_OBS_WMO_1.5DEG | 14 +++++++++++++ src/libcode/vx_statistics/read_climo.cc | 21 ++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/internal/test_unit/config/GridStatConfig_climo_FCST_NCEP_1.0DEG_OBS_WMO_1.5DEG b/internal/test_unit/config/GridStatConfig_climo_FCST_NCEP_1.0DEG_OBS_WMO_1.5DEG index ab1cdd8362..3eca135c6d 100644 --- a/internal/test_unit/config/GridStatConfig_climo_FCST_NCEP_1.0DEG_OBS_WMO_1.5DEG +++ b/internal/test_unit/config/GridStatConfig_climo_FCST_NCEP_1.0DEG_OBS_WMO_1.5DEG @@ -82,6 +82,13 @@ fcst = { file_name = [ "${FCST_CLIMO_DIR}/cstdv_1d.19590410" ]; }; + regrid = { + method = BILIN; + width = 2; + vld_thresh = 0.5; + shape = SQUARE; + } + time_interp_method = DW_MEAN; day_interval = 1; hour_interval = 6; @@ -108,6 +115,13 @@ obs = { "${OBS_CLIMO_DIR}/v850hPa_stdev.grib" ]; }; + regrid = { + method = BILIN; + width = 2; + vld_thresh = 0.5; + shape = SQUARE; + } + time_interp_method = DW_MEAN; day_interval = 1; hour_interval = 12; diff --git a/src/libcode/vx_statistics/read_climo.cc b/src/libcode/vx_statistics/read_climo.cc index 072588aff1..50882aac51 100644 --- a/src/libcode/vx_statistics/read_climo.cc +++ b/src/libcode/vx_statistics/read_climo.cc @@ -106,19 +106,26 @@ DataPlaneArray read_climo_data_plane_array(Dictionary *dict, // Get the i-th array entry Dictionary i_dict = parse_conf_i_vx_dict(field_dict, i_vx); - // Parse the "regrid" dictionary - RegridInfo regrid_info; + // Find the correct "regrid" config file context + Dictionary *regrid_parent_dict = nullptr; cs << cs_erase << climo_name << "." << conf_key_regrid; + // First choice e.g. "config.fcst.climo_mean.regrid" if(dict->lookup(cs.c_str(), false)) { - Dictionary *climo_dict = dict->lookup_dictionary(climo_name); - regrid_info = parse_conf_regrid(climo_dict); + regrid_parent_dict = dict->lookup_dictionary(climo_name); + } + // Second choice e.g. "config.fcst.regrid" + else if(dict->lookup(conf_key_regrid)) { + regrid_parent_dict = dict; } - else { - Dictionary *climo_dict = dict->parent()->lookup_dictionary(climo_name); - regrid_info = parse_conf_regrid(climo_dict); + // Third choice e.g. default "config.climo_mean.regrid" + else if(dict->parent()->lookup(cs.c_str(), false)) { + regrid_parent_dict = dict->parent()->lookup_dictionary(climo_name); } + // Parse the "regrid" dictionary + RegridInfo regrid_info = parse_conf_regrid(regrid_parent_dict); + // Parse the "time_interp_method" cs << cs_erase << climo_name << "." << conf_key_time_interp_method; InterpMthd time_interp = int_to_interpmthd(dict->lookup_int(cs.c_str()));