Skip to content

Commit

Permalink
Per #1943, tweak log messages for SEEPS pointing users to setting the…
Browse files Browse the repository at this point in the history
… MET_SEEPS_GRID_CLIMO_NAME or MET_SEEPS_POINT_CLIMO_NAME environment variables.
  • Loading branch information
JohnHalleyGotway committed Dec 6, 2022
1 parent d9e4b13 commit 6ce65cf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
45 changes: 27 additions & 18 deletions src/libcode/vx_seeps/seeps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ bool standalone_debug_seeps = false;
static SeepsClimo *seeps_climo = 0;
static std::map<int,SeepsClimoGrid *> seeps_climo_grid_map_00;

static const char *def_seeps_filename = "MET_BASE/climo/seeps/PPT24_seepsweights.nc";
static const char *def_seeps_grid_filename = "MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc";
static const char *def_seeps_filename =
"MET_BASE/climo/seeps/PPT24_seepsweights.nc";
static const char *def_seeps_grid_filename =
"MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc";

static const char *var_name_sid = "sid";
static const char *var_name_lat = "lat";
Expand Down Expand Up @@ -200,8 +202,10 @@ SeepsClimo::SeepsClimo() {
if (seeps_ready) read_seeps_scores(seeps_name);
else {
mlog << Error << "\nSeepsClimo::SeepsClimo() -> "
<< "The SEEPS climo data \"" << seeps_name << "\" is missing!"
<< " Turn off SEEPS and SEEPS_MPR to continue\n\n";
<< "The SEEPS point climo data \"" << seeps_name << "\" is missing!\n"
<< "Set the " << MET_ENV_SEEPS_POINT_CLIMO_NAME
<< " environment variable to define its location "
<< "or disable output for SEEPS and SEEPS_MPR.\n\n";
exit(1);
}
}
Expand Down Expand Up @@ -312,10 +316,13 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) {
}
else {
mlog << Error << "\n" << method_name
<< "The SEEPS climo data is missing!"
<< " Turn off SEEPS and SEEPS_MPR to continue\n\n";
<< "The SEEPS point climo data is missing!\n"
<< "Set the " << MET_ENV_SEEPS_POINT_CLIMO_NAME
<< " environment variable to define its location "
<< "or disable output for SEEPS and SEEPS_MPR.\n\n";
exit(1);
}

return record;
}

Expand All @@ -326,22 +333,22 @@ ConcatString SeepsClimo::get_seeps_climo_filename() {
const char *method_name = "SeepsClimo::get_seeps_climo_filename() -> ";

// Use the MET_TMP_DIR environment variable, if set.
bool use_env = get_env(MET_ENV_SEEPS_CLIMO_NAME, seeps_filename);
bool use_env = get_env(MET_ENV_SEEPS_POINT_CLIMO_NAME, seeps_filename);
if(use_env) seeps_filename = replace_path(seeps_filename);
else seeps_filename = replace_path(def_seeps_filename);

if (seeps_ready = file_exists(seeps_filename.c_str())) {
mlog << Debug(7) << method_name << "SEEPS climo name=\""
mlog << Debug(7) << method_name << "SEEPS point climo name=\""
<< seeps_filename.c_str() << "\"\n";
}
else {
ConcatString message = " ";
ConcatString message = "";
if (use_env) {
message.add("from the env. name ");
message.add(MET_ENV_SEEPS_CLIMO_NAME);
message.add(MET_ENV_SEEPS_POINT_CLIMO_NAME);
}
mlog << Warning << "\n" << method_name
<< "The SEEPS climo name \"" << seeps_filename.c_str()
<< "The SEEPS point climo name \"" << seeps_filename.c_str()
<< "\"" << message << " does not exist!\n\n";
}

Expand Down Expand Up @@ -652,8 +659,10 @@ SeepsClimoGrid::SeepsClimoGrid(int month, int hour) : month{month}, hour{hour}
if (seeps_ready) read_seeps_scores(seeps_name);
else {
mlog << Error << "\nSeepsClimoGrid::SeepsClimoGrid -> "
<< "The SEEPS climo data \"" << seeps_name << "\" is missing!"
<< " Turn off SEEPS to continue\n\n";
<< "The SEEPS grid climo data \"" << seeps_name << "\" is missing!\n"
<< "Set the " << MET_ENV_SEEPS_GRID_CLIMO_NAME
<< " environment variable to define its location "
<< "or disable output for SEEPS.\n\n";
exit(1);
}

Expand Down Expand Up @@ -769,24 +778,24 @@ ConcatString SeepsClimoGrid::get_seeps_climo_filename() {
const char *method_name = "SeepsClimoGrid::get_seeps_climo_filename() -> ";

// Use the MET_TMP_DIR environment variable, if set.
bool use_env = get_env(MET_ENV_SEEPS_CLIMO_GRID_NAME, seeps_filename);
bool use_env = get_env(MET_ENV_SEEPS_GRID_CLIMO_NAME, seeps_filename);
if(use_env) {
seeps_filename = replace_path(seeps_filename);
}
else seeps_filename = replace_path(def_seeps_grid_filename);

if (seeps_ready = file_exists(seeps_filename.c_str())) {
mlog << Debug(7) << method_name << "SEEPS climo name=\""
mlog << Debug(7) << method_name << "SEEPS grid climo name=\""
<< seeps_filename.c_str() << "\"\n";
}
else {
ConcatString message = " ";
ConcatString message = "";
if (use_env) {
message.add("from the env. name ");
message.add(MET_ENV_SEEPS_CLIMO_GRID_NAME);
message.add(MET_ENV_SEEPS_GRID_CLIMO_NAME);
}
mlog << Warning << "\n" << method_name
<< "The SEEPS climo name \"" << seeps_filename.c_str()
<< "The SEEPS grid climo name \"" << seeps_filename.c_str()
<< "\"" << message << " does not exist!\n\n";
}

Expand Down
4 changes: 2 additions & 2 deletions src/libcode/vx_seeps/seeps.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

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

static const char *MET_ENV_SEEPS_CLIMO_NAME = "MET_SEEPS_POINT_CLIMO_NAME";
static const char *MET_ENV_SEEPS_CLIMO_GRID_NAME = "MET_SEEPS_GRID_CLIMO_NAME";
static const char *MET_ENV_SEEPS_POINT_CLIMO_NAME = "MET_SEEPS_POINT_CLIMO_NAME";
static const char *MET_ENV_SEEPS_GRID_CLIMO_NAME = "MET_SEEPS_GRID_CLIMO_NAME";

static const char *dim_name_nstn = "nstn";

Expand Down

0 comments on commit 6ce65cf

Please sign in to comment.