Skip to content

Commit

Permalink
Per #3006, revert back to using FileType instead of GrdFileType. That…
Browse files Browse the repository at this point in the history
… change was not meaningful or warranted.
  • Loading branch information
JohnHalleyGotway committed Nov 19, 2024
1 parent f99af01 commit 6afe990
Show file tree
Hide file tree
Showing 96 changed files with 386 additions and 394 deletions.
2 changes: 1 addition & 1 deletion src/basic/vx_config/config_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ met_open(configfilein, filename);
if ( ! configfilein ) {

mlog << Error << "\nMetConfig::read(const char *) -> "
<< "unable to open input file \"" << filename << "\". Please specify \"file_type = GrdFileType_<type>;\" at the configration file\n\n";
<< "unable to open input file \"" << filename << "\". Please specify \"file_type = FileType_<type>;\" at the configration file\n\n";

exit ( 1 );

Expand Down
24 changes: 12 additions & 12 deletions src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ StringArray parse_conf_string_array(Dictionary *dict, const char *conf_key, cons

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

GrdFileType parse_conf_grd_file_type(Dictionary *dict) {
GrdFileType t = GrdFileType_None;
FileType parse_conf_grd_file_type(Dictionary *dict) {
FileType t = FileType_None;
int v;

if(!dict) {
Expand All @@ -359,16 +359,16 @@ GrdFileType parse_conf_grd_file_type(Dictionary *dict) {
v = dict->lookup_int(conf_key_file_type, false);

if(dict->last_lookup_status()) {
// Convert integer to enumerated GrdFileType
if(v == conf_const.lookup_int(conf_val_grib1)) t = GrdFileType_Gb1;
else if(v == conf_const.lookup_int(conf_val_grib2)) t = GrdFileType_Gb2;
else if(v == conf_const.lookup_int(conf_val_netcdf_met)) t = GrdFileType_NcMet;
else if(v == conf_const.lookup_int(conf_val_netcdf_wrf)) t = GrdFileType_NcWrf;
else if(v == conf_const.lookup_int(conf_val_netcdf_pint)) t = GrdFileType_NcPinterp;
else if(v == conf_const.lookup_int(conf_val_netcdf_nccf)) t = GrdFileType_NcCF;
else if(v == conf_const.lookup_int(conf_val_netcdf_ugrid)) t = GrdFileType_UGrid;
else if(v == conf_const.lookup_int(conf_val_python_numpy)) t = GrdFileType_Python_Numpy;
else if(v == conf_const.lookup_int(conf_val_python_xarray)) t = GrdFileType_Python_Xarray;
// Convert integer to enumerated FileType
if(v == conf_const.lookup_int(conf_val_grib1)) t = FileType_Gb1;
else if(v == conf_const.lookup_int(conf_val_grib2)) t = FileType_Gb2;
else if(v == conf_const.lookup_int(conf_val_netcdf_met)) t = FileType_NcMet;
else if(v == conf_const.lookup_int(conf_val_netcdf_wrf)) t = FileType_NcWrf;
else if(v == conf_const.lookup_int(conf_val_netcdf_pint)) t = FileType_NcPinterp;
else if(v == conf_const.lookup_int(conf_val_netcdf_nccf)) t = FileType_NcCF;
else if(v == conf_const.lookup_int(conf_val_netcdf_ugrid)) t = FileType_UGrid;
else if(v == conf_const.lookup_int(conf_val_python_numpy)) t = FileType_Python_Numpy;
else if(v == conf_const.lookup_int(conf_val_python_xarray)) t = FileType_Python_Xarray;
else {
mlog << Error << "\nparse_conf_grd_file_type() -> "
<< "Unexpected config file value of " << v << " for \""
Expand Down
2 changes: 1 addition & 1 deletion src/basic/vx_config/config_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern ConcatString parse_conf_string(
Dictionary *dict,
const char *,
bool check_empty=true);
extern GrdFileType parse_conf_grd_file_type(Dictionary *dict);
extern FileType parse_conf_grd_file_type(Dictionary *dict);
extern std::map<STATLineType,STATOutputType>
parse_conf_output_flag(
Dictionary *dict,
Expand Down
49 changes: 24 additions & 25 deletions src/basic/vx_config/data_file_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,43 @@
///////////////////////////////////////////////////////////////////////////////

//
// Enumeration of supported gridded file types
// Enumeration of supported file types
//

enum GrdFileType {
enum FileType {

GrdFileType_None, // Default
FileType_None, // Default

GrdFileType_Gb1, // GRIB version 1
GrdFileType_Gb2, // GRIB version 2
GrdFileType_NcMet, // NetCDF MET format
GrdFileType_General_Netcdf, // NetCDF
GrdFileType_NcWrf, // NetCDF output directly from WRF-ARW
GrdFileType_NcPinterp, // NetCDF output of WRF-ARW pinterp tool
GrdFileType_NcCF, // NetCDF Climate-Forecast Convention
GrdFileType_HdfEos, // Hierarchical Data Format - Earth Observing System
GrdFileType_Bufr, // Bufr or PrepBufr format
GrdFileType_Python_Numpy, // Python script using numpy array and attributes dictionary
GrdFileType_Python_Xarray, // Python script using xarray dataplane
GrdFileType_UGrid, // Unstructured grid
FileType_Gb1, // GRIB version 1
FileType_Gb2, // GRIB version 2
FileType_NcMet, // NetCDF MET format
FileType_General_Netcdf, // NetCDF
FileType_NcWrf, // NetCDF output directly from WRF-ARW
FileType_NcPinterp, // NetCDF output of WRF-ARW pinterp tool
FileType_NcCF, // NetCDF Climate-Forecast Convention
FileType_HdfEos, // Hierarchical Data Format - Earth Observing System
FileType_Bufr, // Bufr or PrepBufr format
FileType_Python_Numpy, // Python script using numpy array and attributes dictionary
FileType_Python_Xarray, // Python script using xarray dataplane
FileType_UGrid, // Unstructured grid

};

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

inline bool is_netcdf_grdfiletype(const GrdFileType _t) {
return(_t == GrdFileType_NcMet ||
_t == GrdFileType_General_Netcdf ||
_t == GrdFileType_NcWrf ||
_t == GrdFileType_NcPinterp ||
_t == GrdFileType_NcCF);
inline bool is_netcdf_grdfiletype(const FileType _t) {
return(_t == FileType_NcMet ||
_t == FileType_General_Netcdf ||
_t == FileType_NcWrf ||
_t == FileType_NcPinterp ||
_t == FileType_NcCF);
}


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

inline bool is_python_grdfiletype(const GrdFileType _t) {
return(_t == GrdFileType_Python_Xarray ||
_t == GrdFileType_Python_Numpy);
inline bool is_python_grdfiletype(const FileType _t) {
return(_t == FileType_Python_Xarray ||
_t == FileType_Python_Numpy);
}

///////////////////////////////////////////////////////////////////////////////
Expand Down
60 changes: 30 additions & 30 deletions src/basic/vx_config/grdfiletype_to_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ using namespace std;
////////////////////////////////////////////////////////////////////////


ConcatString grdfiletype_to_string(const GrdFileType t)
ConcatString grdfiletype_to_string(const FileType t)

{

const char * s = (const char *) nullptr;

switch ( t ) {

case GrdFileType_None: s = "GrdFileType_None"; break;
case GrdFileType_Gb1: s = "GrdFileType_Gb1"; break;
case GrdFileType_Gb2: s = "GrdFileType_Gb2"; break;
case GrdFileType_NcMet: s = "GrdFileType_NcMet"; break;
case GrdFileType_General_Netcdf: s = "GrdFileType_General_Netcdf"; break;
case FileType_None: s = "FileType_None"; break;
case FileType_Gb1: s = "FileType_Gb1"; break;
case FileType_Gb2: s = "FileType_Gb2"; break;
case FileType_NcMet: s = "FileType_NcMet"; break;
case FileType_General_Netcdf: s = "FileType_General_Netcdf"; break;

case GrdFileType_NcWrf: s = "GrdFileType_NcWrf"; break;
case GrdFileType_NcPinterp: s = "GrdFileType_NcPinterp"; break;
case GrdFileType_NcCF: s = "GrdFileType_NcCF"; break;
case GrdFileType_HdfEos: s = "GrdFileType_HdfEos"; break;
case GrdFileType_Bufr: s = "GrdFileType_Bufr"; break;
case FileType_NcWrf: s = "FileType_NcWrf"; break;
case FileType_NcPinterp: s = "FileType_NcPinterp"; break;
case FileType_NcCF: s = "FileType_NcCF"; break;
case FileType_HdfEos: s = "FileType_HdfEos"; break;
case FileType_Bufr: s = "FileType_Bufr"; break;

case GrdFileType_Python_Numpy: s = "GrdFileType_Python_Numpy"; break;
case GrdFileType_Python_Xarray: s = "GrdFileType_Python_Xarray"; break;
case GrdFileType_UGrid: s = "GrdFileType_UGrid"; break;
case FileType_Python_Numpy: s = "FileType_Python_Numpy"; break;
case FileType_Python_Xarray: s = "FileType_Python_Xarray"; break;
case FileType_UGrid: s = "FileType_UGrid"; break;

default:
s = "(bad value)";
Expand All @@ -73,25 +73,25 @@ return ConcatString(s);
////////////////////////////////////////////////////////////////////////


bool string_to_grdfiletype(const char * text, GrdFileType & t)
bool string_to_grdfiletype(const char * text, FileType & t)

{

if ( strcmp(text, "GrdFileType_None" ) == 0 ) { t = GrdFileType_None; return true; }
else if ( strcmp(text, "GrdFileType_Gb1" ) == 0 ) { t = GrdFileType_Gb1; return true; }
else if ( strcmp(text, "GrdFileType_Gb2" ) == 0 ) { t = GrdFileType_Gb2; return true; }
else if ( strcmp(text, "GrdFileType_NcMet" ) == 0 ) { t = GrdFileType_NcMet; return true; }
else if ( strcmp(text, "GrdFileType_General_Netcdf") == 0 ) { t = GrdFileType_General_Netcdf; return true; }

else if ( strcmp(text, "GrdFileType_NcWrf" ) == 0 ) { t = GrdFileType_NcWrf; return true; }
else if ( strcmp(text, "GrdFileType_NcPinterp" ) == 0 ) { t = GrdFileType_NcPinterp; return true; }
else if ( strcmp(text, "GrdFileType_NcCF" ) == 0 ) { t = GrdFileType_NcCF; return true; }
else if ( strcmp(text, "GrdFileType_HdfEos" ) == 0 ) { t = GrdFileType_HdfEos; return true; }
else if ( strcmp(text, "GrdFileType_Bufr" ) == 0 ) { t = GrdFileType_Bufr; return true; }

else if ( strcmp(text, "GrdFileType_Python_Numpy" ) == 0 ) { t = GrdFileType_Python_Numpy; return true; }
else if ( strcmp(text, "GrdFileType_Python_Xarray" ) == 0 ) { t = GrdFileType_Python_Xarray; return true; }
else if ( strcmp(text, "GrdFileType_UGrid" ) == 0 ) { t = GrdFileType_UGrid; return true; }
if ( strcmp(text, "FileType_None" ) == 0 ) { t = FileType_None; return true; }
else if ( strcmp(text, "FileType_Gb1" ) == 0 ) { t = FileType_Gb1; return true; }
else if ( strcmp(text, "FileType_Gb2" ) == 0 ) { t = FileType_Gb2; return true; }
else if ( strcmp(text, "FileType_NcMet" ) == 0 ) { t = FileType_NcMet; return true; }
else if ( strcmp(text, "FileType_General_Netcdf") == 0 ) { t = FileType_General_Netcdf; return true; }

else if ( strcmp(text, "FileType_NcWrf" ) == 0 ) { t = FileType_NcWrf; return true; }
else if ( strcmp(text, "FileType_NcPinterp" ) == 0 ) { t = FileType_NcPinterp; return true; }
else if ( strcmp(text, "FileType_NcCF" ) == 0 ) { t = FileType_NcCF; return true; }
else if ( strcmp(text, "FileType_HdfEos" ) == 0 ) { t = FileType_HdfEos; return true; }
else if ( strcmp(text, "FileType_Bufr" ) == 0 ) { t = FileType_Bufr; return true; }

else if ( strcmp(text, "FileType_Python_Numpy" ) == 0 ) { t = FileType_Python_Numpy; return true; }
else if ( strcmp(text, "FileType_Python_Xarray" ) == 0 ) { t = FileType_Python_Xarray; return true; }
else if ( strcmp(text, "FileType_UGrid" ) == 0 ) { t = FileType_UGrid; return true; }
//
// nope
//
Expand Down
4 changes: 2 additions & 2 deletions src/basic/vx_config/grdfiletype_to_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
////////////////////////////////////////////////////////////////////////


extern ConcatString grdfiletype_to_string(const GrdFileType);
extern ConcatString grdfiletype_to_string(const FileType);


extern bool string_to_grdfiletype(const char *, GrdFileType &);
extern bool string_to_grdfiletype(const char *, FileType &);


////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/libcode/vx_data2d/data_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Met2dDataFile : public Met2dData {
virtual int raw_nx() const;
virtual int raw_ny() const;

virtual GrdFileType file_type() const = 0;
virtual FileType file_type() const = 0;

int shift_right() const;

Expand Down
2 changes: 1 addition & 1 deletion src/libcode/vx_data2d/var_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ ConcatString EnsVarInfo::get_ens_member_id(int index) {

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

ConcatString raw_magic_str(Dictionary i_edict, GrdFileType file_type) {
ConcatString raw_magic_str(Dictionary i_edict, FileType file_type) {
ConcatString magic_str;

ConcatString name = i_edict.lookup_string("name");
Expand Down
4 changes: 2 additions & 2 deletions src/libcode/vx_data2d/var_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class VarInfo
// get stuff
//

virtual GrdFileType file_type() const = 0;
virtual FileType file_type() const = 0;

ConcatString magic_str() const;
ConcatString magic_time_str() const;
Expand Down Expand Up @@ -310,7 +310,7 @@ class EnsVarInfo {

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

ConcatString raw_magic_str(Dictionary i_edict, GrdFileType file_type);
ConcatString raw_magic_str(Dictionary i_edict, FileType file_type);
bool is_req_level_match(const ConcatString &, const ConcatString &);

///////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit 6afe990

Please sign in to comment.