Skip to content

Commit

Permalink
Per #2321, update TCDiag types and strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Nov 15, 2022
1 parent f982fdc commit fb7be08
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
22 changes: 18 additions & 4 deletions src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,28 @@ enum TrackType {
//

enum DiagType {
DiagType_None, // Default
TCDiagType, // Tropical Cyclone Diagnostics
LSDiagRTType, // Realtime Large Scale Diagnostics
LSDiagDevType // Development Large Scale Diagnostics
DiagType_None, // Default
DiagType_CIRA_RT, // Realtime CIRA Tropical Cyclone Diagnostics
DiagType_CIRA_Dev, // Developmental CIRA Tropical Cyclone Diagnostics
DiagType_SHIPS_RT, // Realtime SHIPS Large Scale Diagnostics
DiagType_SHIPS_Dev // Developmental SHIPS Large Scale Diagnostics
};

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

//
// Corresponding diagnostic type strings
//

static const char cira_diag_str[] = "CIRA_DIAG";
static const char cira_diag_rt_str[] = "CIRA_DIAG_RT";
static const char cira_diag_dev_str[] = "CIRA_DIAG_DEV";
static const char ships_diag_str[] = "SHIPS_DIAG";
static const char ships_diag_rt_str[] = "SHIPS_DIAG_RT";
static const char ships_diag_dev_str[] = "SHIPS_DIAG_DEV";

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

//
// Enumeration for 12-hour interpolation logic
//
Expand Down
26 changes: 12 additions & 14 deletions src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2757,16 +2757,13 @@ ConcatString tracktype_to_string(TrackType type) {
DiagType string_to_diagtype(const char *s) {
DiagType t = DiagType_None;

// Convert string to enumerated DiagType
if(strcasecmp(s, conf_val_none) == 0) t = DiagType_None;
else if(strcasecmp(s, "TCDIAG") == 0) t = TCDiagType;
else if(strcasecmp(s, "LSDIAG_RT") == 0) t = LSDiagRTType;
else if(strcasecmp(s, "LSDIAG_DEV") == 0) t = LSDiagDevType;
else {
mlog << Error << "\nstring_to_diagtype() -> "
<< "Unexpected DiagType string \"" << s << "\".\n\n";
exit(1);
}
// Convert string to enumerated DiagType, storing unknown strings
// as the default type
if(strcasecmp(s, cira_diag_rt_str) == 0) t = DiagType_CIRA_RT;
else if(strcasecmp(s, cira_diag_dev_str) == 0) t = DiagType_CIRA_Dev;
else if(strcasecmp(s, ships_diag_rt_str) == 0) t = DiagType_SHIPS_RT;
else if(strcasecmp(s, ships_diag_dev_str) == 0) t = DiagType_SHIPS_Dev;
else t = DiagType_None;

return(t);
}
Expand All @@ -2778,10 +2775,11 @@ ConcatString diagtype_to_string(DiagType type) {

// Convert enumerated DiagType to string
switch(type) {
case(DiagType_None): s = conf_val_none; break;
case(TCDiagType): s = "TCDIAG"; break;
case(LSDiagRTType): s = "LSDIAG_RT"; break;
case(LSDiagDevType): s = "LSDIAG_DEV"; break;
case(DiagType_None): s = conf_val_none; break;
case(DiagType_CIRA_RT): s = cira_diag_rt_str; break;
case(DiagType_CIRA_Dev): s = cira_diag_dev_str; break;
case(DiagType_SHIPS_RT): s = ships_diag_rt_str; break;
case(DiagType_SHIPS_Dev): s = ships_diag_dev_str; break;
default:
mlog << Error << "\ndiagtype_to_string() -> "
<< "Unexpected DiagType value of " << type << ".\n\n";
Expand Down

0 comments on commit fb7be08

Please sign in to comment.