Skip to content

Commit

Permalink
Per #1879, in the VarInfoGrib::add_grib_code() try doing a table look…
Browse files Browse the repository at this point in the history
…up 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 committed Aug 17, 2021
1 parent 0787125 commit 071d21b
Showing 1 changed file with 8 additions and 9 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

0 comments on commit 071d21b

Please sign in to comment.