Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #2893 output_obtype #2995

Merged
merged 12 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/config/EnsembleStatConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ message_type_group_map = [
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
Expand Down
2 changes: 2 additions & 0 deletions data/config/PointStatConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ message_type_group_map = [
{ key = "WATERSF"; val = "SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

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

//
Expand Down
19 changes: 19 additions & 0 deletions docs/Users_Guide/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,25 @@ used.
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag
------------------------

The "obtype_as_group_val_flag" entry is a boolean that controls how the
OBTYPE header column is populated for message type groups defined in
"message_type_group_map". If set to TRUE and when writing matched pair
line types (MPR, SEEPS_MPR, and ORANK), write OBTYPE as the group map
*value*, i.e. the input message type for each individual observation.
If set to FALSE (default) and for all other line types, write OBTYPE
as the group map key, i.e. the name of the message type group.

For example, if FALSE, write the OBTYPE column in the MPR line type
as the "ANYAIR" message type group name. If TRUE, write OBTYPE as "AIRCAR"
or "AIRCFT", based on the input message type of each point observation.

.. code-block:: none

obtyp_as_group_val_flag = FALSE;

message_type_map
----------------

Expand Down
1 change: 1 addition & 0 deletions docs/Users_Guide/ensemble-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ ____________________
obs_summary = NONE;
obs_perc_value = 50;
message_type_group_map = [...];
obtype_as_group_val_flag = FALSE;
grid_weight_flag = NONE;
point_weight_flag = NONE;
output_prefix = "";
Expand Down
1 change: 1 addition & 0 deletions docs/Users_Guide/point-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ ________________________
obs_summary = NONE;
obs_perc_value = 50;
message_type_group_map = [...];
obtype_as_group_val_flag = FALSE;
point_weight_flag = NONE;
tmp_dir = "/tmp";
output_prefix = "";
Expand Down
2 changes: 2 additions & 0 deletions internal/test_unit/config/EnsembleStatConfig_python
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ message_type_group_map = [
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
Expand Down
2 changes: 2 additions & 0 deletions internal/test_unit/config/EnsembleStatConfig_single_file_grib
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ message_type_group_map = [
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
Expand Down
2 changes: 2 additions & 0 deletions internal/test_unit/config/EnsembleStatConfig_single_file_nc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ message_type_group_map = [
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
Expand Down
2 changes: 2 additions & 0 deletions internal/test_unit/config/PointStatConfig_LAND_TOPO_MASK
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ message_type_group_map = [
{ key = "WATERSF"; val = "SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

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

climo_mean = fcst;
Expand Down
166 changes: 166 additions & 0 deletions internal/test_unit/config/PointStatConfig_MPR_OBTYPE
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
////////////////////////////////////////////////////////////////////////////////
//
// Point-Stat configuration file.
//
// For additional information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

model = "FCST";

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

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

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;

//
// Mapping of message type group name to comma-separated list of values.
//
message_type_group_map = [
{ key = "SURFACE"; val = "ADPSFC,SFCSHP,MSONET"; },
{ key = "ANYAIR"; val = "AIRCAR,AIRCFT"; },
{ key = "ANYSFC"; val = "ADPSFC,SFCSHP,ADPUPA,PROFLR,MSONET"; },
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; },
{ key = "LANDSF"; val = "ADPSFC,MSONET"; },
{ key = "WATERSF"; val = "SFCSHP"; }
];

obtype_as_group_val_flag = TRUE;

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

message_type = [ "SURFACE" ];

field = [
{ name = "TMP"; level = "Z2"; }
];

}
obs = fcst;

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

climo_mean = fcst;
climo_mean = {
file_name = [ ${CLIMO_FILE} ];
}

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

mask = {
grid = [ "FULL" ];
poly = [];
sid = [];
llpnt = [];
}

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

ci_alpha = [ 0.05 ];

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

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

interp = {
vld_thresh = 1.0;

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

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

hira = {
flag = TRUE;
width = [ 3 ];
vld_thresh = 1.0;
cov_thresh = [ ==0.25 ];
shape = SQUARE;
prob_cat_thresh = [ >273 ];
}

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

output_flag = {
fho = NONE;
ctc = NONE;
cts = NONE;
mctc = NONE;
mcts = NONE;
cnt = STAT;
sl1l2 = STAT;
sal1l2 = STAT;
vl1l2 = NONE;
val1l2 = NONE;
vcnt = NONE;
pct = STAT;
pstd = NONE;
pjc = NONE;
prc = NONE;
ecnt = STAT;
rps = NONE;
orank = STAT;
eclv = NONE;
mpr = STAT;
seeps = NONE;
seeps_mpr = NONE;
}

////////////////////////////////////////////////////////////////////////////////
// Threshold for SEEPS p1 (Probability of being dry)

seeps_p1_thresh = NA;

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

duplicate_flag = NONE;
rank_corr_flag = TRUE;

point_weight_flag = NONE;

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

////////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions internal/test_unit/config/PointStatConfig_WINDS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ message_type_group_map = [
{ key = "USERSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

fcst = {
sid_inc = [];
sid_exc = [];
Expand Down
2 changes: 2 additions & 0 deletions internal/test_unit/config/PointStatConfig_airnow
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ message_type_group_map = [
{ key = "WATERSF"; val = "SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

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

//
Expand Down
20 changes: 20 additions & 0 deletions internal/test_unit/xml/unit_point_stat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@
</output>
</test>

<test name="point_stat_GRIB1_NAM_GDAS_MPR_OBTYPE">
<exec>&MET_BIN;/point_stat</exec>
<env>
<pair><name>BEG_DS</name> <value>-300</value></pair>
<pair><name>END_DS</name> <value>300</value></pair>
<pair><name>OUTPUT_PREFIX</name> <value>GRIB1_NAM_GDAS_MPR_OBTYPE</value></pair>
<pair><name>CONFIG_DIR</name> <value>&CONFIG_DIR;</value></pair>
<pair><name>CLIMO_FILE</name> <value>"&DATA_DIR_MODEL;/grib1/gfs/gfs_2012040900_F012_gNam.grib"</value></pair>
</env>
<param> \
&DATA_DIR_MODEL;/grib1/nam/nam_2012040900_F012.grib \
&OUTPUT_DIR;/pb2nc/gdas1.20120409.t12z.prepbufr.nc \
&CONFIG_DIR;/PointStatConfig_MPR_OBTYPE \
-outdir &OUTPUT_DIR;/point_stat -v 1
</param>
<output>
<stat>&OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MPR_OBTYPE_120000L_20120409_120000V.stat</stat>
</output>
</test>

<test name="point_stat_GRIB1_NAM_GDAS_MASK_SID">
<exec>&MET_BIN;/point_stat</exec>
<env>
Expand Down
2 changes: 2 additions & 0 deletions scripts/config/EnsembleStatConfig
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ message_type_group_map = [
{ key = "ONLYSF"; val = "ADPSFC,SFCSHP"; }
];

obtype_as_group_val_flag = FALSE;

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
Expand Down
1 change: 1 addition & 0 deletions src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ static const char conf_key_model[] = "model";
static const char conf_key_desc[] = "desc";
static const char conf_key_obtype[] = "obtype";
static const char conf_key_output_flag[] = "output_flag";
static const char conf_key_obtype_as_group_val_flag[] = "obtype_as_group_val_flag";
static const char conf_key_obs_window[] = "obs_window";
static const char conf_key_beg[] = "beg";
static const char conf_key_end[] = "end";
Expand Down
14 changes: 13 additions & 1 deletion src/libcode/vx_stat_out/stat_columns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ void write_mpr_row(StatHdrColumns &shc, const PairDataPoint *pd_ptr,
STATOutputType out_type,
AsciiTable &stat_at, int &stat_row,
AsciiTable &txt_at, int &txt_row,
bool update_obtype,
bool update_thresh) {

// MPR line type
Expand All @@ -1567,6 +1568,9 @@ void write_mpr_row(StatHdrColumns &shc, const PairDataPoint *pd_ptr,
// Write a line for each matched pair
for(int i=0; i<pd_ptr->n_obs; i++) {

// MET #2893 write individual obs message type
if(update_obtype) shc.set_obtype(pd_ptr->typ_sa[i].c_str());

// Set the observation valid time
shc.set_obs_valid_beg(pd_ptr->vld_ta[i]);
shc.set_obs_valid_end(pd_ptr->vld_ta[i]);
Expand Down Expand Up @@ -1645,6 +1649,7 @@ void write_seeps_mpr_row(StatHdrColumns &shc, const PairDataPoint *pd_ptr,
STATOutputType out_type,
AsciiTable &stat_at, int &stat_row,
AsciiTable &txt_at, int &txt_row,
bool update_obtype,
bool update_thresh) {

// SEEPS line type
Expand All @@ -1668,6 +1673,9 @@ void write_seeps_mpr_row(StatHdrColumns &shc, const PairDataPoint *pd_ptr,
if(!pd_ptr->seeps_mpr[i] ||
is_bad_data(pd_ptr->seeps_mpr[i]->score)) continue;

// MET #2893 write individual obs message type
if(update_obtype) shc.set_obtype(pd_ptr->typ_sa[i].c_str());

// Set the observation valid time
shc.set_obs_valid_beg(pd_ptr->vld_ta[i]);
shc.set_obs_valid_end(pd_ptr->vld_ta[i]);
Expand Down Expand Up @@ -1899,7 +1907,8 @@ void write_phist_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr,
void write_orank_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr,
STATOutputType out_type,
AsciiTable &stat_at, int &stat_row,
AsciiTable &txt_at, int &txt_row) {
AsciiTable &txt_at, int &txt_row,
bool update_obtype) {

// Observation Rank line type
shc.set_line_type(stat_orank_str);
Expand All @@ -1913,6 +1922,9 @@ void write_orank_row(StatHdrColumns &shc, const PairDataEnsemble *pd_ptr,
// Write a line for each ensemble pair
for(int i=0; i<pd_ptr->n_obs; i++) {

// MET #2893 write individual obs message type
if(update_obtype) shc.set_obtype(pd_ptr->typ_sa[i].c_str());

// Set the observation valid time
shc.set_obs_valid_beg(pd_ptr->vld_ta[i]);
shc.set_obs_valid_end(pd_ptr->vld_ta[i]);
Expand Down
Loading
Loading