Skip to content

Commit

Permalink
Bugfix #2437 develop convert (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Feb 15, 2023
1 parent d124e2e commit 9a7ebe8
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 81 deletions.
1 change: 0 additions & 1 deletion data/config/GridStatConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ climo_mean = {
}

time_interp_method = DW_MEAN;
match_month = TRUE;
day_interval = 31;
hour_interval = 6;
}
Expand Down
15 changes: 8 additions & 7 deletions docs/Users_Guide/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,16 @@ using the following entries:
smoothing. The default is 120. Ignored if not Gaussian method.

* The "gaussian_dx" and "gaussian_radius" settings must be in the same
units, such as kilometers or degress. Their ratio
units, such as kilometers or degress. Their ratio
(sigma = gaussian_radius / gaussian_dx) determines the Guassian weighting
function.

* The "convert", "censor_thresh", and "censor_val" entries are described
below. When specified, these operations are applied to the output of the
regridding step. The conversion operation is applied first, followed by
the censoring operation.
below. When specified, these operations are applied to the output of the
regridding step. The conversion operation is applied first, followed by
the censoring operation. Note that these operations are limited in scope.
They are only applied if defined within the regrid dictionary itself.
Settings defined at higher levels of config file context are not applied.

.. code-block:: none
Expand Down Expand Up @@ -1318,9 +1320,8 @@ of several entires defining the climatology file names and fields to be used.

* The "hour_interval" entry is an integer specifying the spacing in hours of
the climatology data for each day. This should be set between 0 and 24,
with 6 and 12 being common choices. For example, use 6 for climatology data
with 4 times per day, such as 00Z, 06Z, 12Z, and 18Z. Use "NA" if the timing
of the climatology data should not be checked.
with 6 and 12 being common choices. Use "NA" if the timing of the
climatology data should not be checked.

* The "day_interval" and "hour_interval" entries replace the deprecated
entries "match_month", "match_day", and "time_step".
Expand Down
25 changes: 14 additions & 11 deletions internal/test_unit/config/PointStatConfig_climo
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ fcst = {

field = [
{
name = "TMP";
level = [ "Z2" ];
desc = "KELVIN";
name = "TMP";
level = [ "Z2" ];
desc = "KELVIN";
set_attr_units = "K";
},
{
name = "TMP";
level = [ "Z2" ];
desc = "CELCIUS";
convert(x) = K_to_C(x);
name = "TMP";
level = [ "Z2" ];
desc = "CELCIUS";
convert(x) = K_to_C(x);
set_attr_units = "C";
},
{
name = "TMP";
level = [ "Z2" ];
desc = "FAHRENHEIT";
convert(x) = K_to_F(x);
name = "TMP";
level = [ "Z2" ];
desc = "FAHRENHEIT";
convert(x) = K_to_F(x);
set_attr_units = "F";
},
{
name = "TMP";
Expand Down
29 changes: 29 additions & 0 deletions internal/test_unit/xml/unit_climatology_2.5deg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,33 @@
</output>
</test>

<!-- MET#2437: Test interpolation with a single input monthly climo file -->

<test name="climatology_GRID_STAT_SINGLE_MONTH_2.5DEG">
<exec>&MET_BIN;/grid_stat</exec>
<env>
<pair><name>OUTPUT_PREFIX</name> <value>SINGLE_MONTH_CLIMO_2.5DEG</value></pair>
<pair><name>DAY_INTERVAL</name> <value>31</value></pair>
<pair><name>HOUR_INTERVAL</name> <value>6</value></pair>
<pair><name>CLIMO_MEAN_FILE_LIST</name>
<value>"&DATA_DIR_CLIMO;/NCEP_2.5deg/pgba_mean.19591215"
</value>
</pair>
<pair><name>CLIMO_STDEV_FILE_LIST</name>
<value>"&DATA_DIR_CLIMO;/NCEP_2.5deg/pgba_stdv.19591215"
</value>
</pair>
</env>
<param> \
&DATA_DIR_MODEL;/grib2/gfsanl/gfsanl_4_20120409_1200_000.grb2 \
&DATA_DIR_MODEL;/grib2/gfsanl/gfsanl_4_20120409_1200_000.grb2 \
&CONFIG_DIR;/GridStatConfig_climo_wrap_year \
-outdir &OUTPUT_DIR;/climatology_2.5deg -v 3
</param>
<output>
<stat>&OUTPUT_DIR;/climatology_2.5deg/grid_stat_SINGLE_MONTH_CLIMO_2.5DEG_000000L_20201225_120000V.stat</stat>
<grid_nc>&OUTPUT_DIR;/climatology_2.5deg/grid_stat_SINGLE_MONTH_CLIMO_2.5DEG_000000L_20201225_120000V_pairs.nc</grid_nc>
</output>
</test>

</met_test>
1 change: 0 additions & 1 deletion scripts/config/GridStatConfig_all
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ climo_mean = {
}

time_interp_method = DW_MEAN;
match_month = TRUE;
match_day = FALSE;
time_step = 21600;
}
Expand Down
1 change: 1 addition & 0 deletions src/basic/vx_cal/doyhms_to_unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,4 @@ return ( dt );


////////////////////////////////////////////////////////////////////////

10 changes: 7 additions & 3 deletions src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1299,14 +1299,18 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) {
info.gaussian.trunc_factor = (is_bad_data(conf_value) ? default_trunc_factor : conf_value);
if (info.method == InterpMthd_Gaussian || info.method == InterpMthd_MaxGauss) info.gaussian.compute();

// MET#2437 Do not search the higher levels of config file context for convert,
// censor_thresh, and censor_val. They must be specified within the
// regrid dictionary itself.

// Conf: convert
info.convert_fx.set(regrid_dict->lookup(conf_key_convert));
info.convert_fx.set(regrid_dict->lookup(conf_key_convert, false));

// Conf: censor_thresh
info.censor_thresh = regrid_dict->lookup_thresh_array(conf_key_censor_thresh, false);
info.censor_thresh = regrid_dict->lookup_thresh_array(conf_key_censor_thresh, false, true, false);

// Conf: censor_val
info.censor_val = regrid_dict->lookup_num_array(conf_key_censor_val, false);
info.censor_val = regrid_dict->lookup_num_array(conf_key_censor_val, false, true, false);

// Validate the settings
info.validate();
Expand Down
Loading

0 comments on commit 9a7ebe8

Please sign in to comment.