Skip to content

Commit

Permalink
Bugfix 1879 main_v10.0 ecmwf grib1 (#1880)
Browse files Browse the repository at this point in the history
* Per #1879, in Ensemble-Stat, only call add_grib_code() when point verification data is provided.

* Per #1879, in the VarInfoGrib::add_grib_code() try doing a table lookup using the user-specified GRIB1 values first and then the default values second. Also, make the error message about no matches much more verbose.
  • Loading branch information
JohnHalleyGotway authored Aug 18, 2021
1 parent 5c9db2d commit 63335c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions met/src/libcode/vx_data2d_grib/var_info_grib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,7 @@ void VarInfoGrib::add_grib_code (Dictionary &dict)
}
int field_center = dict.lookup_int (conf_key_GRIB1_center, false);
int field_subcenter = dict.lookup_int (conf_key_GRIB1_subcenter, false);
Grib1TableEntry tab;

// if not specified, fill others with default values
if(field_ptv == bad_data_int) field_ptv = default_grib1_ptv;
if(field_center == bad_data_int) field_center = default_grib1_center;
if(field_subcenter == bad_data_int) field_subcenter = default_grib1_subcenter;
Grib1TableEntry tab;

// if the name is specified, use it
if( !field_name.empty() ){
Expand All @@ -229,9 +224,13 @@ void VarInfoGrib::add_grib_code (Dictionary &dict)
if( !GribTable.lookup_grib1(field_name.c_str(), default_grib1_ptv, field_code, default_grib1_center, default_grib1_subcenter, tab, tab_match) )
{
mlog << Error << "\nVarInfoGrib::add_grib_code() -> "
<< "unrecognized GRIB1 field abbreviation '"
<< field_name << "' for table version " << field_ptv
<< "\n\n";
<< "unrecognized GRIB1 field abbreviation '" << field_name
<< "' for table version (" << field_ptv
<< "), center (" << field_center
<< "), and subcenter (" << field_subcenter
<< ") or default table version (" << default_grib1_ptv
<< "), center (" << default_grib1_center
<< "), and subcenter (" << default_grib1_subcenter << ").\n\n";
exit(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict,
vx_pd.obs_info->set_dict(odict);

// Set the GRIB code for point observations
if(!use_var_id) vx_pd.obs_info->add_grib_code(odict);
if(point_vx && !use_var_id) vx_pd.obs_info->add_grib_code(odict);

// Dump the contents of the current VarInfo
if(mlog.verbosity_level() >= 5) {
Expand Down

0 comments on commit 63335c0

Please sign in to comment.