Skip to content

Commit

Permalink
Per #3006, saving work in progress prior to seneca reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Nov 18, 2024
1 parent da85f7a commit f99af01
Show file tree
Hide file tree
Showing 59 changed files with 351 additions and 499 deletions.
2 changes: 1 addition & 1 deletion data/config/ConfigConstants
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MB_to_PA(p) = HPA_to_PA(p);
//
////////////////////////////////////////////////////////////////////////////////

// File types
// Gridded data file types
GRIB1 = 1;
GRIB2 = 2;
NETCDF_MET = 3;
Expand Down
2 changes: 1 addition & 1 deletion src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ static const char conf_key_cira_diag_flag[] = "cira_diag_flag";
// Parameter value names common to multiple tools
//

// File types
// Gridded data file types
static const char conf_val_grib1 [] = "GRIB1";
static const char conf_val_grib2 [] = "GRIB2";
static const char conf_val_netcdf_met [] = "NETCDF_MET";
Expand Down
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 = FileType_<type>;\" at the configration file\n\n";
<< "unable to open input file \"" << filename << "\". Please specify \"file_type = GrdFileType_<type>;\" at the configration file\n\n";

exit ( 1 );

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

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

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

if(!dict) {
mlog << Error << "\nparse_conf_file_type() -> "
mlog << Error << "\nparse_conf_grd_file_type() -> "
<< "empty dictionary!\n\n";
exit(1);
}
Expand All @@ -360,17 +360,17 @@ GrdFileType parse_conf_file_type(Dictionary *dict) {

if(dict->last_lookup_status()) {
// Convert integer to enumerated GrdFileType
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;
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;
else {
mlog << Error << "\nparse_conf_file_type() -> "
mlog << Error << "\nparse_conf_grd_file_type() -> "
<< "Unexpected config file value of " << v << " for \""
<< conf_key_file_type << "\".\n\n";
exit(1);
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_file_type(Dictionary *dict);
extern GrdFileType parse_conf_grd_file_type(Dictionary *dict);
extern std::map<STATLineType,STATOutputType>
parse_conf_output_flag(
Dictionary *dict,
Expand Down
65 changes: 26 additions & 39 deletions src/basic/vx_config/data_file_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,52 @@

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


#ifndef __DATA_FILE_TYPE_H__
#define __DATA_FILE_TYPE_H__


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

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

//
// Enumeration of supported gridded file types
//
enum GrdFileType {

enum GrdFileType
{
GrdFileType_None, // Default

FileType_None, // Default

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
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

};


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


inline bool is_netcdf_grdfiletype(const GrdFileType _t)

{

return ( (_t == FileType_NcMet) || (_t == FileType_General_Netcdf) ||
(_t == FileType_NcWrf) || (_t == FileType_NcPinterp) ||
(_t == FileType_NcCF) );

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_python_grdfiletype(const GrdFileType _t)

{

return ( (_t == FileType_Python_Xarray) || (_t == FileType_Python_Numpy) );

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


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

#endif /* __DATA_FILE_TYPE_H__ */
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 @@ -42,21 +42,21 @@ const char * s = (const char *) nullptr;

switch ( t ) {

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 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 FileType_Python_Numpy: s = "FileType_Python_Numpy"; break;
case FileType_Python_Xarray: s = "FileType_Python_Xarray"; break;
case FileType_UGrid: s = "FileType_UGrid"; break;
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 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 GrdFileType_Python_Numpy: s = "GrdFileType_Python_Numpy"; break;
case GrdFileType_Python_Xarray: s = "GrdFileType_Python_Xarray"; break;
case GrdFileType_UGrid: s = "GrdFileType_UGrid"; break;

default:
s = "(bad value)";
Expand All @@ -77,21 +77,21 @@ bool string_to_grdfiletype(const char * text, GrdFileType & t)

{

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; }
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; }
//
// nope
//
Expand Down
Loading

0 comments on commit f99af01

Please sign in to comment.