Skip to content

Commit

Permalink
Bugfix 3056 ugrid forecast reference time (#3061)
Browse files Browse the repository at this point in the history
* #3056 Initial release

* #3056 Added  UGridConfig_lfric2

* #3056 Moved some APIs (for init_time) to nc_utils.cc from nc_cf_file.cc

* #3056 Get ther InitTime from the forecast_reference_time variable or filename

* #3056 Added an unittest for LFric dataset, point_stat_ugrid_lfric2_config

* #3056 Moved back getting init_time and valid_time from ghe filename

* #3056 Corrected version

* #3056 Cleanup

* #3056 Resolved SonarQUbe findings

* #3056 Cleanup

* Per #3056, rename 'ugrid_lfric2' as 'ugrid_lfric_pressure_levels' throughout to more clearly indicate that this configuration is for lfric data that's been interpolated in the vertical to pressure levels.

* Per #3056, tweak wording of UGrid config file comments

* Per #3056, reconfigure the UGrid LFRic pressure levels test to make more realistic comparisons at 2 pressure levels and don't write .stat and _mpr.txt because the data is duplicated.

---------

Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
Co-authored-by: MET Tools Test Account <met_test@seneca.rap.ucar.edu>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent bf40993 commit 2e8a62b
Show file tree
Hide file tree
Showing 11 changed files with 347 additions and 84 deletions.
1 change: 1 addition & 0 deletions data/config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ config_DATA = \
PlotModeFieldConfig_default \
Point2GridConfig_default \
UGridConfig_lfric \
UGridConfig_lfric_pressure_levels \
UGridConfig_mpas \
PlotPointObsConfig_default

Expand Down
1 change: 1 addition & 0 deletions data/config/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ config_DATA = \
PlotModeFieldConfig_default \
Point2GridConfig_default \
UGridConfig_lfric \
UGridConfig_lfric_pressure_levels \
UGridConfig_mpas \
PlotPointObsConfig_default

Expand Down
5 changes: 3 additions & 2 deletions data/config/UGridConfig_lfric
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
//
// Unstructured grid configuration file.
//
// UGridConfig_lfric at the current working directory replaces the settings here.
// UGridConfig_lfric in the current working directory overrides the settings
// here for reading native model level data from the LFRic modeling system.
// For additional or updated information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

//
// Dimensions and variables mapping for LFric dataset
// Dimensions and variables mapping for LFRic dataset
//
ugrid_metadata_map = [
{ key = "dim_face"; val = "nMesh2d_face"; },
Expand Down
37 changes: 37 additions & 0 deletions data/config/UGridConfig_lfric_pressure_levels
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
////////////////////////////////////////////////////////////////////////////////
//
// Unstructured grid configuration file.
//
// UGridConfig_lfric_pressure_levels in the current working directory overrides
// the settings here for reading pressure level data from LFRic modeling system.
// For additional or updated information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

//
// Dimensions and variables mapping for LFRic dataset
//
ugrid_metadata_map = [
{ key = "dim_face"; val = "dim1"; },
{ key = "dim_node"; val = "nMesh2d_node"; },
{ key = "dim_edge"; val = "nMesh2d_edge"; },
{ key = "dim_time"; val = "time_counter"; },
{ key = "dim_vert"; val = "pressure"; },
{ key = "cell_id"; val = "indexToCellID"; },
{ key = "lat_face"; val = "Mesh2d_face_y"; },
{ key = "lon_face"; val = "Mesh2d_face_x"; },
{ key = "vert_face"; val = "pressure"; },
{ key = "lat_edge"; val = "Mesh2d_edge_y"; },
{ key = "lon_edge"; val = "Mesh2d_edge_x"; },
{ key = "lat_node"; val = "Mesh2d_node_y"; },
{ key = "lon_node"; val = "Mesh2d_node_x"; },
{ key = "time"; val = "time_instant"; }
];

ugrid_max_distance_km = 30;

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

version = "V12.1.0";

////////////////////////////////////////////////////////////////////////////////
3 changes: 2 additions & 1 deletion data/config/UGridConfig_mpas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//
// Unstructured grid configuration file.
//
// UGridConfig_mpas at the current working directory replaces the settings here.
// UGridConfig_mpas in the current working directory overrides the settings
// here for reading data from the MPAS modeling system.
// For additional or updated information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////
Expand Down
188 changes: 188 additions & 0 deletions internal/test_unit/config/PointStatConfig_ugrid_lfric_pressure_levels
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
////////////////////////////////////////////////////////////////////////////////
//
// Point-Stat configuration file.
//
// For additional information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

//
// Output model name to be written
//
model = "FCST";

//
// Output description to be written
// May be set separately in each "obs.field" entry
//
desc = "NA";

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

//
// Verification grid
// May be set separately in each "field" entry
//
regrid = {
to_grid = NONE;
method = NEAREST;
width = 1;
}

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

obs_window = {
beg = ${BEG_DS};
end = ${END_DS};
}

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

mpr_column = [];
mpr_thresh = [];
cnt_thresh = [ NA ];
cnt_logic = UNION;
wind_thresh = [ NA ];
wind_logic = UNION;
eclv_points = 0.05;

//
// Forecast and observation fields to be verified

fcst = {
sid_inc = [];
sid_exc = [];
obs_quality_inc = [];
obs_quality_exc = [];

file_type = NETCDF_UGRID;

field = [
{ name = "u_in_w3"; level = "(21,*)"; set_attr_level = "P500"; },
{ name = "u_in_w3"; level = "(24,*)"; set_attr_level = "P850"; }
];
}
obs = {
sid_inc = [];
sid_exc = [];
obs_quality_inc = [];
obs_quality_exc = [];

field = [
{ name = "UGRD"; level = "P500"; },
{ name = "UGRD"; level = "P850"; }
];
}

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

climo_mean = obs;
climo_mean = {
file_name = [];
}

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

mask = {
grid = [];
poly = [];
sid = [];
llpnt = [{ name = "ALLLATLON"; lat_thresh = NA; lon_thresh = NA; }];
}

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

ci_alpha = [ 0.05 ];

boot = {
interval = PCTILE;
rep_prop = 1.0;
n_rep = 200;
rng = "mt19937";
seed = "1";
}

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

//
// Interpolation methods
// May be set separately in each "obs.field" entry
//
interp = {
vld_thresh = 1.0;
shape = SQUARE;

type = [
{
method = NEAREST;
width = 1;
}
];
}

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

//
// HiRA verification method
// May be set separately in each "obs.field" entry
//
hira = {
flag = FALSE;
width = [ 2, 3, 4, 5 ];
vld_thresh = 1.0;
cov_thresh = [ ==0.25 ];
shape = SQUARE;
prob_cat_thresh = [];
}

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

//
// Threshold for SEEPS p1 (Probability of being dry)
//
seeps_p1_thresh = >=0.1&&<=0.85;

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

//
// Statistical output types
// May be set separately in each "obs.field" entry
//
output_flag = {
fho = NONE;
ctc = NONE;
cts = NONE;
mctc = NONE;
mcts = NONE;
cnt = NONE;
sl1l2 = NONE;
sal1l2 = NONE;
vl1l2 = NONE;
val1l2 = NONE;
vcnt = NONE;
pct = NONE;
pstd = NONE;
pjc = NONE;
prc = NONE;
ecnt = NONE; // Only for HiRA.
orank = NONE; // Only for HiRA.
rps = NONE; // Only for HiRA.
eclv = NONE;
mpr = STAT;
seeps = NONE;
seeps_mpr = NONE;
}

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

ugrid_dataset = "lfric_pressure_levels";
ugrid_max_distance_km = 30;
//ugrid_coordinates_file = "";

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

tmp_dir = "/tmp";
output_prefix = "${OUTPUT_PREFIX}";
version = "V12.1.0";

////////////////////////////////////////////////////////////////////////////////
20 changes: 20 additions & 0 deletions internal/test_unit/xml/unit_ugrid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,24 @@
</output>
</test>

<test name="point_stat_ugrid_lfric_pressure_levels">
<exec>&MET_BIN;/point_stat</exec>
<env>
<pair><name>BEG_DS</name> <value>-180000</value></pair>
<pair><name>END_DS</name> <value>180000</value></pair>
<pair><name>OUTPUT_PREFIX</name> <value>UGRID_LFRIC_PRESSURE_LEVELS</value></pair>
<pair><name>CONFIG_DIR</name> <value>&CONFIG_DIR;</value></pair>
</env>
<param> \
&DATA_DIR_UGRID;/lfric/lfric_2012-04-09_00.00.00.nc \
&OUTPUT_DIR;/pb2nc/gdas1.20120409.t12z.prepbufr.nc \
&CONFIG_DIR;/PointStatConfig_ugrid_lfric_pressure_levels \
-ugrid_config ${MET_BASE}/config/UGridConfig_lfric_pressure_levels \
-outdir &OUTPUT_DIR;/point_stat_ugrid -v 4
</param>
<output>
<stat>&OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_LFRIC_PRESSURE_LEVELS_180000L_20120409_180000V.stat</stat>
</output>
</test>

</met_test>
Loading

0 comments on commit 2e8a62b

Please sign in to comment.