Skip to content

Commit

Permalink
#1408 Check variable name in the configuration to use the variable na…
Browse files Browse the repository at this point in the history
…me instewad of grib code
  • Loading branch information
hsoh-u committed Jan 12, 2021
1 parent 3922f86 commit a971683
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions met/src/tools/other/point2grid/point2grid.cc
Expand Up @@ -744,8 +744,15 @@ void process_point_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo,
var_idx_or_gc = atoi(vname.c_str());
sprintf(grib_code, "%d", var_idx_or_gc);
if (vname != grib_code) {
exit_by_field_name_error = true;;
error_msg << "Invalid GRIB code [" << vname << "]\n";
ConcatString var_id = conf_info.get_var_id(vname);
if( var_id.nonempty() ) {
var_idx_or_gc = atoi(var_id.c_str());
sprintf(grib_code, "%d", var_idx_or_gc);
}
else {
exit_by_field_name_error = true;;
error_msg << "Invalid GRIB code [" << vname << "]\n";
}
}
else {
bool not_found_grib_code = true;
Expand Down

0 comments on commit a971683

Please sign in to comment.