Skip to content

Commit

Permalink
Per #2924, update the parsing logic for the climatology regrid dictio…
Browse files Browse the repository at this point in the history
…nary. 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.
  • Loading branch information
MET Tools Test Account committed Sep 5, 2024
1 parent f8ddfcc commit 0e21fa6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
21 changes: 14 additions & 7 deletions src/libcode/vx_statistics/read_climo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 0e21fa6

Please sign in to comment.