From ea8a66e1a34e9bad9ce68e2b40e83c03c7d4fedd Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Thu, 8 Sep 2022 14:55:13 -0600 Subject: [PATCH 01/26] Per #2227 changes in this commit resolve all errors from removing 'using namespace std' from all header files in the src/basic directory --- src/basic/vx_cal/time_array.h | 2 +- src/basic/vx_cal/vx_cal.h | 2 +- src/basic/vx_config/config.tab.cc | 2 +- src/basic/vx_config/config_file.h | 2 +- src/basic/vx_config/config_util.h | 20 +++++----- src/basic/vx_config/dictionary.h | 12 +++--- src/basic/vx_config/icode.h | 10 ++--- src/basic/vx_config/idstack.h | 8 ++-- src/basic/vx_config/threshold.h | 14 +++---- src/basic/vx_log/file_fxns.h | 4 +- src/basic/vx_log/main.cc | 22 +++++----- src/basic/vx_log/main.h | 4 +- src/basic/vx_log/vx_log.h | 2 - src/basic/vx_math/hist.h | 2 +- src/basic/vx_math/is_bad_data.h | 8 ++-- src/basic/vx_math/pwl.h | 2 +- src/basic/vx_math/so3.h | 2 +- src/basic/vx_math/vx_vector.h | 4 +- src/basic/vx_util/GridOffset.h | 4 +- src/basic/vx_util/GridTemplate.h | 32 +++++++-------- src/basic/vx_util/ascii_header.h | 4 +- src/basic/vx_util/ascii_table.h | 2 +- src/basic/vx_util/command_line.h | 18 ++++----- src/basic/vx_util/crc_array.h | 10 ++--- src/basic/vx_util/data_line.h | 8 ++-- src/basic/vx_util/data_plane.h | 4 +- src/basic/vx_util/grib_constants.h | 4 -- src/basic/vx_util/is_number.h | 2 +- src/basic/vx_util/long_array.h | 2 +- src/basic/vx_util/mask_poly.h | 2 +- src/basic/vx_util/num_array.h | 4 +- src/basic/vx_util/polyline.h | 2 +- src/basic/vx_util/stat_column_defs.h | 20 +++++----- src/basic/vx_util/thresh_array.h | 4 +- src/libcode/vx_afm/afm.h | 16 ++++---- src/libcode/vx_afm/afm_line.h | 4 +- src/libcode/vx_afm/afm_token.h | 2 +- src/libcode/vx_analysis_util/by_case_info.h | 2 +- src/libcode/vx_analysis_util/mode_atts.h | 4 +- src/libcode/vx_analysis_util/mode_job.h | 12 +++--- src/libcode/vx_analysis_util/mode_line.h | 2 +- src/libcode/vx_analysis_util/stat_job.h | 12 +++--- src/libcode/vx_analysis_util/stat_line.h | 2 +- src/libcode/vx_analysis_util/time_series.h | 2 +- src/libcode/vx_color/color.h | 10 ++--- src/libcode/vx_color/color_list.h | 4 +- src/libcode/vx_data2d/data_class.h | 4 +- src/libcode/vx_data2d/level_info.h | 2 +- src/libcode/vx_data2d/table_lookup.h | 10 ++--- src/libcode/vx_data2d/var_info.h | 6 +-- .../vx_data2d_python/var_info_python.h | 2 +- src/libcode/vx_gis/dbf_file.h | 6 +-- src/libcode/vx_gis/shp_array.h | 4 +- src/libcode/vx_gis/shp_file.h | 4 +- src/libcode/vx_gis/shp_point_record.h | 2 +- src/libcode/vx_gis/shp_poly_record.h | 2 +- src/libcode/vx_gis/shx_file.h | 2 +- src/libcode/vx_grid/gaussian_grid.h | 2 +- src/libcode/vx_grid/grid_base.h | 6 +-- src/libcode/vx_grid/latlon_grid.h | 2 +- src/libcode/vx_grid/latlon_grid_defs.h | 2 +- src/libcode/vx_grid/lc_grid.h | 2 +- src/libcode/vx_grid/merc_grid.h | 2 +- src/libcode/vx_grid/rot_latlon_grid.h | 2 +- src/libcode/vx_grid/st_grid.h | 2 +- src/libcode/vx_plot_util/map_region.h | 2 +- src/libcode/vx_ps/ps_text.h | 2 +- src/libcode/vx_ps/vx_ps.h | 4 +- src/libcode/vx_pxm/pbm.h | 2 +- src/libcode/vx_pxm/pcm.h | 2 +- src/libcode/vx_pxm/pgm.h | 2 +- src/libcode/vx_pxm/ppm.h | 2 +- src/libcode/vx_pxm/pxm_base.h | 2 +- src/libcode/vx_render/psout_filter.h | 6 +-- src/libcode/vx_shapedata/mode_field_info.h | 2 +- .../vx_time_series/compute_swinging_door.h | 14 +++---- src/tools/dev_utils/nceptab_to_flat.cc | 22 +++++----- src/tools/dev_utils/pbtime.cc | 12 +++--- src/tools/dev_utils/reformat_county_data.cc | 22 +++++----- src/tools/dev_utils/reformat_map_data.cc | 22 +++++----- src/tools/other/gis_utils/gis_dump_dbf.cc | 16 ++++---- src/tools/other/gis_utils/gis_dump_shp.cc | 40 +++++++++---------- src/tools/other/gis_utils/gis_dump_shx.cc | 20 +++++----- src/tools/other/pb2nc/pb2nc_conf_info.h | 8 ++-- src/tools/other/wwmca_tool/wwmca_plot.cc | 36 ++++++++--------- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 2 +- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 6 +-- .../tc_utils/tc_rmw/tc_rmw_wind_converter.h | 6 +-- 88 files changed, 311 insertions(+), 321 deletions(-) diff --git a/src/basic/vx_cal/time_array.h b/src/basic/vx_cal/time_array.h index 4e38832454..955f9be998 100644 --- a/src/basic/vx_cal/time_array.h +++ b/src/basic/vx_cal/time_array.h @@ -59,7 +59,7 @@ class TimeArray { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; unixtime operator[](int) const; diff --git a/src/basic/vx_cal/vx_cal.h b/src/basic/vx_cal/vx_cal.h index 74885b50a1..2b270769a6 100644 --- a/src/basic/vx_cal/vx_cal.h +++ b/src/basic/vx_cal/vx_cal.h @@ -187,7 +187,7 @@ static const double bad_data_double = -9999.0; static const char bad_data_str[] = "-9999"; static const char bad_data_char = '\0'; static const char na_str[] = "NA"; -static const string na_string = "NA"; +static const std::string na_string = "NA"; //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/config.tab.cc b/src/basic/vx_config/config.tab.cc index 5b67009f59..43fe74766f 100644 --- a/src/basic/vx_config/config.tab.cc +++ b/src/basic/vx_config/config.tab.cc @@ -1389,7 +1389,7 @@ yyparse (void) YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 8; + yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ diff --git a/src/basic/vx_config/config_file.h b/src/basic/vx_config/config_file.h index e5a2953692..d079daffba 100644 --- a/src/basic/vx_config/config_file.h +++ b/src/basic/vx_config/config_file.h @@ -48,7 +48,7 @@ class MetConfig : public Dictionary { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index d39d08b615..45de85dd0f 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -33,9 +33,9 @@ static const char conf_key_old_prepbufr_map[] = "obs_prefbufr_map"; // for ba extern ConcatString parse_conf_version(Dictionary *dict); extern ConcatString parse_conf_string(Dictionary *dict, const char *, bool check_empty = true); extern GrdFileType parse_conf_file_type(Dictionary *dict); -extern map +extern std::map parse_conf_output_flag(Dictionary *dict, const STATLineType *, int); -extern map +extern std::map parse_conf_output_stats(Dictionary *dict); extern int parse_conf_n_vx(Dictionary *dict); extern Dictionary parse_conf_i_vx_dict(Dictionary *dict, int index); @@ -43,7 +43,7 @@ extern StringArray parse_conf_tc_model(Dictionary *dict, bool error_out = de extern StringArray parse_conf_message_type(Dictionary *dict, bool error_out = default_dictionary_error_out); extern StringArray parse_conf_sid_list(Dictionary *dict, const char *); extern void parse_sid_mask(const ConcatString &, StringArray &, ConcatString &); -extern vector +extern std::vector parse_conf_llpnt_mask(Dictionary *dict); extern StringArray parse_conf_obs_qty_inc(Dictionary *dict); extern StringArray parse_conf_obs_qty_exc(Dictionary *dict); @@ -51,16 +51,16 @@ extern NumArray parse_conf_ci_alpha(Dictionary *dict); extern NumArray parse_conf_eclv_points(Dictionary *dict); extern ClimoCDFInfo parse_conf_climo_cdf(Dictionary *dict); extern TimeSummaryInfo parse_conf_time_summary(Dictionary *dict); -extern map parse_conf_key_value_map( +extern std::map parse_conf_key_value_map( Dictionary *dict, const char *conf_key_map_name, const char *caller=0); extern void parse_add_conf_key_value_map( - Dictionary *dict, const char *conf_key_map_name, map *m); -extern map + Dictionary *dict, const char *conf_key_map_name, std::map *m); +extern std::map parse_conf_message_type_map(Dictionary *dict); -extern map +extern std::map parse_conf_message_type_group_map(Dictionary *dict); -extern map parse_conf_metadata_map(Dictionary *dict); -extern map +extern std::map parse_conf_metadata_map(Dictionary *dict); +extern std::map parse_conf_obs_name_map(Dictionary *dict); extern BootInfo parse_conf_boot(Dictionary *dict); extern RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out = default_dictionary_error_out); @@ -74,7 +74,7 @@ extern ConcatString parse_conf_tmp_dir(Dictionary *dict); extern GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict); extern WaveletType parse_conf_wavelet_type(Dictionary *dict); extern PlotInfo parse_conf_plot_info(Dictionary *dict); -extern map +extern std::map parse_conf_filter_attr_map(Dictionary *dict); extern void parse_conf_range_int(Dictionary *dict, int &beg, int &end); extern void parse_conf_range_double(Dictionary *dict, double &beg, double &end); diff --git a/src/basic/vx_config/dictionary.h b/src/basic/vx_config/dictionary.h index 6319e8d78c..4265b7c3d1 100644 --- a/src/basic/vx_config/dictionary.h +++ b/src/basic/vx_config/dictionary.h @@ -85,9 +85,9 @@ class DictionaryEntry { void clear(); - void dump(ostream & out, int = 0) const; + void dump(std::ostream & out, int = 0) const; - void dump_config_format(ostream & out, int = 0) const; + void dump_config_format(std::ostream & out, int = 0) const; // // set stuff @@ -219,9 +219,9 @@ class Dictionary { void clear(); - virtual void dump(ostream &, int = 0) const; + virtual void dump(std::ostream &, int = 0) const; - virtual void dump_config_format(ostream & out, int = 0) const; + virtual void dump_config_format(std::ostream & out, int = 0) const; // // set stuff @@ -365,9 +365,9 @@ class DictionaryStack { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; - void dump_config_format(ostream & out, int = 0) const; + void dump_config_format(std::ostream & out, int = 0) const; // // set stuff diff --git a/src/basic/vx_config/icode.h b/src/basic/vx_config/icode.h index 816beaf969..37ba172584 100644 --- a/src/basic/vx_config/icode.h +++ b/src/basic/vx_config/icode.h @@ -153,7 +153,7 @@ class IcodeCell { double as_double() const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -203,7 +203,7 @@ class IcodeVector { void add (const IcodeVector &); void add_front (const IcodeVector &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool is_mark() const; bool is_mark(int) const; @@ -257,9 +257,9 @@ class CellStack { int depth() const; - void dump_cell(ostream &, int n, int depth = 0) const; + void dump_cell(std::ostream &, int n, int depth = 0) const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -311,7 +311,7 @@ class ICVStack { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/basic/vx_config/idstack.h b/src/basic/vx_config/idstack.h index f2f36fe909..5fc487f6c0 100644 --- a/src/basic/vx_config/idstack.h +++ b/src/basic/vx_config/idstack.h @@ -24,8 +24,6 @@ #include "indent.h" -using namespace std; - //////////////////////////////////////////////////////////////////////// @@ -50,13 +48,13 @@ class Identifier { Identifier(const Identifier &); Identifier & operator=(const Identifier &); - string name; + std::string name; void clear(); void set(const char *); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -143,7 +141,7 @@ class IdentifierArray { void add(const Identifier &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool has(const char *) const; diff --git a/src/basic/vx_config/threshold.h b/src/basic/vx_config/threshold.h index e35c894618..eccbee8ac3 100644 --- a/src/basic/vx_config/threshold.h +++ b/src/basic/vx_config/threshold.h @@ -168,7 +168,7 @@ class ThreshNode { virtual void multiply_by(const double) = 0; - virtual void get_simple_nodes(vector &) const = 0; + virtual void get_simple_nodes(std::vector &) const = 0; ConcatString s; ConcatString abbr_s; @@ -210,7 +210,7 @@ class Or_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * left_child; ThreshNode * right_child; @@ -259,7 +259,7 @@ class And_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * copy() const; @@ -310,7 +310,7 @@ class Not_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * copy() const; @@ -375,7 +375,7 @@ class Simple_Node : public ThreshNode { bool need_perc() const; - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; // // do stuff @@ -421,7 +421,7 @@ class SingleThresh { SingleThresh(const char *); SingleThresh & operator=(const SingleThresh &); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; bool operator==(const SingleThresh &) const; @@ -446,7 +446,7 @@ class SingleThresh { PercThreshType get_ptype() const; double get_pvalue() const; double get_climo_prob() const; - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; void multiply_by(const double); diff --git a/src/basic/vx_log/file_fxns.h b/src/basic/vx_log/file_fxns.h index 5ffaa463fe..84dd361302 100644 --- a/src/basic/vx_log/file_fxns.h +++ b/src/basic/vx_log/file_fxns.h @@ -37,9 +37,9 @@ extern ConcatString replace_path(const char * path); extern int met_open(const char *path, int oflag); -extern void met_open(ifstream &in, const char *path); +extern void met_open(std::ifstream &in, const char *path); -extern void met_open(ofstream &out, const char *path); +extern void met_open(std::ofstream &out, const char *path); extern FILE * met_fopen(const char *path, const char *mode); diff --git a/src/basic/vx_log/main.cc b/src/basic/vx_log/main.cc index 8891ca98df..8181f3ca9a 100644 --- a/src/basic/vx_log/main.cc +++ b/src/basic/vx_log/main.cc @@ -26,9 +26,11 @@ // void initialize(); // void process_command_line(int argc, char **argv); // -// Mod# Date Name Description -// ---- ---- ---- ----------- -// 000 07/06/22 Howard Soh New +// Mod# Date Name Description +// ---- ---- ---- ----------- +// 000 07-06-22 Soh New +// 001 09-06-22 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -48,12 +50,12 @@ static std::string met_cmdline = ""; static int met_start_time; static int met_end_time; static uid_t met_user_id; -static string met_user_name; -static string met_tool_name; +static std::string met_user_name; +static std::string met_tool_name; //////////////////////////////////////////////////////////////////////// -extern string get_tool_name(); +extern std::string get_tool_name(); extern int met_main(int argc, char *argv[]); @@ -106,7 +108,7 @@ void do_post_process() { //////////////////////////////////////////////////////////////////////// -string get_current_time() { +std::string get_current_time() { time_t curr_time; tm * curr_tm; char date_string[MET_BUF_SIZE]; @@ -116,7 +118,7 @@ string get_current_time() { strftime(date_string, MET_BUF_SIZE, "%Y-%m-%d %TZ", curr_tm); - return string(date_string); + return std::string(date_string); } //////////////////////////////////////////////////////////////////////// @@ -146,7 +148,7 @@ void segv_handler(int signum) { void set_handlers() { - set_new_handler(oom); + std::set_new_handler(oom); } //////////////////////////////////////////////////////////////////////// @@ -155,7 +157,7 @@ void set_user_id() { met_user_id = geteuid (); register struct passwd *pw; pw = getpwuid (met_user_id); - if (pw) met_user_name = string(pw->pw_name); + if (pw) met_user_name = std::string(pw->pw_name); } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/main.h b/src/basic/vx_log/main.h index a008a26c7c..7cbedef200 100644 --- a/src/basic/vx_log/main.h +++ b/src/basic/vx_log/main.h @@ -20,8 +20,6 @@ #include #include -using namespace std; - //////////////////////////////////////////////////////////////////////// #define MET_BUF_SIZE 4096 @@ -29,7 +27,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////// //extern void log_event(int event_id, string event_msg); -extern string get_current_time(); +extern std::string get_current_time(); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/vx_log.h b/src/basic/vx_log/vx_log.h index b8f26c758c..6aa7e5a2d7 100644 --- a/src/basic/vx_log/vx_log.h +++ b/src/basic/vx_log/vx_log.h @@ -17,8 +17,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "concat_string.h" #include "indent.h" #include "string_array.h" diff --git a/src/basic/vx_math/hist.h b/src/basic/vx_math/hist.h index 00e282dd9a..f1f26292ed 100644 --- a/src/basic/vx_math/hist.h +++ b/src/basic/vx_math/hist.h @@ -115,7 +115,7 @@ inline int Histogram::too_small_count () const { return ( TooSmallCount ); } //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Histogram &); +extern std::ostream & operator<<(std::ostream &, const Histogram &); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/is_bad_data.h b/src/basic/vx_math/is_bad_data.h index d8bc9b92a1..601949a0c9 100644 --- a/src/basic/vx_math/is_bad_data.h +++ b/src/basic/vx_math/is_bad_data.h @@ -28,22 +28,22 @@ inline int is_bad_data(int a) { - if(a == bad_data_int || isnan(a)) return(1); + if(a == bad_data_int || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(long long a) { - if(a == bad_data_ll || isnan(a)) return(1); + if(a == bad_data_ll || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(double a) { - if(fabs(a - bad_data_double) < default_tol || isnan(a)) return(1); + if(fabs(a - bad_data_double) < default_tol || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(float a) { - if(fabs(a - bad_data_float) < default_tol || isnan(a)) return(1); + if(fabs(a - bad_data_float) < default_tol || std::isnan(a)) return(1); else return(0); } diff --git a/src/basic/vx_math/pwl.h b/src/basic/vx_math/pwl.h index 2290e33c19..410fe66993 100644 --- a/src/basic/vx_math/pwl.h +++ b/src/basic/vx_math/pwl.h @@ -62,7 +62,7 @@ class PiecewiseLinear { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // set stuff diff --git a/src/basic/vx_math/so3.h b/src/basic/vx_math/so3.h index ecbfdbd952..dc4f1ad0c9 100644 --- a/src/basic/vx_math/so3.h +++ b/src/basic/vx_math/so3.h @@ -60,7 +60,7 @@ class SO3 { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // diff --git a/src/basic/vx_math/vx_vector.h b/src/basic/vx_math/vx_vector.h index 59dc87daf1..53ad9daac1 100644 --- a/src/basic/vx_math/vx_vector.h +++ b/src/basic/vx_math/vx_vector.h @@ -53,7 +53,7 @@ class Vector { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -166,7 +166,7 @@ extern void latlon_to_vector(double lat, double lon, double & x, double & y, d //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Vector &); +extern std::ostream & operator<<(std::ostream &, const Vector &); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/GridOffset.h b/src/basic/vx_util/GridOffset.h index dc3b9ec147..cea32e3b5d 100644 --- a/src/basic/vx_util/GridOffset.h +++ b/src/basic/vx_util/GridOffset.h @@ -17,6 +17,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. +// 001 09-06-22 Prestopnik Added "std::"; removing namespace +// from header files // /////////////////////////////////////////////////////////////////////////////// @@ -29,8 +31,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - class GridOffset { public: diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index be191ebecf..64d5dfa123 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -18,6 +18,8 @@ // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. // 001 09-07-21 Halley Gotway Add wrap_lon. +// 002 09-07-22 Prestopnik Added "std::"; removing namespace +// from header files // /////////////////////////////////////////////////////////////////////////////// @@ -34,8 +36,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - class GridTemplate { public: @@ -118,20 +118,20 @@ class GridTemplate { bool _wrapLon; // The offsets that make up the circle - vector _offsetList; + std::vector _offsetList; // The offsets that define the first and last rows and columns - vector _offsetLftEdge; // not allocated - vector _offsetRgtEdge; // not allocated - vector _offsetTopEdge; // not allocated - vector _offsetBotEdge; // not allocated + std::vector _offsetLftEdge; // not allocated + std::vector _offsetRgtEdge; // not allocated + std::vector _offsetTopEdge; // not allocated + std::vector _offsetBotEdge; // not allocated // Iterator for finding points within a grid - mutable vector::const_iterator _pointInGridIterator; - mutable vector::const_iterator _pointInLftEdgeIterator; - mutable vector::const_iterator _pointInRgtEdgeIterator; - mutable vector::const_iterator _pointInTopEdgeIterator; - mutable vector::const_iterator _pointInBotEdgeIterator; + mutable std::vector::const_iterator _pointInGridIterator; + mutable std::vector::const_iterator _pointInLftEdgeIterator; + mutable std::vector::const_iterator _pointInRgtEdgeIterator; + mutable std::vector::const_iterator _pointInTopEdgeIterator; + mutable std::vector::const_iterator _pointInBotEdgeIterator; mutable GridPoint _pointInGridBase; mutable int _pointInGridNumX; @@ -168,12 +168,12 @@ class GridTemplateFactory { }; // String corresponding to the enumerated values above - vector enum_to_string; + std::vector enum_to_string; - GridTemplates string2Enum(string target); - string enum2String(GridTemplates gt); + GridTemplates string2Enum(std::string target); + std::string enum2String(GridTemplates gt); - GridTemplate* buildGT(string gt, int width, bool wrap_lon); + GridTemplate* buildGT(std::string gt, int width, bool wrap_lon); GridTemplate* buildGT(GridTemplates gt, int width, bool wrap_lon); }; diff --git a/src/basic/vx_util/ascii_header.h b/src/basic/vx_util/ascii_header.h index 5c0a498c77..527ca75ec4 100644 --- a/src/basic/vx_util/ascii_header.h +++ b/src/basic/vx_util/ascii_header.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -106,7 +104,7 @@ class AsciiHeader { void assign(const AsciiHeader &); StringArray Versions; - vector Headers; + std::vector Headers; public: diff --git a/src/basic/vx_util/ascii_table.h b/src/basic/vx_util/ascii_table.h index c13c67c904..6e6ee96290 100644 --- a/src/basic/vx_util/ascii_table.h +++ b/src/basic/vx_util/ascii_table.h @@ -357,7 +357,7 @@ inline bool AsciiTable::decimal_points_aligned() const { return ( DecimalPointsA // externs // -extern ostream & operator<<(ostream &, AsciiTable &); +extern std::ostream & operator<<(std::ostream &, AsciiTable &); extern void justified_item(const char * text, const int field_width, const char pad, const AsciiTableJust just, char * out); diff --git a/src/basic/vx_util/command_line.h b/src/basic/vx_util/command_line.h index 9acbc3fa9b..7c02bf589a 100644 --- a/src/basic/vx_util/command_line.h +++ b/src/basic/vx_util/command_line.h @@ -57,7 +57,7 @@ class CLOptionInfo { // command-line option info void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString option_text; @@ -101,7 +101,7 @@ class CLOptionInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_alloc_inc(int = 0); // 0 means default value (16) @@ -112,7 +112,7 @@ class CLOptionInfoArray { CLOptionInfo & operator[](int) const; - int lookup(const string &) const; + int lookup(const std::string &) const; }; @@ -143,7 +143,7 @@ class CommandLine { void do_log(); void get_n_args(StringArray &, const int Nargs, - const string & switch_name, const int pos); + const std::string & switch_name, const int pos); int get_unlimited_args(StringArray &, const int pos); @@ -159,7 +159,7 @@ class CommandLine { bool AllowUnrecognizedSwitches; // default: false - bool is_switch(const string &) const; + bool is_switch(const std::string &) const; public: @@ -170,7 +170,7 @@ class CommandLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // set stuff @@ -197,7 +197,7 @@ class CommandLine { int length(int) const; // length of jth arg - bool has_option(const string &) const; + bool has_option(const std::string &) const; int next_option(int & index) const; // -1 if no option found @@ -207,11 +207,11 @@ class CommandLine { void shift_down(int pos, int k); - const string operator[](int) const; + const std::string operator[](int) const; void parse(); - void add(CLSetFunction, const string & text, int n_args); // n_args not including switch + void add(CLSetFunction, const std::string & text, int n_args); // n_args not including switch }; diff --git a/src/basic/vx_util/crc_array.h b/src/basic/vx_util/crc_array.h index 7d86fe97e9..2b7dcb52e3 100644 --- a/src/basic/vx_util/crc_array.h +++ b/src/basic/vx_util/crc_array.h @@ -101,9 +101,9 @@ class CRC_Array { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; - void dump_one_line(ostream & out, int depth) const; + void dump_one_line(std::ostream & out, int depth) const; // // set stuff @@ -330,7 +330,7 @@ return; template -void CRC_Array::dump(ostream & out, int depth) const +void CRC_Array::dump(std::ostream & out, int depth) const { @@ -364,7 +364,7 @@ return; template -void CRC_Array::dump_one_line(ostream & out, int depth) const +void CRC_Array::dump_one_line(std::ostream & out, int depth) const { @@ -385,7 +385,7 @@ for (j=0; j e; + std::vector e; bool Sorted; @@ -52,7 +52,7 @@ class NumArray { void extend(int); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; double operator[](int) const; diff --git a/src/basic/vx_util/polyline.h b/src/basic/vx_util/polyline.h index 1278a71508..c3a31455d8 100644 --- a/src/basic/vx_util/polyline.h +++ b/src/basic/vx_util/polyline.h @@ -51,7 +51,7 @@ class Polyline { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ///////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index c76cf29b01..fa8340fa86 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -417,16 +417,16 @@ static const int n_genmpr_columns = sizeof(genmpr_columns)/sizeof(*genmpr_ //////////////////////////////////////////////////////////////////////// -inline int get_n_mctc_columns (int n) { return(3 + n*n); } // n = N_CAT -inline int get_n_pct_columns (int n) { return(3 + 3*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_pstd_columns (int n) { return(17 + max(1, n) ); } // n = N_THRESH -inline int get_n_pjc_columns (int n) { return(3 + 7*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_prc_columns (int n) { return(3 + 3*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_eclv_columns (int n) { return(4 + 2*n); } // n = N_PNT -inline int get_n_rhist_columns (int n) { return(2 + n); } // n = N_RANK -inline int get_n_phist_columns (int n) { return(3 + n); } // n = N_BINS -inline int get_n_relp_columns (int n) { return(2 + n); } // n = N_ENS -inline int get_n_orank_columns (int n) { return(20 + n); } // n = N_ENS +inline int get_n_mctc_columns (int n) { return(3 + n*n); } // n = N_CAT +inline int get_n_pct_columns (int n) { return(3 + 3*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_pstd_columns (int n) { return(17 + std::max(1, n) ); } // n = N_THRESH +inline int get_n_pjc_columns (int n) { return(3 + 7*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_prc_columns (int n) { return(3 + 3*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_eclv_columns (int n) { return(4 + 2*n); } // n = N_PNT +inline int get_n_rhist_columns (int n) { return(2 + n); } // n = N_RANK +inline int get_n_phist_columns (int n) { return(3 + n); } // n = N_BINS +inline int get_n_relp_columns (int n) { return(2 + n); } // n = N_ENS +inline int get_n_orank_columns (int n) { return(20 + n); } // n = N_ENS //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/thresh_array.h b/src/basic/vx_util/thresh_array.h index c3f6cafb2d..7a74dee69c 100644 --- a/src/basic/vx_util/thresh_array.h +++ b/src/basic/vx_util/thresh_array.h @@ -43,7 +43,7 @@ class ThreshArray { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool operator==(const ThreshArray &) const; SingleThresh operator[](int) const; @@ -74,7 +74,7 @@ class ThreshArray { void multiply_by(const double); - void get_simple_nodes(vector &); + void get_simple_nodes(std::vector &); ConcatString get_str(const char * = thresh_default_sep, int precision = thresh_default_precision) const; diff --git a/src/libcode/vx_afm/afm.h b/src/libcode/vx_afm/afm.h index 2d00ad58ff..cbe3c34d27 100644 --- a/src/libcode/vx_afm/afm.h +++ b/src/libcode/vx_afm/afm.h @@ -51,7 +51,7 @@ class AfmBBox { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int L; int B; @@ -82,7 +82,7 @@ class LigatureInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * successor_name; @@ -116,7 +116,7 @@ class AfmCharMetrics { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int ascii_code; @@ -154,7 +154,7 @@ class PCC { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name; @@ -184,7 +184,7 @@ class AfmCompositeInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name; @@ -215,7 +215,7 @@ class KPX { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name1; @@ -249,7 +249,7 @@ class Afm { void do_fontbbox(AfmLine &); - ifstream * in; // used for reading + std::ifstream * in; // used for reading int line_number; // void patch_ligatures(LigatureInfo &); @@ -263,7 +263,7 @@ class Afm { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read(const ConcatString&); diff --git a/src/libcode/vx_afm/afm_line.h b/src/libcode/vx_afm/afm_line.h index 3ccc32b241..07f3b5af8b 100644 --- a/src/libcode/vx_afm/afm_line.h +++ b/src/libcode/vx_afm/afm_line.h @@ -28,7 +28,7 @@ class AfmLine { - friend istream & operator>>(istream &, AfmLine &); + friend std::istream & operator>>(std::istream &, AfmLine &); private: @@ -70,7 +70,7 @@ class AfmLine { //////////////////////////////////////////////////////////////////////// -extern istream & operator>>(istream &, AfmLine &); +extern std::istream & operator>>(std::istream &, AfmLine &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afm_token.h b/src/libcode/vx_afm/afm_token.h index 158afed618..0153481327 100644 --- a/src/libcode/vx_afm/afm_token.h +++ b/src/libcode/vx_afm/afm_token.h @@ -44,7 +44,7 @@ class AfmToken { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // void set_string(const char *); void set_string(const ConcatString); diff --git a/src/libcode/vx_analysis_util/by_case_info.h b/src/libcode/vx_analysis_util/by_case_info.h index e95bd49846..1084c5331b 100644 --- a/src/libcode/vx_analysis_util/by_case_info.h +++ b/src/libcode/vx_analysis_util/by_case_info.h @@ -45,7 +45,7 @@ class ByCaseInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void add(const ModeLine &); diff --git a/src/libcode/vx_analysis_util/mode_atts.h b/src/libcode/vx_analysis_util/mode_atts.h index a20570ddc7..851a7eb653 100644 --- a/src/libcode/vx_analysis_util/mode_atts.h +++ b/src/libcode/vx_analysis_util/mode_atts.h @@ -65,7 +65,7 @@ class ModeAttributes { void clear(); - void dump(ostream & out, int depth = 0) const; + void dump(std::ostream & out, int depth = 0) const; int is_keeper(const ModeLine &) const; @@ -587,7 +587,7 @@ class ModeAttributes { //////////////////////////////////////////////////////////////////////// -extern void mode_atts_usage(ostream &); +extern void mode_atts_usage(std::ostream &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/mode_job.h b/src/libcode/vx_analysis_util/mode_job.h index 7e9c2668cc..e7d2958c44 100644 --- a/src/libcode/vx_analysis_util/mode_job.h +++ b/src/libcode/vx_analysis_util/mode_job.h @@ -62,13 +62,13 @@ class BasicModeAnalysisJob { virtual void clear(); - virtual void dump(ostream &, int depth = 0) const; + virtual void dump(std::ostream &, int depth = 0) const; virtual void add_column_by_name (const char *); virtual void add_column_by_number (int); // numbers start at zero - virtual void do_output(ostream &) const = 0; + virtual void do_output(std::ostream &) const = 0; virtual void setup() = 0; @@ -84,8 +84,8 @@ class BasicModeAnalysisJob { int n_lines_read; int n_lines_kept; - ostream * dumpfile; // NOT allocated, so don't delete - ostream * outfile; // NOT allocated, so don't delete + std::ostream * dumpfile; // NOT allocated, so don't delete + std::ostream * outfile; // NOT allocated, so don't delete int n_dump; // number of lines written to dump file AsciiTable dump_at; // AsciiTable object to buffer dump data @@ -123,7 +123,7 @@ class SummaryJob : public BasicModeAnalysisJob { void clear(); - void do_output(ostream &) const; + void do_output(std::ostream &) const; void setup(); @@ -154,7 +154,7 @@ class ByCaseJob : public BasicModeAnalysisJob { void clear(); - void do_output(ostream &) const; + void do_output(std::ostream &) const; void setup(); diff --git a/src/libcode/vx_analysis_util/mode_line.h b/src/libcode/vx_analysis_util/mode_line.h index d02d261449..9f111a4c47 100644 --- a/src/libcode/vx_analysis_util/mode_line.h +++ b/src/libcode/vx_analysis_util/mode_line.h @@ -48,7 +48,7 @@ class ModeLine : public DataLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); // virtual from base class diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 50cf4a91af..2645e884e2 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -117,7 +117,7 @@ class STATAnalysisJob { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; ////////////////////////////////////////////////////////////////// @@ -225,11 +225,11 @@ class STATAnalysisJob { NumArray weight; // Numeric column thresholds - map column_thresh_map; + std::map column_thresh_map; // ASCII column string matching - map column_str_inc_map; - map column_str_exc_map; + std::map column_str_inc_map; + std::map column_str_exc_map; StringArray hdr_name; StringArray hdr_value; @@ -243,12 +243,12 @@ class STATAnalysisJob { // Variables used to the store the analysis job specification // char *dump_row; // dump rows used to a file - ofstream *dr_out; // output file stream for dump row + std::ofstream *dr_out; // output file stream for dump row int n_dump; // number of lines written to dump row AsciiTable dump_at; // AsciiTable for buffering dump row data char *stat_file; // dump output statistics to a STAT file - ofstream *stat_out; // output file stream for -out_stat + std::ofstream *stat_out; // output file stream for -out_stat AsciiTable stat_at; // AsciiTable for buffering output STAT data int stat_row; // Counter for the current stat row diff --git a/src/libcode/vx_analysis_util/stat_line.h b/src/libcode/vx_analysis_util/stat_line.h index e7b63ee9d5..6c2a4282d0 100644 --- a/src/libcode/vx_analysis_util/stat_line.h +++ b/src/libcode/vx_analysis_util/stat_line.h @@ -49,7 +49,7 @@ class STATLine : public DataLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); // virtual from base class diff --git a/src/libcode/vx_analysis_util/time_series.h b/src/libcode/vx_analysis_util/time_series.h index 0474bc6503..10aab9b890 100644 --- a/src/libcode/vx_analysis_util/time_series.h +++ b/src/libcode/vx_analysis_util/time_series.h @@ -52,7 +52,7 @@ class TimeSeries { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set(unixtime _start, int _delta, int _n); diff --git a/src/libcode/vx_color/color.h b/src/libcode/vx_color/color.h index 986287aa6c..5c0126d2e5 100644 --- a/src/libcode/vx_color/color.h +++ b/src/libcode/vx_color/color.h @@ -67,7 +67,7 @@ class Color { void reverse_video(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool is_gray () const; @@ -172,7 +172,7 @@ class CtableEntry { double value_low () const; double value_high () const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -191,9 +191,9 @@ inline double CtableEntry::value_high() const { return ( ValueHi ); } //////////////////////////////////////////////////////////////////////// -extern istream & operator>>(istream &, CtableEntry &); +extern std::istream & operator>>(std::istream &, CtableEntry &); -extern ostream & operator<<(ostream &, const CtableEntry &); +extern std::ostream & operator<<(std::ostream &, const CtableEntry &); //////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ class ColorTable { double gamma() const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; CtableEntry operator[](int) const; diff --git a/src/libcode/vx_color/color_list.h b/src/libcode/vx_color/color_list.h index 8bcee60348..aebf35b641 100644 --- a/src/libcode/vx_color/color_list.h +++ b/src/libcode/vx_color/color_list.h @@ -47,7 +47,7 @@ class ClistEntry { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set_name(const std::string); @@ -102,7 +102,7 @@ class ColorList { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int n_elements() const; diff --git a/src/libcode/vx_data2d/data_class.h b/src/libcode/vx_data2d/data_class.h index 401cd4e0c7..06aecd0739 100644 --- a/src/libcode/vx_data2d/data_class.h +++ b/src/libcode/vx_data2d/data_class.h @@ -50,7 +50,7 @@ class Met2dData { void mtdd_clear(); - virtual void dump(ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data + virtual void dump(std::ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data // // set stuff @@ -105,7 +105,7 @@ class Met2dDataFile : public Met2dData { void mtddf_clear(); - virtual void dump(ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data + virtual void dump(std::ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data // // set stuff diff --git a/src/libcode/vx_data2d/level_info.h b/src/libcode/vx_data2d/level_info.h index 445528017a..377550de62 100644 --- a/src/libcode/vx_data2d/level_info.h +++ b/src/libcode/vx_data2d/level_info.h @@ -63,7 +63,7 @@ class LevelInfo void clear(); - void dump(ostream &) const; + void dump(std::ostream &) const; // // get stuff diff --git a/src/libcode/vx_data2d/table_lookup.h b/src/libcode/vx_data2d/table_lookup.h index d6ae3fa6f7..a234bf72bb 100644 --- a/src/libcode/vx_data2d/table_lookup.h +++ b/src/libcode/vx_data2d/table_lookup.h @@ -43,7 +43,7 @@ class Grib1TableEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int code; int table_number; @@ -94,7 +94,7 @@ class Grib2TableEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int index_a; // Section 0 Discipline int mtab_set; // Section 1 Master Tables Version Number used by set_var @@ -139,8 +139,8 @@ class TableFlatFile { void assign(const TableFlatFile &); - bool read_grib1(istream &, const char * filename, const int n); - bool read_grib2(istream &, const char * filename, const int n); + bool read_grib1(std::istream &, const char * filename, const int n); + bool read_grib2(std::istream &, const char * filename, const int n); void extend_grib1(int); void extend_grib2(int); @@ -164,7 +164,7 @@ class TableFlatFile { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/libcode/vx_data2d/var_info.h b/src/libcode/vx_data2d/var_info.h index d32715d130..7ac6399f6b 100644 --- a/src/libcode/vx_data2d/var_info.h +++ b/src/libcode/vx_data2d/var_info.h @@ -96,7 +96,7 @@ class VarInfo void clear(); - virtual void dump(ostream &) const; + virtual void dump(std::ostream &) const; // // get stuff @@ -158,7 +158,7 @@ class VarInfo void set_req_name(const char *); void set_name(const char *); - void set_name(const string); + void set_name(const std::string); void set_units(const char *); void set_level_info(const LevelInfo &); void set_req_level_name(const char *); @@ -272,7 +272,7 @@ struct InputInfo { class EnsVarInfo { private: - vector inputs; // Vector of InputInfo + std::vector inputs; // Vector of InputInfo VarInfo * ctrl_info; // Field info for control member public: diff --git a/src/libcode/vx_data2d_python/var_info_python.h b/src/libcode/vx_data2d_python/var_info_python.h index a9d9f781fa..776f0f4087 100644 --- a/src/libcode/vx_data2d_python/var_info_python.h +++ b/src/libcode/vx_data2d_python/var_info_python.h @@ -42,7 +42,7 @@ class VarInfoPython : public VarInfo VarInfoPython(const VarInfoPython &); VarInfoPython & operator=(const VarInfoPython &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_gis/dbf_file.h b/src/libcode/vx_gis/dbf_file.h index 78fc40e73f..03928046bc 100644 --- a/src/libcode/vx_gis/dbf_file.h +++ b/src/libcode/vx_gis/dbf_file.h @@ -71,7 +71,7 @@ class DbfHeader { void set_subrecords(int fd); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; DbfSubRecord * lookup_subrec(const char * text) const; // matches field_name @@ -119,13 +119,13 @@ class DbfSubRecord { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; //////////////////////////////////////////////////////////////////////// -void dump_record(ostream &, const int depth, const unsigned char * buf, const DbfHeader &); +void dump_record(std::ostream &, const int depth, const unsigned char * buf, const DbfHeader &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shp_array.h b/src/libcode/vx_gis/shp_array.h index 06f6aaeb4a..f0df12982d 100644 --- a/src/libcode/vx_gis/shp_array.h +++ b/src/libcode/vx_gis/shp_array.h @@ -78,7 +78,7 @@ class Shp_Array { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void extend(int, bool exact = true); @@ -232,7 +232,7 @@ return; template -void Shp_Array::dump(ostream & out, int depth) const +void Shp_Array::dump(std::ostream & out, int depth) const { diff --git a/src/libcode/vx_gis/shp_file.h b/src/libcode/vx_gis/shp_file.h index 821f0145ce..87e9f65031 100644 --- a/src/libcode/vx_gis/shp_file.h +++ b/src/libcode/vx_gis/shp_file.h @@ -61,7 +61,7 @@ struct ShpFileHeader { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -84,7 +84,7 @@ struct ShpRecordHeader { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_gis/shp_point_record.h b/src/libcode/vx_gis/shp_point_record.h index 62e529f8d3..006223c6f7 100644 --- a/src/libcode/vx_gis/shp_point_record.h +++ b/src/libcode/vx_gis/shp_point_record.h @@ -61,7 +61,7 @@ struct ShpPointRecord { // this should really be a class, not a struct void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_gis/shp_poly_record.h b/src/libcode/vx_gis/shp_poly_record.h index bccc220387..5bd6e23777 100644 --- a/src/libcode/vx_gis/shp_poly_record.h +++ b/src/libcode/vx_gis/shp_poly_record.h @@ -69,7 +69,7 @@ struct ShpPolyRecord { // this should really be a class, not a struct void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int start_index(int partno) const; int stop_index(int partno) const; diff --git a/src/libcode/vx_gis/shx_file.h b/src/libcode/vx_gis/shx_file.h index b4d788183f..c57809865f 100644 --- a/src/libcode/vx_gis/shx_file.h +++ b/src/libcode/vx_gis/shx_file.h @@ -43,7 +43,7 @@ struct ShxRecord { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_grid/gaussian_grid.h b/src/libcode/vx_grid/gaussian_grid.h index d8d28d16f1..056a2699cb 100644 --- a/src/libcode/vx_grid/gaussian_grid.h +++ b/src/libcode/vx_grid/gaussian_grid.h @@ -73,7 +73,7 @@ class GaussianGrid : public GridRep { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/grid_base.h b/src/libcode/vx_grid/grid_base.h index eb77e04b4b..838db38bcb 100644 --- a/src/libcode/vx_grid/grid_base.h +++ b/src/libcode/vx_grid/grid_base.h @@ -130,7 +130,7 @@ class GridInterface { // pure abstract class for grid public interface virtual ConcatString name() const = 0; - virtual void dump(ostream &, int = 0) const = 0; + virtual void dump(std::ostream &, int = 0) const = 0; virtual GridInfo info() const = 0; @@ -160,7 +160,7 @@ class GridRep : public GridInterface { GridRep(); virtual ~GridRep(); - virtual void dump(ostream &, int = 0) const = 0; + virtual void dump(std::ostream &, int = 0) const = 0; virtual ConcatString serialize(const char *sep=" ") const = 0; @@ -211,7 +211,7 @@ class Grid : public GridInterface { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set (const char *); // lookup by name void set (const LambertData &); diff --git a/src/libcode/vx_grid/latlon_grid.h b/src/libcode/vx_grid/latlon_grid.h index 646e6df0c4..d419802c65 100644 --- a/src/libcode/vx_grid/latlon_grid.h +++ b/src/libcode/vx_grid/latlon_grid.h @@ -69,7 +69,7 @@ class LatLonGrid : public GridRep { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/latlon_grid_defs.h b/src/libcode/vx_grid/latlon_grid_defs.h index adb3d521ef..9a88bd5a3f 100644 --- a/src/libcode/vx_grid/latlon_grid_defs.h +++ b/src/libcode/vx_grid/latlon_grid_defs.h @@ -70,7 +70,7 @@ struct RotatedLatLonData { void dump() const; // doesn't work if verbosity level < 4 - void dump(ostream &, int depth) const; + void dump(std::ostream &, int depth) const; }; diff --git a/src/libcode/vx_grid/lc_grid.h b/src/libcode/vx_grid/lc_grid.h index 3d9ffc4f27..cd105c5f49 100644 --- a/src/libcode/vx_grid/lc_grid.h +++ b/src/libcode/vx_grid/lc_grid.h @@ -110,7 +110,7 @@ class LambertGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/merc_grid.h b/src/libcode/vx_grid/merc_grid.h index c262cd9ebe..37c17fc5cc 100644 --- a/src/libcode/vx_grid/merc_grid.h +++ b/src/libcode/vx_grid/merc_grid.h @@ -93,7 +93,7 @@ class MercatorGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/rot_latlon_grid.h b/src/libcode/vx_grid/rot_latlon_grid.h index b6eb9e8442..c381fc99c1 100644 --- a/src/libcode/vx_grid/rot_latlon_grid.h +++ b/src/libcode/vx_grid/rot_latlon_grid.h @@ -62,7 +62,7 @@ class RotatedLatLonGrid : public LatLonGrid { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/st_grid.h b/src/libcode/vx_grid/st_grid.h index 5ee9747f5b..53d5150b9b 100644 --- a/src/libcode/vx_grid/st_grid.h +++ b/src/libcode/vx_grid/st_grid.h @@ -91,7 +91,7 @@ class StereographicGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_plot_util/map_region.h b/src/libcode/vx_plot_util/map_region.h index b228642231..94b6d36b6a 100644 --- a/src/libcode/vx_plot_util/map_region.h +++ b/src/libcode/vx_plot_util/map_region.h @@ -64,7 +64,7 @@ class MapRegion { //////////////////////////////////////////////////////////////////////// -extern bool operator>>(istream &, MapRegion &); +extern bool operator>>(std::istream &, MapRegion &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/ps_text.h b/src/libcode/vx_ps/ps_text.h index 905fb11046..cf92607792 100644 --- a/src/libcode/vx_ps/ps_text.h +++ b/src/libcode/vx_ps/ps_text.h @@ -73,7 +73,7 @@ class VxpsTextNode { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set_font_number(int); diff --git a/src/libcode/vx_ps/vx_ps.h b/src/libcode/vx_ps/vx_ps.h index 3cfeec731e..26ed654a26 100644 --- a/src/libcode/vx_ps/vx_ps.h +++ b/src/libcode/vx_ps/vx_ps.h @@ -126,7 +126,7 @@ class PSfile { DocumentOrientation Orientation; DocumentMedia Media; - ofstream * File; // the output file ... allocated + std::ofstream * File; // the output file ... allocated ConcatString OutputFilename; @@ -163,7 +163,7 @@ class PSfile { // get stuff // - // ofstream & file() const; + // std::ofstream & file() const; PSFilter & file() const; DocumentOrientation orientation () const; diff --git a/src/libcode/vx_pxm/pbm.h b/src/libcode/vx_pxm/pbm.h index e9bac50a97..330ed9afb1 100644 --- a/src/libcode/vx_pxm/pbm.h +++ b/src/libcode/vx_pxm/pbm.h @@ -81,7 +81,7 @@ class Pbm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_pxm/pcm.h b/src/libcode/vx_pxm/pcm.h index ecddb54d57..960856a235 100644 --- a/src/libcode/vx_pxm/pcm.h +++ b/src/libcode/vx_pxm/pcm.h @@ -77,7 +77,7 @@ class Pcm : public PxmBase { void reverse_video(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void all_black(); // does nothing void all_white(); // does nothing diff --git a/src/libcode/vx_pxm/pgm.h b/src/libcode/vx_pxm/pgm.h index ece18d1f6e..c8bfdea763 100644 --- a/src/libcode/vx_pxm/pgm.h +++ b/src/libcode/vx_pxm/pgm.h @@ -76,7 +76,7 @@ class Pgm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_pxm/ppm.h b/src/libcode/vx_pxm/ppm.h index 00eb09aa37..e5e3aa2334 100644 --- a/src/libcode/vx_pxm/ppm.h +++ b/src/libcode/vx_pxm/ppm.h @@ -75,7 +75,7 @@ class Ppm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // not from base class diff --git a/src/libcode/vx_pxm/pxm_base.h b/src/libcode/vx_pxm/pxm_base.h index 33abeb3726..b0d1b06189 100644 --- a/src/libcode/vx_pxm/pxm_base.h +++ b/src/libcode/vx_pxm/pxm_base.h @@ -101,7 +101,7 @@ class PxmBase { virtual void all_white() = 0; - virtual void dump (ostream &, int depth = 0) const = 0; + virtual void dump (std::ostream &, int depth = 0) const = 0; // // non-abstract member functions diff --git a/src/libcode/vx_render/psout_filter.h b/src/libcode/vx_render/psout_filter.h index 00032e430f..6753182dfc 100644 --- a/src/libcode/vx_render/psout_filter.h +++ b/src/libcode/vx_render/psout_filter.h @@ -31,9 +31,9 @@ class PSOutputFilter : public PSFilter { PSOutputFilter(); ~PSOutputFilter(); - PSOutputFilter(ofstream &); + PSOutputFilter(std::ofstream &); - ofstream *file; + std::ofstream *file; bool ignore_columns; // default: false @@ -44,7 +44,7 @@ class PSOutputFilter : public PSFilter { virtual void eod(); - void attach(ofstream *); + void attach(std::ofstream *); void detach(); }; diff --git a/src/libcode/vx_shapedata/mode_field_info.h b/src/libcode/vx_shapedata/mode_field_info.h index 2a4f298fbe..08ef22e072 100644 --- a/src/libcode/vx_shapedata/mode_field_info.h +++ b/src/libcode/vx_shapedata/mode_field_info.h @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////////////////// -typedef map AttrFilterMap; +typedef std::map AttrFilterMap; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_time_series/compute_swinging_door.h b/src/libcode/vx_time_series/compute_swinging_door.h index 052ce0a789..d4c9ac5283 100644 --- a/src/libcode/vx_time_series/compute_swinging_door.h +++ b/src/libcode/vx_time_series/compute_swinging_door.h @@ -37,7 +37,7 @@ class SDObservation _validTime(valid_time), _value(value) {} - SDObservation(const string &valid_time_string, + SDObservation(const std::string &valid_time_string, const double value) : _validTime(_getTime(valid_time_string)), _value(value) {} @@ -55,7 +55,7 @@ class SDObservation return _validTime; } - string getValidTimeString() const + std::string getValidTimeString() const { return _getTimeString(_validTime); } @@ -99,7 +99,7 @@ class SDObservation // Protected methods // /////////////////////// - static time_t _getTime(const string &time_string) + static time_t _getTime(const std::string &time_string) { struct tm time_struct; memset(&time_struct, 0, sizeof(time_struct)); @@ -114,7 +114,7 @@ class SDObservation return timegm(&time_struct); } - static string _getTimeString(const time_t &unix_time) + static std::string _getTimeString(const time_t &unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -126,7 +126,7 @@ class SDObservation time_struct->tm_mday, time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec); - return string(time_string); + return std::string(time_string); } }; @@ -163,9 +163,9 @@ extern bool compute_swinging_door_slopes(const TimeArray &valid_times, // Return: // Returns true if successful, false otherwise. -extern bool compute_swinging_door_ramps(const vector< SDObservation > &observations, +extern bool compute_swinging_door_ramps(const std::vector< SDObservation > &observations, const double error, - vector< pair< SDObservation, SDObservation > > &ramps); + std::vector< std::pair< SDObservation, SDObservation > > &ramps); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index 5c9934e163..f21f35bc88 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -84,7 +84,7 @@ if ( cline.n() == 0 ) usage(); int j; -cout << "GRIB1\n"; +std::cout << "GRIB1\n"; for (j=0; j<(cline.n()); ++j) { // j starts at one, here @@ -104,7 +104,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "nceptab_to_flat"; } @@ -116,7 +116,7 @@ void usage() { -cerr << "\n\n usage: " << program_name << " nceptab_source_file.c [ more such files ...]\n\n"; +std::cerr << "\n\n usage: " << program_name << " nceptab_source_file.c [ more such files ...]\n\n"; exit ( 1 ); @@ -149,7 +149,7 @@ void process(const char * input_filename) { ConcatString line; -ifstream in; +std::ifstream in; bool found = false; const char * short_name = get_short_name(input_filename); @@ -265,7 +265,7 @@ if ( !c ) return ( false ); n = atoi(c); -cout << n << ' ' << table_number << ' '; +std::cout << n << ' ' << table_number << ' '; // // first string @@ -275,7 +275,7 @@ c = strtok(s, " /*{\""); if ( !c ) return ( false ); -cout << '\"' << c << "\" "; +std::cout << '\"' << c << "\" "; // // second string (is this football?) @@ -290,7 +290,7 @@ if ( c[k] == ' ' ) c[k] = (char) 0; if ( !c ) return ( false ); -cout << '\"' << c << "\" "; +std::cout << '\"' << c << "\" "; // // units @@ -298,7 +298,7 @@ cout << '\"' << c << "\" "; if ( strcmp(c, "undefined") == 0 ) { - cout << "\"\" "; + std::cout << "\"\" "; } else { @@ -306,8 +306,8 @@ if ( strcmp(c, "undefined") == 0 ) { if ( !c ) return ( false ); - if ( c[0] == '}' ) cout << "\"\" "; - else cout << '\"' << c << "\" "; + if ( c[0] == '}' ) std::cout << "\"\" "; + else std::cout << '\"' << c << "\" "; } @@ -315,7 +315,7 @@ if ( strcmp(c, "undefined") == 0 ) { // done // -cout << '\n' << flush; +std::cout << '\n' << std::flush; return ( true ); diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index ec3bcc4517..ad06521acf 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -59,10 +59,10 @@ int met_main(int argc, char *argv[]) { char hdr_typ[512], time_str[512]; if(argc != 2) { - cout << "Usage: " << program_name << " pbfile\n" - << "\twhere \"pbfile\" is the PrepBufr file whose center " - << "time should be dumped (required).\n" - << flush; + std::cout << "Usage: " << program_name << " pbfile\n" + << "\twhere \"pbfile\" is the PrepBufr file whose center " + << "time should be dumped (required).\n" + << std::flush; exit(1); } @@ -84,7 +84,7 @@ int met_main(int argc, char *argv[]) { // Format and dump out the time string snprintf(time_str, sizeof(time_str), "%.10i", i_date); ut = yyyymmddhh_to_unix(time_str); - cout << unix_to_yyyymmdd_hhmmss(ut) << "\n" << flush; + std::cout << unix_to_yyyymmdd_hhmmss(ut) << "\n" << std::flush; // Delete the temporary blocked file remove_temp_file(blk_file); @@ -94,7 +94,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return program_name; } diff --git a/src/tools/dev_utils/reformat_county_data.cc b/src/tools/dev_utils/reformat_county_data.cc index a81f84dfa6..910ab18071 100644 --- a/src/tools/dev_utils/reformat_county_data.cc +++ b/src/tools/dev_utils/reformat_county_data.cc @@ -63,7 +63,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "reformat_country_data"; } @@ -75,7 +75,7 @@ void usage() { -cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; +std::cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; exit ( 1 ); @@ -95,8 +95,8 @@ int j, k, region_number, n_points; int a, b; double lat, lon; double lat_min, lat_max, lon_min, lon_max; -ifstream in; -ofstream out; +std::ifstream in; +std::ofstream out; char in_line[512]; // the maximum line length in any of the data files is 66 char out_line[512]; @@ -108,7 +108,7 @@ met_open(in, input_filename); if ( !in ) { - cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; exit ( 1 ); @@ -118,7 +118,7 @@ if ( !in ) { if ( !out ) { - cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; exit ( 1 ); @@ -149,7 +149,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 7 ) { - cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; exit ( 1 ); @@ -161,7 +161,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { region_number, n_points, lat_min, lat_max, lon_min, lon_max); - out << out_line << '\n' << flush; + out << out_line << '\n' << std::flush; // // data points @@ -173,7 +173,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( ! in.getline(in_line, sizeof(in_line)) ) { - cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; exit ( 1 ); @@ -183,7 +183,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 2 ) { - cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; exit ( 1 ); @@ -193,7 +193,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { snprintf(out_line, sizeof(out_line), "%7.3f %8.3f", lat, lon); - out << out_line << '\n' << flush; + out << out_line << '\n' << std::flush; } // for j diff --git a/src/tools/dev_utils/reformat_map_data.cc b/src/tools/dev_utils/reformat_map_data.cc index ce0eb1a631..99edf2d3ab 100644 --- a/src/tools/dev_utils/reformat_map_data.cc +++ b/src/tools/dev_utils/reformat_map_data.cc @@ -63,7 +63,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "reformat_map_data"; } @@ -75,7 +75,7 @@ void usage() { -cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; +std::cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; exit ( 1 ); @@ -95,8 +95,8 @@ int j, k, region_number, n_points; int a, b, c, d; double lat, lon; double lat_min, lat_max, lon_min, lon_max; -ifstream in; -ofstream out; +std::ifstream in; +std::ofstream out; char in_line[512]; // the maximum line length in any of the data files is 66 char out_line[512]; @@ -108,7 +108,7 @@ met_open(in, input_filename); if ( !in ) { - cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; exit ( 1 ); @@ -118,7 +118,7 @@ met_open(out, output_filename); if ( !out ) { - cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; exit ( 1 ); @@ -149,7 +149,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 9 ) { - cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; exit ( 1 ); @@ -161,7 +161,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { region_number, n_points, lat_min, lat_max, lon_min, lon_max); - out << out_line << '\n' << flush; + out << out_line << '\n' << std::flush; // // data points @@ -173,7 +173,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( ! in.getline(in_line, sizeof(in_line)) ) { - cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; exit ( 1 ); @@ -183,7 +183,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 2 ) { - cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; + std::cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; exit ( 1 ); @@ -193,7 +193,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { snprintf(out_line, sizeof(out_line), "%7.3f %8.3f", lat, lon); - out << out_line << '\n' << flush; + out << out_line << '\n' << std::flush; } // for j diff --git a/src/tools/other/gis_utils/gis_dump_dbf.cc b/src/tools/other/gis_utils/gis_dump_dbf.cc index 1afd53e07f..de1fd58fa3 100644 --- a/src/tools/other/gis_utils/gis_dump_dbf.cc +++ b/src/tools/other/gis_utils/gis_dump_dbf.cc @@ -58,7 +58,7 @@ if ( argc != 2 ) usage(); int fd = -1; int j; size_t n_read, bytes; -ConcatString input_filename = (string)argv[1]; +ConcatString input_filename = (std::string)argv[1]; DbfHeader h; DbfSubRecord sr; @@ -73,7 +73,7 @@ if ( (fd = met_open(input_filename.c_str(), O_RDONLY)) < 0 ) { } -cout << get_short_name(input_filename.c_str()) << '\n'; +std::cout << get_short_name(input_filename.c_str()) << '\n'; // // main header @@ -93,7 +93,7 @@ if ( (n_read = read(fd, buf, bytes)) != bytes ) { h.set_header(buf); -cout << "\n"; +std::cout << "\n"; // // subrecords @@ -101,9 +101,9 @@ cout << "\n"; h.set_subrecords(fd); -h.dump(cout); +h.dump(std::cout); -cout << "\n"; +std::cout << "\n"; // // records @@ -137,9 +137,9 @@ for (j=0; j<(h.n_records); ++j) { buf[h.record_length] = 0; } - cout << "Record " << j << " ...\n"; + std::cout << "Record " << j << " ...\n"; - dump_record(cout, 1, buf, h); + dump_record(std::cout, 1, buf, h); } // for j @@ -158,7 +158,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "gis_dump_dbf"; } diff --git a/src/tools/other/gis_utils/gis_dump_shp.cc b/src/tools/other/gis_utils/gis_dump_shp.cc index 6db3275963..80d299bfbd 100644 --- a/src/tools/other/gis_utils/gis_dump_shp.cc +++ b/src/tools/other/gis_utils/gis_dump_shp.cc @@ -89,11 +89,11 @@ cline.parse(); if ( cline.n() != 1 ) usage(); - ConcatString input_filename = (string)cline[0]; +ConcatString input_filename = (std::string)cline[0]; ShpFile f; -cout << "file = \"" << get_short_name(input_filename.c_str()) << "\"\n\n"; +std::cout << "file = \"" << get_short_name(input_filename.c_str()) << "\"\n\n"; if ( ! f.open(input_filename.c_str()) ) { @@ -109,11 +109,11 @@ if ( ! f.open(input_filename.c_str()) ) { // header // -cout << "File Header ... \n"; +std::cout << "File Header ... \n"; -f.header()->dump(cout, 1); +f.header()->dump(std::cout, 1); -cout << '\n' << flush; +std::cout << '\n' << std::flush; if ( header_only ) return ( 0 ); @@ -156,7 +156,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "gis_dump_shp"; } @@ -204,22 +204,22 @@ ShpPolyRecord r; while ( f >> r ) { - cout << "Record Header ... \n"; + std::cout << "Record Header ... \n"; - r.rh.dump(cout, 1); + r.rh.dump(std::cout, 1); - cout << "\n"; + std::cout << "\n"; - cout << "Record Data ... \n"; + std::cout << "Record Data ... \n"; - r.dump(cout, 1); + r.dump(std::cout, 1); - cout << "\n"; + std::cout << "\n"; } // while -cout << "\n\n"; +std::cout << "\n\n"; @@ -245,22 +245,22 @@ ShpPointRecord r; while ( f >> r ) { - cout << "Record Header ... \n"; + std::cout << "Record Header ... \n"; - r.rh.dump(cout, 1); + r.rh.dump(std::cout, 1); - cout << "\n"; + std::cout << "\n"; - cout << "Record Data ... \n"; + std::cout << "Record Data ... \n"; - r.dump(cout, 1); + r.dump(std::cout, 1); - cout << "\n"; + std::cout << "\n"; } // while -cout << "\n\n"; +std::cout << "\n\n"; // diff --git a/src/tools/other/gis_utils/gis_dump_shx.cc b/src/tools/other/gis_utils/gis_dump_shx.cc index d8b37d049f..3566a17cb4 100644 --- a/src/tools/other/gis_utils/gis_dump_shx.cc +++ b/src/tools/other/gis_utils/gis_dump_shx.cc @@ -58,7 +58,7 @@ if ( argc != 2 ) usage(); int fd = -1; int n_read, bytes; int count; -ConcatString input_filename = (string)argv[1]; +ConcatString input_filename = (std::string)argv[1]; ShxFileHeader h; ShxRecord r; @@ -73,7 +73,7 @@ if ( (fd = met_open(input_filename.c_str(), O_RDONLY)) < 0 ) { } -cout << get_short_name(input_filename.c_str()) << '\n'; +std::cout << get_short_name(input_filename.c_str()) << '\n'; // // main header @@ -93,11 +93,11 @@ if ( (n_read = read(fd, buf, bytes)) != bytes ) { h.set(buf); -cout << "ShxFileHeader ...\n"; +std::cout << "ShxFileHeader ...\n"; -h.dump(cout, 1); +h.dump(std::cout, 1); -cout << "\n"; +std::cout << "\n"; // // records @@ -109,15 +109,15 @@ while ( (n_read = read(fd, buf, 8)) == 8 ) { r.set(buf); - cout << "Record " << (count++) << " ... \n"; + std::cout << "Record " << (count++) << " ... \n"; - r.dump(cout, 1); + r.dump(std::cout, 1); - cout << "\n"; + std::cout << "\n"; } // while -cout << "\n\n Read " << count << " records\n\n"; +std::cout << "\n\n Read " << count << " records\n\n"; // // done @@ -132,7 +132,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "gis_dump_shx"; } diff --git a/src/tools/other/pb2nc/pb2nc_conf_info.h b/src/tools/other/pb2nc/pb2nc_conf_info.h index 5bff649adf..401e0271f0 100644 --- a/src/tools/other/pb2nc/pb2nc_conf_info.h +++ b/src/tools/other/pb2nc/pb2nc_conf_info.h @@ -57,8 +57,8 @@ class PB2NCConfInfo { ConcatString tmp_dir; // Directory for temporary files ConcatString version; // Config file version - map obs_bufr_map; - map message_type_map; + std::map obs_bufr_map; + std::map message_type_map; StringArray surface_message_types; TimeSummaryInfo timeSummaryInfo; @@ -70,8 +70,8 @@ class PB2NCConfInfo { void clear(); - map getObsVarMap() const { return obs_bufr_map; } - map getMessageTypeMap() const { return message_type_map; } + std::map getObsVarMap() const { return obs_bufr_map; } + std::map getMessageTypeMap() const { return message_type_map; } TimeSummaryInfo getSummaryInfo() const { return timeSummaryInfo; }; void read_config(const char *, const char *); diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index 1e742cf99a..aa17e3f2bf 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -169,7 +169,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "wwmca_plot"; } @@ -181,22 +181,22 @@ void usage() { -cout << "\nUsage: " << program_name << "\n" - << "\t[-outdir path]\n" - << "\t[-max max_minutes]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\twwmca_cloud_pct_file_list\n\n" - << "\twhere\t\"-outdir path\" overrides the default output " - << "directory (.) (optional).\n" - << "\t\t\"-max max_minutes\" overrides the default maximum " - << "minutes of (" << max_minutes << ") (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"wwmca_cloud_pct_file_list\" is a list of one or " - << "more wwmca cloud percent files to plot.\n\n"; +std::cout << "\nUsage: " << program_name << "\n" + << "\t[-outdir path]\n" + << "\t[-max max_minutes]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\twwmca_cloud_pct_file_list\n\n" + << "\twhere\t\"-outdir path\" overrides the default output " + << "directory (.) (optional).\n" + << "\t\t\"-max max_minutes\" overrides the default maximum " + << "minutes of (" << max_minutes << ") (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"wwmca_cloud_pct_file_list\" is a list of one or " + << "more wwmca cloud percent files to plot.\n\n"; exit ( 1 ); @@ -519,7 +519,7 @@ void draw_map(PSfile & plot, const char hemisphere) { MapRegion r; -ifstream in; +std::ifstream in; ConcatString filename; filename = replace_path(map_filename); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 92906015de..2d58c0f4de 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -229,7 +229,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { if(mlog.verbosity_level() >=5) { mlog << Debug(5) << "Parsed data field " << i + 1 << ":\n"; - data_info[i]->dump(cout); + data_info[i]->dump(std::cout); } } diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc index 762fc29edd..f6cb8e349d 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc @@ -125,9 +125,9 @@ void TCRMW_WindConverter::update_input(const std::string &variableName, const st //////////////////////////////////////////////////////////////////////// -void TCRMW_WindConverter::append_nc_output_vars(map > &variable_levels, - map &variable_long_names, - map &variable_units) { +void TCRMW_WindConverter::append_nc_output_vars(std::map > &variable_levels, + std::map &variable_long_names, + std::map &variable_units) { if (!_computeWinds) { return; } diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h index d07f770c3c..a400841b24 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h @@ -97,9 +97,9 @@ class TCRMW_WindConverter { // append to the input maps for tangential and radial winds data // if configured to compute winds, but didn't find U or V, turn off // the wind computations and report an error - void append_nc_output_vars(map > &variable_levels, - map &variable_long_names, - map &variable_units); + void append_nc_output_vars(std::map > &variable_levels, + std::map &variable_long_names, + std::map &variable_units); // Check input varName against U, and if it's a match, lookup V using the // map members, and then compute tangential and radial winds if it is so From 6cd7d7d47146b94d3d26bd2e2a9d319067607b14 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 12 Sep 2022 15:13:31 -0600 Subject: [PATCH 02/26] Attempt to resolve errors in GitHub actions from removing 'using namepsace std' from all src/basic/ libraries, plus removal from src/libcode/vx_gnomon/gnomon.h and src/libcode/vx_nc_util/nc_utils.h --- src/basic/vx_util/observation.h | 42 ++-- src/libcode/vx_data2d_python/data2d_python.h | 2 +- src/libcode/vx_gnomon/gnomon.h | 5 - src/libcode/vx_nc_obs/nc_obs_util.h | 4 +- src/libcode/vx_nc_obs/nc_point_obs_out.h | 6 +- src/libcode/vx_nc_obs/nc_summary.h | 4 +- src/libcode/vx_nc_util/nc_utils.h | 164 +++++++------- src/libcode/vx_nc_util/nc_utils.hpp | 14 +- src/libcode/vx_nc_util/nc_var_info.h | 20 +- src/libcode/vx_summary/summary_calc.h | 2 +- src/libcode/vx_summary/summary_obs.h | 40 ++-- src/libcode/vx_tc_util/atcf_line_base.h | 14 +- src/libcode/vx_tc_util/atcf_prob_line.h | 2 +- src/libcode/vx_tc_util/atcf_track_line.h | 2 +- src/libcode/vx_tc_util/gen_shape_info.h | 2 +- src/libcode/vx_tc_util/genesis_info.h | 8 +- src/libcode/vx_tc_util/pair_data_genesis.h | 8 +- src/libcode/vx_tc_util/prob_gen_info.h | 2 +- src/libcode/vx_tc_util/prob_info_array.h | 6 +- src/libcode/vx_tc_util/prob_info_base.h | 2 +- src/libcode/vx_tc_util/prob_rirw_info.h | 2 +- src/libcode/vx_tc_util/prob_rirw_pair_info.h | 6 +- src/libcode/vx_tc_util/tc_columns.h | 4 +- src/libcode/vx_tc_util/track_info.h | 6 +- src/libcode/vx_tc_util/track_pair_info.h | 4 +- src/libcode/vx_tc_util/track_point.h | 4 +- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 124 +++++----- src/libcode/vx_tc_util/vx_tc_nc_util.h | 30 +-- src/tools/dev_utils/met_nc_file.h | 10 +- src/tools/dev_utils/swinging_door.cc | 86 +++---- .../other/modis_regrid/cloudsat_swath_file.h | 10 +- src/tools/other/modis_regrid/modis_regrid.cc | 50 ++-- src/tools/other/pb2nc/pb2nc.cc | 214 +++++++++--------- .../shift_data_plane/shift_data_plane.cc | 92 ++++---- 34 files changed, 494 insertions(+), 497 deletions(-) diff --git a/src/basic/vx_util/observation.h b/src/basic/vx_util/observation.h index 58d9e29285..cd18961f93 100644 --- a/src/basic/vx_util/observation.h +++ b/src/basic/vx_util/observation.h @@ -37,23 +37,23 @@ class Observation public: - Observation(const string &header_type, const string &station_id, + Observation(const std::string &header_type, const std::string &station_id, const time_t valid_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int grib_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); + const std::string &var_name = ""); - Observation(const string &header_type, const string &station_id, + Observation(const std::string &header_type, const std::string &station_id, const time_t start_time, const time_t end_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int grib_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); + const std::string &var_name = ""); //////////////////////// #ifdef ENABLE_PYTHON @@ -85,12 +85,12 @@ class Observation hdrIndex = headerIndex; } - string getHeaderType() const + std::string getHeaderType() const { return _headerType; } - string getStationId() const + std::string getStationId() const { return _stationId; } @@ -100,7 +100,7 @@ class Observation return _validTime; } - string getValidTimeString() const + std::string getValidTimeString() const { return _getTimeString(_validTime); } @@ -120,7 +120,7 @@ class Observation return _elevation; } - string getQualityFlag() const + std::string getQualityFlag() const { return _qualityFlag; } @@ -155,7 +155,7 @@ class Observation return _value; } - string getVarName() const + std::string getVarName() const { return _varName; } @@ -201,14 +201,14 @@ class Observation // Protected members // /////////////////////// - string _headerType; - string _stationId; + std::string _headerType; + std::string _stationId; time_t _validTime; double _latitude; double _longitude; double _elevation; - string _qualityFlag; - string _varName; + std::string _qualityFlag; + std::string _varName; int varCode; long hdrIndex; double _pressureLevel; @@ -220,7 +220,7 @@ class Observation // Protected methods // /////////////////////// - static string _getTimeString(const time_t &unix_time) + static std::string _getTimeString(const time_t &unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -232,14 +232,14 @@ class Observation time_struct->tm_mday, time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec); - return string(time_string); + return std::string(time_string); } - static string _getTimeString(const time_t &start_time, + static std::string _getTimeString(const time_t &start_time, const time_t &end_time) { - string start_time_string = _getTimeString(start_time); - string end_time_string = _getTimeString(end_time); + std::string start_time_string = _getTimeString(start_time); + std::string end_time_string = _getTimeString(end_time); char time_string[tmp_buf_size]; @@ -247,7 +247,7 @@ class Observation "%s-%s", start_time_string.c_str(), end_time_string.c_str()); - return string(time_string); + return std::string(time_string); } }; diff --git a/src/libcode/vx_data2d_python/data2d_python.h b/src/libcode/vx_data2d_python/data2d_python.h index 161b0a83fb..bb837ef5a4 100644 --- a/src/libcode/vx_data2d_python/data2d_python.h +++ b/src/libcode/vx_data2d_python/data2d_python.h @@ -84,7 +84,7 @@ class MetPythonDataFile : public Met2dDataFile { void close(); - void dump (ostream &, int depth = 0) const; + void dump (std::ostream &, int depth = 0) const; bool data_plane(VarInfo &, DataPlane &); diff --git a/src/libcode/vx_gnomon/gnomon.h b/src/libcode/vx_gnomon/gnomon.h index 81e280526a..2be3503707 100644 --- a/src/libcode/vx_gnomon/gnomon.h +++ b/src/libcode/vx_gnomon/gnomon.h @@ -16,11 +16,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - - class GnomonicProjection { private: diff --git a/src/libcode/vx_nc_obs/nc_obs_util.h b/src/libcode/vx_nc_obs/nc_obs_util.h index 2d8a06ca2c..0a119cad21 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.h +++ b/src/libcode/vx_nc_obs/nc_obs_util.h @@ -175,7 +175,7 @@ struct NcPointObsData : public MetPointObsData { extern bool add_nc_header_prepbufr (const int pb_report_type, const int in_report_type, const int instrument_type); -extern long count_nc_headers (vector< Observation > &observations); +extern long count_nc_headers (std::vector< Observation > &observations); extern int get_nc_hdr_cur_index(); extern int get_nc_obs_buf_index(); @@ -186,7 +186,7 @@ extern bool is_using_var_id (NcFile * nc_file); extern void reset_header_buffer(int buf_size, bool reset_all=false); extern void set_header_buffer (int buf_size, bool reset_all=false); -extern string seconds_to_time_string(const int secs); +extern std::string seconds_to_time_string(const int secs); extern void write_nc_obs_buffer (const int buf_size); extern int write_nc_string_array (NcVar *ncVar, StringArray &strArray, diff --git a/src/libcode/vx_nc_obs/nc_point_obs_out.h b/src/libcode/vx_nc_obs/nc_point_obs_out.h index 34ce1c5ebf..42f1381b3f 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs_out.h +++ b/src/libcode/vx_nc_obs/nc_point_obs_out.h @@ -60,10 +60,10 @@ class MetNcPointObsOut : public MetNcPointObs { void init_buffer(); void init_obs_vars(bool using_var_id, int deflate_level, bool attr_agl=false); - bool init_netcdf(int obs_count, int hdr_count, string program_name); + bool init_netcdf(int obs_count, int hdr_count, std::string program_name); void reset_header_buffer(int buf_size, bool reset_all); - void set_nc_out_data(vector observations, + void set_nc_out_data(std::vector observations, SummaryObs *summary_obs, TimeSummaryInfo summary_info, int processed_hdr_cnt=0); void set_using_var_id(bool using_var_id); @@ -75,7 +75,7 @@ class MetNcPointObsOut : public MetNcPointObs { void write_observation(); void write_observation(const float obs_arr[OBS_ARRAY_LEN], const char *obs_qty); void write_obs_data(); - int write_obs_data(const vector< Observation > observations, + int write_obs_data(const std::vector< Observation > observations, const bool do_header = true); bool write_to_netcdf(StringArray obs_names, StringArray obs_units, StringArray obs_descs); diff --git a/src/libcode/vx_nc_obs/nc_summary.h b/src/libcode/vx_nc_obs/nc_summary.h index 7cebff8932..788af6232d 100644 --- a/src/libcode/vx_nc_obs/nc_summary.h +++ b/src/libcode/vx_nc_obs/nc_summary.h @@ -25,14 +25,14 @@ using namespace netCDF; struct NcObsOutputData { int processed_hdr_cnt; int deflate_level; - vector observations; + std::vector observations; SummaryObs *summary_obs; TimeSummaryInfo summary_info; }; //////////////////////////////////////////////////////////////////////// -extern string _secsToTimeString(const int secs); +extern std::string _secsToTimeString(const int secs); // Not moved to nc_obs_util to reduce the dependency (library) diff --git a/src/libcode/vx_nc_util/nc_utils.h b/src/libcode/vx_nc_util/nc_utils.h index 58fed1d8c3..5196559be1 100644 --- a/src/libcode/vx_nc_util/nc_utils.h +++ b/src/libcode/vx_nc_util/nc_utils.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -35,7 +33,7 @@ typedef unsigned char uchar; //////////////////////////////////////////////////////////////////////// -static const string C_unknown_str = string("unknown"); +static const std::string C_unknown_str = std::string("unknown"); #define IS_VALID_NC(ncObj) (!ncObj.isNull()) #define IS_VALID_NC_P(ncObjPtr) ((ncObjPtr != 0 && !ncObjPtr->isNull())) @@ -86,65 +84,65 @@ static const string C_unknown_str = string("unknown"); #define OBS_BUFFER_SIZE (128 * 1024) -static const char nc_dim_nhdr[] = "nhdr"; -static const char nc_dim_nhdr_typ[] = "nhdr_typ"; -static const char nc_dim_nhdr_sid[] = "nhdr_sid"; -static const char nc_dim_nhdr_vld[] = "nhdr_vld"; -static const char nc_dim_npbhdr[] = "npbhdr"; -static const char nc_dim_nobs[] = "nobs"; -static const char nc_dim_nqty[] = "nobs_qty"; -static const char nc_dim_hdr_arr[] = "hdr_arr_len"; -static const char nc_dim_obs_arr[] = "obs_arr_len"; -static const char nc_dim_mxstr[] = "mxstr"; -static const char nc_dim_mxstr2[] = "mxstr2"; -static const char nc_dim_mxstr3[] = "mxstr3"; -static const char nc_dim_nvar[] = "obs_var_num"; -static const char nc_dim_unit[] = "unit_len"; -static const char nc_dim_desc[] = "desc_len"; -static const char nc_var_desc[] = "obs_desc"; -static const char nc_var_hdr_arr[] = "hdr_arr"; -static const char nc_var_hdr_lat[] = "hdr_lat"; -static const char nc_var_hdr_lon[] = "hdr_lon"; -static const char nc_var_hdr_elv[] = "hdr_elv"; -static const char nc_var_hdr_typ[] = "hdr_typ"; -static const char nc_var_hdr_sid[] = "hdr_sid"; -static const char nc_var_hdr_vld[] = "hdr_vld"; -static const char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ"; -static const char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ"; -static const char nc_var_hdr_inst_typ[] = "hdr_inst_typ"; -static const char nc_var_hdr_typ_tbl[] = "hdr_typ_table"; -static const char nc_var_hdr_sid_tbl[] = "hdr_sid_table"; -static const char nc_var_hdr_vld_tbl[] = "hdr_vld_table"; -static const char nc_var_obs_arr[] = "obs_arr"; -static const char nc_var_obs_hid[] = "obs_hid"; -static const char nc_var_obs_gc[] = "obs_gc"; -static const char nc_var_obs_vid[] = "obs_vid"; -static const char nc_var_obs_lvl[] = "obs_lvl"; -static const char nc_var_obs_hgt[] = "obs_hgt"; -static const char nc_var_obs_val[] = "obs_val"; -static const char nc_var_obs_qty[] = "obs_qty"; -static const char nc_var_obs_qty_tbl[] = "obs_qty_table"; -static const char nc_var_obs_var[] = "obs_var"; -static const char nc_var_unit[] = "obs_unit"; -static const string nc_att_use_var_id = "use_var_id"; -static const char nc_att_obs_version[] = "MET_Obs_version"; -static const char nc_att_met_point_nccf[] = "MET_point_NCCF"; - -static const string add_offset_att_name = "add_offset"; -static const string axis_att_name = "axis"; -static const string bounds_att_name = "bounds"; -static const string coordinates_att_name = "coordinates"; -static const string coordinate_axis_type_att_name = "_CoordinateAxisType"; -static const string description_att_name = "description"; -static const string fill_value_att_name = "_FillValue"; -static const string grid_mapping_att_name = "grid_mapping"; -static const string grid_mapping_name_att_name = "grid_mapping_name"; -static const string long_name_att_name = "long_name"; -static const string missing_value_att_name = "missing_value"; -static const string projection_att_name = "Projection"; -static const string scale_factor_att_name = "scale_factor"; -static const string standard_name_att_name = "standard_name"; -static const string units_att_name = "units"; +static const char nc_dim_nhdr[] = "nhdr"; +static const char nc_dim_nhdr_typ[] = "nhdr_typ"; +static const char nc_dim_nhdr_sid[] = "nhdr_sid"; +static const char nc_dim_nhdr_vld[] = "nhdr_vld"; +static const char nc_dim_npbhdr[] = "npbhdr"; +static const char nc_dim_nobs[] = "nobs"; +static const char nc_dim_nqty[] = "nobs_qty"; +static const char nc_dim_hdr_arr[] = "hdr_arr_len"; +static const char nc_dim_obs_arr[] = "obs_arr_len"; +static const char nc_dim_mxstr[] = "mxstr"; +static const char nc_dim_mxstr2[] = "mxstr2"; +static const char nc_dim_mxstr3[] = "mxstr3"; +static const char nc_dim_nvar[] = "obs_var_num"; +static const char nc_dim_unit[] = "unit_len"; +static const char nc_dim_desc[] = "desc_len"; +static const char nc_var_desc[] = "obs_desc"; +static const char nc_var_hdr_arr[] = "hdr_arr"; +static const char nc_var_hdr_lat[] = "hdr_lat"; +static const char nc_var_hdr_lon[] = "hdr_lon"; +static const char nc_var_hdr_elv[] = "hdr_elv"; +static const char nc_var_hdr_typ[] = "hdr_typ"; +static const char nc_var_hdr_sid[] = "hdr_sid"; +static const char nc_var_hdr_vld[] = "hdr_vld"; +static const char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ"; +static const char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ"; +static const char nc_var_hdr_inst_typ[] = "hdr_inst_typ"; +static const char nc_var_hdr_typ_tbl[] = "hdr_typ_table"; +static const char nc_var_hdr_sid_tbl[] = "hdr_sid_table"; +static const char nc_var_hdr_vld_tbl[] = "hdr_vld_table"; +static const char nc_var_obs_arr[] = "obs_arr"; +static const char nc_var_obs_hid[] = "obs_hid"; +static const char nc_var_obs_gc[] = "obs_gc"; +static const char nc_var_obs_vid[] = "obs_vid"; +static const char nc_var_obs_lvl[] = "obs_lvl"; +static const char nc_var_obs_hgt[] = "obs_hgt"; +static const char nc_var_obs_val[] = "obs_val"; +static const char nc_var_obs_qty[] = "obs_qty"; +static const char nc_var_obs_qty_tbl[] = "obs_qty_table"; +static const char nc_var_obs_var[] = "obs_var"; +static const char nc_var_unit[] = "obs_unit"; +static const std::string nc_att_use_var_id = "use_var_id"; +static const char nc_att_obs_version[] = "MET_Obs_version"; +static const char nc_att_met_point_nccf[] = "MET_point_NCCF"; + +static const std::string add_offset_att_name = "add_offset"; +static const std::string axis_att_name = "axis"; +static const std::string bounds_att_name = "bounds"; +static const std::string coordinates_att_name = "coordinates"; +static const std::string coordinate_axis_type_att_name = "_CoordinateAxisType"; +static const std::string description_att_name = "description"; +static const std::string fill_value_att_name = "_FillValue"; +static const std::string grid_mapping_att_name = "grid_mapping"; +static const std::string grid_mapping_name_att_name = "grid_mapping_name"; +static const std::string long_name_att_name = "long_name"; +static const std::string missing_value_att_name = "missing_value"; +static const std::string projection_att_name = "Projection"; +static const std::string scale_factor_att_name = "scale_factor"; +static const std::string standard_name_att_name = "standard_name"; +static const std::string units_att_name = "units"; static const char nc_time_unit_exp[] = "^[a-z|A-Z]* since [0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}"; @@ -184,7 +182,7 @@ extern bool get_att_no_leap_year(const NcVar *); extern NcVarAtt *get_nc_att(const NcVar *, const ConcatString &, bool exit_on_error = false); extern NcGroupAtt *get_nc_att(const NcFile *, const ConcatString &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVarAtt *, string &); +extern bool get_nc_att_value(const NcVarAtt *, std::string &); extern bool get_nc_att_value(const NcVarAtt *, int &, bool exit_on_error = true); extern bool get_nc_att_value(const NcVarAtt *, float &, bool exit_on_error = true); extern bool get_nc_att_value(const NcVarAtt *, double &, bool exit_on_error = true); @@ -209,14 +207,14 @@ extern bool get_global_att(const NcFile *, const ConcatString &, double &, bool extern int get_version_no(const NcFile *); extern bool is_version_less_than_1_02(const NcFile *nc); -extern void add_att(NcFile *, const string &, const int ); -extern void add_att(NcFile *, const string &, const string); -extern void add_att(NcFile *, const string &, const char *); -extern void add_att(NcFile *, const string &, const ConcatString); -extern void add_att(NcVar *, const string &, const string); -extern void add_att(NcVar *, const string &, const int ); -extern void add_att(NcVar *, const string &, const float ); -extern void add_att(NcVar *, const string &, const double); +extern void add_att(NcFile *, const std::string &, const int ); +extern void add_att(NcFile *, const std::string &, const std::string); +extern void add_att(NcFile *, const std::string &, const char *); +extern void add_att(NcFile *, const std::string &, const ConcatString); +extern void add_att(NcVar *, const std::string &, const std::string); +extern void add_att(NcVar *, const std::string &, const int ); +extern void add_att(NcVar *, const std::string &, const float ); +extern void add_att(NcVar *, const std::string &, const double); extern int get_var_names(NcFile *, StringArray *varNames); @@ -329,24 +327,24 @@ extern void copy_nc_var_data(NcVar *, NcVar *); extern bool has_var(NcFile *, const char * var_name); -extern NcVar add_var(NcFile *, const string &, const NcType, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const vector, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern NcVar add_var(NcFile *, const std::string &, const NcType, const std::vector, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcDim add_dim(NcFile *, const string &); -extern NcDim add_dim(NcFile *, const string &, const size_t); +extern NcDim add_dim(NcFile *, const std::string &); +extern NcDim add_dim(NcFile *, const std::string &, const size_t); extern bool has_dim(NcFile *, const char *dim_name); extern bool get_dim(const NcFile *, const ConcatString &, int &, bool error_out = false); extern int get_dim_count(const NcVar *); extern int get_dim_count(const NcFile *); extern int get_dim_size(const NcDim *); extern int get_dim_size(const NcVar *, const int dim_offset); -extern int get_dim_value(const NcFile *, const string &, const bool error_out = false); -extern NcDim get_nc_dim(const NcFile *, const string &dim_name); -extern NcDim get_nc_dim(const NcVar *, const string &dim_name); +extern int get_dim_value(const NcFile *, const std::string &, const bool error_out = false); +extern NcDim get_nc_dim(const NcFile *, const std::string &dim_name); +extern NcDim get_nc_dim(const NcVar *, const std::string &dim_name); extern NcDim get_nc_dim(const NcVar *, const int dim_offset); extern bool get_dim_names(const NcVar *var, StringArray *dimNames); extern bool get_dim_names(const NcFile *nc, StringArray *dimNames); @@ -354,7 +352,7 @@ extern bool get_dim_names(const NcFile *nc, StringArray *dimNames); extern NcVar get_nc_var_lat(const NcFile *nc); extern NcVar get_nc_var_lon(const NcFile *nc); extern NcVar get_nc_var_time(const NcFile *nc); -extern int get_index_at_nc_data(NcVar *var, double value, const string dim_name, bool is_time=false); +extern int get_index_at_nc_data(NcVar *var, double value, const std::string dim_name, bool is_time=false); extern NcFile* open_ncfile(const char * nc_name, bool write = false); extern int get_data_size(NcVar *); diff --git a/src/libcode/vx_nc_util/nc_utils.hpp b/src/libcode/vx_nc_util/nc_utils.hpp index f66b665a29..7783219985 100644 --- a/src/libcode/vx_nc_util/nc_utils.hpp +++ b/src/libcode/vx_nc_util/nc_utils.hpp @@ -22,7 +22,7 @@ extern bool get_att_value(const NcAtt *att, unsigned int &att_val); extern bool get_att_value(const NcAtt *att, float &att_val); extern bool get_att_value(const NcAtt *att, double &att_val); extern ConcatString get_log_msg_for_att(const NcVarAtt *att); -extern ConcatString get_log_msg_for_att(const NcVarAtt *att, string var_name, +extern ConcatString get_log_msg_for_att(const NcVarAtt *att, std::string var_name, const ConcatString att_name); extern double get_var_add_offset(const NcVar *var); extern double get_var_scale_factor(const NcVar *var); @@ -54,7 +54,7 @@ bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { status = true; } else if (NC_CHAR == nc_type_id) { - string att_value; + std::string att_value; att->getValues(att_value); if (matching_type == NC_FLOAT) att_val = atof(att_value.c_str()); @@ -132,7 +132,7 @@ bool get_global_att_value_(const NcFile *nc, const ConcatString& att_name, NcGroupAtt *nc_att = get_nc_att(nc, att_name); if (IS_VALID_NC_P(nc_att)) { status = get_att_value((NcAtt *)nc_att, att_val); - string data_type = GET_NC_TYPE_NAME_P(nc_att); + std::string data_type = GET_NC_TYPE_NAME_P(nc_att); if (error_out && !status) { mlog << Error << caller_name << "The data type \"" << data_type @@ -636,7 +636,7 @@ void copy_nc_data_(NcVar *var, double *data, const T *packed_data, template bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long offset2) { - vector offsets; + std::vector offsets; offsets.push_back((size_t)offset0); if (0 <= offset1) { offsets.push_back((size_t)offset1); @@ -652,7 +652,7 @@ bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long of template bool put_nc_data_T(NcVar *var, const T *data, const long length, const long offset) { - vector offsets, counts; + std::vector offsets, counts; int dim_count = get_dim_count(var); offsets.push_back(offset); if (dim_count >= 2) { @@ -669,7 +669,7 @@ bool put_nc_data_T(NcVar *var, const T *data, const long length, const long o template bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long *offsets) { int dim = get_dim_count(var); - vector nc_offsets, counts; + std::vector nc_offsets, counts; for (int idx = 0 ; idx < dim; idx++) { nc_offsets.push_back(offsets[idx]); } @@ -685,7 +685,7 @@ bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long * template bool put_nc_data_T_with_dims(NcVar *var, const T *data, const long len0, const long len1, const long len2) { - vector offsets, counts; + std::vector offsets, counts; if (0 < len0) { offsets.push_back(0); counts.push_back(len0); diff --git a/src/libcode/vx_nc_util/nc_var_info.h b/src/libcode/vx_nc_util/nc_var_info.h index 3a8e6b3681..d1a8b08e35 100644 --- a/src/libcode/vx_nc_util/nc_var_info.h +++ b/src/libcode/vx_nc_util/nc_var_info.h @@ -28,14 +28,14 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -static const string accum_time_att_name = "accum_time"; -static const string accum_time_sec_att_name = "accum_time_sec"; -static const string init_time_att_name = "init_time"; -static const string init_time_ut_att_name = "init_time_ut"; -static const string level_att_name = "level"; -static const string name_att_name = "name"; -static const string valid_time_att_name = "valid_time"; -static const string valid_time_ut_att_name = "valid_time_ut"; +static const std::string accum_time_att_name = "accum_time"; +static const std::string accum_time_sec_att_name = "accum_time_sec"; +static const std::string init_time_att_name = "init_time"; +static const std::string init_time_ut_att_name = "init_time_ut"; +static const std::string level_att_name = "level"; +static const std::string name_att_name = "name"; +static const std::string valid_time_att_name = "valid_time"; +static const std::string valid_time_ut_att_name = "valid_time_ut"; //////////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ class NcVarInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; NcVar * var; // not allocated @@ -109,7 +109,7 @@ extern unixtime get_att_value_unixtime(const NcAtt *); extern unixtime get_att_value_unixtime(const NcAtt *); -extern NcVarInfo* find_var_info_by_dim_name(NcVarInfo *vars, const string dim_name, +extern NcVarInfo* find_var_info_by_dim_name(NcVarInfo *vars, const std::string dim_name, const int nvars); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_summary/summary_calc.h b/src/libcode/vx_summary/summary_calc.h index ce40206295..6948e5e87e 100644 --- a/src/libcode/vx_summary/summary_calc.h +++ b/src/libcode/vx_summary/summary_calc.h @@ -31,7 +31,7 @@ class SummaryCalc SummaryCalc(); virtual ~SummaryCalc(); - virtual string getType() const = 0; + virtual std::string getType() const = 0; virtual double calcSummary(const NumArray &num_array) const = 0; }; diff --git a/src/libcode/vx_summary/summary_obs.h b/src/libcode/vx_summary/summary_obs.h index 284b67b388..3cba669b41 100644 --- a/src/libcode/vx_summary/summary_obs.h +++ b/src/libcode/vx_summary/summary_obs.h @@ -34,21 +34,21 @@ class SummaryObs bool summarizeObs(const TimeSummaryInfo &summary_info); bool addObservationObj(const Observation &obs); - bool addObservation(const string &header_type, const string &station_id, + bool addObservation(const std::string &header_type, const std::string &station_id, const time_t valid_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int var_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); - vector< Observation > getObservations(); - vector< Observation > getSummaries(); + const std::string &var_name = ""); + std::vector< Observation > getObservations(); + std::vector< Observation > getSummaries(); long countHeaders(); - long countHeaders(vector< Observation > *obs_vector); - long countHeaders(vector< Observation > &obs_vector); + long countHeaders(std::vector< Observation > *obs_vector); + long countHeaders(std::vector< Observation > &obs_vector); long countSummaryHeaders(); - time_t getValidTime(const string &time_string) const; + time_t getValidTime(const std::string &time_string) const; TimeSummaryInfo getSummaryInfo(); void setSummaryInfo(const TimeSummaryInfo &summary_info); StringArray getObsNames(); @@ -67,8 +67,8 @@ class SummaryObs TimeSummaryInfo summaryInfo; // List of observations read - vector< Observation > observations; - vector< Observation > summaries; + std::vector< Observation > observations; + std::vector< Observation > summaries; StringArray obs_names; /////////////////////// @@ -84,12 +84,12 @@ class SummaryObs // Use the configuration information to generate the list of summary // calculators needed. - vector< SummaryCalc* > getSummaryCalculators(const TimeSummaryInfo &info) const; + std::vector< SummaryCalc* > getSummaryCalculators(const TimeSummaryInfo &info) const; // Use the configuration file time summary information to figure out the // time intervals for our summaries - vector< TimeSummaryInterval > getTimeIntervals(const time_t first_data_time, + std::vector< TimeSummaryInterval > getTimeIntervals(const time_t first_data_time, const time_t last_data_time, const TimeSummaryInfo &info) const; @@ -104,8 +104,8 @@ class SummaryObs // Generate the summary header type string for the netCDF file - string getSummaryHeaderType(const string &header_type, - const string &summary_type, + std::string getSummaryHeaderType(const std::string &header_type, + const std::string &summary_type, const int summary_width_secs) const; public: @@ -123,7 +123,7 @@ class SummaryObs // Convert the number of seconds from the beginning of the day to a string - static string secsToTimeString(const int secs) + static std::string secsToTimeString(const int secs) { // Get the different fields from the number of seconds @@ -140,7 +140,7 @@ class SummaryObs snprintf(string_buffer, sizeof(string_buffer), "%02d%02d%02d", hour, minute, second); - return string(string_buffer); + return std::string(string_buffer); } // Get the first possible interval time after 0:00Z @@ -219,7 +219,7 @@ class SummaryObs return timegm(time_struct); } - static string _timeToString(const time_t unix_time) + static std::string _timeToString(const time_t unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -234,7 +234,7 @@ class SummaryObs return time_string; } - static time_t _stringToTime(const string &time_string) + static time_t _stringToTime(const std::string &time_string) { struct tm time_struct; memset(&time_struct, 0, sizeof(time_struct)); @@ -251,8 +251,8 @@ class SummaryObs }; -inline vector< Observation > SummaryObs::getObservations() { return observations; } -inline vector< Observation > SummaryObs::getSummaries() { return summaries; } +inline std::vector< Observation > SummaryObs::getObservations() { return observations; } +inline std::vector< Observation > SummaryObs::getSummaries() { return summaries; } inline StringArray SummaryObs::getObsNames() { return obs_names; } inline void SummaryObs::setSummaryInfo(const TimeSummaryInfo &summary_info) { summaryInfo = summary_info;}; inline TimeSummaryInfo SummaryObs::getSummaryInfo() { return summaryInfo;}; diff --git a/src/libcode/vx_tc_util/atcf_line_base.h b/src/libcode/vx_tc_util/atcf_line_base.h index 000b267d04..45b93e8529 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.h +++ b/src/libcode/vx_tc_util/atcf_line_base.h @@ -62,10 +62,10 @@ class ATCFLineBase : public DataLine { void assign(const ATCFLineBase &); - const map * BasinMap; // not allocated - const StringArray * BestTechnique; // not allocated - const StringArray * OperTechnique; // not allocated - const ConcatString * TechSuffix; // not allocated + const std::map * BasinMap; // not allocated + const StringArray * BestTechnique; // not allocated + const StringArray * OperTechnique; // not allocated + const ConcatString * TechSuffix; // not allocated ATCFLineType Type; ConcatString Basin; @@ -81,7 +81,7 @@ class ATCFLineBase : public DataLine { ATCFLineBase & operator= (const ATCFLineBase &); bool operator==(const ATCFLineBase &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void clear(); @@ -93,7 +93,7 @@ class ATCFLineBase : public DataLine { // set values // - void set_basin_map (const map *); + void set_basin_map (const std::map *); void set_best_technique(const StringArray *); void set_oper_technique(const StringArray *); void set_tech_suffix (const ConcatString *); @@ -130,7 +130,7 @@ class ATCFLineBase : public DataLine { //////////////////////////////////////////////////////////////////////// -inline void ATCFLineBase::set_basin_map (const map *m) +inline void ATCFLineBase::set_basin_map (const std::map *m) { BasinMap = m; } inline void ATCFLineBase::set_best_technique(const StringArray *s) { BestTechnique = s; } inline void ATCFLineBase::set_oper_technique(const StringArray *s) { OperTechnique = s; } diff --git a/src/libcode/vx_tc_util/atcf_prob_line.h b/src/libcode/vx_tc_util/atcf_prob_line.h index 9dcb426b5b..40f869ef4d 100644 --- a/src/libcode/vx_tc_util/atcf_prob_line.h +++ b/src/libcode/vx_tc_util/atcf_prob_line.h @@ -45,7 +45,7 @@ class ATCFProbLine : public ATCFLineBase { ATCFProbLine(const ATCFProbLine &); ATCFProbLine & operator= (const ATCFProbLine &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void clear(); diff --git a/src/libcode/vx_tc_util/atcf_track_line.h b/src/libcode/vx_tc_util/atcf_track_line.h index 1e93f4e6c6..8f46f73b3c 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.h +++ b/src/libcode/vx_tc_util/atcf_track_line.h @@ -146,7 +146,7 @@ class ATCFTrackLine : public ATCFLineBase { ATCFTrackLine(const ATCFTrackLine &); ATCFTrackLine & operator= (const ATCFTrackLine &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); diff --git a/src/libcode/vx_tc_util/gen_shape_info.h b/src/libcode/vx_tc_util/gen_shape_info.h index 98a49e1973..f783e22019 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.h +++ b/src/libcode/vx_tc_util/gen_shape_info.h @@ -110,7 +110,7 @@ class GenShapeInfoArray { void init_from_scratch(); void assign(const GenShapeInfoArray &); - vector GenShape; + std::vector GenShape; public: diff --git a/src/libcode/vx_tc_util/genesis_info.h b/src/libcode/vx_tc_util/genesis_info.h index 36e36b0d18..1a22a9ec1a 100644 --- a/src/libcode/vx_tc_util/genesis_info.h +++ b/src/libcode/vx_tc_util/genesis_info.h @@ -31,7 +31,7 @@ struct GenesisEventInfo { ConcatString Technique; - vector Category; + std::vector Category; SingleThresh VMaxThresh; SingleThresh MSLPThresh; @@ -72,7 +72,7 @@ class GenesisInfo : public TrackInfo { bool is_storm(const GenesisInfo &) const; void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -130,7 +130,7 @@ class GenesisInfoArray { void init_from_scratch(); void assign(const GenesisInfoArray &); - vector Genesis; + std::vector Genesis; public: @@ -140,7 +140,7 @@ class GenesisInfoArray { GenesisInfoArray & operator=(const GenesisInfoArray &); void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/pair_data_genesis.h b/src/libcode/vx_tc_util/pair_data_genesis.h index 1725273751..2d0e0e1d1b 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.h +++ b/src/libcode/vx_tc_util/pair_data_genesis.h @@ -81,13 +81,13 @@ class PairDataGenesis { TimeArray InitTime; IntArray LeadTime; - vector FcstGen; - vector BestGen; - vector GenDiff; + std::vector FcstGen; + std::vector BestGen; + std::vector GenDiff; ////////////////////////////////////////////////////////////////// - bool has_gen (const vector&, + bool has_gen (const std::vector&, const GenesisInfo *, int &) const; bool has_case(const ConcatString &, const unixtime, int &) const; diff --git a/src/libcode/vx_tc_util/prob_gen_info.h b/src/libcode/vx_tc_util/prob_gen_info.h index 0fa15defc8..af86991a91 100644 --- a/src/libcode/vx_tc_util/prob_gen_info.h +++ b/src/libcode/vx_tc_util/prob_gen_info.h @@ -48,7 +48,7 @@ class ProbGenInfo : public ProbInfoBase { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_info_array.h b/src/libcode/vx_tc_util/prob_info_array.h index e0ea6230e9..cd2e8125f7 100644 --- a/src/libcode/vx_tc_util/prob_info_array.h +++ b/src/libcode/vx_tc_util/prob_info_array.h @@ -36,8 +36,8 @@ class ProbInfoArray { void init_from_scratch(); void assign(const ProbInfoArray &); - vector ProbRIRW; - vector ProbGen; + std::vector ProbRIRW; + std::vector ProbGen; public: @@ -48,7 +48,7 @@ class ProbInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_info_base.h b/src/libcode/vx_tc_util/prob_info_base.h index 015563e9e5..4622ad922a 100644 --- a/src/libcode/vx_tc_util/prob_info_base.h +++ b/src/libcode/vx_tc_util/prob_info_base.h @@ -69,7 +69,7 @@ class ProbInfoBase { void clear(); - virtual void dump(ostream &, int = 0) const; + virtual void dump(std::ostream &, int = 0) const; virtual ConcatString serialize() const; virtual ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_rirw_info.h b/src/libcode/vx_tc_util/prob_rirw_info.h index b1034eb00a..ba18fd5b9f 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_info.h @@ -47,7 +47,7 @@ class ProbRIRWInfo : public ProbInfoBase { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.h b/src/libcode/vx_tc_util/prob_rirw_pair_info.h index 977c07c67c..b76a14a756 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.h @@ -69,7 +69,7 @@ class ProbRIRWPairInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString case_info() const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -146,7 +146,7 @@ class ProbRIRWPairInfoArray { void init_from_scratch(); void assign(const ProbRIRWPairInfoArray &); - vector Pairs; + std::vector Pairs; public: @@ -157,7 +157,7 @@ class ProbRIRWPairInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/tc_columns.h b/src/libcode/vx_tc_util/tc_columns.h index 5241d92997..b67eeda002 100644 --- a/src/libcode/vx_tc_util/tc_columns.h +++ b/src/libcode/vx_tc_util/tc_columns.h @@ -136,8 +136,8 @@ inline int get_n_prob_rirw_cols (int n) { return(n_prob_rirw_cols + (2*n)); } // //////////////////////////////////////////////////////////////////////// -extern void open_tc_txt_file (ofstream *&, const char *); -extern void close_tc_txt_file(ofstream *&, const char *); +extern void open_tc_txt_file (std::ofstream *&, const char *); +extern void close_tc_txt_file(std::ofstream *&, const char *); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_info.h b/src/libcode/vx_tc_util/track_info.h index 73b3317bf6..3159063ce2 100644 --- a/src/libcode/vx_tc_util/track_info.h +++ b/src/libcode/vx_tc_util/track_info.h @@ -86,7 +86,7 @@ class TrackInfo { void clear(); void clear_points(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -206,7 +206,7 @@ class TrackInfoArray { void init_from_scratch(); void assign(const TrackInfoArray &); - vector Track; + std::vector Track; public: @@ -217,7 +217,7 @@ class TrackInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/track_pair_info.h b/src/libcode/vx_tc_util/track_pair_info.h index 6afa9b6437..b4e92739ab 100644 --- a/src/libcode/vx_tc_util/track_pair_info.h +++ b/src/libcode/vx_tc_util/track_pair_info.h @@ -87,7 +87,7 @@ class TrackPairInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString case_info() const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -193,7 +193,7 @@ class TrackPairInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/track_point.h b/src/libcode/vx_tc_util/track_point.h index 93908858af..cc861f547d 100644 --- a/src/libcode/vx_tc_util/track_point.h +++ b/src/libcode/vx_tc_util/track_point.h @@ -53,7 +53,7 @@ class QuadInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -177,7 +177,7 @@ class TrackPoint { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.cc b/src/libcode/vx_tc_util/vx_tc_nc_util.cc index fb72b127d5..63acb0b278 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.cc +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.cc @@ -51,8 +51,8 @@ void write_tc_tracks(NcFile* nc_out, track_mrd_data[i] = track[i].mrd(); } - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; mlog << Debug(2) << "Writing " << track_lines.n() << " track lines.\n"; @@ -61,7 +61,7 @@ void write_tc_tracks(NcFile* nc_out, offsets.push_back(i); counts.clear(); counts.push_back(1); - string line = track_lines[i]; + std::string line = track_lines[i]; mlog << Debug(3) << line << "\n"; const char* str = line.c_str(); track_lines_var.putVar(offsets, counts, &str); @@ -84,16 +84,16 @@ void write_tc_tracks(NcFile* nc_out, //////////////////////////////////////////////////////////////////////// -set get_pressure_level_strings( - map > variable_levels) { +std::set get_pressure_level_strings( + std::map > variable_levels) { - set pressure_level_strings; + std::set pressure_level_strings; - for (map >::iterator i = variable_levels.begin(); + for (std::map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { - vector levels = variable_levels[i->first]; + std::vector levels = variable_levels[i->first]; for (int j = 0; j < levels.size(); j++) { - string label = levels[j].substr(0, 1); + std::string label = levels[j].substr(0, 1); if (label == "P") { pressure_level_strings.insert(levels[j]); } @@ -105,16 +105,16 @@ set get_pressure_level_strings( //////////////////////////////////////////////////////////////////////// -set get_pressure_levels( - map > variable_levels) { +std::set get_pressure_levels( + std::map > variable_levels) { - set pressure_levels; + std::set pressure_levels; - for (map >::iterator i = variable_levels.begin(); + for (std::map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { - vector levels = variable_levels[i->first]; + std::vector levels = variable_levels[i->first]; for (int j = 0; j < levels.size(); j++) { - string label = levels[j].substr(0, 1); + std::string label = levels[j].substr(0, 1); double level = atof(levels[j].substr(1).c_str()); if (label == "P") { pressure_levels.insert(level); @@ -127,15 +127,15 @@ set get_pressure_levels( //////////////////////////////////////////////////////////////////////// -set get_pressure_levels( - set pressure_level_strings) { +std::set get_pressure_levels( + std::set pressure_level_strings) { - set pressure_levels; + std::set pressure_levels; - for (set::iterator i = pressure_level_strings.begin(); + for (std::set::iterator i = pressure_level_strings.begin(); i != pressure_level_strings.end(); ++i) { - string level_str = *i; + std::string level_str = *i; double level = atof(level_str.substr(1).c_str()); pressure_levels.insert(level); } @@ -145,14 +145,14 @@ set get_pressure_levels( //////////////////////////////////////////////////////////////////////// -map get_pressure_level_indices( - set pressure_levels) { +std::map get_pressure_level_indices( + std::set pressure_levels) { - map pressure_level_indices; + std::map pressure_level_indices; int k = pressure_levels.size() - 1; - for (set::iterator i = pressure_levels.begin(); + for (std::set::iterator i = pressure_levels.begin(); i != pressure_levels.end(); ++i) { double level = *i; @@ -165,18 +165,18 @@ map get_pressure_level_indices( //////////////////////////////////////////////////////////////////////// -map get_pressure_level_indices( - set pressure_level_strings, set pressure_levels) { +std::map get_pressure_level_indices( + std::set pressure_level_strings, std::set pressure_levels) { - map pressure_level_indices; + std::map pressure_level_indices; - map indices_from_levels - = get_pressure_level_indices(pressure_levels); + std::map indices_from_levels + = get_pressure_level_indices(pressure_levels); - for (set::iterator i = pressure_level_strings.begin(); + for (std::set::iterator i = pressure_level_strings.begin(); i != pressure_level_strings.end(); ++i) { - string level_str = *i; + std::string level_str = *i; double level = atof(level_str.substr(1).c_str()); pressure_level_indices[level_str] = indices_from_levels[level]; } @@ -187,7 +187,7 @@ map get_pressure_level_indices( //////////////////////////////////////////////////////////////////////// void def_tc_pressure(NcFile* nc_out, - const NcDim& pressure_dim, set pressure_levels) { + const NcDim& pressure_dim, std::set pressure_levels) { NcVar pressure_var; @@ -204,7 +204,7 @@ void def_tc_pressure(NcFile* nc_out, // Extract pressure coordinates int k = pressure_levels.size() - 1; - for (set::iterator i = pressure_levels.begin(); + for (std::set::iterator i = pressure_levels.begin(); i != pressure_levels.end(); ++i) { pressure_data[k] = *i; k--; @@ -271,7 +271,7 @@ void def_tc_lat_lon_time(NcFile* nc_out, const NcDim& track_point_dim, NcVar& lat_var, NcVar& lon_var, NcVar& valid_time_var) { - vector dims; + std::vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); @@ -301,8 +301,8 @@ void write_tc_valid_time(NcFile* nc_out, const int& i_point, const NcVar& var, const long& valid_time) { - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; offsets.clear(); offsets.push_back(i_point); @@ -316,32 +316,32 @@ void write_tc_valid_time(NcFile* nc_out, //////////////////////////////////////////////////////////////////////// void def_tc_variables(NcFile* nc_out, - map > variable_levels, - map variable_long_names, - map variable_units, + std::map > variable_levels, + std::map variable_long_names, + std::map variable_units, const NcDim& range_dim, const NcDim& azimuth_dim, const NcDim& pressure_dim, const NcDim& track_point_dim, - map& data_vars) { + std::map& data_vars) { - vector dims; + std::vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); - vector dims_3d; + std::vector dims_3d; dims_3d.push_back(range_dim); dims_3d.push_back(azimuth_dim); dims_3d.push_back(pressure_dim); dims_3d.push_back(track_point_dim); - for (map >::iterator i = variable_levels.begin(); + for (std::map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { NcVar data_var; - string var_name = i->first; - vector levels = variable_levels[i->first]; - string long_name = variable_long_names[i->first]; - string units = variable_units[i->first]; + std::string var_name = i->first; + std::vector levels = variable_levels[i->first]; + std::string long_name = variable_long_names[i->first]; + std::string units = variable_units[i->first]; if (levels.size() > 1) { data_var = nc_out->addVar( @@ -367,7 +367,7 @@ void def_tc_data(NcFile* nc_out, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - vector dims; + std::vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); @@ -392,7 +392,7 @@ void def_tc_data_3d(NcFile* nc_out, const NcDim& pressure_dim, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - vector dims; + std::vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(pressure_dim); @@ -414,7 +414,7 @@ void def_tc_azi_mean_data(NcFile* nc_out, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - vector dims; + std::vector dims; dims.push_back(range_dim); dims.push_back(track_point_dim); @@ -436,8 +436,8 @@ void def_tc_azi_mean_data(NcFile* nc_out, void write_tc_data(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; offsets.clear(); offsets.push_back(0); @@ -457,8 +457,8 @@ void write_tc_data(NcFile* nc_out, const TcrmwGrid& grid, void write_tc_data_rev(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; double* data_rev; @@ -493,8 +493,8 @@ void write_tc_data_rev(NcFile* nc_out, const TcrmwGrid& grid, void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; double* data_rev; double* data_azi_mean; @@ -535,14 +535,14 @@ void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, extern void write_tc_pressure_level_data( NcFile* nc_out, const TcrmwGrid& grid, - map pressure_level_indices, const string& level_str, + std::map pressure_level_indices, const std::string& level_str, const int& i_point, const NcVar& var, const double* data) { - vector offsets; - vector counts; + std::vector offsets; + std::vector counts; - vector offsets_3d; - vector counts_3d; + std::vector offsets_3d; + std::vector counts_3d; double* data_rev; @@ -581,7 +581,7 @@ extern void write_tc_pressure_level_data( } } - // string label = level_str.substr(0, 1); + // std::string label = level_str.substr(0, 1); // if (label == "P") { // var.putVar(offsets_3d, counts_3d, data_rev); // } else { diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.h b/src/libcode/vx_tc_util/vx_tc_nc_util.h index 8f4bae8387..679742ba00 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.h +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.h @@ -27,23 +27,23 @@ using namespace netCDF; extern void write_tc_tracks(NcFile*, const NcDim&, const TrackInfoArray&); -extern set get_pressure_level_strings( - map >); +extern std::set get_pressure_level_strings( + std::map >); -extern set get_pressure_levels( - map >); +extern std::set get_pressure_levels( + std::map >); -extern set get_pressure_levels( - set); +extern std::set get_pressure_levels( + std::set); -extern map get_pressure_level_indices( - set); +extern std::map get_pressure_level_indices( + std::set); -extern map get_pressure_level_indices( - set, set); +extern std::map get_pressure_level_indices( + std::set, std::set); extern void def_tc_pressure(NcFile*, - const NcDim&, set); + const NcDim&, std::set); extern void def_tc_range_azimuth(NcFile*, const NcDim&, const NcDim&, const TcrmwGrid&, double); @@ -53,10 +53,10 @@ extern void def_tc_lat_lon_time(NcFile*, NcVar&, NcVar&, NcVar&); extern void def_tc_variables(NcFile*, - map >, - map, map, + std::map >, + std::map, std::map, const NcDim&, const NcDim&, const NcDim&, const NcDim&, - map&); + std::map&); extern void def_tc_data(NcFile*, const NcDim&, const NcDim&, const NcDim&, @@ -83,7 +83,7 @@ extern void write_tc_azi_mean_data(NcFile*, const TcrmwGrid&, const int&, const NcVar&, const double*); extern void write_tc_pressure_level_data(NcFile*, const TcrmwGrid&, - map, const string&, + std::map, const std::string&, const int&, const NcVar&, const double*); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/met_nc_file.h b/src/tools/dev_utils/met_nc_file.h index 0b89cbdf40..adbc568a4f 100644 --- a/src/tools/dev_utils/met_nc_file.h +++ b/src/tools/dev_utils/met_nc_file.h @@ -36,14 +36,14 @@ class MetNcFile public: - MetNcFile(const string &file_path); + MetNcFile(const std::string &file_path); virtual ~MetNcFile(); bool readFile(const int desired_grib_code, - const string &desired_station_id, - const string &desired_message_type, - vector< SDObservation > &observations); + const std::string &desired_station_id, + const std::string &desired_message_type, + std::vector< SDObservation > &observations); protected: @@ -52,7 +52,7 @@ class MetNcFile // Protected members // /////////////////////// - string _filePath; + std::string _filePath; NcFile *_ncFile; diff --git a/src/tools/dev_utils/swinging_door.cc b/src/tools/dev_utils/swinging_door.cc index c38032dc30..6aaa9c6d5b 100644 --- a/src/tools/dev_utils/swinging_door.cc +++ b/src/tools/dev_utils/swinging_door.cc @@ -18,7 +18,9 @@ // ---- ---- ---- ----------- // 000 08-19-14 Rehak New // 001 04-27-154 Halley Gotway List and format output files -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09-12-22 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -52,22 +54,22 @@ static const char *program_name = "swinging_door"; //////////////////////////////////////////////////////////////////////// // Variables for command line arguments -static string ncfile_arg; +static std::string ncfile_arg; static double error_arg; static int grib_code_arg; -static string message_type_arg; -static string station_id_arg; +static std::string message_type_arg; +static std::string station_id_arg; //////////////////////////////////////////////////////////////////////// static bool process_file(); -static bool run_algorithm(const vector< SDObservation > &obs, - vector< SDObservation > &compressed_obs); +static bool run_algorithm(const std::vector< SDObservation > &obs, + std::vector< SDObservation > &compressed_obs); static void usage(); -static bool write_observations(const vector< SDObservation > &observations, - const string &file_path); -static bool write_ramps(const vector< SDObservation > &observations, - const string &file_path); +static bool write_observations(const std::vector< SDObservation > &observations, + const std::string &file_path); +static bool write_ramps(const std::vector< SDObservation > &observations, + const std::string &file_path); //////////////////////////////////////////////////////////////////////// @@ -114,7 +116,7 @@ int met_main(int argc, char *argv[]) //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return program_name; } @@ -126,7 +128,7 @@ bool process_file() MetNcFile nc_file(ncfile_arg); - vector< SDObservation > observations; + std::vector< SDObservation > observations; if (!nc_file.readFile(grib_code_arg, station_id_arg, message_type_arg, observations)) @@ -139,7 +141,7 @@ bool process_file() // Run the algorithm - vector< SDObservation > compressed_observations; + std::vector< SDObservation > compressed_observations; if (!run_algorithm(observations, compressed_observations)) return false; @@ -161,19 +163,19 @@ bool process_file() //////////////////////////////////////////////////////////////////////// -bool run_algorithm(const vector< SDObservation > &observations, - vector< SDObservation > &compressed_observations) +bool run_algorithm(const std::vector< SDObservation > &observations, + std::vector< SDObservation > &compressed_observations) { // Run the algorithm - vector< pair< SDObservation, SDObservation > > ramps; + std::vector< std::pair< SDObservation, SDObservation > > ramps; if (!compute_swinging_door_ramps(observations, error_arg, ramps)) return false; // Create the compressed observations from the ramps - vector< pair< SDObservation, SDObservation > >::const_iterator ramp; + std::vector< std::pair< SDObservation, SDObservation > >::const_iterator ramp; for (ramp = ramps.begin(); ramp != ramps.end(); ++ramp) { compressed_observations.push_back(ramp->first); @@ -187,40 +189,40 @@ bool run_algorithm(const vector< SDObservation > &observations, void usage() { - cout << "\nUsage: " - << program_name << "\n" - << "\tnetcdf_file\n" - << "\terror_value\n" - << "\tgrib_code\n" - << "\tmessage_type\n" - << "\tstation_id\n\n" + std::cout << "\nUsage: " + << program_name << "\n" + << "\tnetcdf_file\n" + << "\terror_value\n" + << "\tgrib_code\n" + << "\tmessage_type\n" + << "\tstation_id\n\n" - << "\twhere\t\"netcdf_file\" is the NetCDF file containing " - << "the raw observations (required).\n" + << "\twhere\t\"netcdf_file\" is the NetCDF file containing " + << "the raw observations (required).\n" - << "\t\t\"error_value\" is the error value (E) to use when " - << "computing the corridors (required).\n" + << "\t\t\"error_value\" is the error value (E) to use when " + << "computing the corridors (required).\n" - << "\t\t\"grib_code\" is the grib code of the field to use " - << "(required).\n" + << "\t\t\"grib_code\" is the grib code of the field to use " + << "(required).\n" - << "\t\t\"message_type\" is the message type of the observations " - << "to use (required).\n" + << "\t\t\"message_type\" is the message type of the observations " + << "to use (required).\n" - << "\t\t\"station_id\" is the station identifier of the " - << "observations to use (required).\n" + << "\t\t\"station_id\" is the station identifier of the " + << "observations to use (required).\n" - << flush; + << std::flush; exit(1); } //////////////////////////////////////////////////////////////////////// -bool write_observations(const vector< SDObservation > &observations, - const string &file_path) +bool write_observations(const std::vector< SDObservation > &observations, + const std::string &file_path) { - static const string method_name = "write_observations()"; + static const std::string method_name = "write_observations()"; mlog << Debug(2) << "Writing: " << file_path << "\n"; @@ -242,7 +244,7 @@ bool write_observations(const vector< SDObservation > &observations, // Write the observations - vector< SDObservation >::const_iterator obs; + std::vector< SDObservation >::const_iterator obs; for (obs = observations.begin(); obs != observations.end(); ++obs) fprintf(output_file, "%s,%d,%f\n", unix_to_yyyymmdd_hhmmss(obs->getValidTime()).text(), @@ -257,10 +259,10 @@ bool write_observations(const vector< SDObservation > &observations, //////////////////////////////////////////////////////////////////////// -bool write_ramps(const vector< SDObservation > &observations, - const string &file_path) +bool write_ramps(const std::vector< SDObservation > &observations, + const std::string &file_path) { - static const string method_name = "write_ramps()"; + static const std::string method_name = "write_ramps()"; mlog << Debug(2) << "Writing: " << file_path << "\n"; diff --git a/src/tools/other/modis_regrid/cloudsat_swath_file.h b/src/tools/other/modis_regrid/cloudsat_swath_file.h index 2cd797b84a..11f63f33c4 100644 --- a/src/tools/other/modis_regrid/cloudsat_swath_file.h +++ b/src/tools/other/modis_regrid/cloudsat_swath_file.h @@ -52,7 +52,7 @@ class SatDimension { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -125,7 +125,7 @@ class SatAttribute { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -213,7 +213,7 @@ class SwathDataField { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -307,7 +307,7 @@ class CloudsatSwath { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -417,7 +417,7 @@ class CloudsatSwathFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 0157de39fd..ab40c544e3 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -50,7 +50,7 @@ static ConcatString modis_filename; static ConcatString modis_field; -static ConcatString units = (string)default_units; +static ConcatString units = (std::string)default_units; static double data_fill_value = -9999.0; @@ -158,7 +158,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "modis_regrid"; } @@ -229,29 +229,29 @@ ConcatString tab; tab.set_repeat(' ', 13); -cout << "\n" - << "Usage: " << program_name << '\n' - << tab << "-data_file path\n" - << tab << "-field name\n" - << tab << "-out path\n" - << tab << "-scale value\n" - << tab << "-offset value\n" - << tab << "-fill value\n" - << tab << "[-units text]\n" - << tab << "[-compress level]\n" - << tab << "modis_file\n\n" - - << " where \"-data_file path\" specifies the data files used to get the grid information.\n" - << " \"-field name\" specifies the name of the field to use in the modis data file.\n" - << " \"-out path\" specifies the name of the output netcdf file.\n" - << " \"-scale value\" specifies the scale factor to be used on the raw modis values.\n" - << " \"-offset value\" specifies the offset value to be used on the raw modis values.\n" - << " \"-fill value\" specifies the bad data value in the modis data.\n" - << " \"-units text\" specifies the units string in the global attributes section of the output file (optional).\n" - << " \"-compress level\" specifies the compression level of output NetCDF variable (optional).\n" - << " \"modis_file\" is the name of the modis input file.\n" - - << "\n"; +std::cout << "\n" + << "Usage: " << program_name << '\n' + << tab << "-data_file path\n" + << tab << "-field name\n" + << tab << "-out path\n" + << tab << "-scale value\n" + << tab << "-offset value\n" + << tab << "-fill value\n" + << tab << "[-units text]\n" + << tab << "[-compress level]\n" + << tab << "modis_file\n\n" + + << " where \"-data_file path\" specifies the data files used to get the grid information.\n" + << " \"-field name\" specifies the name of the field to use in the modis data file.\n" + << " \"-out path\" specifies the name of the output netcdf file.\n" + << " \"-scale value\" specifies the scale factor to be used on the raw modis values.\n" + << " \"-offset value\" specifies the offset value to be used on the raw modis values.\n" + << " \"-fill value\" specifies the bad data value in the modis data.\n" + << " \"-units text\" specifies the units string in the global attributes section of the output file (optional).\n" + << " \"-compress level\" specifies the compression level of output NetCDF variable (optional).\n" + << " \"modis_file\" is the name of the modis input file.\n" + + << "\n"; exit ( 1 ); diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 985b027b10..b2656f38e4 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -54,6 +54,8 @@ // 015 02/10/18 Halley Gotway Add message_type_group_map. // 016 07/23/18 Halley Gotway Support masks defined by gen_vx_mask. // 017 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 018 09/12/22 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -207,7 +209,7 @@ static int nmsg_percent = -1; // Dump contents of PrepBufr file to ASCII files static bool dump_flag = false; -static ConcatString dump_dir = (string)"."; +static ConcatString dump_dir = (std::string)"."; static bool do_all_vars = false; static bool override_vars = false; @@ -283,8 +285,8 @@ static ConcatString bufr_hdrs; // header name list to read header static StringArray bufr_hdr_name_arr; // available header name list static StringArray bufr_obs_name_arr; // available obs. name list static IntArray filtered_times; -static vector bufr_derive_cfgs; -static map variableTypeMap; +static std::vector bufr_derive_cfgs; +static std::map variableTypeMap; static bool do_summary; static SummaryObs *summary_obs; @@ -292,7 +294,7 @@ static SummaryObs *summary_obs; //////////////////////////////////////////////////////////////////////// static int n_total_obs; // Running total of observations -static vector< Observation > observations; +static std::vector< Observation > observations; // // Output NetCDF file, dimensions, and variables @@ -361,10 +363,10 @@ static bool keep_level_category(int); static float derive_grib_code(int, float *, float *, double, float&); -static int combine_tqz_and_uv(map, - map, map &); -static float compute_pbl(map pqtzuv_map_tq, - map pqtzuv_map_uv); +static int combine_tqz_and_uv(std::map, + std::map, std::map &); +static float compute_pbl(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv); static void copy_pqtzuv(float *to_pqtzuv, float *from_pqtzuv, bool copy_all=true); static bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_code, const float pbl_p, const float pbl_h, const float pbl_qm, @@ -374,17 +376,17 @@ static bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_co static int interpolate_by_pressure(int length, float *pres_data, float *var_data); static void interpolate_pqtzuv(float*, float*, float*); static bool is_valid_pb_data(float pb_value); -static void log_merged_tqz_uv(map pqtzuv_map_tq, - map pqtzuv_map_uv, - map &pqtzuv_map_merged, +static void log_merged_tqz_uv(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv, + std::map &pqtzuv_map_merged, const char *method_name); static void log_pbl_input(int pbl_level, const char *method_name); -static void log_tqz_and_uv(map pqtzuv_map_tq, - map pqtzuv_map_uv, +static void log_tqz_and_uv(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv, const char *method_name); -static void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, - map pqtzuv_map_aux, - map &pqtzuv_map_merged); +static void merge_records(float *first_pqtzuv, std::map pqtzuv_map_pivot, + std::map pqtzuv_map_aux, + std::map &pqtzuv_map_merged); static void usage(); static void set_pbfile(const StringArray &); @@ -456,7 +458,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return program_name; } @@ -621,7 +623,7 @@ ConcatString save_bufr_table_to_file(const char *blk_file, int file_id) { closepb_(&file_id); //close(file_id); // Delete the temporary blocked file - remove_temp_file((string)blk_file); + remove_temp_file((std::string)blk_file); return tbl_filename; } @@ -654,7 +656,7 @@ void get_variable_info(const char* tbl_filename) { ConcatString input_data; if (fp != NULL) { char var_name[BUFR_NAME_LEN+1]; - char var_desc[max(BUFR_DESCRIPTION_LEN,BUFR_SEQUENCE_LEN)+1]; + char var_desc[std::max(BUFR_DESCRIPTION_LEN,BUFR_SEQUENCE_LEN)+1]; char var_unit_str[BUFR_UNIT_LEN+1]; bool find_mnemonic = false; @@ -972,7 +974,7 @@ void process_pbfile(int i_pb) { } int grib_code, bufr_var_index; - map message_type_map = conf_info.getMessageTypeMap(); + std::map message_type_map = conf_info.getMessageTypeMap(); int bin_count = nint(npbmsg/20.0); int bufr_hdr_length = bufr_hdrs.length(); @@ -1011,9 +1013,9 @@ void process_pbfile(int i_pb) { unixtime prev_hdr_vld_ut = (unixtime) 0; char prev_hdr_typ[max_str_len], prev_hdr_sid[max_str_len]; double prev_hdr_lat, prev_hdr_lon, prev_hdr_elv; - map pqtzuv_map_tq; - map pqtzuv_map_uv; - vector pqtzuv_list; + std::map pqtzuv_map_tq; + std::map pqtzuv_map_uv; + std::vector pqtzuv_list; // Initialize prev_hdr_lat = prev_hdr_lon = prev_hdr_elv = bad_data_double; @@ -1052,12 +1054,12 @@ void process_pbfile(int i_pb) { if(mlog.verbosity_level() > 0) { if(bin_count > 0 && (i_read+1)%bin_count == 0) { - cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << flush; + std::cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << std::flush; showed_progress = true; if(mlog.verbosity_level() >= debug_level_for_performance) { end_t = clock(); - cout << (end_t-start_t)/double(CLOCKS_PER_SEC) - << " seconds\n"; + std::cout << (end_t-start_t)/double(CLOCKS_PER_SEC) + << " seconds\n"; start_t = clock(); } } @@ -1304,8 +1306,8 @@ void process_pbfile(int i_pb) { bool is_airnow = (0 == strcmp("AIRNOW", hdr_typ) || 0 == strcmp("ANOWPM", hdr_typ)); - if (0 < message_type_map.count((string)hdr_typ)) { - ConcatString mappedMessageType = message_type_map[(string)hdr_typ]; + if (0 < message_type_map.count((std::string)hdr_typ)) { + ConcatString mappedMessageType = message_type_map[(std::string)hdr_typ]; mlog << Debug(6) << "\n" << method_name << "Switching report type \"" << hdr_typ << "\" to message type \"" << mappedMessageType << "\".\n"; @@ -1524,7 +1526,7 @@ void process_pbfile(int i_pb) { // continue to the next observation variable if(!keep_bufr_obs_index(bufr_var_index)) continue; - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); @@ -1563,7 +1565,7 @@ void process_pbfile(int i_pb) { if(is_eq(obs_arr[4], fill_value)) continue; - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); @@ -1698,7 +1700,7 @@ void process_pbfile(int i_pb) { obs_arr[2] = cape_p; obs_arr[3] = cape_h; obs_arr[4] = cape_val; // observation value - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, cape_qm, OBS_BUFFER_SIZE); cape_count++; @@ -1732,7 +1734,7 @@ void process_pbfile(int i_pb) { obs_arr[2] = cape_p; obs_arr[3] = cape_h; obs_arr[4] = mlcape_val; // observation value - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, cape_qm, OBS_BUFFER_SIZE); mlcape_count++; @@ -1863,7 +1865,7 @@ void process_pbfile(int i_pb) { } } - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); // Increment the current and total observations counts @@ -1894,7 +1896,7 @@ void process_pbfile(int i_pb) { if (insert_pbl(obs_arr, pbl_value, pbl_code, pbl_p, pbl_h, pbl_qm, hdr_lat, hdr_lon, hdr_elv, hdr_vld_ut, hdr_typ, hdr_sid)) n_derived_obs++; - for(vector::iterator it = pqtzuv_list.begin(); + for(std::vector::iterator it = pqtzuv_list.begin(); it != pqtzuv_list.end(); ++it) { delete *it; } @@ -1934,7 +1936,7 @@ void process_pbfile(int i_pb) { if (insert_pbl(obs_arr, pbl_value, pbl_code, pbl_p, pbl_h, pbl_qm, hdr_lat, hdr_lon, hdr_elv, hdr_vld_ut, hdr_typ, hdr_sid)) n_derived_obs++; - for(vector::iterator it = pqtzuv_list.begin(); + for(std::vector::iterator it = pqtzuv_list.begin(); it != pqtzuv_list.end(); ++it) { delete *it; } @@ -1950,7 +1952,7 @@ void process_pbfile(int i_pb) { log_message << (end_t-start_t)/double(CLOCKS_PER_SEC) << " seconds"; //start_t = clock(); } - cout << log_message << "\n"; + std::cout << log_message << "\n"; } if(0 < diff_file_time_count && 0 < diff_file_times.n_elements()) { @@ -1968,7 +1970,7 @@ void process_pbfile(int i_pb) { } nc_point_obs.write_observation(); - if(mlog.verbosity_level() > 0) cout << "\n" << flush; + if(mlog.verbosity_level() > 0) std::cout << "\n" << std::flush; mlog << Debug(2) << "Total Messages processed\t\t= " << npbmsg << "\n" @@ -2048,9 +2050,9 @@ void process_pbfile(int i_pb) { remove_temp_file(blk_file); if(mlog.verbosity_level() >= debug_level_for_performance) { method_end = clock(); - cout << " PERF: " << method_name_s << " " - << (method_end-method_start)/double(CLOCKS_PER_SEC) - << " seconds\n"; + std::cout << " PERF: " << method_name_s << " " + << (method_end-method_start)/double(CLOCKS_PER_SEC) + << " seconds\n"; } if(i_msg <= 0) { @@ -2191,7 +2193,7 @@ void process_pbfile_metadata(int i_pb) { if(mlog.verbosity_level() > 0) { if(nint(npbmsg/20.0) > 0 && (i_read+1)%nint(npbmsg/20.0) == 0) { showed_progress = true; - cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << flush; + std::cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << std::flush; } } @@ -2353,7 +2355,7 @@ void process_pbfile_metadata(int i_pb) { } else { for (index=0; index variable \"" << bufr_var_name <<"\" does not exist at BUFR file\n\n"; @@ -2414,7 +2416,7 @@ void process_pbfile_metadata(int i_pb) { } } // end for vIdx } // end for - if(showed_progress && mlog.verbosity_level() > 0) cout << "\n"; + if(showed_progress && mlog.verbosity_level() > 0) std::cout << "\n"; int bufr_var_index = 0; bool has_prepbufr_vars = false; @@ -2465,7 +2467,7 @@ void write_netcdf_hdr_data() { long dim_count, pb_hdr_count; bool is_prepbufr = is_prepbufr_file(&event_names); TimeSummaryInfo summary_info = conf_info.getSummaryInfo(); - static const string method_name = "write_netcdf_hdr_data() "; + static const std::string method_name = "write_netcdf_hdr_data() "; pb_hdr_count = (long) nc_point_obs.get_hdr_index(); nc_point_obs.set_nc_out_data(observations, summary_obs, @@ -2499,7 +2501,7 @@ void write_netcdf_hdr_data() { StringArray nc_var_name_arr; StringArray nc_var_unit_arr; StringArray nc_var_desc_arr; - map obs_var_map = conf_info.getObsVarMap(); + std::map obs_var_map = conf_info.getObsVarMap(); for(int i=0; i= 0 && m_strlen("Variable index can't be negative")); - string var_name = bufr_obs_name_arr[var_index]; + std::string var_name = bufr_obs_name_arr[var_index]; Observation obs = Observation(hdr_typ.text(), hdr_sid.text(), hdr_vld, @@ -2914,8 +2916,8 @@ void copy_pqtzuv(float *to_pqtzuv, float *from_pqtzuv, bool copy_all) { //////////////////////////////////////////////////////////////////////// -int combine_tqz_and_uv(map pqtzuv_map_tq, - map pqtzuv_map_uv, map &pqtzuv_map_merged) { +int combine_tqz_and_uv(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv, std::map &pqtzuv_map_merged) { static const char *method_name = "combine_tqz_and_uv() "; int tq_count = pqtzuv_map_tq.size(); int uv_count = pqtzuv_map_uv.size(); @@ -3033,8 +3035,8 @@ int combine_tqz_and_uv(map pqtzuv_map_tq, //////////////////////////////////////////////////////////////////////// -float compute_pbl(map pqtzuv_map_tq, - map pqtzuv_map_uv) { +float compute_pbl(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv) { int jpbl; // - BOUNDARY-LAYER TOP (LEVEL NUMBER - INTEGER) int mzbl; // - TOP OF MODEL DOMAIN (LEVEL NUMBER - INTEGER) float hpbl; // M ATMOSPHERIC BOUNDARY-LAYER DEPTH @@ -3052,7 +3054,7 @@ float compute_pbl(map pqtzuv_map_tq, int hgt_cnt, spfh_cnt; IntArray selected_levels; - map pqtzuv_map_merged; + std::map pqtzuv_map_merged; pbl_level = combine_tqz_and_uv(pqtzuv_map_tq, pqtzuv_map_uv, pqtzuv_map_merged); mlog << Debug(7) << method_name << "pbl_level= " << pbl_level @@ -3202,7 +3204,7 @@ bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_code, << " (" << hdr_info<< ")\n"; } else { - addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, pbl_qm, OBS_BUFFER_SIZE); added = true; } @@ -3311,8 +3313,8 @@ static bool is_valid_pb_data(float pb_value) { //////////////////////////////////////////////////////////////////////// -void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, - map pqtzuv_map_aux, map &pqtzuv_map_merged) { +void merge_records(float *first_pqtzuv, std::map pqtzuv_map_pivot, + std::map pqtzuv_map_aux, std::map &pqtzuv_map_merged) { float cur_pres; float *cur_pqtzuv, *next_pqtzuv, *prev_pqtzuv; @@ -3384,8 +3386,8 @@ void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, //////////////////////////////////////////////////////////////////////// -void log_tqz_and_uv(map pqtzuv_map_tq, - map pqtzuv_map_uv, const char *method_name) { +void log_tqz_and_uv(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv, const char *method_name) { int offset; ConcatString buf; StringArray log_array; @@ -3423,9 +3425,9 @@ void log_tqz_and_uv(map pqtzuv_map_tq, //////////////////////////////////////////////////////////////////////// -void log_merged_tqz_uv(map pqtzuv_map_tq, - map pqtzuv_map_uv, - map &pqtzuv_map_merged, +void log_merged_tqz_uv(std::map pqtzuv_map_tq, + std::map pqtzuv_map_uv, + std::map &pqtzuv_map_merged, const char *method_name) { ConcatString buf; StringArray log_array; @@ -3485,68 +3487,68 @@ void log_pbl_input(int pbl_level, const char *method_name) { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tprepbufr_file\n" - << "\tnetcdf_file\n" - << "\tconfig_file\n" - << "\t[-pbfile prepbufr_file]\n" - << "\t[-valid_beg time]\n" - << "\t[-valid_end time]\n" - << "\t[-nmsg n]\n" - << "\t[-index]\n" - << "\t[-dump path]\n" - << "\t[-obs_var var]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" + << "Usage: " << program_name << "\n" + << "\tprepbufr_file\n" + << "\tnetcdf_file\n" + << "\tconfig_file\n" + << "\t[-pbfile prepbufr_file]\n" + << "\t[-valid_beg time]\n" + << "\t[-valid_end time]\n" + << "\t[-nmsg n]\n" + << "\t[-index]\n" + << "\t[-dump path]\n" + << "\t[-obs_var var]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"prepbufr_file\" is the input PrepBufr " - << "observation file to be converted to netCDF format " - << "(required).\n" + << "\twhere\t\"prepbufr_file\" is the input PrepBufr " + << "observation file to be converted to netCDF format " + << "(required).\n" - << "\t\t\"netcdf_file\" indicates the name of the output " - << "netCDF file to be written (required).\n" + << "\t\t\"netcdf_file\" indicates the name of the output " + << "netCDF file to be written (required).\n" - << "\t\t\"config_file\" is a PB2NCConfig file containing the " - << "desired configuration settings (required).\n" + << "\t\t\"config_file\" is a PB2NCConfig file containing the " + << "desired configuration settings (required).\n" - << "\t\t\"-pbfile prepbufr_file\" may be used to specify " - << "additional input PrepBufr observation files to be used " - << "(optional).\n" + << "\t\t\"-pbfile prepbufr_file\" may be used to specify " + << "additional input PrepBufr observation files to be used " + << "(optional).\n" - << "\t\t\"-valid_beg time\" in YYYYMMDD[_HH[MMSS]] sets the " - << "beginning of the retention time window (optional).\n" + << "\t\t\"-valid_beg time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "beginning of the retention time window (optional).\n" - << "\t\t\"-valid_end time\" in YYYYMMDD[_HH[MMSS]] sets the " - << "end of the retention time window (optional).\n" + << "\t\t\"-valid_end time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "end of the retention time window (optional).\n" - << "\t\t\"-nmsg n\" indicates the number of PrepBufr message " - << "to process (optional).\n" + << "\t\t\"-nmsg n\" indicates the number of PrepBufr message " + << "to process (optional).\n" - << "\t\t\"-dump path\" indicates that the entire contents of " - << "\"prepbufr_file\" should also be dumped to text files " - << "in the directory specified (optional).\n" + << "\t\t\"-dump path\" indicates that the entire contents of " + << "\"prepbufr_file\" should also be dumped to text files " + << "in the directory specified (optional).\n" - << "\t\t\"-obs_var var1,...\" or multiple \"-obs_var var\" sets the variable list to be saved" - << " from input BUFR files (optional, default: all).\n" + << "\t\t\"-obs_var var1,...\" or multiple \"-obs_var var\" sets the variable list to be saved" + << " from input BUFR files (optional, default: all).\n" - << "\t\t\"-index\" indicates that the meta data (available variables and headers)" - << " is extracted from \"prepbufr_file\" (optional). " - << "No NetCDF outputs. \"-obs_var\" is ignored.\n" + << "\t\t\"-index\" indicates that the meta data (available variables and headers)" + << " is extracted from \"prepbufr_file\" (optional). " + << "No NetCDF outputs. \"-obs_var\" is ignored.\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (" - << conf_info.conf.nc_compression() << ") (optional).\n\n" + << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (" + << conf_info.conf.nc_compression() << ") (optional).\n\n" - << flush; + << std::flush; exit (1); } diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 1affa85a9b..23dcb90b88 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -22,6 +22,8 @@ // 000 11-12-14 Halley Gotway New // 001 06-07-22 Halley Gotway MET #2173 Fix python embedding // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09-12-22 Prestopnik Added "std::"; removing namespace from +// header files // //////////////////////////////////////////////////////////////////////// @@ -103,7 +105,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "shift_data_plane"; } @@ -319,14 +321,14 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, int deflate_level = compress_level; if (deflate_level < 0) deflate_level = 0; - NcVar data_var = add_var(f_out, (string)cs, ncFloat, lat_dim, lon_dim, deflate_level); - add_att(&data_var, "name", (string)cs); - add_att(&data_var, "long_name", (string)vinfo->long_name_attr()); - add_att(&data_var, "level", (string)vinfo->level_attr()); - add_att(&data_var, "units", (string)vinfo->units_attr()); + NcVar data_var = add_var(f_out, (std::string)cs, ncFloat, lat_dim, lon_dim, deflate_level); + add_att(&data_var, "name", (std::string)cs); + add_att(&data_var, "long_name", (std::string)vinfo->long_name_attr()); + add_att(&data_var, "level", (std::string)vinfo->level_attr()); + add_att(&data_var, "units", (std::string)vinfo->units_attr()); add_att(&data_var, "_FillValue", bad_data_float); write_netcdf_var_times(&data_var, dp); - add_att(&data_var, "smoothing_method", (string)interpmthd_to_string(Method)); + add_att(&data_var, "smoothing_method", (std::string)interpmthd_to_string(Method)); add_att(&data_var, "smoothing_neighborhood", Width*Width); GridTemplateFactory gtf; @@ -367,57 +369,55 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tinput_filename\n" - << "\toutput_filename\n" - << "\tfield_string\n" - << "\t-from lat lon\n" - << "\t-to lat lon\n" - << "\t[-method type]\n" - << "\t[-width n]\n" - << "\t[-shape SHAPE]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" + << "Usage: " << program_name << "\n" + << "\tinput_filename\n" + << "\toutput_filename\n" + << "\tfield_string\n" + << "\t-from lat lon\n" + << "\t-to lat lon\n" + << "\t[-method type]\n" + << "\t[-width n]\n" + << "\t[-shape SHAPE]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"input_filename\" is the name of a " - << "gridded data file to be plotted (required).\n" + << "\twhere\t\"input_filename\" is the name of a " + << "gridded data file to be plotted (required).\n" - << "\t\t\"output_filename\" is the name of the output " - << "NetCDF file to be written (required).\n" + << "\t\t\"output_filename\" is the name of the output " + << "NetCDF file to be written (required).\n" - << "\t\t\"field_string\" defines the data to be shifted " - << "from the input file (required).\n" + << "\t\t\"field_string\" defines the data to be shifted " + << "from the input file (required).\n" - << "\t\t\"-from lat lon\" specifies the starting latitude " - << "(degrees north) and longitude (degrees east) to " - << "define the shift.\n" + << "\t\t\"-from lat lon\" specifies the starting latitude " + << "(degrees north) and longitude (degrees east) to " + << "define the shift.\n" - << "\t\t\"-to lat lon\" specifies the ending latitude " - << "(degrees north) and longitude (degrees east) to " - << "define the shift.\n" + << "\t\t\"-to lat lon\" specifies the ending latitude " + << "(degrees north) and longitude (degrees east) to " + << "define the shift.\n" - << "\t\t\"-method type\" overrides the default interpolation " - << "method (DW_MEAN) (optional).\n" + << "\t\t\"-method type\" overrides the default interpolation " + << "method (DW_MEAN) (optional).\n" - << "\t\t\"-width\" overrides the default interpolation width (2) " - << "(optional).\n" + << "\t\t\"-width\" overrides the default interpolation width (2) " + << "(optional).\n" - << "\t\t\"-shape\" overrides the default interpolation shape (SQUARE) " - << "(optional).\n" + << "\t\t\"-shape\" overrides the default interpolation shape (SQUARE) " + << "(optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" - - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" - - << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (optional).\n\n" << flush; + << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (optional).\n\n" << std::flush; exit(1); } From 1ec80e4c207714cbc64060a5f5ef0c12a30a951b Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 12 Sep 2022 15:57:11 -0600 Subject: [PATCH 03/26] Attempt to fix GHA errors with compilation after removal of 'using namespace std'; locally compiles fine --- src/tools/other/lidar2nc/lidar2nc.cc | 50 +++++++++++++++------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index 18adf15d73..e8d233ed61 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -18,6 +18,8 @@ // ---- ---- ---- ----------- // 000 03-22-17 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-12-22 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -152,7 +154,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "lidar2nc"; } @@ -160,29 +162,29 @@ const string get_tool_name() { void usage() { -cout << "\nUsage: " - << program_name << "\n" - << "\tlidar_file\n" - << "\t-out out_file\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" +std::cout << "\nUsage: " + << program_name << "\n" + << "\tlidar_file\n" + << "\t-out out_file\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"lidar_file\" is the HDF lidar point observation " - << "file (required).\n" + << "\twhere\t\"lidar_file\" is the HDF lidar point observation " + << "file (required).\n" - << "\t\t\"-out out_file\" is the output NetCDF file (required).\n" + << "\t\t\"-out out_file\" is the output NetCDF file (required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-compress level\" specifies the compression level of " - << "the output NetCDF variable (optional).\n\n" + << "\t\t\"-compress level\" specifies the compression level of " + << "the output NetCDF variable (optional).\n\n" - << flush; + << std::flush; exit (1); @@ -297,7 +299,7 @@ Calipso_5km_Vars hdf_5km; hdf_5km.get_vars(hdf_sd_id); -n_data = max (hdf_5km.lat.dimsizes[0], hdf_5km.lat.dimsizes[1]); +n_data = std::max (hdf_5km.lat.dimsizes[0], hdf_5km.lat.dimsizes[1]); const int nhdr_dim_size = n_data; @@ -311,8 +313,8 @@ const int hdr_arr_bytes = nhdr_dim_size*HDR_ARRAY_LEN*sizeof(float); int buf_size = hdr_typ_bytes; -buf_size = max(buf_size, hdr_vld_bytes); -buf_size = max(buf_size, hdr_arr_bytes); +buf_size = std::max(buf_size, hdr_vld_bytes); +buf_size = std::max(buf_size, hdr_arr_bytes); mlog << Debug(1) << method_name << "Writing MET File:\t" << output_filename << "\n"; @@ -359,9 +361,9 @@ memset(junk, 0, sizeof(junk)); if ( gethostname(junk, sizeof(junk) - 1) < 0 ) s << " on unknown host"; else s << " on host " << junk; -(void) out->putAtt(string("FileOrigins"), string( s.text() )); -(void) out->putAtt(string("MET_version"), string( met_version )); -(void) out->putAtt(string("MET_tool"), string(program_name.text())); +(void) out->putAtt(std::string("FileOrigins"), std::string( s.text() )); +(void) out->putAtt(std::string("MET_version"), std::string( met_version )); +(void) out->putAtt(std::string("MET_tool"), std::string(program_name.text())); // // allocate the buffer From 99c395aefef19838e456559d239215ee9ca432f0 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 13 Sep 2022 15:02:28 -0600 Subject: [PATCH 04/26] Per #2227, attempting to fix GHA compilation; Compiltion on seneca works fine --- src/tools/other/modis_regrid/modis_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/other/modis_regrid/modis_file.h b/src/tools/other/modis_regrid/modis_file.h index c50510d683..757641c9d7 100644 --- a/src/tools/other/modis_regrid/modis_file.h +++ b/src/tools/other/modis_regrid/modis_file.h @@ -91,7 +91,7 @@ class ModisFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff From 26bd8c56985a53e68322f027a7e818243615e593 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 13 Sep 2022 15:18:11 -0600 Subject: [PATCH 05/26] Per #2227, attempt to resolve GHA compilation issues; seneca compilation works fine --- src/tools/other/mode_graphics/cgraph_font.h | 4 +- .../other/mode_graphics/mode_nc_output_file.h | 2 +- .../other/mode_graphics/plot_mode_field.cc | 54 ++++++++++--------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/tools/other/mode_graphics/cgraph_font.h b/src/tools/other/mode_graphics/cgraph_font.h index 0c2ea2cff5..f8e4f8b493 100644 --- a/src/tools/other/mode_graphics/cgraph_font.h +++ b/src/tools/other/mode_graphics/cgraph_font.h @@ -50,7 +50,7 @@ class CgFont { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_by_number(int); // for builtin fonts @@ -109,7 +109,7 @@ class CgFontCollection { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int n_fonts() const; diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.h b/src/tools/other/mode_graphics/mode_nc_output_file.h index 5959dedd73..d883d74152 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.h +++ b/src/tools/other/mode_graphics/mode_nc_output_file.h @@ -115,7 +115,7 @@ class ModeNcOutputFile { void close(); - void dump(ostream &) const; + void dump(std::ostream &) const; ConcatString filename() const; ConcatString short_filename() const; diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 118fbe9b6d..43007a46b5 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -17,6 +17,8 @@ // ---- ---- ---- ----------- // 000 09-05-14 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-13-22 Prestopnik Adding "std::"; removing namespace from +// header files // //////////////////////////////////////////////////////////////////////// @@ -114,7 +116,7 @@ static bool do_anno = true; static bool do_data_rescale = false; static ConcatString ctable_filename; -static ConcatString output_directory = (string)"."; +static ConcatString output_directory = (std::string)"."; // // default plot info @@ -257,7 +259,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "plot_mode_field"; } @@ -281,7 +283,7 @@ if ( ! config.read(config_filename.c_str()) ) { } -if ( mlog.verbosity_level() >= 5 ) config.dump(cout); +if ( mlog.verbosity_level() >= 5 ) config.dump(std::cout); const DictionaryEntry * e = 0; const char * name = 0; @@ -442,7 +444,7 @@ if ( ! mode_in.open(mode_nc_filename) ) { } -if ( mlog.verbosity_level() >= 5 ) mode_in.dump(cout); +if ( mlog.verbosity_level() >= 5 ) mode_in.dump(std::cout); output_filename << output_directory << '/' << get_short_name(mode_nc_filename); @@ -599,31 +601,31 @@ void usage() { -cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" +std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tmode_nc_file_list\n" - << "\t-raw | -simple | -cluster\n" - << "\t-obs | -fcst\n" - << "\t-config file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\tmode_nc_file_list\n" + << "\t-raw | -simple | -cluster\n" + << "\t-obs | -fcst\n" + << "\t-config file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-raw | -simple | -cluster\" plots the raw, simple, " - << "or cluster object field (required).\n" + << "\twhere\t\"-raw | -simple | -cluster\" plots the raw, simple, " + << "or cluster object field (required).\n" - << "\t\t\"-obs | -fcst\" plots the forecast or observation field " - << "(required).\n" + << "\t\t\"-obs | -fcst\" plots the forecast or observation field " + << "(required).\n" - << "\t\t\"-config file\" is a PlotModeFieldConfig file specifying " - << "the desired plotting options (required).\n" + << "\t\t\"-config file\" is a PlotModeFieldConfig file specifying " + << "the desired plotting options (required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; exit (1); } @@ -960,7 +962,7 @@ void draw_mapfile(Cgraph & plot, const Box & map_box, const Grid & grid, Diction { -ifstream in; +std::ifstream in; MapRegion r; double map_linewidth; ConcatString s; @@ -976,9 +978,9 @@ map_linewidth = get_dict_double (dict, linewidth_name); map_color = get_dict_color (dict, linecolor_name); -in.open(map_filename.c_str()); +std::in.open(map_filename.c_str()); -if ( !in ) { +if ( !std::in ) { mlog << Error << "\n\n " << program_name << ": draw_mapfile() -> unable to open map data file \"" From 0fbb8b453d3eb8c99972e19633f5c62bfc99fc83 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 13 Sep 2022 15:37:23 -0600 Subject: [PATCH 06/26] Per #2227, attempt to resolve GHA compilation issues; seneca compilation works fine --- src/tools/other/mode_graphics/color_stack.h | 2 +- src/tools/other/mode_graphics/plot_mode_field.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/other/mode_graphics/color_stack.h b/src/tools/other/mode_graphics/color_stack.h index 9afd846a91..a583fc4efa 100644 --- a/src/tools/other/mode_graphics/color_stack.h +++ b/src/tools/other/mode_graphics/color_stack.h @@ -54,7 +54,7 @@ class ColorStack { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_alloc_inc(int = 0); // 0 means default value (10) diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 43007a46b5..88f495edf1 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -978,9 +978,9 @@ map_linewidth = get_dict_double (dict, linewidth_name); map_color = get_dict_color (dict, linecolor_name); -std::in.open(map_filename.c_str()); +in.open(map_filename.c_str()); -if ( !std::in ) { +if ( !in ) { mlog << Error << "\n\n " << program_name << ": draw_mapfile() -> unable to open map data file \"" From d20f4011ce15974a484d577cc9cca84efbad74f7 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 11:25:47 -0600 Subject: [PATCH 07/26] Per #2227, removing namespace from vx_series_data library --- .../vx_series_data/test_series_data.cc | 2 +- src/libcode/vx_grid/semilatlon_grid.h | 2 +- src/libcode/vx_series_data/series_pdf.cc | 24 +++++++++---------- src/libcode/vx_series_data/series_pdf.h | 15 ++++++------ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/internal/test_util/libcode/vx_series_data/test_series_data.cc b/internal/test_util/libcode/vx_series_data/test_series_data.cc index d9cd9f0cb3..4523a5dbeb 100644 --- a/internal/test_util/libcode/vx_series_data/test_series_data.cc +++ b/internal/test_util/libcode/vx_series_data/test_series_data.cc @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { double delta = (max - min) / nbin; double width = 10; - vector pdf; + std::vector pdf; init_pdf(nbin, pdf); diff --git a/src/libcode/vx_grid/semilatlon_grid.h b/src/libcode/vx_grid/semilatlon_grid.h index a6a07d6c66..9ca66cf9f8 100644 --- a/src/libcode/vx_grid/semilatlon_grid.h +++ b/src/libcode/vx_grid/semilatlon_grid.h @@ -77,7 +77,7 @@ class SemiLatLonGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index 446466ae22..5e6900f4ad 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -22,7 +22,7 @@ void init_pdf( int n, - vector& pdf) { + std::vector& pdf) { for(int k = 0; k < n; k++) { pdf.push_back(0); @@ -35,7 +35,7 @@ void init_pdf( double min, double max, double delta, - vector& pdf) { + std::vector& pdf) { int n = (max - min) / delta; for(int k = 0; k < n; k++) { @@ -48,7 +48,7 @@ void init_pdf( void init_joint_pdf( int n_A, int n_B, - vector& pdf) { + std::vector& pdf) { for(int k = 0; k < n_A * n_B; k++) { pdf.push_back(0); @@ -60,7 +60,7 @@ void init_joint_pdf( void update_pdf( double min, double delta, - vector& pdf, + std::vector& pdf, const DataPlane& dp, const MaskPlane& mp) { @@ -86,7 +86,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - vector& pdf, + std::vector& pdf, const DataPlane& dp_A, const DataPlane& dp_B, const MaskPlane& mp) { @@ -115,13 +115,13 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const vector& pdf) { + const std::vector& pdf) { for(int k = 0; k < pdf.size(); k++) { double bin_min = min + k * delta; double bin_max = min + (k + 1) * delta; - cout << "[" << bin_min << ", " << bin_max << "] " - << pdf[k] << "\n"; + std::cout << "[" << bin_min << ", " << bin_max << "] " + << pdf[k] << "\n"; } } @@ -132,11 +132,11 @@ void write_nc_pdf( const VarInfo& info, double min, double delta, - const vector& pdf) { + const std::vector& pdf) { - vector bin_min; - vector bin_max; - vector bin_mid; + std::vector bin_min; + std::vector bin_max; + std::vector bin_mid; for(int k = 0; k < pdf.size(); k++) { bin_min.push_back(min + delta * k); diff --git a/src/libcode/vx_series_data/series_pdf.h b/src/libcode/vx_series_data/series_pdf.h index 3d178ad7b1..ec0792bcec 100644 --- a/src/libcode/vx_series_data/series_pdf.h +++ b/src/libcode/vx_series_data/series_pdf.h @@ -15,7 +15,6 @@ #include #include -using namespace std; #include using namespace netCDF; @@ -30,7 +29,7 @@ using namespace netCDF; void init_pdf( int n, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// @@ -38,21 +37,21 @@ void init_pdf( double min, double max, double delta, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// void init_joint_pdf( int n_A, int n_B, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// void update_pdf( double min, double delta, - vector& pdf, + std::vector& pdf, const DataPlane&, const MaskPlane&); @@ -65,7 +64,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - vector& pdf, + std::vector& pdf, const DataPlane&, const DataPlane&, const MaskPlane&); @@ -75,7 +74,7 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const vector& pdf); + const std::vector& pdf); //////////////////////////////////////////////////////////////////////// @@ -84,7 +83,7 @@ void write_nc_pdf( const VarInfo& info, double min, double delta, - const vector& pdf); + const std::vector& pdf); //////////////////////////////////////////////////////////////////////// From 058b43fceb2d1c38443f548542c3662367f81361 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 11:39:59 -0600 Subject: [PATCH 08/26] Per #2227, removing namespace std from vx_shapedata library --- src/libcode/vx_shapedata/shape.h | 2 ++ src/libcode/vx_shapedata/shapedata.h | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcode/vx_shapedata/shape.h b/src/libcode/vx_shapedata/shape.h index 7e6813c350..f3b677ad3e 100644 --- a/src/libcode/vx_shapedata/shape.h +++ b/src/libcode/vx_shapedata/shape.h @@ -17,6 +17,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-03-06 Halley Gotway New +// 001 22-09-28 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/shapedata.h b/src/libcode/vx_shapedata/shapedata.h index f4bd1e0332..7598474ca0 100644 --- a/src/libcode/vx_shapedata/shapedata.h +++ b/src/libcode/vx_shapedata/shapedata.h @@ -16,6 +16,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-05-31 Halley Gotway Adapated from wrfdata.h. +// 001 22-09-28 Prestopnik Added "std::"; removing namspace +// from header files // /////////////////////////////////////////////////////////////////////////////// @@ -24,10 +26,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - -/////////////////////////////////////////////////////////////////////////////// - #include #include "moments.h" @@ -166,7 +164,7 @@ class ShapeData { void threshold(double t); void threshold(SingleThresh); - void threshold_attr(const map&, + void threshold_attr(const std::map&, const ShapeData *, const SingleThresh &, const Grid *, @@ -253,7 +251,7 @@ class Cell { /////////////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Cell &); +extern std::ostream & operator<<(std::ostream &, const Cell &); /////////////////////////////////////////////////////////////////////////////// From 760f6fffe0a82fab04d03552f34966791dfdcf44 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 12:20:10 -0600 Subject: [PATCH 09/26] Per #2227, removing namespace std from vx_data2d_grib2 and vx_data2d_grib libraries --- src/libcode/vx_data2d_grib/data2d_grib.h | 2 +- src/libcode/vx_data2d_grib/grib_classes.h | 18 +++-- src/libcode/vx_data2d_grib/grib_strings.h | 12 ++-- src/libcode/vx_data2d_grib/var_info_grib.h | 2 +- src/libcode/vx_data2d_grib2/var_info_grib2.h | 2 - src/libcode/vx_data2d_nc_met/data2d_nc_met.h | 2 +- src/libcode/vx_data2d_nc_met/met_file.h | 2 +- .../vx_data2d_nc_met/var_info_nc_met.h | 2 +- .../vx_data2d_nc_pinterp/data2d_nc_pinterp.h | 2 +- .../vx_data2d_nc_pinterp/pinterp_file.h | 2 +- .../var_info_nc_pinterp.h | 2 +- .../other/plot_data_plane/plot_data_plane.cc | 66 ++++++++++--------- src/tools/tc_utils/tc_dland/tc_dland.cc | 60 ++++++++--------- src/tools/tc_utils/tc_dland/tc_poly.h | 4 +- 14 files changed, 86 insertions(+), 92 deletions(-) diff --git a/src/libcode/vx_data2d_grib/data2d_grib.h b/src/libcode/vx_data2d_grib/data2d_grib.h index 6c72eaca1c..275d77b36e 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.h +++ b/src/libcode/vx_data2d_grib/data2d_grib.h @@ -78,7 +78,7 @@ class MetGrib1DataFile : public Met2dDataFile { void close(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool read_record(const int, const bool read_plane = true); diff --git a/src/libcode/vx_data2d_grib/grib_classes.h b/src/libcode/vx_data2d_grib/grib_classes.h index 3b0295cf45..eab0f7b3ac 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.h +++ b/src/libcode/vx_data2d_grib/grib_classes.h @@ -18,8 +18,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -366,9 +364,9 @@ class GribRecord { public: - vector data; // allocated + std::vector data; // allocated - vector bitmap; // allocated + std::vector bitmap; // allocated Section0_Header * is; // allocated unsigned char * pds; // allocated @@ -579,13 +577,13 @@ extern double char4_to_dbl(const unsigned char *); extern unsigned int char3_to_int(const unsigned char *); extern unsigned int char2_to_int(const unsigned char *); -extern ostream & operator<<(ostream &, const GribRecord &); +extern std::ostream & operator<<(std::ostream &, const GribRecord &); -extern ostream & operator<<(ostream &, const Section0_Header &); -extern ostream & operator<<(ostream &, const Section1_Header &); -extern ostream & operator<<(ostream &, const Section2_Header &); -extern ostream & operator<<(ostream &, const Section3_Header &); -extern ostream & operator<<(ostream &, const Section4_Header &); +extern std::ostream & operator<<(std::ostream &, const Section0_Header &); +extern std::ostream & operator<<(std::ostream &, const Section1_Header &); +extern std::ostream & operator<<(std::ostream &, const Section2_Header &); +extern std::ostream & operator<<(std::ostream &, const Section3_Header &); +extern std::ostream & operator<<(std::ostream &, const Section4_Header &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_strings.h b/src/libcode/vx_data2d_grib/grib_strings.h index 2fddd2dcef..665f80bd03 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.h +++ b/src/libcode/vx_data2d_grib/grib_strings.h @@ -13,20 +13,16 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - #include "vx_util.h" //////////////////////////////////////////////////////////////////////// -static const string missing_str = "MISSING"; +static const std::string missing_str = "MISSING"; static const char ugrd_abbr_str[] = "UGRD"; static const char vgrd_abbr_str[] = "VGRD"; -static const string ugrd_vgrd_abbr_str = "UGRD_VGRD"; -static const string wind_abbr_str = "WIND"; -static const string wdir_abbr_str = "WDIR"; +static const std::string ugrd_vgrd_abbr_str = "UGRD_VGRD"; +static const std::string wind_abbr_str = "WIND"; +static const std::string wdir_abbr_str = "WDIR"; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/var_info_grib.h b/src/libcode/vx_data2d_grib/var_info_grib.h index 9a0b9bf4ce..ef5acef9dc 100644 --- a/src/libcode/vx_data2d_grib/var_info_grib.h +++ b/src/libcode/vx_data2d_grib/var_info_grib.h @@ -68,7 +68,7 @@ class VarInfoGrib : public VarInfo VarInfoGrib(const VarInfoGrib &); VarInfoGrib & operator=(const VarInfoGrib &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_data2d_grib2/var_info_grib2.h b/src/libcode/vx_data2d_grib2/var_info_grib2.h index a6bf0fcd5e..8f5bb6a7c5 100644 --- a/src/libcode/vx_data2d_grib2/var_info_grib2.h +++ b/src/libcode/vx_data2d_grib2/var_info_grib2.h @@ -19,8 +19,6 @@ #include #include -using namespace std; - #include "vx_config.h" #include "vx_util.h" #include "var_info.h" diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h index eb72f67605..206cc48681 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h @@ -80,7 +80,7 @@ class MetNcMetDataFile : public Met2dDataFile { void close (); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; }; diff --git a/src/libcode/vx_data2d_nc_met/met_file.h b/src/libcode/vx_data2d_nc_met/met_file.h index d2321f97c7..ab33ee5b4c 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.h +++ b/src/libcode/vx_data2d_nc_met/met_file.h @@ -57,7 +57,7 @@ class MetNcFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; NcFile * Nc; // allocated diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.h b/src/libcode/vx_data2d_nc_met/var_info_nc_met.h index bc2e0d0673..fb39471352 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.h @@ -42,7 +42,7 @@ class VarInfoNcMet : public VarInfo VarInfoNcMet(const VarInfoNcMet &); VarInfoNcMet & operator=(const VarInfoNcMet &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h index d9538dfa09..a52a3d0e3e 100644 --- a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h +++ b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h @@ -80,7 +80,7 @@ class MetNcPinterpDataFile : public Met2dDataFile { void close (); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; }; diff --git a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h index 631b7b4a02..29c0a42077 100644 --- a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h +++ b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h @@ -53,7 +53,7 @@ class PinterpFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; NcFile * Nc; // allocated diff --git a/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h b/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h index bff8f90389..921d477b42 100644 --- a/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h +++ b/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h @@ -201,7 +201,7 @@ class VarInfoNcPinterp : public VarInfo VarInfoNcPinterp(const VarInfoNcPinterp &); VarInfoNcPinterp & operator=(const VarInfoNcPinterp &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/tools/other/plot_data_plane/plot_data_plane.cc b/src/tools/other/plot_data_plane/plot_data_plane.cc index b373c520f4..3129674659 100644 --- a/src/tools/other/plot_data_plane/plot_data_plane.cc +++ b/src/tools/other/plot_data_plane/plot_data_plane.cc @@ -25,7 +25,9 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 12/19/11 Holmes New -// 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09/28/22 Prestopnik Added "std::"; removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -60,7 +62,7 @@ //////////////////////////////////////////////////////////////////////// -static ConcatString program_name = (string)"plot_data_plane"; +static ConcatString program_name = (std::string)"plot_data_plane"; //////////////////////////////////////////////////////////////////////// @@ -214,7 +216,7 @@ int met_main(int argc, char * argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "plot_data_plane"; } @@ -277,44 +279,44 @@ void process_command_line(int argc, char **argv) { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tinput_filename\n" - << "\toutput_filename\n" - << "\tfield_string\n" - << "\t[-color_table color_table_name]\n" - << "\t[-plot_range min max]\n" - << "\t[-title title_string]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\tinput_filename\n" + << "\toutput_filename\n" + << "\tfield_string\n" + << "\t[-color_table color_table_name]\n" + << "\t[-plot_range min max]\n" + << "\t[-title title_string]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"input_filename\" is the name of a " - << "gridded data file to be plotted (required).\n" + << "\twhere\t\"input_filename\" is the name of a " + << "gridded data file to be plotted (required).\n" - << "\t\t\"output_filename\" is the name of the output " - << "PostScript file to be written (required).\n" + << "\t\t\"output_filename\" is the name of the output " + << "PostScript file to be written (required).\n" - << "\t\t\"field_string\" defines the data to be plotted " - << "from the input file (required).\n" + << "\t\t\"field_string\" defines the data to be plotted " + << "from the input file (required).\n" - << "\t\t\"-color_table color_table_name\" overrides the " - << "default color table " - << "(\"colortables/met_default.ctable\") " - << "(optional).\n" + << "\t\t\"-color_table color_table_name\" overrides the " + << "default color table " + << "(\"colortables/met_default.ctable\") " + << "(optional).\n" - << "\t\t\"-plot_range min max\" defines the range of the " - << "data to be plotted (optional).\n" + << "\t\t\"-plot_range min max\" defines the range of the " + << "data to be plotted (optional).\n" - << "\t\t\"-title title_string\" specifies the plot title " - << "string (optional).\n" + << "\t\t\"-title title_string\" specifies the plot title " + << "string (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; exit(1); diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index 2c043a9619..00eeb6adde 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -111,7 +111,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "tc_dland"; } @@ -235,7 +235,7 @@ void process_distances() { if (deflate_level < 0) deflate_level = 0; // Define Variables - dland_var = add_var(f_out, (string)"dland", ncFloat, lat_dim, lon_dim, deflate_level); + dland_var = add_var(f_out, (std::string)"dland", ncFloat, lat_dim, lon_dim, deflate_level); add_att(&dland_var, "long_name", "distance to land"); add_att(&dland_var, "units", "nm"); add_att(&dland_var, "_FillValue", bad_data_float); @@ -257,7 +257,7 @@ void process_distances() { for(y=0; y>(istream &, TCPoly &); + friend bool operator>>(std::istream &, TCPoly &); private: @@ -69,7 +69,7 @@ inline ConcatString TCPoly::name() const { return(Name); } //////////////////////////////////////////////////////////////////////// -extern bool operator>>(istream &, TCPoly &); +extern bool operator>>(std::istream &, TCPoly &); //////////////////////////////////////////////////////////////////////// From 5999051d0ddd25b414f070be8627aa3cf4e0953e Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 12:24:40 -0600 Subject: [PATCH 10/26] Per #2227, removing namespace std from vx_statistics library --- src/libcode/vx_statistics/pair_data_ensemble.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index ce4210c0a6..6159fbb9c7 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -24,7 +24,6 @@ #include "vx_data2d_grib.h" #include "vx_gsl_prob.h" -using namespace std; //////////////////////////////////////////////////////////////////////// From d133162007290fca16e4d42d8e51d5c4bff6bcf2 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 14:55:02 -0600 Subject: [PATCH 11/26] Per #2227, removing namespace std from src/tools/tc_utils --- src/libcode/vx_seeps/seeps.h | 4 +- src/libcode/vx_statistics/contable.h | 4 +- src/libcode/vx_statistics/pair_base.h | 22 ++--- .../tc_utils/rmw_analysis/rmw_analysis.cc | 78 +++++++-------- .../tc_utils/rmw_analysis/rmw_analysis.h | 54 +++++------ .../rmw_analysis/rmw_analysis_conf_info.cc | 2 +- .../rmw_analysis/rmw_analysis_conf_info.h | 2 - src/tools/tc_utils/tc_gen/tc_gen.cc | 96 ++++++++++--------- src/tools/tc_utils/tc_gen/tc_gen.h | 2 - src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 22 ++--- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 92 +++++++++--------- src/tools/tc_utils/tc_pairs/tc_pairs.h | 4 +- .../tc_utils/tc_pairs/tc_pairs_conf_info.h | 2 +- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 53 +++++----- src/tools/tc_utils/tc_rmw/tc_rmw.h | 27 +++--- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 11 ++- src/tools/tc_utils/tc_stat/tc_stat.cc | 61 ++++++------ src/tools/tc_utils/tc_stat/tc_stat.h | 6 +- .../tc_utils/tc_stat/tc_stat_conf_info.cc | 8 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 94 +++++++++--------- src/tools/tc_utils/tc_stat/tc_stat_job.h | 54 +++++------ 21 files changed, 351 insertions(+), 347 deletions(-) diff --git a/src/libcode/vx_seeps/seeps.h b/src/libcode/vx_seeps/seeps.h index ad6d52691a..6fd08ca12e 100644 --- a/src/libcode/vx_seeps/seeps.h +++ b/src/libcode/vx_seeps/seeps.h @@ -118,8 +118,8 @@ class SeepsClimo { bool seeps_ready; int nstn; - map seeps_score_00_map; - map seeps_score_12_map; + std::map seeps_score_00_map; + std::map seeps_score_12_map; SeepsClimoRecord *create_climo_record(int sid, float lat, float lon, float elv, float *p1, float *p2, float *t1, float *t2, diff --git a/src/libcode/vx_statistics/contable.h b/src/libcode/vx_statistics/contable.h index 28689fa58a..ded7cf3d84 100644 --- a/src/libcode/vx_statistics/contable.h +++ b/src/libcode/vx_statistics/contable.h @@ -48,7 +48,7 @@ class ContingencyTable { int rc_to_n(int r, int c) const; - vector *E; // this is really a two-dimensional array + std::vector *E; // this is really a two-dimensional array int Nrows; int Ncols; @@ -69,7 +69,7 @@ class ContingencyTable { void zero_out(); - virtual void dump(ostream & out, int depth = 0) const; + virtual void dump(std::ostream & out, int depth = 0) const; // // condition on an event diff --git a/src/libcode/vx_statistics/pair_base.h b/src/libcode/vx_statistics/pair_base.h index 984bfa690d..9acee06bcc 100644 --- a/src/libcode/vx_statistics/pair_base.h +++ b/src/libcode/vx_statistics/pair_base.h @@ -22,11 +22,11 @@ struct ob_val_t { unixtime ut; double val; - string qc; + std::string qc; }; struct station_values_t { - string sid; + std::string sid; double lat; double lon; double x; @@ -38,7 +38,7 @@ struct station_values_t { double cmn; double csd; double summary_val; - vector obs; + std::vector obs; }; //////////////////////////////////////////////////////////////////////// @@ -112,7 +112,7 @@ class PairBase { int obs_perc_value; // Percentile value for ObsSummary_Perc StringArray map_key; - map map_val; // Storage for single obs values + std::map map_val; // Storage for single obs values ////////////////////////////////////////////////////////////////// @@ -146,13 +146,13 @@ class PairBase { int has_obs_rec(const char *, double, double, double, double, double, double, int &); - ob_val_t compute_nearest(string sng_key); - ob_val_t compute_min(string sng_key); - ob_val_t compute_max(string sng_key); - ob_val_t compute_uw_mean(string sng_key); - ob_val_t compute_dw_mean(string sng_key); - ob_val_t compute_median(string sng_key); - ob_val_t compute_percentile(string sng_key, int perc); + ob_val_t compute_nearest(std::string sng_key); + ob_val_t compute_min(std::string sng_key); + ob_val_t compute_max(std::string sng_key); + ob_val_t compute_uw_mean(std::string sng_key); + ob_val_t compute_dw_mean(std::string sng_key); + ob_val_t compute_median(std::string sng_key); + ob_val_t compute_percentile(std::string sng_key, int perc); bool add_point_obs(const char *, double, double, double, double, unixtime, double, double, double, const char *, diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index 0ae2a6584f..29c75fbf87 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -66,7 +66,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "rmw_analysis"; } @@ -74,30 +74,30 @@ const string get_tool_name() { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-data file_1 ... file_n | data_file_list\n" - << "\t-config file\n" - << "\t-out file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + << "Usage: " << program_name << "\n" + << "\t-data file_1 ... file_n | data_file_list\n" + << "\t-config file\n" + << "\t-out file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " - << "is the NetCDF output of TC-RMW to be processed or an " - << "ASCII file containing a list of files (required).\n" + << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " + << "is the NetCDF output of TC-RMW to be processed or an " + << "ASCII file containing a list of files (required).\n" - << "\t\t\"-config file\" is the RMWAnalysisConfig to be used " - << "(required).\n" + << "\t\t\"-config file\" is the RMWAnalysisConfig to be used " + << "(required).\n" - << "\t\t\"-out file\" is the NetCDF output file to be written " - << "(required).\n" + << "\t\t\"-out file\" is the NetCDF output file to be written " + << "(required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; exit(1); } @@ -197,8 +197,8 @@ void setup() { << n_range << ", " << n_azimuth << ", " << n_level << ")\n"; // Get dimension coordinates - vector start; - vector count; + std::vector start; + std::vector count; start.push_back(0); ConcatString s; @@ -313,10 +313,10 @@ void process_files() { data_3d_sq.set_size(n_range, n_azimuth, n_level); // Set up array track point slices - vector start_2d; - vector count_2d; - vector start_3d; - vector count_3d; + std::vector start_2d; + std::vector count_2d; + std::vector start_3d; + std::vector count_3d; start_2d.push_back(0); start_2d.push_back(0); start_2d.push_back(0); @@ -432,11 +432,11 @@ void write_stats() { azimuth_dim = add_dim(nc_out, "azimuth", n_azimuth); level_dim = add_dim(nc_out, level_name, n_level); - vector dims_2d; + std::vector dims_2d; dims_2d.push_back(range_dim); dims_2d.push_back(azimuth_dim); - vector dims_3d; + std::vector dims_3d; dims_3d.push_back(range_dim); dims_3d.push_back(azimuth_dim); dims_3d.push_back(level_dim); @@ -445,10 +445,10 @@ void write_stats() { NcVar azimuth_var = nc_out->addVar("azimuth", ncDouble, azimuth_dim); NcVar level_var = nc_out->addVar(level_name, ncDouble, level_dim); - vector offset; - vector count_range; - vector count_azimuth; - vector count_level; + std::vector offset; + std::vector count_range; + std::vector count_azimuth; + std::vector count_level; offset.push_back(0); count_range.push_back(n_range); count_azimuth.push_back(n_azimuth); @@ -467,10 +467,10 @@ void write_stats() { level_var.putVar(offset, count_level, level_coord.data()); add_att(&level_var, "units", level_units); - vector offset_2d; - vector count_2d; - vector offset_3d; - vector count_3d; + std::vector offset_2d; + std::vector count_2d; + std::vector offset_3d; + std::vector count_3d; offset_2d.push_back(0); offset_2d.push_back(0); @@ -702,7 +702,7 @@ void read_nc_tracks(NcFile* nc_in) { mlog << Debug(3) << adeck_source << "\n"; - ofstream f; + std::ofstream f; f.open(adeck_source.c_str()); adeck_tracks.clear(); @@ -715,8 +715,8 @@ void read_nc_tracks(NcFile* nc_in) { NcVar track_lines_var = get_nc_var(nc_in, "TrackLines"); - vector counts; - vector offsets; + std::vector counts; + std::vector offsets; for(int i = 0; i < n_track_line; i++) { offsets.clear(); diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index 541f069dc5..ad7693f68b 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -12,9 +12,11 @@ // // Description: // -// Mod# Date Name Description -// ---- ---- ---- ----------- -// 000 08/19/19 Fillmore New +// Mod# Date Name Description +// ---- ---- ---- ----------- +// 000 08/19/19 Fillmore New +// 001 09/28/22 Prestopnik Adding "std::"; Removing namspace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -92,12 +92,12 @@ static NcDim azimuth_dim; static NcDim level_dim; static NcDim track_point_dim; -static string range_name; -static string range_units; -static string azimuth_name; -static string azimuth_units; -static string level_name; -static string level_units; +static std::string range_name; +static std::string range_units; +static std::string azimuth_name; +static std::string azimuth_units; +static std::string level_name; +static std::string level_units; static NcVar valid_time_var; @@ -108,27 +108,27 @@ static int n_level; static int n_track_point; static int n_track_line; -vector range_coord; -vector azimuth_coord; -vector level_coord; +std::vector range_coord; +std::vector azimuth_coord; +std::vector level_coord; -vector track_valid_time; -vector track_lat; -vector track_lon; -vector track_rmw; +std::vector track_valid_time; +std::vector track_lat; +std::vector track_lon; +std::vector track_rmw; // Variable information -static vector data_names; -static vector data_n_dims; -static vector data_long_names; -static vector data_units; +static std::vector data_names; +static std::vector data_n_dims; +static std::vector data_long_names; +static std::vector data_units; // Variable data -static vector data_counts; -static vector data_means; -static vector data_stdevs; -static vector data_mins; -static vector data_maxs; +static std::vector data_counts; +static std::vector data_means; +static std::vector data_stdevs; +static std::vector data_mins; +static std::vector data_maxs; // Track information static TrackInfoArray adeck_tracks; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index 28f6d0c864..db0588c05e 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -203,7 +203,7 @@ void RMWAnalysisConfInfo::process_config() { if(mlog.verbosity_level() >=5) { mlog << Debug(5) << "Parsed data field " << i + 1 << ":\n"; - data_info[i]->dump(cout); + data_info[i]->dump(std::cout); } } diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h index ff1e1b7193..37b5db6188 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_config.h" diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index f28d121d12..3a62d5dffe 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -24,6 +24,8 @@ // 007 11/22/21 Halley Gotway MET #1810 Add -shape option // 008 05/02/22 Halley Gotway MET #2148 Fix init_hour and lead misses // 009 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 010 09/28/22 Prestopnik MET #2227 Remove using namespace std +// // //////////////////////////////////////////////////////////////////////// @@ -2488,7 +2490,7 @@ void write_nc(GenCTCInfo &gci) { nc_var_sa.add(var_name); // Define the variable - nc_var = add_var(nc_out, (string) var_name, + nc_var = add_var(nc_out, (std::string) var_name, ncFloat, lat_dim, lon_dim, conf_info.compression_level()); @@ -2572,52 +2574,52 @@ ConcatString string_to_basin_abbr(ConcatString cs) { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - - << "Usage: " << program_name << "\n" - << "\t-genesis source\n" - << "\t-edeck source\n" - << "\t-shape source\n" - << "\t-track source\n" - << "\t-config file\n" - << "\t[-out base]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" - - << "\twhere\t\"-genesis source\" is one or more ATCF genesis " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_gen_reg_exp << "\" (required if no -edeck or -shape).\n" - - << "\t\t\"-edeck source\" is one or more ensemble model output " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_reg_exp << "\" (required if no -genesis or -shape).\n" - - << "\t\t\"-shape source\" is one or more genesis area shapefiles, " - << "an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << gen_shp_reg_exp << "\" (required if no -genesis or -edeck).\n" - - << "\t\t\"-track source\" is one or more ATCF track " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_reg_exp << "\" for the verifying BEST and operational " - << "tracks (required).\n" - - << "\t\t\"-config file\" is used once to specify the " - << "TCGenConfig file containing the desired configuration " - << "settings (required).\n" - - << "\t\t\"-out base\" overrides the default output file base " - << "(" << out_base << ") (optional).\n" - - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" - - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n"; + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + + << "Usage: " << program_name << "\n" + << "\t-genesis source\n" + << "\t-edeck source\n" + << "\t-shape source\n" + << "\t-track source\n" + << "\t-config file\n" + << "\t[-out base]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" + + << "\twhere\t\"-genesis source\" is one or more ATCF genesis " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_gen_reg_exp << "\" (required if no -edeck or -shape).\n" + + << "\t\t\"-edeck source\" is one or more ensemble model output " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_reg_exp << "\" (required if no -genesis or -shape).\n" + + << "\t\t\"-shape source\" is one or more genesis area shapefiles, " + << "an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << gen_shp_reg_exp << "\" (required if no -genesis or -edeck).\n" + + << "\t\t\"-track source\" is one or more ATCF track " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_reg_exp << "\" for the verifying BEST and operational " + << "tracks (required).\n" + + << "\t\t\"-config file\" is used once to specify the " + << "TCGenConfig file containing the desired configuration " + << "settings (required).\n" + + << "\t\t\"-out base\" overrides the default output file base " + << "(" << out_base << ") (optional).\n" + + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" + + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n"; exit(1); } diff --git a/src/tools/tc_utils/tc_gen/tc_gen.h b/src/tools/tc_utils/tc_gen/tc_gen.h index 64cc8975c7..ab8676991d 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.h +++ b/src/tools/tc_utils/tc_gen/tc_gen.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index f4ac5a74cf..de7f31fc31 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -850,7 +850,7 @@ void TCGenConfInfo::process_config() { //////////////////////////////////////////////////////////////////////// void TCGenConfInfo::process_flags( - const map &m, + const std::map &m, const TCGenNcOutInfo &n) { int i; @@ -1224,7 +1224,7 @@ void GenCTCInfo::add_best_gen(const GenesisInfo &gi) { //////////////////////////////////////////////////////////////////////// -void GenCTCInfo::inc_pnt(double lat, double lon, const string &s) { +void GenCTCInfo::inc_pnt(double lat, double lon, const std::string &s) { // Nothing to do if there is no DataPlane map entry if(DpMap.count(s) == 0) return; @@ -1247,7 +1247,7 @@ void GenCTCInfo::inc_pnt(double lat, double lon, const string &s) { //////////////////////////////////////////////////////////////////////// -void GenCTCInfo::inc_trk(const GenesisInfo &gi, const string &s) { +void GenCTCInfo::inc_trk(const GenesisInfo &gi, const std::string &s) { // Nothing to do if there is no DataPlane map entry if(DpMap.count(s) == 0) return; @@ -1367,10 +1367,10 @@ void ProbGenPCTInfo::add_probgen(const ProbGenInfo &pgi, int index, if(!LeadTimes.has(lead_hr)) { LeadTimes.add(lead_hr); - vector empty_pgi; - vector empty_idx; - vector empty_bgi; - vector empty_evt; + std::vector empty_pgi; + std::vector empty_idx; + std::vector empty_bgi; + std::vector empty_evt; PCTMap [lead_hr] = DefaultPCT; ProbGenMap[lead_hr] = empty_pgi; @@ -1422,10 +1422,10 @@ void ProbGenPCTInfo::add_genshape(const GenShapeInfo &gsi, int index, if(!LeadTimes.has(lead_hr)) { LeadTimes.add(lead_hr); - vector empty_gsi; - vector empty_idx; - vector empty_bgi; - vector empty_evt; + std::vector empty_gsi; + std::vector empty_idx; + std::vector empty_bgi; + std::vector empty_evt; PCTMap [lead_hr] = DefaultPCT; GenShapeMap[lead_hr] = empty_gsi; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index fd5f6d20ba..9518cfd652 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -33,7 +33,9 @@ // that contain all required lead times. // 011 07/27/18 Halley Gotway Support masks defined by // the gen_vx_mask tool. -// 020 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 012 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 013 09/28/22 Prestopnik Adding "std::"; Removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -170,7 +172,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const string get_tool_name() { +const std::string get_tool_name() { return "tc_gen"; } @@ -1782,8 +1784,8 @@ void compute_track_err(const TrackInfo &adeck, const TrackInfo &bdeck, crtk_err.clear(); // Get the valid time range - ut_min = min(adeck.valid_min(), bdeck.valid_min()); - ut_max = max(adeck.valid_max(), bdeck.valid_max()); + ut_min = std::min(adeck.valid_min(), bdeck.valid_min()); + ut_max = std::max(adeck.valid_max(), bdeck.valid_max()); // Determine the valid increment // For BEST tracks, use a constant time step @@ -1844,8 +1846,8 @@ void compute_track_err(const TrackInfo &adeck, const TrackInfo &bdeck, is_bad_data(alon[i]) || is_bad_data(blon[i])) continue; // Keep track of min/max longitudes - lon_min = (min(alon[i], blon[i]) < lon_min ? min(alon[i], blon[i]) : lon_min); - lon_max = (max(alon[i], blon[i]) > lon_max ? max(alon[i], blon[i]) : lon_max); + lon_min = (std::min(alon[i], blon[i]) < lon_min ? std::min(alon[i], blon[i]) : lon_min); + lon_max = (std::max(alon[i], blon[i]) > lon_max ? std::max(alon[i], blon[i]) : lon_max); // Compute and store track errors latlon_to_xytk_err(alat[i], alon[i], blat[i], blon[i], x, y, tk); @@ -1956,7 +1958,7 @@ void write_tracks(const TrackPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - ofstream *out = (ofstream *) 0; + std::ofstream *out = (std::ofstream *) 0; // Set the track pair output file name out_file << out_base << tc_stat_file_ext; @@ -2000,11 +2002,11 @@ void write_tracks(const TrackPairInfoArray &p) { } // Write the AsciiTable contents and clean up - if(out != (ofstream *) 0) { + if(out != (std::ofstream *) 0) { *out << out_at; out->close(); delete out; - out = (ofstream *) 0; + out = (std::ofstream *) 0; } return; @@ -2017,7 +2019,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - ofstream *out = (ofstream *) 0; + std::ofstream *out = (std::ofstream *) 0; // Set the track pair output file name out_file << out_base << "_PROBRIRW" << tc_stat_file_ext; @@ -2078,11 +2080,11 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { } // Write the AsciiTable contents and clean up - if(out != (ofstream *) 0) { + if(out != (std::ofstream *) 0) { *out << out_at; out->close(); delete out; - out = (ofstream *) 0; + out = (std::ofstream *) 0; } return; @@ -2114,48 +2116,48 @@ void setup_table(AsciiTable &at) { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-adeck source and/or -edeck source\n" - << "\t-bdeck source\n" - << "\t-config file\n" - << "\t[-out base]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\t-adeck source and/or -edeck source\n" + << "\t-bdeck source\n" + << "\t-config file\n" + << "\t[-out base]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-adeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "model output \"" << atcf_suffix - << "\" data to process (required if no -edeck).\n" + << "\twhere\t\"-adeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "model output \"" << atcf_suffix + << "\" data to process (required if no -edeck).\n" - << "\t\t\"-edeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "ensemble model output \"" << atcf_suffix - << "\" data to process (required if no -adeck).\n" + << "\t\t\"-edeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "ensemble model output \"" << atcf_suffix + << "\" data to process (required if no -adeck).\n" - << "\t\t\"-bdeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "best track \"" << atcf_suffix - << "\" data to process (required).\n" + << "\t\t\"-bdeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "best track \"" << atcf_suffix + << "\" data to process (required).\n" - << "\t\t\"-config file\" is used once to specify the " - << "TCPairsConfig file containing the desired configuration " - << "settings (required).\n" + << "\t\t\"-config file\" is used once to specify the " + << "TCPairsConfig file containing the desired configuration " + << "settings (required).\n" - << "\t\t\"-out base\" overrides the default output file base " - << "(" << out_base << ") (optional).\n" + << "\t\t\"-out base\" overrides the default output file base " + << "(" << out_base << ") (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" - << "\tNote: The \"-adeck\", \"-edeck\", and \"-bdeck\" options " - << "may include \"suffix=string\" to modify the model names " - << "from that source.\n\n"; + << "\tNote: The \"-adeck\", \"-edeck\", and \"-bdeck\" options " + << "may include \"suffix=string\" to modify the model names " + << "from that source.\n\n"; exit(1); } diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.h b/src/tools/tc_utils/tc_pairs/tc_pairs.h index 2e1d2f17ea..2ef0342a88 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.h +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.h @@ -16,6 +16,8 @@ // ---- ---- ---- ----------- // 000 03/14/12 Halley Gotway New // 001 03/09/17 Halley Gotway Define BEST track time step. +// 002 09/28/22 Prestopnik Adding "std::"; Removing namspace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -24,8 +26,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h index 4b7b2e364f..3fc82f2671 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h +++ b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h @@ -112,7 +112,7 @@ class TCPairsConfInfo { int WatchWarnOffset; // Basin Map - map BasinMap; + std::map BasinMap; // Config file version ConcatString Version; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 0ddfcdd710..65de37f717 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -16,7 +16,8 @@ // ---- ---- ---- ----------- // 000 04/18/19 Fillmore New // 001 05/15/20 Halley Gotway Fix data file list option logic. -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std // //////////////////////////////////////////////////////////////////////// @@ -106,34 +107,34 @@ const string get_tool_name() { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-data file_1 ... file_n | data_file_list\n" - << "\t-deck file\n" - << "\t-config file\n" - << "\t-out file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + << "Usage: " << program_name << "\n" + << "\t-data file_1 ... file_n | data_file_list\n" + << "\t-deck file\n" + << "\t-config file\n" + << "\t-out file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " - << "specifies the gridded data files or an ASCII file " - << "containing a list of files to be used (required).\n" + << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " + << "specifies the gridded data files or an ASCII file " + << "containing a list of files to be used (required).\n" - << "\t\t\"-deck source\" is the ATCF format data source " - << "(required).\n" + << "\t\t\"-deck source\" is the ATCF format data source " + << "(required).\n" - << "\t\t\"config_file\" is a TCRMWConfig file to be used " - << "(required).\n" + << "\t\t\"config_file\" is a TCRMWConfig file to be used " + << "(required).\n" - << "\t\t\"-out file\" is the NetCDF output file to be written " - << "(required).\n" + << "\t\t\"-out file\" is the NetCDF output file to be written " + << "(required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; exit(1); } @@ -586,7 +587,7 @@ void setup_nc_file() { // Get VarInfo data_info = conf_info.data_info[i_var]; mlog << Debug(4) << "Processing field: " << data_info->magic_str() << "\n"; - string fname = data_info->name_attr(); + std::string fname = data_info->name_attr(); variable_levels[fname].push_back(data_info->level_attr()); variable_long_names[fname] = data_info->long_name_attr(); variable_units[fname] = data_info->units_attr(); @@ -689,8 +690,8 @@ void process_fields(const TrackInfoArray& tracks) { // Update the variable info with the valid time of the track point data_info = conf_info.data_info[i_var]; - string sname = data_info->name_attr().string(); - string slevel = data_info->level_attr().string(); + std::string sname = data_info->name_attr().string(); + std::string slevel = data_info->level_attr().string(); data_info->set_valid(valid_time); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 1a0e6ab178..74f2760e66 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -12,9 +12,11 @@ // // Description: // -// Mod# Date Name Description -// ---- ---- ---- ----------- -// 000 04/18/19 Fillmore New +// Mod# Date Name Description +// ---- ---- ---- ----------- +// 000 04/18/19 Fillmore New +// 001 09/28/22 Prestopnik Adding "std::"; removing namspace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -23,7 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -110,21 +111,21 @@ static NcVar data_var; static NcVar wind_r_var; static NcVar wind_a_var; -static vector data_vars; -static vector azi_mean_data_vars; +static std::vector data_vars; +static std::vector azi_mean_data_vars; -static map data_3d_vars; +static std::map data_3d_vars; // List of output NetCDF variable names static StringArray nc_var_sa; -static map > variable_levels; -static map variable_long_names; -static map variable_units; +static std::map > variable_levels; +static std::map variable_long_names; +static std::map variable_units; -static set pressure_level_strings; -static set pressure_levels; -static map pressure_level_indices; +static std::set pressure_level_strings; +static std::set pressure_levels; +static std::map pressure_level_indices; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc index f6cb8e349d..d9dfd003a9 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 05/11/22 Albo Pulled the wind conversion into a class +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -83,8 +84,8 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { VarInfo* data_info = (VarInfo*) 0; for(int i_var = 0; i_var < _conf->get_n_data(); i_var++) { data_info = _conf->data_info[i_var]; - string varname = data_info->name_attr().string(); - string varlevel = data_info->level_attr().string(); + std::string varname = data_info->name_attr().string(); + std::string varlevel = data_info->level_attr().string(); if (varname == _conf->u_wind_field_name.string()) { _uIndexMap[varlevel] = i_var; } @@ -99,7 +100,7 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { << _conf->v_wind_field_name.string() << " has " << _vIndexMap.size() << " inputs\n"; _computeWinds = false; } - map::const_iterator iu, iv; + std::map::const_iterator iu, iv; for (iu=_uIndexMap.begin(), iv=_vIndexMap.begin(); iu!=_uIndexMap.end(); ++iu, ++iv) { if (iu->first != iv->first) { mlog << Warning << "Ordering of u/v wind input levels not the same, not implemented, no wind conversions will be done:\n" @@ -157,8 +158,8 @@ void TCRMW_WindConverter::append_nc_output_vars(std::mapopen(out_file.c_str()); if(!(*tc_stat_out)) { @@ -287,7 +288,7 @@ void open_out_file() { void close_out_file() { // Close the output file - if(tc_stat_out != (ofstream *) 0) { + if(tc_stat_out != (std::ofstream *) 0) { // List the file being closed mlog << Debug(1) @@ -296,7 +297,7 @@ void close_out_file() { // Close the output file tc_stat_out->close(); delete tc_stat_out; - tc_stat_out = (ofstream *) 0; + tc_stat_out = (std::ofstream *) 0; } return; @@ -306,40 +307,40 @@ void close_out_file() { void usage() { - cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + std::cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-lookin source\n" - << "\t[-out file]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-config file] | [JOB COMMAND LINE]\n\n" + << "Usage: " << program_name << "\n" + << "\t-lookin source\n" + << "\t[-out file]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-config file] | [JOB COMMAND LINE]\n\n" - << "\twhere\t\"-lookin source\" is used one or more times to " - << "specify a file or top-level directory containing TC-MET " - << "files \"" << tc_stat_file_ext << "\" data to process " - << "(required).\n" + << "\twhere\t\"-lookin source\" is used one or more times to " + << "specify a file or top-level directory containing TC-MET " + << "files \"" << tc_stat_file_ext << "\" data to process " + << "(required).\n" - << "\t\t\"-out file\" to redirect the job output to a " - << "file (optional).\n" + << "\t\t\"-out file\" to redirect the job output to a " + << "file (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-config file\" specifies the TCStatConfig file " - << "containing the desired configuration settings.\n" + << "\t\t\"-config file\" specifies the TCStatConfig file " + << "containing the desired configuration settings.\n" - << "\t\t\"JOB COMMAND LINE\" specifies all the arguments " - << "necessary to perform a single job.\n\n" + << "\t\t\"JOB COMMAND LINE\" specifies all the arguments " + << "necessary to perform a single job.\n\n" - << "\tNOTE: Refer to a TCStatConfig file for details " - << "on how to specify the JOB COMMAND LINE.\n\n" + << "\tNOTE: Refer to a TCStatConfig file for details " + << "on how to specify the JOB COMMAND LINE.\n\n" - << flush; + << std::flush; exit(1); } diff --git a/src/tools/tc_utils/tc_stat/tc_stat.h b/src/tools/tc_utils/tc_stat/tc_stat.h index 0e526f46ee..70da1913f3 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.h +++ b/src/tools/tc_utils/tc_stat/tc_stat.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04/03/12 Halley Gotway New +// 001 09/28/22 Prestopnik Adding "std::"; Removing namespace +// from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -82,7 +82,7 @@ static ConcatString command_line_job; //////////////////////////////////////////////////////////////////////// // Output file stream -static ofstream *tc_stat_out = (ofstream *) 0; +static std::ofstream *tc_stat_out = (std::ofstream *) 0; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc index d2edb908df..8ea0cb55b0 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc @@ -27,10 +27,10 @@ using namespace std; // Functions for parsing config entries static void parse_conf_thresh_map(MetConfig &, const char *, const char *, - map &); + std::map &); static void parse_conf_string_map(MetConfig &, const char *, const char *, - map &); + std::map &); //////////////////////////////////////////////////////////////////////// // @@ -262,7 +262,7 @@ void TCStatConfInfo::process_config() { void parse_conf_thresh_map(MetConfig &conf, const char *conf_key_name, const char *conf_key_val, - map &m) { + std::map &m) { StringArray sa; ThreshArray ta_val, ta_new; @@ -297,7 +297,7 @@ void parse_conf_thresh_map(MetConfig &conf, void parse_conf_string_map(MetConfig &conf, const char *conf_key_name, const char *conf_key_val, - map &m) { + std::map &m) { StringArray sa, sa_val, sa_new; sa = conf.lookup_string_array(conf_key_name); diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 79e217ffa4..9cc54447f7 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -39,8 +39,8 @@ static const char *TCStatJobType_ProbRIRWStr = "probrirw"; //////////////////////////////////////////////////////////////////////// // Functions for parsing command line options -static void parse_thresh_option(const char *, const char *, map &); -static void parse_string_option(const char *, const char *, map &); +static void parse_thresh_option(const char *, const char *, std::map &); +static void parse_string_option(const char *, const char *, std::map &); static void setup_table (AsciiTable &, int, int); static ConcatString build_map_key (const char *, const TCStatLine &, const StringArray &); static bool check_masks (const MaskPoly &, const Grid &, const MaskPlane &, @@ -57,7 +57,7 @@ TCStatJob *TCStatJobFactory::new_tc_stat_job_type(const char *type_str) { TCStatJobType type = NoTCStatJobType; // Determine the TCStatJobType - type = string_to_tcstatjobtype((string)type_str); + type = string_to_tcstatjobtype((std::string)type_str); // Switch on job type and instantiate the appropriate class. // The TCStatJob object is allocated and needs to be deleted by caller. @@ -355,10 +355,10 @@ void TCStatJob::assign(const TCStatJob & j) { //////////////////////////////////////////////////////////////////////// -void TCStatJob::dump(ostream & out, int depth) const { +void TCStatJob::dump(std::ostream & out, int depth) const { Indent prefix(depth); - map::const_iterator thr_it; - map::const_iterator str_it; + std::map::const_iterator thr_it; + std::map::const_iterator str_it; out << prefix << "JobType = " << tcstatjobtype_to_string(JobType) << "\n"; @@ -512,8 +512,8 @@ bool TCStatJob::is_keeper_track(const TrackPairInfo &pair, int i, i_init; double v_dbl; ConcatString v_str; - map::const_iterator thr_it; - map::const_iterator str_it; + std::map::const_iterator thr_it; + std::map::const_iterator str_it; // Check TrackWatchWarn for each TrackPoint if(TrackWatchWarn.n() > 0) { @@ -670,8 +670,8 @@ bool TCStatJob::is_keeper_line(const TCStatLine &line, double v_dbl, alat, alon, blat, blon; ConcatString v_str; StringArray sa; - map::const_iterator thr_it; - map::const_iterator str_it; + std::map::const_iterator thr_it; + std::map::const_iterator str_it; // Check TC-STAT header columns if(AModel.n() > 0 && @@ -1162,8 +1162,8 @@ void TCStatJob::dump_line(const TCStatLine &line, ofstream *out) { ConcatString TCStatJob::serialize() const { ConcatString s; int i; - map::const_iterator thr_it; - map::const_iterator str_it; + std::map::const_iterator thr_it; + std::map::const_iterator str_it; // Initialize the jobstring s.clear(); @@ -1334,8 +1334,8 @@ void TCStatJob::event_equalize_tracks() { int i; // Event equalization case map - map case_map; - map::iterator it; + std::map case_map; + std::map::iterator it; mlog << Debug(3) << "Applying track-based event equalization logic.\n"; @@ -1422,8 +1422,8 @@ void TCStatJob::event_equalize_lines() { int i; // Event equalization case map - map case_map; - map::iterator it; + std::map case_map; + std::map::iterator it; mlog << Debug(3) << "Applying line-based event equalization logic.\n"; @@ -1673,7 +1673,7 @@ void TCStatJobFilter::do_job(const StringArray &file_list, // Process the filter output if(JobOut) do_output(*JobOut); - else do_output(cout); + else do_output(std::cout); return; } @@ -1756,7 +1756,7 @@ void TCStatJobFilter::filter_lines(TCLineCounts &n) { //////////////////////////////////////////////////////////////////////// -void TCStatJobFilter::do_output(ostream &out) { +void TCStatJobFilter::do_output(std::ostream &out) { ConcatString line; // Build a simple output line @@ -2012,7 +2012,7 @@ void TCStatJobSummary::do_job(const StringArray &file_list, // Process the filter output if(JobOut) do_output(*JobOut); - else do_output(cout); + else do_output(std::cout); return; } @@ -2103,7 +2103,7 @@ void TCStatJobSummary::summarize_lines(TCLineCounts &n) { void TCStatJobSummary::process_pair(TrackPairInfo &pair) { int i, j; - map cur_map; + std::map cur_map; ConcatString prefix, key, cur; SummaryMapData data; double val; @@ -2148,7 +2148,7 @@ void TCStatJobSummary::process_pair(TrackPairInfo &pair) { void TCStatJobSummary::process_line(TCStatLine &line) { int i; - map cur_map; + std::map cur_map; ConcatString prefix, key, cur; SummaryMapData data; double val; @@ -2186,8 +2186,8 @@ void TCStatJobSummary::process_line(TCStatLine &line) { //////////////////////////////////////////////////////////////////////// -void TCStatJobSummary::add_map(map&m) { - map::iterator it; +void TCStatJobSummary::add_map(std::map&m) { + std::map::iterator it; // Loop over the input map entries for(it=m.begin(); it!= m.end(); it++) { @@ -2226,8 +2226,8 @@ void TCStatJobSummary::add_map(map&m) { //////////////////////////////////////////////////////////////////////// -void TCStatJobSummary::do_output(ostream &out) { - map::iterator it; +void TCStatJobSummary::do_output(std::ostream &out) { + std::map::iterator it; StringArray sa; ConcatString line; AsciiTable out_at; @@ -2376,7 +2376,7 @@ void TCStatJobSummary::do_output(ostream &out) { out << line; // Write the table - out << out_at << "\n" << flush; + out << out_at << "\n" << std::flush; return; } @@ -2385,7 +2385,7 @@ void TCStatJobSummary::do_output(ostream &out) { void TCStatJobSummary::compute_fsp(NumArray &total, NumArray &best, NumArray &ties) { - map::iterator it; + std::map::iterator it; StringArray case_list; double v, best_val; ConcatString best_mod, s; @@ -2708,7 +2708,7 @@ StringArray intersection(const StringArray &s1, const StringArray &s2) { //////////////////////////////////////////////////////////////////////// void parse_thresh_option(const char *col_name, const char *col_val, - map &m) { + std::map &m) { ConcatString cs = to_upper((string)col_name); ThreshArray ta; ta.add_css(col_val); @@ -2723,7 +2723,7 @@ void parse_thresh_option(const char *col_name, const char *col_val, //////////////////////////////////////////////////////////////////////// void parse_string_option(const char *col_name, const char *col_val, - map &m) { + std::map &m) { ConcatString cs = to_upper((string)col_name); StringArray sa; sa.set_ignore_case(1); @@ -3009,7 +3009,7 @@ void TCStatJobRIRW::do_job(const StringArray &file_list, // Process the RI/RW job output if(JobOut) do_output(*JobOut); - else do_output(cout); + else do_output(std::cout); return; } @@ -3018,7 +3018,7 @@ void TCStatJobRIRW::do_job(const StringArray &file_list, void TCStatJobRIRW::process_pair(TrackPairInfo &pair) { int i, j, a, b, cur_dt, min_dt, i_min_dt, lead; - map cur_map; + std::map cur_map; ConcatString key, cur, cat; RIRWMapData data; TrackPairInfo pair_pt; @@ -3157,7 +3157,7 @@ void TCStatJobRIRW::process_pair(TrackPairInfo &pair) { //////////////////////////////////////////////////////////////////////// void TCStatJobRIRW::add_map(map&m) { - map::iterator it; + std::map::iterator it; // Loop over the input map entries for(it=m.begin(); it!= m.end(); it++) { @@ -3209,7 +3209,7 @@ void TCStatJobRIRW::add_map(map&m) { //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_output(ostream &out) { +void TCStatJobRIRW::do_output(std::ostream &out) { ConcatString line; // Build a simple output line @@ -3225,8 +3225,8 @@ void TCStatJobRIRW::do_output(ostream &out) { //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_ctc_output(ostream &out) { - map::iterator it; +void TCStatJobRIRW::do_ctc_output(std::ostream &out) { + std::map::iterator it; StringArray sa; int i, r, c; AsciiTable out_at; @@ -3292,15 +3292,15 @@ void TCStatJobRIRW::do_ctc_output(ostream &out) { } // Write the table - out << out_at << "\n" << flush; + out << out_at << "\n" << std::flush; return; } //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_cts_output(ostream &out) { - map::iterator it; +void TCStatJobRIRW::do_cts_output(std::ostream &out) { + std::map::iterator it; StringArray sa; int i, r, c; AsciiTable out_at; @@ -3374,15 +3374,15 @@ void TCStatJobRIRW::do_cts_output(ostream &out) { } // Write the table - out << out_at << "\n" << flush; + out << out_at << "\n" << std::flush; return; } //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_mpr_output(ostream &out) { - map::iterator it; +void TCStatJobRIRW::do_mpr_output(std::ostream &out) { + std::map::iterator it; StringArray sa; int i, j, r, c; AsciiTable out_at; @@ -3474,7 +3474,7 @@ void TCStatJobRIRW::do_mpr_output(ostream &out) { } // Write the table - out << out_at << "\n" << flush; + out << out_at << "\n" << std::flush; return; } @@ -3782,7 +3782,7 @@ void TCStatJobProbRIRW::do_job(const StringArray &file_list, // Process the ProbRIRW job output if(JobOut) do_output(*JobOut); - else do_output(cout); + else do_output(std::cout); return; } @@ -3856,8 +3856,8 @@ void TCStatJobProbRIRW::process_pair(ProbRIRWPairInfo &pair) { //////////////////////////////////////////////////////////////////////// -void TCStatJobProbRIRW::do_output(ostream &out) { - map::iterator it; +void TCStatJobProbRIRW::do_output(std::ostream &out) { + std::map::iterator it; StringArray sa; int n, i, j, r, c; int lt_cols = 0; @@ -3886,7 +3886,7 @@ void TCStatJobProbRIRW::do_output(ostream &out) { else if(out_lt == stat_prc) lt_cols = get_n_prc_columns (n); else if(out_lt == stat_pjc) lt_cols = get_n_pjc_columns (n); else { - mlog << Error << "\nvoid TCStatJobProbRIRW::do_output(ostream &out) -> " + mlog << Error << "\nvoid TCStatJobProbRIRW::do_output(std::ostream &out) -> " << "unsupported output line type \"" << OutLineType[i] << "\"\n\n"; exit(1); } @@ -3958,7 +3958,7 @@ void TCStatJobProbRIRW::do_output(ostream &out) { } // end for it // Write the table for the current output line type - out << out_at << "\n" << flush; + out << out_at << "\n" << std::flush; } // end for i diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.h b/src/tools/tc_utils/tc_stat/tc_stat_job.h index 8d35120a5d..c01bcaeb2d 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.h +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.h @@ -195,7 +195,7 @@ class TCStatJob { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; ////////////////////////////////////////////////////////////////// @@ -224,8 +224,8 @@ class TCStatJob { void open_stat_file(); void close_stat_file(); - void dump_pair(const TrackPairInfo &, ofstream *); - void dump_line(const TCStatLine &, ofstream *); + void dump_pair(const TrackPairInfo &, std::ofstream *); + void dump_line(const TCStatLine &, std::ofstream *); virtual ConcatString serialize() const; @@ -285,27 +285,27 @@ class TCStatJob { bool WaterOnly; // Numeric column thresholds - map ColumnThreshMap; + std::map ColumnThreshMap; // ASCII column string matching - map ColumnStrIncMap; - map ColumnStrExcMap; + std::map ColumnStrIncMap; + std::map ColumnStrExcMap; // Numeric column thresholds - map InitThreshMap; + std::map InitThreshMap; // ASCII column string matching - map InitStrIncMap; - map InitStrExcMap; + std::map InitStrIncMap; + std::map InitStrExcMap; // Variables to the store the analysis job specification - ConcatString DumpFile; // Dump TrackPairInfo used to a file - ofstream *DumpOut; // Dump output file stream - ofstream *JobOut; // Job output file stream (not allocated) + ConcatString DumpFile; // Dump TrackPairInfo used to a file + std::ofstream *DumpOut; // Dump output file stream + std::ofstream *JobOut; // Job output file stream (not allocated) // Derived output statistics - ConcatString StatFile; // File name for output statistics - ofstream *StatOut; // Output statistics file stream + ConcatString StatFile; // File name for output statistics + std::ofstream *StatOut; // Output statistics file stream // Polyline masking regions ConcatString OutInitMaskFile; @@ -376,7 +376,7 @@ class TCStatJobFilter : public TCStatJob { void filter_tracks(TCLineCounts &); void filter_lines (TCLineCounts &); - void do_output(ostream &); + void do_output(std::ostream &); }; @@ -413,9 +413,9 @@ class TCStatJobSummary : public TCStatJob { void process_pair(TrackPairInfo &); void process_line(TCStatLine &); - void add_map(map&); + void add_map(std::map&); - void do_output(ostream &); + void do_output(std::ostream &); void compute_fsp(NumArray &, NumArray &, NumArray &); @@ -436,7 +436,7 @@ class TCStatJobSummary : public TCStatJob { SingleThresh FSPThresh; // Map column and case info to column values - map SummaryMap; + std::map SummaryMap; }; @@ -451,7 +451,7 @@ class TCStatJobRIRW : public TCStatJob { void assign(const TCStatJobRIRW &); ConcatString DumpFileCTC[4]; - ofstream *DumpOutCTC[4]; + std::ofstream *DumpOutCTC[4]; public: @@ -473,12 +473,12 @@ class TCStatJobRIRW : public TCStatJob { void process_pair(TrackPairInfo &); - void add_map(map&); + void add_map(std::map&); - void do_output (ostream &); - void do_ctc_output(ostream &); - void do_cts_output(ostream &); - void do_mpr_output(ostream &); + void do_output (std::ostream &); + void do_ctc_output(std::ostream &); + void do_cts_output(std::ostream &); + void do_mpr_output(std::ostream &); // Store the case information StringArray ByColumn; @@ -490,7 +490,7 @@ class TCStatJobRIRW : public TCStatJob { StringArray OutLineType; // Map column and case info to column values - map RIRWMap; + std::map RIRWMap; }; @@ -523,7 +523,7 @@ class TCStatJobProbRIRW : public TCStatJob { void process_pair(ProbRIRWPairInfo &); - void do_output(ostream &); + void do_output(std::ostream &); // Probability information bool ProbRIRWExact; // True for exact change, false for maximum change @@ -544,7 +544,7 @@ class TCStatJobProbRIRW : public TCStatJob { StringArray OutLineType; // Map column and case info to column values - map ProbRIRWMap; + std::map ProbRIRWMap; }; From 31e805e2ef7e3a0671cd755cbf01ef58985dd1db Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Wed, 28 Sep 2022 15:59:50 -0600 Subject: [PATCH 12/26] Per #2227, removed namespace std from /src/tools/core header files --- src/tools/core/ensemble_stat/ensemble_stat.h | 18 +++--- src/tools/core/grid_stat/grid_stat.h | 21 ++++--- src/tools/core/point_stat/point_stat.h | 20 +++---- .../core/series_analysis/series_analysis.h | 8 +-- src/tools/core/stat_analysis/aggr_stat_line.h | 47 ++++++++------- .../core/stat_analysis/parse_stat_line.h | 3 +- .../stat_analysis/skill_score_index_job.h | 16 ++--- src/tools/core/stat_analysis/stat_analysis.h | 9 ++- .../core/stat_analysis/stat_analysis_job.h | 59 +++++++++---------- src/tools/core/wavelet_stat/wavelet_stat.h | 19 +++--- 10 files changed, 107 insertions(+), 113 deletions(-) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.h b/src/tools/core/ensemble_stat/ensemble_stat.h index db1041b22e..3714d0b12c 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.h +++ b/src/tools/core/ensemble_stat/ensemble_stat.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -135,16 +133,16 @@ static StringArray nc_ens_var_sa; static StringArray nc_orank_var_sa; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index 04f694fa96..4b3a0c4ace 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -16,8 +16,9 @@ // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New // 001 05/03/10 Halley Gotway Add fcst/obs/diff variable name -// arrays to keep track of NetCDF variables. +// arrays to keep track of NetCDF variables. // 002 05/10/16 Halley Gotway Add grid weighting. +// 003 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -26,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -133,16 +132,16 @@ static NcDim lon_dim; static StringArray nc_var_sa; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; static int compress_level = -1; diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 0a24e9209a..1d0cb938c9 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// // //////////////////////////////////////////////////////////////////////// @@ -25,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -129,16 +129,16 @@ static unixtime fcst_valid_ut = (unixtime) 0; static int fcst_lead_sec = bad_data_int; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index fe8e48a948..0e8e918a27 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 12/10/12 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// // //////////////////////////////////////////////////////////////////////// @@ -23,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -99,7 +99,7 @@ struct NcVarData { }; // Mapping of NetCDF variable name to computed statistic -map stat_data; +std::map stat_data; //////////////////////////////////////////////////////////////////////// // @@ -149,7 +149,7 @@ static int obs_lead_beg = bad_data_int; static int obs_lead_end = bad_data_int; // Mapping of statistic names to descriptions -map stat_long_name; +std::map stat_long_name; static const char stat_long_name_file[] = "MET_BASE/table_files/stat_column_description.txt"; diff --git a/src/tools/core/stat_analysis/aggr_stat_line.h b/src/tools/core/stat_analysis/aggr_stat_line.h index 86a1e771d5..43c5a437ee 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.h +++ b/src/tools/core/stat_analysis/aggr_stat_line.h @@ -29,6 +29,7 @@ // 010 04/25/18 Halley Gotway Add ECNT line type. // 011 04/01/19 Fillmore Add FCST and OBS units. // 012 01/24/20 Halley Gotway Add aggregate RPS lines. +// 013 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -37,8 +38,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -93,8 +92,8 @@ struct StatHdrInfo { struct AggrSummaryInfo { StatHdrInfo hdr; - map val; - map wgt; + std::map val; + std::map wgt; }; struct AggrCTCInfo { @@ -189,7 +188,7 @@ struct ssvar_bin_cmp { struct AggrSSVARInfo { StatHdrInfo hdr; - map ssvar_bins; + std::map ssvar_bins; }; struct AggrTimeSeriesInfo { @@ -207,97 +206,97 @@ struct AggrTimeSeriesInfo { extern void aggr_summary_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ctc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mctc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_pct_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_psum_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_grad_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_wind_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mpr_wind_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mpr_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_isc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ecnt_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_rps_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_rhist_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_phist_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_relp_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_orank_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ssvar_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_time_series_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ss_index( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index ed9a6be48a..0ad26c65e9 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -25,6 +25,7 @@ // 008 10/09/17 Halley Gotway Add GRAD line type. // 009 04/25/18 Halley Gotway Add ECNT line type. // 010 01/24/20 Halley Gotway Add RPS line type. +// 011 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -33,8 +34,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/core/stat_analysis/skill_score_index_job.h b/src/tools/core/stat_analysis/skill_score_index_job.h index 74f2a33e0e..1dcf3df387 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.h +++ b/src/tools/core/stat_analysis/skill_score_index_job.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/28/21 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// // //////////////////////////////////////////////////////////////////////// @@ -78,17 +80,17 @@ class SSIndexJobInfo { NumArray n_fcst_lines, n_ref_lines; // Input line type for each term - vector job_lt; + std::vector job_lt; // Vectors of jobs for each term - vector fcst_job; - vector ref_job; + std::vector fcst_job; + std::vector ref_job; // Vectors of partial sums and contingency tables for each term - vector fcst_sl1l2; - vector ref_sl1l2; - vector fcst_cts; - vector ref_cts; + std::vector fcst_sl1l2; + std::vector ref_sl1l2; + std::vector fcst_cts; + std::vector ref_cts; // Add jobs for each term void add_term(const STATAnalysisJob &, diff --git a/src/tools/core/stat_analysis/stat_analysis.h b/src/tools/core/stat_analysis/stat_analysis.h index 4c9f461139..ad8bd15c6f 100644 --- a/src/tools/core/stat_analysis/stat_analysis.h +++ b/src/tools/core/stat_analysis/stat_analysis.h @@ -16,6 +16,7 @@ // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New // 001 05/03/12 Halley Gotway Switch to using vx_config library. +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -26,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -70,8 +69,8 @@ static StringArray search_dirs; static StringArray files; // Output file set with -out -static ConcatString out_file; -static ofstream *sa_out = (ofstream *) 0; +static ConcatString out_file; +static std::ofstream *sa_out = (std::ofstream *) 0; // Config file set with -config static ConcatString config_file; @@ -91,7 +90,7 @@ static ConcatString tmp_file; static ConcatString tmp_path; // Output file stream for the temporary file -static ofstream tmp_out; +static std::ofstream tmp_out; // STAT-Analysis configuration object static MetConfig conf; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.h b/src/tools/core/stat_analysis/stat_analysis_job.h index 9235af7da3..a963fd1944 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.h +++ b/src/tools/core/stat_analysis/stat_analysis_job.h @@ -24,6 +24,7 @@ // 006 10/09/17 Halley Gotway Add aggregate GRAD lines. // 007 03/01/18 Halley Gotway Update summary job type. // 008 01/24/20 Halley Gotway Add aggregate RPS lines. +// 009 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -32,8 +33,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -53,26 +52,26 @@ extern void set_job_from_config(MetConfig &, STATAnalysisJob &); extern void do_job(const ConcatString &, STATAnalysisJob &, int, const ConcatString &, const ConcatString &, - ofstream *); + std::ofstream *); extern void do_job_filter(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_summary(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *, gsl_rng *); + STATAnalysisJob &, int &, int &, std::ofstream *, gsl_rng *); extern void do_job_aggr(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_aggr_stat(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *, + STATAnalysisJob &, int &, int &, std::ofstream *, const ConcatString &, gsl_rng *); extern void do_job_ss_index(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_ramp(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); //////////////////////////////////////////////////////////////////////// @@ -80,61 +79,61 @@ extern void write_job_aggr_hdr(STATAnalysisJob &, int, int, AsciiTable &); extern void write_job_summary(STATAnalysisJob &, - map &, AsciiTable &, + std::map &, AsciiTable &, gsl_rng *); extern void write_job_aggr_ctc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_mctc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_pct(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_psum(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_grad(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_wind(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_ecnt(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_rps(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_rhist(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_phist(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_relp(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_ssvar(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_orank(STATAnalysisJob &, STATLineType, - map &, AsciiTable &, + std::map &, AsciiTable &, gsl_rng *); extern void write_job_aggr_isc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_mpr(STATAnalysisJob &, STATLineType, - map &, AsciiTable &, + std::map &, AsciiTable &, const char *, gsl_rng *); extern void write_job_aggr_mpr_wind(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_ramp(STATAnalysisJob &, - map &, + std::map &, AsciiTable &, AsciiTable &, AsciiTable &); extern void write_job_ramp_cols(const STATAnalysisJob &, AsciiTable &, @@ -146,9 +145,9 @@ extern void write_job_ss_index(STATAnalysisJob &, //////////////////////////////////////////////////////////////////////// extern void setup_table (AsciiTable &, int, int); -extern void write_table (AsciiTable &, ofstream *); -extern void write_jobstring(const ConcatString &, ofstream *); -extern void write_line (const ConcatString &, ofstream *); +extern void write_table (AsciiTable &, std::ofstream *); +extern void write_jobstring(const ConcatString &, std::ofstream *); +extern void write_line (const ConcatString &, std::ofstream *); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/wavelet_stat/wavelet_stat.h b/src/tools/core/wavelet_stat/wavelet_stat.h index c27548cae6..40f38f382a 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.h +++ b/src/tools/core/wavelet_stat/wavelet_stat.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -25,8 +26,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -109,16 +108,16 @@ static ConcatString out_ps_file; static PSfile *ps_out = (PSfile *) 0; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ISC output file -static ConcatString isc_file; -static ofstream *isc_out = (ofstream *) 0; -static AsciiTable isc_at; -static int i_isc_row; +static ConcatString isc_file; +static std::ofstream *isc_out = (std::ofstream *) 0; +static AsciiTable isc_at; +static int i_isc_row; //////////////////////////////////////////////////////////////////////// // From 9106192c4dea5a7dc87099889870f882ebdf1b87 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Thu, 29 Sep 2022 12:42:35 -0600 Subject: [PATCH 13/26] Per #2227, clean up and continued work --- .../vx_series_data/test_series_data.cc | 4 +- src/basic/vx_util/data_plane.cc | 3 +- src/basic/vx_util/main.cc | 21 +- src/basic/vx_util/ncrr_array.h | 4 +- src/libcode/vx_nc_util/nc_utils.cc | 26 +- src/libcode/vx_nc_util/write_netcdf.cc | 6 +- src/libcode/vx_series_data/series_pdf.cc | 26 +- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 124 +++++----- src/tools/dev_utils/nceptab_to_flat.cc | 25 +- src/tools/dev_utils/pbtime.cc | 15 +- src/tools/dev_utils/reformat_county_data.cc | 23 +- src/tools/dev_utils/reformat_map_data.cc | 23 +- src/tools/dev_utils/swinging_door.cc | 87 +++---- src/tools/other/ascii2nc/airnow_locations.cc | 3 +- src/tools/other/gen_ens_prod/gen_ens_prod.h | 3 +- .../gen_ens_prod/gen_ens_prod_conf_info.h | 6 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 5 +- src/tools/other/gen_vx_mask/gen_vx_mask.h | 3 +- src/tools/other/gis_utils/gis_dump_dbf.cc | 17 +- src/tools/other/gis_utils/gis_dump_shp.cc | 41 ++-- src/tools/other/gis_utils/gis_dump_shx.cc | 21 +- src/tools/other/grid_diag/grid_diag.h | 3 +- src/tools/other/gsi_tools/gsi_util.h | 2 - src/tools/other/gsi_tools/gsid2mpr.h | 3 +- src/tools/other/gsi_tools/gsidens2orank.h | 3 +- src/tools/other/lidar2nc/lidar2nc.cc | 52 ++-- src/tools/other/madis2nc/madis2nc.cc | 3 + src/tools/other/madis2nc/madis2nc.h | 5 +- src/tools/other/madis2nc/madis2nc_conf_info.h | 4 +- .../other/mode_graphics/plot_mode_field.cc | 54 ++--- src/tools/other/modis_regrid/modis_regrid.cc | 51 ++-- src/tools/other/pb2nc/pb2nc.cc | 227 +++++++++--------- .../other/plot_data_plane/plot_data_plane.cc | 69 +++--- .../other/plot_point_obs/plot_point_obs.cc | 3 + .../other/plot_point_obs/plot_point_obs.h | 3 +- .../plot_point_obs/plot_point_obs_conf_info.h | 4 +- .../shift_data_plane/shift_data_plane.cc | 93 +++---- src/tools/other/wwmca_tool/wwmca_plot.cc | 37 +-- .../tc_utils/rmw_analysis/rmw_analysis.cc | 80 +++--- .../tc_utils/rmw_analysis/rmw_analysis.h | 3 +- .../rmw_analysis/rmw_analysis_conf_info.cc | 4 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 61 ++--- src/tools/tc_utils/tc_gen/tc_gen.cc | 98 ++++---- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 22 +- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 93 +++---- src/tools/tc_utils/tc_pairs/tc_pairs.h | 3 +- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 54 +++-- src/tools/tc_utils/tc_rmw/tc_rmw.h | 3 +- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 4 +- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 21 +- src/tools/tc_utils/tc_stat/tc_stat.cc | 60 ++--- src/tools/tc_utils/tc_stat/tc_stat.h | 3 +- .../tc_utils/tc_stat/tc_stat_conf_info.cc | 8 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 94 ++++---- 54 files changed, 874 insertions(+), 839 deletions(-) diff --git a/internal/test_util/libcode/vx_series_data/test_series_data.cc b/internal/test_util/libcode/vx_series_data/test_series_data.cc index 4523a5dbeb..c717ec8f7f 100644 --- a/internal/test_util/libcode/vx_series_data/test_series_data.cc +++ b/internal/test_util/libcode/vx_series_data/test_series_data.cc @@ -7,6 +7,8 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -46,7 +48,7 @@ int main(int argc, char *argv[]) { double delta = (max - min) / nbin; double width = 10; - std::vector pdf; + vector pdf; init_pdf(nbin, pdf); diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index bde7f982bc..0fd0c00efa 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-01-11 Halley Gotway +// 001 22-09-29 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -663,7 +664,7 @@ if ( N == 0 ) return; // no shift, so do nothing int x, y, x_new; int index_old, index_new; -std::vector new_data(Nxy); +vector new_data(Nxy); for (x=0; x #include @@ -45,17 +46,17 @@ //////////////////////////////////////////////////////////////////////// -static std::string met_cmdline = ""; +static string met_cmdline = ""; static int met_start_time; static int met_end_time; static uid_t met_user_id; -static std::string met_user_name; -static std::string met_tool_name; +static string met_user_name; +static string met_tool_name; //////////////////////////////////////////////////////////////////////// -extern std::string get_tool_name(); +extern string get_tool_name(); extern int met_main(int argc, char *argv[]); @@ -108,7 +109,7 @@ void do_post_process() { //////////////////////////////////////////////////////////////////////// -std::string get_current_time() { +string get_current_time() { time_t curr_time; tm * curr_tm; char date_string[MET_BUF_SIZE]; @@ -118,7 +119,7 @@ std::string get_current_time() { strftime(date_string, MET_BUF_SIZE, "%Y-%m-%d %TZ", curr_tm); - return std::string(date_string); + return string(date_string); } //////////////////////////////////////////////////////////////////////// @@ -148,7 +149,7 @@ void segv_handler(int signum) { void set_handlers() { - std::set_new_handler(oom); + set_new_handler(oom); } //////////////////////////////////////////////////////////////////////// @@ -157,7 +158,7 @@ void set_user_id() { met_user_id = geteuid (); register struct passwd *pw; pw = getpwuid (met_user_id); - if (pw) met_user_name = std::string(pw->pw_name); + if (pw) met_user_name = string(pw->pw_name); } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ncrr_array.h b/src/basic/vx_util/ncrr_array.h index 68fbd40592..dc508ca380 100644 --- a/src/basic/vx_util/ncrr_array.h +++ b/src/basic/vx_util/ncrr_array.h @@ -77,7 +77,7 @@ class NCRR_Array { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -254,7 +254,7 @@ return; template -void NCRR_Array::dump(ostream & out, int depth) const +void NCRR_Array::dump(std::ostream & out, int depth) const { diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index dcfa3a2ea3..3441b2744e 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -975,8 +975,8 @@ char get_char_val(NcFile * nc, const char * var_name, const int index) { char get_char_val(NcVar *var, const int index) { char k; - std::vector start; - std::vector count; + vector start; + vector count; // // Retrieve the character array value from the NetCDF variable. @@ -1002,8 +1002,8 @@ ConcatString* get_string_val(NcFile * nc, const char * var_name, const int index ConcatString* get_string_val(NcVar *var, const int index, const int len, ConcatString &tmp_cs) { char tmp_str[len]; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_string_val() "; if (2 != get_dim_count(var)) { @@ -1052,8 +1052,8 @@ int get_int_var(NcFile * nc, const char * var_name, const int index) { int get_int_var(NcVar * var, const int index) { int k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_int_var() "; k = bad_data_int; @@ -1089,8 +1089,8 @@ int get_int_var(NcVar * var, const int index) { double get_nc_time(NcVar * var, const int index) { double k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_nc_time() -> "; k = bad_data_double; @@ -1177,8 +1177,8 @@ float get_float_var(NcFile * nc, const char * var_name, const int index) { float get_float_var(NcVar * var, const int index) { float k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_float_var() -> "; k = bad_data_float; @@ -2541,8 +2541,8 @@ void copy_nc_atts(NcFile *nc_from, NcFile *nc_to, const bool all_attrs) { //////////////////////////////////////////////////////////////////////// void copy_nc_atts(NcVar *var_from, NcVar *var_to, const bool all_attrs) { - std::map ncAttMap = var_from->getAtts(); - for (std::map::iterator itr = ncAttMap.begin(); + map ncAttMap = var_from->getAtts(); + for (map::iterator itr = ncAttMap.begin(); itr != ncAttMap.end(); ++itr) { if (all_attrs || ( (itr->first != "scale_factor") @@ -2706,7 +2706,7 @@ bool has_var(NcFile *nc, const char * var_name) { //////////////////////////////////////////////////////////////////////// NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, const int deflate_level) { - std::vector ncDimVector; + vector ncDimVector; string new_var_name = var_name; patch_nc_name(&new_var_name); NcVar var = nc->addVar(new_var_name, ncType, ncDimVector); diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc index 798c155032..e3d30cb787 100644 --- a/src/libcode/vx_nc_util/write_netcdf.cc +++ b/src/libcode/vx_nc_util/write_netcdf.cc @@ -160,7 +160,7 @@ void write_netcdf_latlon_2d(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, NcVar lat_var, lon_var; float *lat_data = (float *) 0; float *lon_data = (float *) 0; - std::vector dims; + vector dims; long counts[2] = {grid.ny(), grid.nx()}; long offsets[2] = {0 , 0}; @@ -216,8 +216,8 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, //NcVar *wgt_var = (NcVar *) 0; NcVar wgt_var ; float *wgt_data = (float *) 0; - std::vector dims; - std::vector count; + vector dims; + vector count; // Define Variables dims.push_back(*lat_dim); diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index 5e6900f4ad..eca0375312 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -22,7 +24,7 @@ void init_pdf( int n, - std::vector& pdf) { + vector& pdf) { for(int k = 0; k < n; k++) { pdf.push_back(0); @@ -35,7 +37,7 @@ void init_pdf( double min, double max, double delta, - std::vector& pdf) { + vector& pdf) { int n = (max - min) / delta; for(int k = 0; k < n; k++) { @@ -48,7 +50,7 @@ void init_pdf( void init_joint_pdf( int n_A, int n_B, - std::vector& pdf) { + vector& pdf) { for(int k = 0; k < n_A * n_B; k++) { pdf.push_back(0); @@ -60,7 +62,7 @@ void init_joint_pdf( void update_pdf( double min, double delta, - std::vector& pdf, + vector& pdf, const DataPlane& dp, const MaskPlane& mp) { @@ -86,7 +88,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - std::vector& pdf, + vector& pdf, const DataPlane& dp_A, const DataPlane& dp_B, const MaskPlane& mp) { @@ -115,13 +117,13 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const std::vector& pdf) { + const vector& pdf) { for(int k = 0; k < pdf.size(); k++) { double bin_min = min + k * delta; double bin_max = min + (k + 1) * delta; - std::cout << "[" << bin_min << ", " << bin_max << "] " - << pdf[k] << "\n"; + cout << "[" << bin_min << ", " << bin_max << "] " + << pdf[k] << "\n"; } } @@ -132,11 +134,11 @@ void write_nc_pdf( const VarInfo& info, double min, double delta, - const std::vector& pdf) { + const vector& pdf) { - std::vector bin_min; - std::vector bin_max; - std::vector bin_mid; + vector bin_min; + vector bin_max; + vector bin_mid; for(int k = 0; k < pdf.size(); k++) { bin_min.push_back(min + delta * k); diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.cc b/src/libcode/vx_tc_util/vx_tc_nc_util.cc index 63acb0b278..796468a71f 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.cc +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include "vx_tc_nc_util.h" //////////////////////////////////////////////////////////////////////// @@ -51,8 +53,8 @@ void write_tc_tracks(NcFile* nc_out, track_mrd_data[i] = track[i].mrd(); } - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; mlog << Debug(2) << "Writing " << track_lines.n() << " track lines.\n"; @@ -61,7 +63,7 @@ void write_tc_tracks(NcFile* nc_out, offsets.push_back(i); counts.clear(); counts.push_back(1); - std::string line = track_lines[i]; + string line = track_lines[i]; mlog << Debug(3) << line << "\n"; const char* str = line.c_str(); track_lines_var.putVar(offsets, counts, &str); @@ -84,16 +86,16 @@ void write_tc_tracks(NcFile* nc_out, //////////////////////////////////////////////////////////////////////// -std::set get_pressure_level_strings( - std::map > variable_levels) { +set get_pressure_level_strings( + map > variable_levels) { - std::set pressure_level_strings; + set pressure_level_strings; - for (std::map >::iterator i = variable_levels.begin(); + for (map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { - std::vector levels = variable_levels[i->first]; + vector levels = variable_levels[i->first]; for (int j = 0; j < levels.size(); j++) { - std::string label = levels[j].substr(0, 1); + string label = levels[j].substr(0, 1); if (label == "P") { pressure_level_strings.insert(levels[j]); } @@ -105,16 +107,16 @@ std::set get_pressure_level_strings( //////////////////////////////////////////////////////////////////////// -std::set get_pressure_levels( - std::map > variable_levels) { +set get_pressure_levels( + map > variable_levels) { - std::set pressure_levels; + set pressure_levels; - for (std::map >::iterator i = variable_levels.begin(); + for (map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { - std::vector levels = variable_levels[i->first]; + vector levels = variable_levels[i->first]; for (int j = 0; j < levels.size(); j++) { - std::string label = levels[j].substr(0, 1); + string label = levels[j].substr(0, 1); double level = atof(levels[j].substr(1).c_str()); if (label == "P") { pressure_levels.insert(level); @@ -127,15 +129,15 @@ std::set get_pressure_levels( //////////////////////////////////////////////////////////////////////// -std::set get_pressure_levels( - std::set pressure_level_strings) { +set get_pressure_levels( + set pressure_level_strings) { - std::set pressure_levels; + set pressure_levels; - for (std::set::iterator i = pressure_level_strings.begin(); + for (set::iterator i = pressure_level_strings.begin(); i != pressure_level_strings.end(); ++i) { - std::string level_str = *i; + string level_str = *i; double level = atof(level_str.substr(1).c_str()); pressure_levels.insert(level); } @@ -145,14 +147,14 @@ std::set get_pressure_levels( //////////////////////////////////////////////////////////////////////// -std::map get_pressure_level_indices( - std::set pressure_levels) { +map get_pressure_level_indices( + set pressure_levels) { - std::map pressure_level_indices; + map pressure_level_indices; int k = pressure_levels.size() - 1; - for (std::set::iterator i = pressure_levels.begin(); + for (set::iterator i = pressure_levels.begin(); i != pressure_levels.end(); ++i) { double level = *i; @@ -165,18 +167,18 @@ std::map get_pressure_level_indices( //////////////////////////////////////////////////////////////////////// -std::map get_pressure_level_indices( - std::set pressure_level_strings, std::set pressure_levels) { +map get_pressure_level_indices( + set pressure_level_strings, set pressure_levels) { - std::map pressure_level_indices; + map pressure_level_indices; - std::map indices_from_levels + map indices_from_levels = get_pressure_level_indices(pressure_levels); - for (std::set::iterator i = pressure_level_strings.begin(); + for (set::iterator i = pressure_level_strings.begin(); i != pressure_level_strings.end(); ++i) { - std::string level_str = *i; + string level_str = *i; double level = atof(level_str.substr(1).c_str()); pressure_level_indices[level_str] = indices_from_levels[level]; } @@ -187,7 +189,7 @@ std::map get_pressure_level_indices( //////////////////////////////////////////////////////////////////////// void def_tc_pressure(NcFile* nc_out, - const NcDim& pressure_dim, std::set pressure_levels) { + const NcDim& pressure_dim, set pressure_levels) { NcVar pressure_var; @@ -204,7 +206,7 @@ void def_tc_pressure(NcFile* nc_out, // Extract pressure coordinates int k = pressure_levels.size() - 1; - for (std::set::iterator i = pressure_levels.begin(); + for (set::iterator i = pressure_levels.begin(); i != pressure_levels.end(); ++i) { pressure_data[k] = *i; k--; @@ -271,7 +273,7 @@ void def_tc_lat_lon_time(NcFile* nc_out, const NcDim& track_point_dim, NcVar& lat_var, NcVar& lon_var, NcVar& valid_time_var) { - std::vector dims; + vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); @@ -301,8 +303,8 @@ void write_tc_valid_time(NcFile* nc_out, const int& i_point, const NcVar& var, const long& valid_time) { - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; offsets.clear(); offsets.push_back(i_point); @@ -316,32 +318,32 @@ void write_tc_valid_time(NcFile* nc_out, //////////////////////////////////////////////////////////////////////// void def_tc_variables(NcFile* nc_out, - std::map > variable_levels, - std::map variable_long_names, - std::map variable_units, + map > variable_levels, + map variable_long_names, + map variable_units, const NcDim& range_dim, const NcDim& azimuth_dim, const NcDim& pressure_dim, const NcDim& track_point_dim, - std::map& data_vars) { + map& data_vars) { - std::vector dims; + vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); - std::vector dims_3d; + vector dims_3d; dims_3d.push_back(range_dim); dims_3d.push_back(azimuth_dim); dims_3d.push_back(pressure_dim); dims_3d.push_back(track_point_dim); - for (std::map >::iterator i = variable_levels.begin(); + for (map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { NcVar data_var; - std::string var_name = i->first; - std::vector levels = variable_levels[i->first]; - std::string long_name = variable_long_names[i->first]; - std::string units = variable_units[i->first]; + string var_name = i->first; + vector levels = variable_levels[i->first]; + string long_name = variable_long_names[i->first]; + string units = variable_units[i->first]; if (levels.size() > 1) { data_var = nc_out->addVar( @@ -367,7 +369,7 @@ void def_tc_data(NcFile* nc_out, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - std::vector dims; + vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(track_point_dim); @@ -392,7 +394,7 @@ void def_tc_data_3d(NcFile* nc_out, const NcDim& pressure_dim, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - std::vector dims; + vector dims; dims.push_back(range_dim); dims.push_back(azimuth_dim); dims.push_back(pressure_dim); @@ -414,7 +416,7 @@ void def_tc_azi_mean_data(NcFile* nc_out, const NcDim& track_point_dim, NcVar& data_var, VarInfo* data_info) { - std::vector dims; + vector dims; dims.push_back(range_dim); dims.push_back(track_point_dim); @@ -436,8 +438,8 @@ void def_tc_azi_mean_data(NcFile* nc_out, void write_tc_data(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; offsets.clear(); offsets.push_back(0); @@ -457,8 +459,8 @@ void write_tc_data(NcFile* nc_out, const TcrmwGrid& grid, void write_tc_data_rev(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; double* data_rev; @@ -493,8 +495,8 @@ void write_tc_data_rev(NcFile* nc_out, const TcrmwGrid& grid, void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, const int& i_point, const NcVar& var, const double* data) { - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; double* data_rev; double* data_azi_mean; @@ -535,14 +537,14 @@ void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, extern void write_tc_pressure_level_data( NcFile* nc_out, const TcrmwGrid& grid, - std::map pressure_level_indices, const std::string& level_str, + map pressure_level_indices, const string& level_str, const int& i_point, const NcVar& var, const double* data) { - std::vector offsets; - std::vector counts; + vector offsets; + vector counts; - std::vector offsets_3d; - std::vector counts_3d; + vector offsets_3d; + vector counts_3d; double* data_rev; @@ -581,7 +583,7 @@ extern void write_tc_pressure_level_data( } } - // std::string label = level_str.substr(0, 1); + // string label = level_str.substr(0, 1); // if (label == "P") { // var.putVar(offsets_3d, counts_3d, data_rev); // } else { diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index f21f35bc88..73c48ca14a 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -9,6 +9,9 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + +//////////////////////////////////////////////////////////////////////// // // Takes a bunch of C source files from the wgrib code @@ -84,7 +87,7 @@ if ( cline.n() == 0 ) usage(); int j; -std::cout << "GRIB1\n"; +cout << "GRIB1\n"; for (j=0; j<(cline.n()); ++j) { // j starts at one, here @@ -104,7 +107,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "nceptab_to_flat"; } @@ -116,7 +119,7 @@ void usage() { -std::cerr << "\n\n usage: " << program_name << " nceptab_source_file.c [ more such files ...]\n\n"; +cerr << "\n\n usage: " << program_name << " nceptab_source_file.c [ more such files ...]\n\n"; exit ( 1 ); @@ -149,7 +152,7 @@ void process(const char * input_filename) { ConcatString line; -std::ifstream in; +ifstream in; bool found = false; const char * short_name = get_short_name(input_filename); @@ -265,7 +268,7 @@ if ( !c ) return ( false ); n = atoi(c); -std::cout << n << ' ' << table_number << ' '; +cout << n << ' ' << table_number << ' '; // // first string @@ -275,7 +278,7 @@ c = strtok(s, " /*{\""); if ( !c ) return ( false ); -std::cout << '\"' << c << "\" "; +cout << '\"' << c << "\" "; // // second string (is this football?) @@ -290,7 +293,7 @@ if ( c[k] == ' ' ) c[k] = (char) 0; if ( !c ) return ( false ); -std::cout << '\"' << c << "\" "; +cout << '\"' << c << "\" "; // // units @@ -298,7 +301,7 @@ std::cout << '\"' << c << "\" "; if ( strcmp(c, "undefined") == 0 ) { - std::cout << "\"\" "; + cout << "\"\" "; } else { @@ -306,8 +309,8 @@ if ( strcmp(c, "undefined") == 0 ) { if ( !c ) return ( false ); - if ( c[0] == '}' ) std::cout << "\"\" "; - else std::cout << '\"' << c << "\" "; + if ( c[0] == '}' ) cout << "\"\" "; + else cout << '\"' << c << "\" "; } @@ -315,7 +318,7 @@ if ( strcmp(c, "undefined") == 0 ) { // done // -std::cout << '\n' << std::flush; +cout << '\n' << flush; return ( true ); diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index ad06521acf..6d2c49a001 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -15,9 +15,12 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -59,10 +62,10 @@ int met_main(int argc, char *argv[]) { char hdr_typ[512], time_str[512]; if(argc != 2) { - std::cout << "Usage: " << program_name << " pbfile\n" - << "\twhere \"pbfile\" is the PrepBufr file whose center " - << "time should be dumped (required).\n" - << std::flush; + cout << "Usage: " << program_name << " pbfile\n" + << "\twhere \"pbfile\" is the PrepBufr file whose center " + << "time should be dumped (required).\n" + << flush; exit(1); } @@ -84,7 +87,7 @@ int met_main(int argc, char *argv[]) { // Format and dump out the time string snprintf(time_str, sizeof(time_str), "%.10i", i_date); ut = yyyymmddhh_to_unix(time_str); - std::cout << unix_to_yyyymmdd_hhmmss(ut) << "\n" << std::flush; + cout << unix_to_yyyymmdd_hhmmss(ut) << "\n" << flush; // Delete the temporary blocked file remove_temp_file(blk_file); @@ -94,7 +97,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return program_name; } diff --git a/src/tools/dev_utils/reformat_county_data.cc b/src/tools/dev_utils/reformat_county_data.cc index 910ab18071..fb563b9ad8 100644 --- a/src/tools/dev_utils/reformat_county_data.cc +++ b/src/tools/dev_utils/reformat_county_data.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -63,7 +64,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "reformat_country_data"; } @@ -75,7 +76,7 @@ void usage() { -std::cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; +cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; exit ( 1 ); @@ -95,8 +96,8 @@ int j, k, region_number, n_points; int a, b; double lat, lon; double lat_min, lat_max, lon_min, lon_max; -std::ifstream in; -std::ofstream out; +ifstream in; +ofstream out; char in_line[512]; // the maximum line length in any of the data files is 66 char out_line[512]; @@ -108,7 +109,7 @@ met_open(in, input_filename); if ( !in ) { - std::cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; + cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; exit ( 1 ); @@ -118,7 +119,7 @@ if ( !in ) { if ( !out ) { - std::cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; + cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; exit ( 1 ); @@ -149,7 +150,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 7 ) { - std::cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; + cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; exit ( 1 ); @@ -161,7 +162,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { region_number, n_points, lat_min, lat_max, lon_min, lon_max); - out << out_line << '\n' << std::flush; + out << out_line << '\n' << flush; // // data points @@ -173,7 +174,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( ! in.getline(in_line, sizeof(in_line)) ) { - std::cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; + cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; exit ( 1 ); @@ -183,7 +184,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 2 ) { - std::cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; + cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; exit ( 1 ); @@ -193,7 +194,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { snprintf(out_line, sizeof(out_line), "%7.3f %8.3f", lat, lon); - out << out_line << '\n' << std::flush; + out << out_line << '\n' << flush; } // for j diff --git a/src/tools/dev_utils/reformat_map_data.cc b/src/tools/dev_utils/reformat_map_data.cc index 99edf2d3ab..f87be38ea9 100644 --- a/src/tools/dev_utils/reformat_map_data.cc +++ b/src/tools/dev_utils/reformat_map_data.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -63,7 +64,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "reformat_map_data"; } @@ -75,7 +76,7 @@ void usage() { -std::cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; +cerr << "\n\n usage: " << program_name << " input_filename output_filename\n\n"; exit ( 1 ); @@ -95,8 +96,8 @@ int j, k, region_number, n_points; int a, b, c, d; double lat, lon; double lat_min, lat_max, lon_min, lon_max; -std::ifstream in; -std::ofstream out; +ifstream in; +ofstream out; char in_line[512]; // the maximum line length in any of the data files is 66 char out_line[512]; @@ -108,7 +109,7 @@ met_open(in, input_filename); if ( !in ) { - std::cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; + cerr << "\n\n " << program_name << ": reformat() -> unable to open input file \"" << input_filename << "\"\n\n"; exit ( 1 ); @@ -118,7 +119,7 @@ met_open(out, output_filename); if ( !out ) { - std::cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; + cerr << "\n\n " << program_name << ": reformat() -> unable to open output file \"" << output_filename << "\"\n\n"; exit ( 1 ); @@ -149,7 +150,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 9 ) { - std::cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; + cerr << "\n\n " << program_name << ": trouble reading region!\n\n"; exit ( 1 ); @@ -161,7 +162,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { region_number, n_points, lat_min, lat_max, lon_min, lon_max); - out << out_line << '\n' << std::flush; + out << out_line << '\n' << flush; // // data points @@ -173,7 +174,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( ! in.getline(in_line, sizeof(in_line)) ) { - std::cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; + cerr << "\n\n " << program_name << ": trouble reading data points from region! ... j = " << j << "\n\n"; exit ( 1 ); @@ -183,7 +184,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { if ( k != 2 ) { - std::cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; + cerr << "\n\n " << program_name << ": trouble reading data points from line ... \"" << in_line << "\"\n\n"; exit ( 1 ); @@ -193,7 +194,7 @@ while ( in.getline(in_line, sizeof(in_line)) ) { snprintf(out_line, sizeof(out_line), "%7.3f %8.3f", lat, lon); - out << out_line << '\n' << std::flush; + out << out_line << '\n' << flush; } // for j diff --git a/src/tools/dev_utils/swinging_door.cc b/src/tools/dev_utils/swinging_door.cc index 6aaa9c6d5b..49bc48657c 100644 --- a/src/tools/dev_utils/swinging_door.cc +++ b/src/tools/dev_utils/swinging_door.cc @@ -19,11 +19,12 @@ // 000 08-19-14 Rehak New // 001 04-27-154 Halley Gotway List and format output files // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09-12-22 Prestopnik Added "std::"; removing namespace -// from header files +// 003 09-12-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -54,22 +55,22 @@ static const char *program_name = "swinging_door"; //////////////////////////////////////////////////////////////////////// // Variables for command line arguments -static std::string ncfile_arg; +static string ncfile_arg; static double error_arg; static int grib_code_arg; -static std::string message_type_arg; -static std::string station_id_arg; +static string message_type_arg; +static string station_id_arg; //////////////////////////////////////////////////////////////////////// static bool process_file(); -static bool run_algorithm(const std::vector< SDObservation > &obs, - std::vector< SDObservation > &compressed_obs); +static bool run_algorithm(const vector< SDObservation > &obs, + vector< SDObservation > &compressed_obs); static void usage(); -static bool write_observations(const std::vector< SDObservation > &observations, - const std::string &file_path); -static bool write_ramps(const std::vector< SDObservation > &observations, - const std::string &file_path); +static bool write_observations(const vector< SDObservation > &observations, + const string &file_path); +static bool write_ramps(const vector< SDObservation > &observations, + const string &file_path); //////////////////////////////////////////////////////////////////////// @@ -116,7 +117,7 @@ int met_main(int argc, char *argv[]) //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return program_name; } @@ -128,7 +129,7 @@ bool process_file() MetNcFile nc_file(ncfile_arg); - std::vector< SDObservation > observations; + vector< SDObservation > observations; if (!nc_file.readFile(grib_code_arg, station_id_arg, message_type_arg, observations)) @@ -141,7 +142,7 @@ bool process_file() // Run the algorithm - std::vector< SDObservation > compressed_observations; + vector< SDObservation > compressed_observations; if (!run_algorithm(observations, compressed_observations)) return false; @@ -163,19 +164,19 @@ bool process_file() //////////////////////////////////////////////////////////////////////// -bool run_algorithm(const std::vector< SDObservation > &observations, - std::vector< SDObservation > &compressed_observations) +bool run_algorithm(const vector< SDObservation > &observations, + vector< SDObservation > &compressed_observations) { // Run the algorithm - std::vector< std::pair< SDObservation, SDObservation > > ramps; + vector< pair< SDObservation, SDObservation > > ramps; if (!compute_swinging_door_ramps(observations, error_arg, ramps)) return false; // Create the compressed observations from the ramps - std::vector< std::pair< SDObservation, SDObservation > >::const_iterator ramp; + vector< pair< SDObservation, SDObservation > >::const_iterator ramp; for (ramp = ramps.begin(); ramp != ramps.end(); ++ramp) { compressed_observations.push_back(ramp->first); @@ -189,40 +190,40 @@ bool run_algorithm(const std::vector< SDObservation > &observations, void usage() { - std::cout << "\nUsage: " - << program_name << "\n" - << "\tnetcdf_file\n" - << "\terror_value\n" - << "\tgrib_code\n" - << "\tmessage_type\n" - << "\tstation_id\n\n" + cout << "\nUsage: " + << program_name << "\n" + << "\tnetcdf_file\n" + << "\terror_value\n" + << "\tgrib_code\n" + << "\tmessage_type\n" + << "\tstation_id\n\n" - << "\twhere\t\"netcdf_file\" is the NetCDF file containing " - << "the raw observations (required).\n" + << "\twhere\t\"netcdf_file\" is the NetCDF file containing " + << "the raw observations (required).\n" - << "\t\t\"error_value\" is the error value (E) to use when " - << "computing the corridors (required).\n" + << "\t\t\"error_value\" is the error value (E) to use when " + << "computing the corridors (required).\n" - << "\t\t\"grib_code\" is the grib code of the field to use " - << "(required).\n" + << "\t\t\"grib_code\" is the grib code of the field to use " + << "(required).\n" - << "\t\t\"message_type\" is the message type of the observations " - << "to use (required).\n" + << "\t\t\"message_type\" is the message type of the observations " + << "to use (required).\n" - << "\t\t\"station_id\" is the station identifier of the " - << "observations to use (required).\n" + << "\t\t\"station_id\" is the station identifier of the " + << "observations to use (required).\n" - << std::flush; + << flush; exit(1); } //////////////////////////////////////////////////////////////////////// -bool write_observations(const std::vector< SDObservation > &observations, - const std::string &file_path) +bool write_observations(const vector< SDObservation > &observations, + const string &file_path) { - static const std::string method_name = "write_observations()"; + static const string method_name = "write_observations()"; mlog << Debug(2) << "Writing: " << file_path << "\n"; @@ -244,7 +245,7 @@ bool write_observations(const std::vector< SDObservation > &observations, // Write the observations - std::vector< SDObservation >::const_iterator obs; + vector< SDObservation >::const_iterator obs; for (obs = observations.begin(); obs != observations.end(); ++obs) fprintf(output_file, "%s,%d,%f\n", unix_to_yyyymmdd_hhmmss(obs->getValidTime()).text(), @@ -259,10 +260,10 @@ bool write_observations(const std::vector< SDObservation > &observations, //////////////////////////////////////////////////////////////////////// -bool write_ramps(const std::vector< SDObservation > &observations, - const std::string &file_path) +bool write_ramps(const vector< SDObservation > &observations, + const string &file_path) { - static const std::string method_name = "write_ramps()"; + static const string method_name = "write_ramps()"; mlog << Debug(2) << "Writing: " << file_path << "\n"; diff --git a/src/tools/other/ascii2nc/airnow_locations.cc b/src/tools/other/ascii2nc/airnow_locations.cc index 0435ad8281..10810c8727 100644 --- a/src/tools/other/ascii2nc/airnow_locations.cc +++ b/src/tools/other/ascii2nc/airnow_locations.cc @@ -12,7 +12,6 @@ using namespace std; - #include #include #include @@ -103,7 +102,7 @@ bool AirnowLocations::initialize(const string &fileName) // assume the full aqsid are unique compared to the non-full simple aqsid or even the station id // look for the 'full' - std::vector::const_iterator it; + vector::const_iterator it; it = find(monitoringSiteFullAqsid.begin(), monitoringSiteFullAqsid.end(), fullaqsid); if (it == monitoringSiteFullAqsid.end()) { monitoringSiteAqsid.push_back(aqsid); diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.h b/src/tools/other/gen_ens_prod/gen_ens_prod.h index 332c7594a7..a3367364fe 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.h +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 09/10/21 Halley Gotway MET #1904 Initial version. +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h index f92a49d153..c6199639c2 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h @@ -82,9 +82,9 @@ class GenEnsProdConfInfo { ConcatString desc; // Description ConcatString control_id; // Control ID - vector ens_input; // Vector of GenEnsProdVarInfo pointers (allocated) - vector cdf_info; // Array of climo CDF info objects - StringArray ens_member_ids; // Array of ensemble member ID strings + std::vector ens_input; // Vector of GenEnsProdVarInfo pointers (allocated) + std::vector cdf_info; // Array of climo CDF info objects + StringArray ens_member_ids; // Array of ensemble member ID strings NbrhdInfo nbrhd_prob; // Neighborhood probability definition InterpInfo nmep_smooth; // Neighborhood maximum smoothing information diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 55572b1a2b..7f4c4299b5 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -28,10 +28,13 @@ // 010 08/30/21 Halley Gotway MET #1891 Fix input and mask fields. // 011 12/13/21 Halley Gotway MET #1993 Fix -type grid. // 012 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. -// 013 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 013 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 014 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.h b/src/tools/other/gen_vx_mask/gen_vx_mask.h index 937b5db8c5..d87ed09c0f 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.h +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.h @@ -20,6 +20,7 @@ // 003 06/03/21 Seth Linden Changed default mask type to MaskType_None. // 004 08/30/21 Halley Gotway MET #1891 fix input and mask fields. // 005 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. +// 006 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -28,8 +29,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_util.h" #include "vx_cal.h" #include "mask_poly.h" diff --git a/src/tools/other/gis_utils/gis_dump_dbf.cc b/src/tools/other/gis_utils/gis_dump_dbf.cc index de1fd58fa3..8b9a1c6157 100644 --- a/src/tools/other/gis_utils/gis_dump_dbf.cc +++ b/src/tools/other/gis_utils/gis_dump_dbf.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -58,7 +59,7 @@ if ( argc != 2 ) usage(); int fd = -1; int j; size_t n_read, bytes; -ConcatString input_filename = (std::string)argv[1]; +ConcatString input_filename = (string)argv[1]; DbfHeader h; DbfSubRecord sr; @@ -73,7 +74,7 @@ if ( (fd = met_open(input_filename.c_str(), O_RDONLY)) < 0 ) { } -std::cout << get_short_name(input_filename.c_str()) << '\n'; +cout << get_short_name(input_filename.c_str()) << '\n'; // // main header @@ -93,7 +94,7 @@ if ( (n_read = read(fd, buf, bytes)) != bytes ) { h.set_header(buf); -std::cout << "\n"; +cout << "\n"; // // subrecords @@ -101,9 +102,9 @@ std::cout << "\n"; h.set_subrecords(fd); -h.dump(std::cout); +h.dump(cout); -std::cout << "\n"; +cout << "\n"; // // records @@ -137,9 +138,9 @@ for (j=0; j<(h.n_records); ++j) { buf[h.record_length] = 0; } - std::cout << "Record " << j << " ...\n"; + cout << "Record " << j << " ...\n"; - dump_record(std::cout, 1, buf, h); + dump_record(cout, 1, buf, h); } // for j @@ -158,7 +159,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "gis_dump_dbf"; } diff --git a/src/tools/other/gis_utils/gis_dump_shp.cc b/src/tools/other/gis_utils/gis_dump_shp.cc index 80d299bfbd..37d0c06f0b 100644 --- a/src/tools/other/gis_utils/gis_dump_shp.cc +++ b/src/tools/other/gis_utils/gis_dump_shp.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -89,11 +90,11 @@ cline.parse(); if ( cline.n() != 1 ) usage(); -ConcatString input_filename = (std::string)cline[0]; +ConcatString input_filename = (string)cline[0]; ShpFile f; -std::cout << "file = \"" << get_short_name(input_filename.c_str()) << "\"\n\n"; +cout << "file = \"" << get_short_name(input_filename.c_str()) << "\"\n\n"; if ( ! f.open(input_filename.c_str()) ) { @@ -109,11 +110,11 @@ if ( ! f.open(input_filename.c_str()) ) { // header // -std::cout << "File Header ... \n"; +cout << "File Header ... \n"; -f.header()->dump(std::cout, 1); +f.header()->dump(cout, 1); -std::cout << '\n' << std::flush; +cout << '\n' << flush; if ( header_only ) return ( 0 ); @@ -156,7 +157,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "gis_dump_shp"; } @@ -204,22 +205,22 @@ ShpPolyRecord r; while ( f >> r ) { - std::cout << "Record Header ... \n"; + cout << "Record Header ... \n"; - r.rh.dump(std::cout, 1); + r.rh.dump(cout, 1); - std::cout << "\n"; + cout << "\n"; - std::cout << "Record Data ... \n"; + cout << "Record Data ... \n"; - r.dump(std::cout, 1); + r.dump(cout, 1); - std::cout << "\n"; + cout << "\n"; } // while -std::cout << "\n\n"; +cout << "\n\n"; @@ -245,22 +246,22 @@ ShpPointRecord r; while ( f >> r ) { - std::cout << "Record Header ... \n"; + cout << "Record Header ... \n"; - r.rh.dump(std::cout, 1); + r.rh.dump(cout, 1); - std::cout << "\n"; + cout << "\n"; - std::cout << "Record Data ... \n"; + cout << "Record Data ... \n"; - r.dump(std::cout, 1); + r.dump(cout, 1); - std::cout << "\n"; + cout << "\n"; } // while -std::cout << "\n\n"; +cout << "\n\n"; // diff --git a/src/tools/other/gis_utils/gis_dump_shx.cc b/src/tools/other/gis_utils/gis_dump_shx.cc index 3566a17cb4..c22700d653 100644 --- a/src/tools/other/gis_utils/gis_dump_shx.cc +++ b/src/tools/other/gis_utils/gis_dump_shx.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -58,7 +59,7 @@ if ( argc != 2 ) usage(); int fd = -1; int n_read, bytes; int count; -ConcatString input_filename = (std::string)argv[1]; +ConcatString input_filename = (string)argv[1]; ShxFileHeader h; ShxRecord r; @@ -73,7 +74,7 @@ if ( (fd = met_open(input_filename.c_str(), O_RDONLY)) < 0 ) { } -std::cout << get_short_name(input_filename.c_str()) << '\n'; +cout << get_short_name(input_filename.c_str()) << '\n'; // // main header @@ -93,11 +94,11 @@ if ( (n_read = read(fd, buf, bytes)) != bytes ) { h.set(buf); -std::cout << "ShxFileHeader ...\n"; +cout << "ShxFileHeader ...\n"; -h.dump(std::cout, 1); +h.dump(cout, 1); -std::cout << "\n"; +cout << "\n"; // // records @@ -109,15 +110,15 @@ while ( (n_read = read(fd, buf, 8)) == 8 ) { r.set(buf); - std::cout << "Record " << (count++) << " ... \n"; + cout << "Record " << (count++) << " ... \n"; - r.dump(std::cout, 1); + r.dump(cout, 1); - std::cout << "\n"; + cout << "\n"; } // while -std::cout << "\n\n Read " << count << " records\n\n"; +cout << "\n\n Read " << count << " records\n\n"; // // done @@ -132,7 +133,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "gis_dump_shx"; } diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 1bc4d4f30d..59af967e46 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 10/01/19 Fillmore New +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/other/gsi_tools/gsi_util.h b/src/tools/other/gsi_tools/gsi_util.h index cc3f5aa3ee..f8477162cd 100644 --- a/src/tools/other/gsi_tools/gsi_util.h +++ b/src/tools/other/gsi_tools/gsi_util.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_stat_out.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsid2mpr.h b/src/tools/other/gsi_tools/gsid2mpr.h index 32b0733b9a..04001d5479 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.h +++ b/src/tools/other/gsi_tools/gsid2mpr.h @@ -16,6 +16,7 @@ // ---- ---- ---- ----------- // 000 06/09/15 Bullock New // 001 01/26/16 Halley Gotway Add -no_check_dup option. +// 002 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -24,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_util.h" diff --git a/src/tools/other/gsi_tools/gsidens2orank.h b/src/tools/other/gsi_tools/gsidens2orank.h index 0e8fb7dcdd..e68b0d9b09 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.h +++ b/src/tools/other/gsi_tools/gsidens2orank.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/09/15 Halley Gotway New +// 001 09/29/22 Prestopnik MET #2227 Removing namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_util.h" diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index e8d233ed61..17b61a7f08 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -18,8 +18,7 @@ // ---- ---- ---- ----------- // 000 03-22-17 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 002 09-12-22 Prestopnik Added "std::"; removing namespace -// from header files +// 002 09-12-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -29,6 +28,7 @@ static const char hdr_typ_string[] = "calipso"; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -154,7 +154,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "lidar2nc"; } @@ -162,29 +162,29 @@ const std::string get_tool_name() { void usage() { -std::cout << "\nUsage: " - << program_name << "\n" - << "\tlidar_file\n" - << "\t-out out_file\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" +cout << "\nUsage: " + << program_name << "\n" + << "\tlidar_file\n" + << "\t-out out_file\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"lidar_file\" is the HDF lidar point observation " - << "file (required).\n" + << "\twhere\t\"lidar_file\" is the HDF lidar point observation " + << "file (required).\n" - << "\t\t\"-out out_file\" is the output NetCDF file (required).\n" + << "\t\t\"-out out_file\" is the output NetCDF file (required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-compress level\" specifies the compression level of " - << "the output NetCDF variable (optional).\n\n" + << "\t\t\"-compress level\" specifies the compression level of " + << "the output NetCDF variable (optional).\n\n" - << std::flush; + << flush; exit (1); @@ -299,7 +299,7 @@ Calipso_5km_Vars hdf_5km; hdf_5km.get_vars(hdf_sd_id); -n_data = std::max (hdf_5km.lat.dimsizes[0], hdf_5km.lat.dimsizes[1]); +n_data = max (hdf_5km.lat.dimsizes[0], hdf_5km.lat.dimsizes[1]); const int nhdr_dim_size = n_data; @@ -313,8 +313,8 @@ const int hdr_arr_bytes = nhdr_dim_size*HDR_ARRAY_LEN*sizeof(float); int buf_size = hdr_typ_bytes; -buf_size = std::max(buf_size, hdr_vld_bytes); -buf_size = std::max(buf_size, hdr_arr_bytes); +buf_size = max(buf_size, hdr_vld_bytes); +buf_size = max(buf_size, hdr_arr_bytes); mlog << Debug(1) << method_name << "Writing MET File:\t" << output_filename << "\n"; @@ -361,9 +361,9 @@ memset(junk, 0, sizeof(junk)); if ( gethostname(junk, sizeof(junk) - 1) < 0 ) s << " on unknown host"; else s << " on host " << junk; -(void) out->putAtt(std::string("FileOrigins"), std::string( s.text() )); -(void) out->putAtt(std::string("MET_version"), std::string( met_version )); -(void) out->putAtt(std::string("MET_tool"), std::string(program_name.text())); +(void) out->putAtt(string("FileOrigins"), string( s.text() )); +(void) out->putAtt(string("MET_version"), string( met_version )); +(void) out->putAtt(string("MET_tool"), string(program_name.text())); // // allocate the buffer diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index fd5640210b..aa0c6d4d8e 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -33,9 +33,12 @@ // 006 07-23-18 Halley Gotway Support masks from gen_vx_mask. // 007 01-11-19 Howard Soh Added config file option. // 008 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 009 09-29-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index 3317fed702..5dd20f8133 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -19,6 +19,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07-21-11 Halley Gotway Adapted from contributed code. +// 001 09-29-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -27,10 +28,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - #include "vx_log.h" #include "mask_poly.h" #include "vx_grid.h" diff --git a/src/tools/other/madis2nc/madis2nc_conf_info.h b/src/tools/other/madis2nc/madis2nc_conf_info.h index 8e25d40694..0ced5aafef 100644 --- a/src/tools/other/madis2nc/madis2nc_conf_info.h +++ b/src/tools/other/madis2nc/madis2nc_conf_info.h @@ -27,8 +27,8 @@ class Madis2NcConfInfo { Madis2NcConfInfo(); ~Madis2NcConfInfo(); - void read_config(const string &default_filename, - const string &user_filename); + void read_config(const std::string &default_filename, + const std::string &user_filename); TimeSummaryInfo getSummaryInfo() const { diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 88f495edf1..9fca9d3049 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -17,8 +17,7 @@ // ---- ---- ---- ----------- // 000 09-05-14 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 002 09-13-22 Prestopnik Adding "std::"; removing namespace from -// header files +// 002 09-13-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -32,6 +31,7 @@ static const int ctable_text_width = 30; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -116,7 +116,7 @@ static bool do_anno = true; static bool do_data_rescale = false; static ConcatString ctable_filename; -static ConcatString output_directory = (std::string)"."; +static ConcatString output_directory = (string)"."; // // default plot info @@ -259,7 +259,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "plot_mode_field"; } @@ -283,7 +283,7 @@ if ( ! config.read(config_filename.c_str()) ) { } -if ( mlog.verbosity_level() >= 5 ) config.dump(std::cout); +if ( mlog.verbosity_level() >= 5 ) config.dump(cout); const DictionaryEntry * e = 0; const char * name = 0; @@ -444,7 +444,7 @@ if ( ! mode_in.open(mode_nc_filename) ) { } -if ( mlog.verbosity_level() >= 5 ) mode_in.dump(std::cout); +if ( mlog.verbosity_level() >= 5 ) mode_in.dump(cout); output_filename << output_directory << '/' << get_short_name(mode_nc_filename); @@ -601,31 +601,31 @@ void usage() { -std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" +cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tmode_nc_file_list\n" - << "\t-raw | -simple | -cluster\n" - << "\t-obs | -fcst\n" - << "\t-config file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\tmode_nc_file_list\n" + << "\t-raw | -simple | -cluster\n" + << "\t-obs | -fcst\n" + << "\t-config file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-raw | -simple | -cluster\" plots the raw, simple, " - << "or cluster object field (required).\n" + << "\twhere\t\"-raw | -simple | -cluster\" plots the raw, simple, " + << "or cluster object field (required).\n" - << "\t\t\"-obs | -fcst\" plots the forecast or observation field " - << "(required).\n" + << "\t\t\"-obs | -fcst\" plots the forecast or observation field " + << "(required).\n" - << "\t\t\"-config file\" is a PlotModeFieldConfig file specifying " - << "the desired plotting options (required).\n" + << "\t\t\"-config file\" is a PlotModeFieldConfig file specifying " + << "the desired plotting options (required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << flush; exit (1); } @@ -781,7 +781,7 @@ return; //////////////////////////////////////////////////////////////////////// -void get_data_ppm(ModeNcOutputFile & mode_in, Ppm & image) +void get_data_ppm(ModecNOutputFile & mode_in, Ppm & image) { @@ -962,7 +962,7 @@ void draw_mapfile(Cgraph & plot, const Box & map_box, const Grid & grid, Diction { -std::ifstream in; +ifstream in; MapRegion r; double map_linewidth; ConcatString s; diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index ab40c544e3..6e41bcee8c 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -15,6 +15,7 @@ static const char default_units [] = "none"; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -50,7 +51,7 @@ static ConcatString modis_filename; static ConcatString modis_field; -static ConcatString units = (std::string)default_units; +static ConcatString units = (string)default_units; static double data_fill_value = -9999.0; @@ -158,7 +159,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "modis_regrid"; } @@ -229,29 +230,29 @@ ConcatString tab; tab.set_repeat(' ', 13); -std::cout << "\n" - << "Usage: " << program_name << '\n' - << tab << "-data_file path\n" - << tab << "-field name\n" - << tab << "-out path\n" - << tab << "-scale value\n" - << tab << "-offset value\n" - << tab << "-fill value\n" - << tab << "[-units text]\n" - << tab << "[-compress level]\n" - << tab << "modis_file\n\n" - - << " where \"-data_file path\" specifies the data files used to get the grid information.\n" - << " \"-field name\" specifies the name of the field to use in the modis data file.\n" - << " \"-out path\" specifies the name of the output netcdf file.\n" - << " \"-scale value\" specifies the scale factor to be used on the raw modis values.\n" - << " \"-offset value\" specifies the offset value to be used on the raw modis values.\n" - << " \"-fill value\" specifies the bad data value in the modis data.\n" - << " \"-units text\" specifies the units string in the global attributes section of the output file (optional).\n" - << " \"-compress level\" specifies the compression level of output NetCDF variable (optional).\n" - << " \"modis_file\" is the name of the modis input file.\n" - - << "\n"; +cout << "\n" + << "Usage: " << program_name << '\n' + << tab << "-data_file path\n" + << tab << "-field name\n" + << tab << "-out path\n" + << tab << "-scale value\n" + << tab << "-offset value\n" + << tab << "-fill value\n" + << tab << "[-units text]\n" + << tab << "[-compress level]\n" + << tab << "modis_file\n\n" + + << " where \"-data_file path\" specifies the data files used to get the grid information.\n" + << " \"-field name\" specifies the name of the field to use in the modis data file.\n" + << " \"-out path\" specifies the name of the output netcdf file.\n" + << " \"-scale value\" specifies the scale factor to be used on the raw modis values.\n" + << " \"-offset value\" specifies the offset value to be used on the raw modis values.\n" + << " \"-fill value\" specifies the bad data value in the modis data.\n" + << " \"-units text\" specifies the units string in the global attributes section of the output file (optional).\n" + << " \"-compress level\" specifies the compression level of output NetCDF variable (optional).\n" + << " \"modis_file\" is the name of the modis input file.\n" + + << "\n"; exit ( 1 ); diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index b2656f38e4..cfa0bf329c 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -54,11 +54,12 @@ // 015 02/10/18 Halley Gotway Add message_type_group_map. // 016 07/23/18 Halley Gotway Support masks defined by gen_vx_mask. // 017 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 018 09/12/22 Prestopnik Added "std::"; removing namespace -// from header files +// 018 09/12/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -209,7 +210,7 @@ static int nmsg_percent = -1; // Dump contents of PrepBufr file to ASCII files static bool dump_flag = false; -static ConcatString dump_dir = (std::string)"."; +static ConcatString dump_dir = (string)"."; static bool do_all_vars = false; static bool override_vars = false; @@ -285,8 +286,8 @@ static ConcatString bufr_hdrs; // header name list to read header static StringArray bufr_hdr_name_arr; // available header name list static StringArray bufr_obs_name_arr; // available obs. name list static IntArray filtered_times; -static std::vector bufr_derive_cfgs; -static std::map variableTypeMap; +static vector bufr_derive_cfgs; +static map variableTypeMap; static bool do_summary; static SummaryObs *summary_obs; @@ -294,7 +295,7 @@ static SummaryObs *summary_obs; //////////////////////////////////////////////////////////////////////// static int n_total_obs; // Running total of observations -static std::vector< Observation > observations; +static vector< Observation > observations; // // Output NetCDF file, dimensions, and variables @@ -363,10 +364,10 @@ static bool keep_level_category(int); static float derive_grib_code(int, float *, float *, double, float&); -static int combine_tqz_and_uv(std::map, - std::map, std::map &); -static float compute_pbl(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv); +static int combine_tqz_and_uv(map, + map, map &); +static float compute_pbl(map pqtzuv_map_tq, + map pqtzuv_map_uv); static void copy_pqtzuv(float *to_pqtzuv, float *from_pqtzuv, bool copy_all=true); static bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_code, const float pbl_p, const float pbl_h, const float pbl_qm, @@ -376,17 +377,17 @@ static bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_co static int interpolate_by_pressure(int length, float *pres_data, float *var_data); static void interpolate_pqtzuv(float*, float*, float*); static bool is_valid_pb_data(float pb_value); -static void log_merged_tqz_uv(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv, - std::map &pqtzuv_map_merged, +static void log_merged_tqz_uv(map pqtzuv_map_tq, + map pqtzuv_map_uv, + map &pqtzuv_map_merged, const char *method_name); static void log_pbl_input(int pbl_level, const char *method_name); -static void log_tqz_and_uv(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv, +static void log_tqz_and_uv(map pqtzuv_map_tq, + map pqtzuv_map_uv, const char *method_name); -static void merge_records(float *first_pqtzuv, std::map pqtzuv_map_pivot, - std::map pqtzuv_map_aux, - std::map &pqtzuv_map_merged); +static void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, + map pqtzuv_map_aux, + map &pqtzuv_map_merged); static void usage(); static void set_pbfile(const StringArray &); @@ -458,7 +459,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return program_name; } @@ -623,7 +624,7 @@ ConcatString save_bufr_table_to_file(const char *blk_file, int file_id) { closepb_(&file_id); //close(file_id); // Delete the temporary blocked file - remove_temp_file((std::string)blk_file); + remove_temp_file((string)blk_file); return tbl_filename; } @@ -656,7 +657,7 @@ void get_variable_info(const char* tbl_filename) { ConcatString input_data; if (fp != NULL) { char var_name[BUFR_NAME_LEN+1]; - char var_desc[std::max(BUFR_DESCRIPTION_LEN,BUFR_SEQUENCE_LEN)+1]; + char var_desc[max(BUFR_DESCRIPTION_LEN,BUFR_SEQUENCE_LEN)+1]; char var_unit_str[BUFR_UNIT_LEN+1]; bool find_mnemonic = false; @@ -974,7 +975,7 @@ void process_pbfile(int i_pb) { } int grib_code, bufr_var_index; - std::map message_type_map = conf_info.getMessageTypeMap(); + map message_type_map = conf_info.getMessageTypeMap(); int bin_count = nint(npbmsg/20.0); int bufr_hdr_length = bufr_hdrs.length(); @@ -1013,9 +1014,9 @@ void process_pbfile(int i_pb) { unixtime prev_hdr_vld_ut = (unixtime) 0; char prev_hdr_typ[max_str_len], prev_hdr_sid[max_str_len]; double prev_hdr_lat, prev_hdr_lon, prev_hdr_elv; - std::map pqtzuv_map_tq; - std::map pqtzuv_map_uv; - std::vector pqtzuv_list; + map pqtzuv_map_tq; + map pqtzuv_map_uv; + vector pqtzuv_list; // Initialize prev_hdr_lat = prev_hdr_lon = prev_hdr_elv = bad_data_double; @@ -1054,11 +1055,11 @@ void process_pbfile(int i_pb) { if(mlog.verbosity_level() > 0) { if(bin_count > 0 && (i_read+1)%bin_count == 0) { - std::cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << std::flush; + cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << flush; showed_progress = true; if(mlog.verbosity_level() >= debug_level_for_performance) { end_t = clock(); - std::cout << (end_t-start_t)/double(CLOCKS_PER_SEC) + cout << (end_t-start_t)/double(CLOCKS_PER_SEC) << " seconds\n"; start_t = clock(); } @@ -1306,8 +1307,8 @@ void process_pbfile(int i_pb) { bool is_airnow = (0 == strcmp("AIRNOW", hdr_typ) || 0 == strcmp("ANOWPM", hdr_typ)); - if (0 < message_type_map.count((std::string)hdr_typ)) { - ConcatString mappedMessageType = message_type_map[(std::string)hdr_typ]; + if (0 < message_type_map.count((string)hdr_typ)) { + ConcatString mappedMessageType = message_type_map[(string)hdr_typ]; mlog << Debug(6) << "\n" << method_name << "Switching report type \"" << hdr_typ << "\" to message type \"" << mappedMessageType << "\".\n"; @@ -1526,7 +1527,7 @@ void process_pbfile(int i_pb) { // continue to the next observation variable if(!keep_bufr_obs_index(bufr_var_index)) continue; - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); @@ -1565,7 +1566,7 @@ void process_pbfile(int i_pb) { if(is_eq(obs_arr[4], fill_value)) continue; - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); @@ -1700,7 +1701,7 @@ void process_pbfile(int i_pb) { obs_arr[2] = cape_p; obs_arr[3] = cape_h; obs_arr[4] = cape_val; // observation value - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, cape_qm, OBS_BUFFER_SIZE); cape_count++; @@ -1734,7 +1735,7 @@ void process_pbfile(int i_pb) { obs_arr[2] = cape_p; obs_arr[3] = cape_h; obs_arr[4] = mlcape_val; // observation value - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, cape_qm, OBS_BUFFER_SIZE); mlcape_count++; @@ -1865,7 +1866,7 @@ void process_pbfile(int i_pb) { } } - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, quality_mark, OBS_BUFFER_SIZE); // Increment the current and total observations counts @@ -1896,7 +1897,7 @@ void process_pbfile(int i_pb) { if (insert_pbl(obs_arr, pbl_value, pbl_code, pbl_p, pbl_h, pbl_qm, hdr_lat, hdr_lon, hdr_elv, hdr_vld_ut, hdr_typ, hdr_sid)) n_derived_obs++; - for(std::vector::iterator it = pqtzuv_list.begin(); + for(vector::iterator it = pqtzuv_list.begin(); it != pqtzuv_list.end(); ++it) { delete *it; } @@ -1936,7 +1937,7 @@ void process_pbfile(int i_pb) { if (insert_pbl(obs_arr, pbl_value, pbl_code, pbl_p, pbl_h, pbl_qm, hdr_lat, hdr_lon, hdr_elv, hdr_vld_ut, hdr_typ, hdr_sid)) n_derived_obs++; - for(std::vector::iterator it = pqtzuv_list.begin(); + for(vector::iterator it = pqtzuv_list.begin(); it != pqtzuv_list.end(); ++it) { delete *it; } @@ -1952,7 +1953,7 @@ void process_pbfile(int i_pb) { log_message << (end_t-start_t)/double(CLOCKS_PER_SEC) << " seconds"; //start_t = clock(); } - std::cout << log_message << "\n"; + cout << log_message << "\n"; } if(0 < diff_file_time_count && 0 < diff_file_times.n_elements()) { @@ -1970,7 +1971,7 @@ void process_pbfile(int i_pb) { } nc_point_obs.write_observation(); - if(mlog.verbosity_level() > 0) std::cout << "\n" << std::flush; + if(mlog.verbosity_level() > 0) cout << "\n" << flush; mlog << Debug(2) << "Total Messages processed\t\t= " << npbmsg << "\n" @@ -2050,9 +2051,9 @@ void process_pbfile(int i_pb) { remove_temp_file(blk_file); if(mlog.verbosity_level() >= debug_level_for_performance) { method_end = clock(); - std::cout << " PERF: " << method_name_s << " " - << (method_end-method_start)/double(CLOCKS_PER_SEC) - << " seconds\n"; + cout << " PERF: " << method_name_s << " " + << (method_end-method_start)/double(CLOCKS_PER_SEC) + << " seconds\n"; } if(i_msg <= 0) { @@ -2193,7 +2194,7 @@ void process_pbfile_metadata(int i_pb) { if(mlog.verbosity_level() > 0) { if(nint(npbmsg/20.0) > 0 && (i_read+1)%nint(npbmsg/20.0) == 0) { showed_progress = true; - std::cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << std::flush; + cout << nint((double) (i_read+1)/npbmsg*100.0) << "% " << flush; } } @@ -2355,7 +2356,7 @@ void process_pbfile_metadata(int i_pb) { } else { for (index=0; index variable \"" << bufr_var_name <<"\" does not exist at BUFR file\n\n"; @@ -2416,7 +2417,7 @@ void process_pbfile_metadata(int i_pb) { } } // end for vIdx } // end for - if(showed_progress && mlog.verbosity_level() > 0) std::cout << "\n"; + if(showed_progress && mlog.verbosity_level() > 0) cout << "\n"; int bufr_var_index = 0; bool has_prepbufr_vars = false; @@ -2467,7 +2468,7 @@ void write_netcdf_hdr_data() { long dim_count, pb_hdr_count; bool is_prepbufr = is_prepbufr_file(&event_names); TimeSummaryInfo summary_info = conf_info.getSummaryInfo(); - static const std::string method_name = "write_netcdf_hdr_data() "; + static const string method_name = "write_netcdf_hdr_data() "; pb_hdr_count = (long) nc_point_obs.get_hdr_index(); nc_point_obs.set_nc_out_data(observations, summary_obs, @@ -2501,10 +2502,10 @@ void write_netcdf_hdr_data() { StringArray nc_var_name_arr; StringArray nc_var_unit_arr; StringArray nc_var_desc_arr; - std::map obs_var_map = conf_info.getObsVarMap(); + map obs_var_map = conf_info.getObsVarMap(); for(int i=0; i= 0 && m_strlen("Variable index can't be negative")); - std::string var_name = bufr_obs_name_arr[var_index]; + string var_name = bufr_obs_name_arr[var_index]; Observation obs = Observation(hdr_typ.text(), hdr_sid.text(), hdr_vld, @@ -2916,8 +2917,8 @@ void copy_pqtzuv(float *to_pqtzuv, float *from_pqtzuv, bool copy_all) { //////////////////////////////////////////////////////////////////////// -int combine_tqz_and_uv(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv, std::map &pqtzuv_map_merged) { +int combine_tqz_and_uv(map pqtzuv_map_tq, + map pqtzuv_map_uv, map &pqtzuv_map_merged) { static const char *method_name = "combine_tqz_and_uv() "; int tq_count = pqtzuv_map_tq.size(); int uv_count = pqtzuv_map_uv.size(); @@ -2927,7 +2928,7 @@ int combine_tqz_and_uv(std::map pqtzuv_map_tq, float *pqtzuv_merged = (float *) 0; float *next_pqtzuv, *prev_pqtzuv; float tq_pres_max, tq_pres_min, uv_pres_max, uv_pres_min; - std::map::iterator it, it_tq, it_uv; + map::iterator it, it_tq, it_uv; // Gets pressure levels for TQZ records it = pqtzuv_map_tq.begin(); @@ -3035,8 +3036,8 @@ int combine_tqz_and_uv(std::map pqtzuv_map_tq, //////////////////////////////////////////////////////////////////////// -float compute_pbl(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv) { +float compute_pbl(map pqtzuv_map_tq, + map pqtzuv_map_uv) { int jpbl; // - BOUNDARY-LAYER TOP (LEVEL NUMBER - INTEGER) int mzbl; // - TOP OF MODEL DOMAIN (LEVEL NUMBER - INTEGER) float hpbl; // M ATMOSPHERIC BOUNDARY-LAYER DEPTH @@ -3044,7 +3045,7 @@ float compute_pbl(std::map pqtzuv_map_tq, int pbl_level; int tq_count = pqtzuv_map_tq.size(); int uv_count = pqtzuv_map_uv.size(); - std::map::iterator it; + map::iterator it; static const char *method_name = "compute_pbl() "; hpbl = bad_data_float; @@ -3054,7 +3055,7 @@ float compute_pbl(std::map pqtzuv_map_tq, int hgt_cnt, spfh_cnt; IntArray selected_levels; - std::map pqtzuv_map_merged; + map pqtzuv_map_merged; pbl_level = combine_tqz_and_uv(pqtzuv_map_tq, pqtzuv_map_uv, pqtzuv_map_merged); mlog << Debug(7) << method_name << "pbl_level= " << pbl_level @@ -3204,7 +3205,7 @@ bool insert_pbl(float *obs_arr, const float pbl_value, const int pbl_code, << " (" << hdr_info<< ")\n"; } else { - addObservation(obs_arr, (std::string)hdr_typ, (std::string)hdr_sid, hdr_vld_ut, + addObservation(obs_arr, (string)hdr_typ, (string)hdr_sid, hdr_vld_ut, hdr_lat, hdr_lon, hdr_elv, pbl_qm, OBS_BUFFER_SIZE); added = true; } @@ -3313,13 +3314,13 @@ static bool is_valid_pb_data(float pb_value) { //////////////////////////////////////////////////////////////////////// -void merge_records(float *first_pqtzuv, std::map pqtzuv_map_pivot, - std::map pqtzuv_map_aux, std::map &pqtzuv_map_merged) { +void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, + map pqtzuv_map_aux, map &pqtzuv_map_merged) { float cur_pres; float *cur_pqtzuv, *next_pqtzuv, *prev_pqtzuv; float *pqtzuv_merged; - std::map::iterator it_pivot, it_aux; + map::iterator it_pivot, it_aux; static const char *method_name = "merge_records() "; float first_pres = first_pqtzuv[0]; @@ -3386,12 +3387,12 @@ void merge_records(float *first_pqtzuv, std::map pqtzuv_map_pivot //////////////////////////////////////////////////////////////////////// -void log_tqz_and_uv(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv, const char *method_name) { +void log_tqz_and_uv(map pqtzuv_map_tq, + map pqtzuv_map_uv, const char *method_name) { int offset; ConcatString buf; StringArray log_array; - std::map::iterator it; + map::iterator it; for (it=pqtzuv_map_tq.begin(); it!=pqtzuv_map_tq.end(); ++it) { float *pqtzuv = it->second; @@ -3425,13 +3426,13 @@ void log_tqz_and_uv(std::map pqtzuv_map_tq, //////////////////////////////////////////////////////////////////////// -void log_merged_tqz_uv(std::map pqtzuv_map_tq, - std::map pqtzuv_map_uv, - std::map &pqtzuv_map_merged, +void log_merged_tqz_uv(map pqtzuv_map_tq, + map pqtzuv_map_uv, + map &pqtzuv_map_merged, const char *method_name) { ConcatString buf; StringArray log_array; - for (std::map::iterator it=pqtzuv_map_merged.begin(); + for (map::iterator it=pqtzuv_map_merged.begin(); it!=pqtzuv_map_merged.end(); ++it) { float *pqtzuv = it->second; buf.clear(); @@ -3487,68 +3488,68 @@ void log_pbl_input(int pbl_level, const char *method_name) { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tprepbufr_file\n" - << "\tnetcdf_file\n" - << "\tconfig_file\n" - << "\t[-pbfile prepbufr_file]\n" - << "\t[-valid_beg time]\n" - << "\t[-valid_end time]\n" - << "\t[-nmsg n]\n" - << "\t[-index]\n" - << "\t[-dump path]\n" - << "\t[-obs_var var]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" + << "Usage: " << program_name << "\n" + << "\tprepbufr_file\n" + << "\tnetcdf_file\n" + << "\tconfig_file\n" + << "\t[-pbfile prepbufr_file]\n" + << "\t[-valid_beg time]\n" + << "\t[-valid_end time]\n" + << "\t[-nmsg n]\n" + << "\t[-index]\n" + << "\t[-dump path]\n" + << "\t[-obs_var var]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"prepbufr_file\" is the input PrepBufr " - << "observation file to be converted to netCDF format " - << "(required).\n" + << "\twhere\t\"prepbufr_file\" is the input PrepBufr " + << "observation file to be converted to netCDF format " + << "(required).\n" - << "\t\t\"netcdf_file\" indicates the name of the output " - << "netCDF file to be written (required).\n" + << "\t\t\"netcdf_file\" indicates the name of the output " + << "netCDF file to be written (required).\n" - << "\t\t\"config_file\" is a PB2NCConfig file containing the " - << "desired configuration settings (required).\n" + << "\t\t\"config_file\" is a PB2NCConfig file containing the " + << "desired configuration settings (required).\n" - << "\t\t\"-pbfile prepbufr_file\" may be used to specify " - << "additional input PrepBufr observation files to be used " - << "(optional).\n" + << "\t\t\"-pbfile prepbufr_file\" may be used to specify " + << "additional input PrepBufr observation files to be used " + << "(optional).\n" - << "\t\t\"-valid_beg time\" in YYYYMMDD[_HH[MMSS]] sets the " - << "beginning of the retention time window (optional).\n" + << "\t\t\"-valid_beg time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "beginning of the retention time window (optional).\n" - << "\t\t\"-valid_end time\" in YYYYMMDD[_HH[MMSS]] sets the " - << "end of the retention time window (optional).\n" + << "\t\t\"-valid_end time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "end of the retention time window (optional).\n" - << "\t\t\"-nmsg n\" indicates the number of PrepBufr message " - << "to process (optional).\n" + << "\t\t\"-nmsg n\" indicates the number of PrepBufr message " + << "to process (optional).\n" - << "\t\t\"-dump path\" indicates that the entire contents of " - << "\"prepbufr_file\" should also be dumped to text files " - << "in the directory specified (optional).\n" + << "\t\t\"-dump path\" indicates that the entire contents of " + << "\"prepbufr_file\" should also be dumped to text files " + << "in the directory specified (optional).\n" - << "\t\t\"-obs_var var1,...\" or multiple \"-obs_var var\" sets the variable list to be saved" - << " from input BUFR files (optional, default: all).\n" + << "\t\t\"-obs_var var1,...\" or multiple \"-obs_var var\" sets the variable list to be saved" + << " from input BUFR files (optional, default: all).\n" - << "\t\t\"-index\" indicates that the meta data (available variables and headers)" - << " is extracted from \"prepbufr_file\" (optional). " - << "No NetCDF outputs. \"-obs_var\" is ignored.\n" + << "\t\t\"-index\" indicates that the meta data (available variables and headers)" + << " is extracted from \"prepbufr_file\" (optional). " + << "No NetCDF outputs. \"-obs_var\" is ignored.\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (" - << conf_info.conf.nc_compression() << ") (optional).\n\n" + << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (" + << conf_info.conf.nc_compression() << ") (optional).\n\n" - << std::flush; + << flush; exit (1); } diff --git a/src/tools/other/plot_data_plane/plot_data_plane.cc b/src/tools/other/plot_data_plane/plot_data_plane.cc index 3129674659..940a355073 100644 --- a/src/tools/other/plot_data_plane/plot_data_plane.cc +++ b/src/tools/other/plot_data_plane/plot_data_plane.cc @@ -26,11 +26,12 @@ // ---- ---- ---- ----------- // 000 12/19/11 Holmes New // 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 002 09/28/22 Prestopnik Added "std::"; removing namespace -// from header files +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -62,7 +63,7 @@ //////////////////////////////////////////////////////////////////////// -static ConcatString program_name = (std::string)"plot_data_plane"; +static ConcatString program_name = (string)"plot_data_plane"; //////////////////////////////////////////////////////////////////////// @@ -99,7 +100,7 @@ int met_main(int argc, char * argv[]) { double data_min, data_max; bool status = false; - std::ios::sync_with_stdio(true); + ios::sync_with_stdio(true); // // set the default color table @@ -216,7 +217,7 @@ int met_main(int argc, char * argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "plot_data_plane"; } @@ -279,44 +280,44 @@ void process_command_line(int argc, char **argv) { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tinput_filename\n" - << "\toutput_filename\n" - << "\tfield_string\n" - << "\t[-color_table color_table_name]\n" - << "\t[-plot_range min max]\n" - << "\t[-title title_string]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\tinput_filename\n" + << "\toutput_filename\n" + << "\tfield_string\n" + << "\t[-color_table color_table_name]\n" + << "\t[-plot_range min max]\n" + << "\t[-title title_string]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"input_filename\" is the name of a " - << "gridded data file to be plotted (required).\n" + << "\twhere\t\"input_filename\" is the name of a " + << "gridded data file to be plotted (required).\n" - << "\t\t\"output_filename\" is the name of the output " - << "PostScript file to be written (required).\n" + << "\t\t\"output_filename\" is the name of the output " + << "PostScript file to be written (required).\n" - << "\t\t\"field_string\" defines the data to be plotted " - << "from the input file (required).\n" + << "\t\t\"field_string\" defines the data to be plotted " + << "from the input file (required).\n" - << "\t\t\"-color_table color_table_name\" overrides the " - << "default color table " - << "(\"colortables/met_default.ctable\") " - << "(optional).\n" + << "\t\t\"-color_table color_table_name\" overrides the " + << "default color table " + << "(\"colortables/met_default.ctable\") " + << "(optional).\n" - << "\t\t\"-plot_range min max\" defines the range of the " - << "data to be plotted (optional).\n" + << "\t\t\"-plot_range min max\" defines the range of the " + << "data to be plotted (optional).\n" - << "\t\t\"-title title_string\" specifies the plot title " - << "string (optional).\n" + << "\t\t\"-title title_string\" specifies the plot title " + << "string (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << flush; exit(1); diff --git a/src/tools/other/plot_point_obs/plot_point_obs.cc b/src/tools/other/plot_point_obs/plot_point_obs.cc index 47ccd59e44..164d4304f7 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs.cc @@ -26,9 +26,12 @@ // 003 01/24/13 Halley Gotway Add -dotsize. // 004 11/10/20 Halley Gotway Add -config and -plot_grid. // 005 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_mai +// 006 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/plot_point_obs/plot_point_obs.h b/src/tools/other/plot_point_obs/plot_point_obs.h index aeef6c87b2..527d7098b5 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.h +++ b/src/tools/other/plot_point_obs/plot_point_obs.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/05/20 Halley Gotway New +// 001 09/29/22 Prestopnik Removing namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h index 0791512f7c..38c6c06a2d 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h @@ -103,7 +103,7 @@ class PlotPointObsOpt { // Unique collection of locations int n_obs; - vector locations; + std::vector locations; // Flags bool store_obs_val; @@ -150,7 +150,7 @@ class PlotPointObsConfInfo { UserFunc_1Arg const_dotsize_fx; // Options for plotting point data - vector point_opts; + std::vector point_opts; ConcatString tmp_dir; // Directory for temporary files ConcatString version; // Config file version diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index caf551d66b..710f91431a 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -22,11 +22,12 @@ // 000 11-12-14 Halley Gotway New // 001 06-07-22 Halley Gotway MET #2173 Fix python embedding // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09-12-22 Prestopnik Added "std::"; removing namespace from -// header files +// 003 09-12-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -105,7 +106,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "shift_data_plane"; } @@ -318,14 +319,14 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, int deflate_level = compress_level; if (deflate_level < 0) deflate_level = 0; - NcVar data_var = add_var(f_out, (std::string)cs, ncFloat, lat_dim, lon_dim, deflate_level); - add_att(&data_var, "name", (std::string)cs); - add_att(&data_var, "long_name", (std::string)vinfo->long_name_attr()); - add_att(&data_var, "level", (std::string)vinfo->level_attr()); - add_att(&data_var, "units", (std::string)vinfo->units_attr()); + NcVar data_var = add_var(f_out, (string)cs, ncFloat, lat_dim, lon_dim, deflate_level); + add_att(&data_var, "name", (string)cs); + add_att(&data_var, "long_name", (string)vinfo->long_name_attr()); + add_att(&data_var, "level", (string)vinfo->level_attr()); + add_att(&data_var, "units", (string)vinfo->units_attr()); add_att(&data_var, "_FillValue", bad_data_float); write_netcdf_var_times(&data_var, dp); - add_att(&data_var, "smoothing_method", (std::string)interpmthd_to_string(Method)); + add_att(&data_var, "smoothing_method", (string)interpmthd_to_string(Method)); add_att(&data_var, "smoothing_neighborhood", Width*Width); GridTemplateFactory gtf; @@ -366,55 +367,55 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\tinput_filename\n" - << "\toutput_filename\n" - << "\tfield_string\n" - << "\t-from lat lon\n" - << "\t-to lat lon\n" - << "\t[-method type]\n" - << "\t[-width n]\n" - << "\t[-shape SHAPE]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-compress level]\n\n" + << "Usage: " << program_name << "\n" + << "\tinput_filename\n" + << "\toutput_filename\n" + << "\tfield_string\n" + << "\t-from lat lon\n" + << "\t-to lat lon\n" + << "\t[-method type]\n" + << "\t[-width n]\n" + << "\t[-shape SHAPE]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-compress level]\n\n" - << "\twhere\t\"input_filename\" is the name of a " - << "gridded data file to be plotted (required).\n" + << "\twhere\t\"input_filename\" is the name of a " + << "gridded data file to be plotted (required).\n" - << "\t\t\"output_filename\" is the name of the output " - << "NetCDF file to be written (required).\n" + << "\t\t\"output_filename\" is the name of the output " + << "NetCDF file to be written (required).\n" - << "\t\t\"field_string\" defines the data to be shifted " - << "from the input file (required).\n" + << "\t\t\"field_string\" defines the data to be shifted " + << "from the input file (required).\n" - << "\t\t\"-from lat lon\" specifies the starting latitude " - << "(degrees north) and longitude (degrees east) to " - << "define the shift.\n" + << "\t\t\"-from lat lon\" specifies the starting latitude " + << "(degrees north) and longitude (degrees east) to " + << "define the shift.\n" - << "\t\t\"-to lat lon\" specifies the ending latitude " - << "(degrees north) and longitude (degrees east) to " - << "define the shift.\n" + << "\t\t\"-to lat lon\" specifies the ending latitude " + << "(degrees north) and longitude (degrees east) to " + << "define the shift.\n" - << "\t\t\"-method type\" overrides the default interpolation " - << "method (DW_MEAN) (optional).\n" + << "\t\t\"-method type\" overrides the default interpolation " + << "method (DW_MEAN) (optional).\n" - << "\t\t\"-width\" overrides the default interpolation width (2) " - << "(optional).\n" + << "\t\t\"-width\" overrides the default interpolation width (2) " + << "(optional).\n" - << "\t\t\"-shape\" overrides the default interpolation shape (SQUARE) " - << "(optional).\n" + << "\t\t\"-shape\" overrides the default interpolation shape (SQUARE) " + << "(optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (optional).\n\n" << std::flush; + << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (optional).\n\n" << flush; exit(1); } diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index aa17e3f2bf..e251493038 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; static const int gray_min = 130; // these values must be between 0 and 255 inclusive static const int gray_max = 255; @@ -169,7 +170,7 @@ return ( 0 ); //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "wwmca_plot"; } @@ -181,22 +182,22 @@ void usage() { -std::cout << "\nUsage: " << program_name << "\n" - << "\t[-outdir path]\n" - << "\t[-max max_minutes]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\twwmca_cloud_pct_file_list\n\n" - << "\twhere\t\"-outdir path\" overrides the default output " - << "directory (.) (optional).\n" - << "\t\t\"-max max_minutes\" overrides the default maximum " - << "minutes of (" << max_minutes << ") (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"wwmca_cloud_pct_file_list\" is a list of one or " - << "more wwmca cloud percent files to plot.\n\n"; +cout << "\nUsage: " << program_name << "\n" + << "\t[-outdir path]\n" + << "\t[-max max_minutes]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\twwmca_cloud_pct_file_list\n\n" + << "\twhere\t\"-outdir path\" overrides the default output " + << "directory (.) (optional).\n" + << "\t\t\"-max max_minutes\" overrides the default maximum " + << "minutes of (" << max_minutes << ") (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"wwmca_cloud_pct_file_list\" is a list of one or " + << "more wwmca cloud percent files to plot.\n\n"; exit ( 1 ); @@ -519,7 +520,7 @@ void draw_map(PSfile & plot, const char hemisphere) { MapRegion r; -std::ifstream in; +ifstream in; ConcatString filename; filename = replace_path(map_filename); diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index 29c75fbf87..32e12087fb 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -6,6 +6,8 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +using namespace std; + #include #include #include @@ -66,7 +68,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "rmw_analysis"; } @@ -74,30 +76,30 @@ const std::string get_tool_name() { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-data file_1 ... file_n | data_file_list\n" - << "\t-config file\n" - << "\t-out file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + << "Usage: " << program_name << "\n" + << "\t-data file_1 ... file_n | data_file_list\n" + << "\t-config file\n" + << "\t-out file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " - << "is the NetCDF output of TC-RMW to be processed or an " - << "ASCII file containing a list of files (required).\n" + << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " + << "is the NetCDF output of TC-RMW to be processed or an " + << "ASCII file containing a list of files (required).\n" - << "\t\t\"-config file\" is the RMWAnalysisConfig to be used " - << "(required).\n" + << "\t\t\"-config file\" is the RMWAnalysisConfig to be used " + << "(required).\n" - << "\t\t\"-out file\" is the NetCDF output file to be written " - << "(required).\n" + << "\t\t\"-out file\" is the NetCDF output file to be written " + << "(required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << flush; exit(1); } @@ -197,8 +199,8 @@ void setup() { << n_range << ", " << n_azimuth << ", " << n_level << ")\n"; // Get dimension coordinates - std::vector start; - std::vector count; + vector start; + vector count; start.push_back(0); ConcatString s; @@ -313,10 +315,10 @@ void process_files() { data_3d_sq.set_size(n_range, n_azimuth, n_level); // Set up array track point slices - std::vector start_2d; - std::vector count_2d; - std::vector start_3d; - std::vector count_3d; + vector start_2d; + vector count_2d; + vector start_3d; + vector count_3d; start_2d.push_back(0); start_2d.push_back(0); start_2d.push_back(0); @@ -432,11 +434,11 @@ void write_stats() { azimuth_dim = add_dim(nc_out, "azimuth", n_azimuth); level_dim = add_dim(nc_out, level_name, n_level); - std::vector dims_2d; + vector dims_2d; dims_2d.push_back(range_dim); dims_2d.push_back(azimuth_dim); - std::vector dims_3d; + vector dims_3d; dims_3d.push_back(range_dim); dims_3d.push_back(azimuth_dim); dims_3d.push_back(level_dim); @@ -445,10 +447,10 @@ void write_stats() { NcVar azimuth_var = nc_out->addVar("azimuth", ncDouble, azimuth_dim); NcVar level_var = nc_out->addVar(level_name, ncDouble, level_dim); - std::vector offset; - std::vector count_range; - std::vector count_azimuth; - std::vector count_level; + vector offset; + vector count_range; + vector count_azimuth; + vector count_level; offset.push_back(0); count_range.push_back(n_range); count_azimuth.push_back(n_azimuth); @@ -467,10 +469,10 @@ void write_stats() { level_var.putVar(offset, count_level, level_coord.data()); add_att(&level_var, "units", level_units); - std::vector offset_2d; - std::vector count_2d; - std::vector offset_3d; - std::vector count_3d; + vector offset_2d; + vector count_2d; + vector offset_3d; + vector count_3d; offset_2d.push_back(0); offset_2d.push_back(0); @@ -702,7 +704,7 @@ void read_nc_tracks(NcFile* nc_in) { mlog << Debug(3) << adeck_source << "\n"; - std::ofstream f; + ofstream f; f.open(adeck_source.c_str()); adeck_tracks.clear(); @@ -715,8 +717,8 @@ void read_nc_tracks(NcFile* nc_in) { NcVar track_lines_var = get_nc_var(nc_in, "TrackLines"); - std::vector counts; - std::vector offsets; + vector counts; + vector offsets; for(int i = 0; i < n_track_line; i++) { offsets.clear(); diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index ad7693f68b..2e490e1807 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -15,8 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 08/19/19 Fillmore New -// 001 09/28/22 Prestopnik Adding "std::"; Removing namspace -// from header files +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index db0588c05e..ed8860ed5f 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -203,7 +205,7 @@ void RMWAnalysisConfInfo::process_config() { if(mlog.verbosity_level() >=5) { mlog << Debug(5) << "Parsed data field " << i + 1 << ":\n"; - data_info[i]->dump(std::cout); + data_info[i]->dump(cout); } } diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index 00eeb6adde..d3ef66f474 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -18,9 +18,12 @@ // 001 07/25/14 Halley Gotway Add -land option and update how // distances are computed. // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -111,7 +114,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "tc_dland"; } @@ -235,7 +238,7 @@ void process_distances() { if (deflate_level < 0) deflate_level = 0; // Define Variables - dland_var = add_var(f_out, (std::string)"dland", ncFloat, lat_dim, lon_dim, deflate_level); + dland_var = add_var(f_out, (string)"dland", ncFloat, lat_dim, lon_dim, deflate_level); add_att(&dland_var, "long_name", "distance to land"); add_att(&dland_var, "units", "nm"); add_att(&dland_var, "_FillValue", bad_data_float); @@ -257,7 +260,7 @@ void process_distances() { for(y=0; y #include #include @@ -2490,7 +2492,7 @@ void write_nc(GenCTCInfo &gci) { nc_var_sa.add(var_name); // Define the variable - nc_var = add_var(nc_out, (std::string) var_name, + nc_var = add_var(nc_out, (string) var_name, ncFloat, lat_dim, lon_dim, conf_info.compression_level()); @@ -2574,52 +2576,52 @@ ConcatString string_to_basin_abbr(ConcatString cs) { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - - << "Usage: " << program_name << "\n" - << "\t-genesis source\n" - << "\t-edeck source\n" - << "\t-shape source\n" - << "\t-track source\n" - << "\t-config file\n" - << "\t[-out base]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" - - << "\twhere\t\"-genesis source\" is one or more ATCF genesis " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_gen_reg_exp << "\" (required if no -edeck or -shape).\n" - - << "\t\t\"-edeck source\" is one or more ensemble model output " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_reg_exp << "\" (required if no -genesis or -shape).\n" - - << "\t\t\"-shape source\" is one or more genesis area shapefiles, " - << "an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << gen_shp_reg_exp << "\" (required if no -genesis or -edeck).\n" - - << "\t\t\"-track source\" is one or more ATCF track " - << "files, an ASCII file list containing them, or a top-level " - << "directory with files matching the regular expression \"" - << atcf_reg_exp << "\" for the verifying BEST and operational " - << "tracks (required).\n" - - << "\t\t\"-config file\" is used once to specify the " - << "TCGenConfig file containing the desired configuration " - << "settings (required).\n" - - << "\t\t\"-out base\" overrides the default output file base " - << "(" << out_base << ") (optional).\n" - - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" - - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n"; + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + + << "Usage: " << program_name << "\n" + << "\t-genesis source\n" + << "\t-edeck source\n" + << "\t-shape source\n" + << "\t-track source\n" + << "\t-config file\n" + << "\t[-out base]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" + + << "\twhere\t\"-genesis source\" is one or more ATCF genesis " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_gen_reg_exp << "\" (required if no -edeck or -shape).\n" + + << "\t\t\"-edeck source\" is one or more ensemble model output " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_reg_exp << "\" (required if no -genesis or -shape).\n" + + << "\t\t\"-shape source\" is one or more genesis area shapefiles, " + << "an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << gen_shp_reg_exp << "\" (required if no -genesis or -edeck).\n" + + << "\t\t\"-track source\" is one or more ATCF track " + << "files, an ASCII file list containing them, or a top-level " + << "directory with files matching the regular expression \"" + << atcf_reg_exp << "\" for the verifying BEST and operational " + << "tracks (required).\n" + + << "\t\t\"-config file\" is used once to specify the " + << "TCGenConfig file containing the desired configuration " + << "settings (required).\n" + + << "\t\t\"-out base\" overrides the default output file base " + << "(" << out_base << ") (optional).\n" + + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" + + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n"; exit(1); } diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index de7f31fc31..f4ac5a74cf 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -850,7 +850,7 @@ void TCGenConfInfo::process_config() { //////////////////////////////////////////////////////////////////////// void TCGenConfInfo::process_flags( - const std::map &m, + const map &m, const TCGenNcOutInfo &n) { int i; @@ -1224,7 +1224,7 @@ void GenCTCInfo::add_best_gen(const GenesisInfo &gi) { //////////////////////////////////////////////////////////////////////// -void GenCTCInfo::inc_pnt(double lat, double lon, const std::string &s) { +void GenCTCInfo::inc_pnt(double lat, double lon, const string &s) { // Nothing to do if there is no DataPlane map entry if(DpMap.count(s) == 0) return; @@ -1247,7 +1247,7 @@ void GenCTCInfo::inc_pnt(double lat, double lon, const std::string &s) { //////////////////////////////////////////////////////////////////////// -void GenCTCInfo::inc_trk(const GenesisInfo &gi, const std::string &s) { +void GenCTCInfo::inc_trk(const GenesisInfo &gi, const string &s) { // Nothing to do if there is no DataPlane map entry if(DpMap.count(s) == 0) return; @@ -1367,10 +1367,10 @@ void ProbGenPCTInfo::add_probgen(const ProbGenInfo &pgi, int index, if(!LeadTimes.has(lead_hr)) { LeadTimes.add(lead_hr); - std::vector empty_pgi; - std::vector empty_idx; - std::vector empty_bgi; - std::vector empty_evt; + vector empty_pgi; + vector empty_idx; + vector empty_bgi; + vector empty_evt; PCTMap [lead_hr] = DefaultPCT; ProbGenMap[lead_hr] = empty_pgi; @@ -1422,10 +1422,10 @@ void ProbGenPCTInfo::add_genshape(const GenShapeInfo &gsi, int index, if(!LeadTimes.has(lead_hr)) { LeadTimes.add(lead_hr); - std::vector empty_gsi; - std::vector empty_idx; - std::vector empty_bgi; - std::vector empty_evt; + vector empty_gsi; + vector empty_idx; + vector empty_bgi; + vector empty_evt; PCTMap [lead_hr] = DefaultPCT; GenShapeMap[lead_hr] = empty_gsi; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index 9518cfd652..8872388932 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -34,11 +34,12 @@ // 011 07/27/18 Halley Gotway Support masks defined by // the gen_vx_mask tool. // 012 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 013 09/28/22 Prestopnik Adding "std::"; Removing namespace -// from header files +// 013 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -172,7 +173,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "tc_gen"; } @@ -1784,8 +1785,8 @@ void compute_track_err(const TrackInfo &adeck, const TrackInfo &bdeck, crtk_err.clear(); // Get the valid time range - ut_min = std::min(adeck.valid_min(), bdeck.valid_min()); - ut_max = std::max(adeck.valid_max(), bdeck.valid_max()); + ut_min = min(adeck.valid_min(), bdeck.valid_min()); + ut_max = max(adeck.valid_max(), bdeck.valid_max()); // Determine the valid increment // For BEST tracks, use a constant time step @@ -1846,8 +1847,8 @@ void compute_track_err(const TrackInfo &adeck, const TrackInfo &bdeck, is_bad_data(alon[i]) || is_bad_data(blon[i])) continue; // Keep track of min/max longitudes - lon_min = (std::min(alon[i], blon[i]) < lon_min ? std::min(alon[i], blon[i]) : lon_min); - lon_max = (std::max(alon[i], blon[i]) > lon_max ? std::max(alon[i], blon[i]) : lon_max); + lon_min = (min(alon[i], blon[i]) < lon_min ? min(alon[i], blon[i]) : lon_min); + lon_max = (max(alon[i], blon[i]) > lon_max ? max(alon[i], blon[i]) : lon_max); // Compute and store track errors latlon_to_xytk_err(alat[i], alon[i], blat[i], blon[i], x, y, tk); @@ -1958,7 +1959,7 @@ void write_tracks(const TrackPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - std::ofstream *out = (std::ofstream *) 0; + ofstream *out = (ofstream *) 0; // Set the track pair output file name out_file << out_base << tc_stat_file_ext; @@ -2002,11 +2003,11 @@ void write_tracks(const TrackPairInfoArray &p) { } // Write the AsciiTable contents and clean up - if(out != (std::ofstream *) 0) { + if(out != (ofstream *) 0) { *out << out_at; out->close(); delete out; - out = (std::ofstream *) 0; + out = (ofstream *) 0; } return; @@ -2019,7 +2020,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - std::ofstream *out = (std::ofstream *) 0; + ofstream *out = (ofstream *) 0; // Set the track pair output file name out_file << out_base << "_PROBRIRW" << tc_stat_file_ext; @@ -2080,11 +2081,11 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { } // Write the AsciiTable contents and clean up - if(out != (std::ofstream *) 0) { + if(out != (ofstream *) 0) { *out << out_at; out->close(); delete out; - out = (std::ofstream *) 0; + out = (ofstream *) 0; } return; @@ -2116,48 +2117,48 @@ void setup_table(AsciiTable &at) { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-adeck source and/or -edeck source\n" - << "\t-bdeck source\n" - << "\t-config file\n" - << "\t[-out base]\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + << "Usage: " << program_name << "\n" + << "\t-adeck source and/or -edeck source\n" + << "\t-bdeck source\n" + << "\t-config file\n" + << "\t[-out base]\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-adeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "model output \"" << atcf_suffix - << "\" data to process (required if no -edeck).\n" + << "\twhere\t\"-adeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "model output \"" << atcf_suffix + << "\" data to process (required if no -edeck).\n" - << "\t\t\"-edeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "ensemble model output \"" << atcf_suffix - << "\" data to process (required if no -adeck).\n" + << "\t\t\"-edeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "ensemble model output \"" << atcf_suffix + << "\" data to process (required if no -adeck).\n" - << "\t\t\"-bdeck source\" is used one or more times to " - << "specify a file or top-level directory containing ATCF " - << "best track \"" << atcf_suffix - << "\" data to process (required).\n" + << "\t\t\"-bdeck source\" is used one or more times to " + << "specify a file or top-level directory containing ATCF " + << "best track \"" << atcf_suffix + << "\" data to process (required).\n" - << "\t\t\"-config file\" is used once to specify the " - << "TCPairsConfig file containing the desired configuration " - << "settings (required).\n" + << "\t\t\"-config file\" is used once to specify the " + << "TCPairsConfig file containing the desired configuration " + << "settings (required).\n" - << "\t\t\"-out base\" overrides the default output file base " - << "(" << out_base << ") (optional).\n" + << "\t\t\"-out base\" overrides the default output file base " + << "(" << out_base << ") (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" - << "\tNote: The \"-adeck\", \"-edeck\", and \"-bdeck\" options " - << "may include \"suffix=string\" to modify the model names " - << "from that source.\n\n"; + << "\tNote: The \"-adeck\", \"-edeck\", and \"-bdeck\" options " + << "may include \"suffix=string\" to modify the model names " + << "from that source.\n\n"; exit(1); } diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.h b/src/tools/tc_utils/tc_pairs/tc_pairs.h index 2ef0342a88..e49aed3c3d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.h +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.h @@ -16,8 +16,7 @@ // ---- ---- ---- ----------- // 000 03/14/12 Halley Gotway New // 001 03/09/17 Halley Gotway Define BEST track time step. -// 002 09/28/22 Prestopnik Adding "std::"; Removing namspace -// from header files +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 65de37f717..7cffe21f4e 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -17,10 +17,12 @@ // 000 04/18/19 Fillmore New // 001 05/15/20 Halley Gotway Fix data file list option logic. // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09/28/22 Prestopnik MET #2227 Remove namspace std +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -107,34 +109,34 @@ const string get_tool_name() { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-data file_1 ... file_n | data_file_list\n" - << "\t-deck file\n" - << "\t-config file\n" - << "\t-out file\n" - << "\t[-log file]\n" - << "\t[-v level]\n\n" + cout << "\n*** Model Evaluation Tools (MET" << met_version + << ") ***\n\n" + << "Usage: " << program_name << "\n" + << "\t-data file_1 ... file_n | data_file_list\n" + << "\t-deck file\n" + << "\t-config file\n" + << "\t-out file\n" + << "\t[-log file]\n" + << "\t[-v level]\n\n" - << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " - << "specifies the gridded data files or an ASCII file " - << "containing a list of files to be used (required).\n" + << "\twhere\t\"-data file_1 ... file_n | data_file_list\" " + << "specifies the gridded data files or an ASCII file " + << "containing a list of files to be used (required).\n" - << "\t\t\"-deck source\" is the ATCF format data source " - << "(required).\n" + << "\t\t\"-deck source\" is the ATCF format data source " + << "(required).\n" - << "\t\t\"config_file\" is a TCRMWConfig file to be used " - << "(required).\n" + << "\t\t\"config_file\" is a TCRMWConfig file to be used " + << "(required).\n" - << "\t\t\"-out file\" is the NetCDF output file to be written " - << "(required).\n" + << "\t\t\"-out file\" is the NetCDF output file to be written " + << "(required).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n\n" << std::flush; + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n\n" << flush; exit(1); } @@ -587,7 +589,7 @@ void setup_nc_file() { // Get VarInfo data_info = conf_info.data_info[i_var]; mlog << Debug(4) << "Processing field: " << data_info->magic_str() << "\n"; - std::string fname = data_info->name_attr(); + string fname = data_info->name_attr(); variable_levels[fname].push_back(data_info->level_attr()); variable_long_names[fname] = data_info->long_name_attr(); variable_units[fname] = data_info->units_attr(); @@ -690,8 +692,8 @@ void process_fields(const TrackInfoArray& tracks) { // Update the variable info with the valid time of the track point data_info = conf_info.data_info[i_var]; - std::string sname = data_info->name_attr().string(); - std::string slevel = data_info->level_attr().string(); + string sname = data_info->name_attr().string(); + string slevel = data_info->level_attr().string(); data_info->set_valid(valid_time); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 74f2760e66..1763703999 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -15,8 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04/18/19 Fillmore New -// 001 09/28/22 Prestopnik Adding "std::"; removing namspace -// from header files +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 2d58c0f4de..951c43f193 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -229,7 +231,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { if(mlog.verbosity_level() >=5) { mlog << Debug(5) << "Parsed data field " << i + 1 << ":\n"; - data_info[i]->dump(std::cout); + data_info[i]->dump(cout); } } diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc index d9dfd003a9..3ed71fc98f 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc @@ -16,10 +16,11 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 05/11/22 Albo Pulled the wind conversion into a class -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; #include "tc_rmw_wind_converter.h" #include "series_data.h" @@ -84,8 +85,8 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { VarInfo* data_info = (VarInfo*) 0; for(int i_var = 0; i_var < _conf->get_n_data(); i_var++) { data_info = _conf->data_info[i_var]; - std::string varname = data_info->name_attr().string(); - std::string varlevel = data_info->level_attr().string(); + string varname = data_info->name_attr().string(); + string varlevel = data_info->level_attr().string(); if (varname == _conf->u_wind_field_name.string()) { _uIndexMap[varlevel] = i_var; } @@ -100,7 +101,7 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { << _conf->v_wind_field_name.string() << " has " << _vIndexMap.size() << " inputs\n"; _computeWinds = false; } - std::map::const_iterator iu, iv; + map::const_iterator iu, iv; for (iu=_uIndexMap.begin(), iv=_vIndexMap.begin(); iu!=_uIndexMap.end(); ++iu, ++iv) { if (iu->first != iv->first) { mlog << Warning << "Ordering of u/v wind input levels not the same, not implemented, no wind conversions will be done:\n" @@ -112,7 +113,7 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { //////////////////////////////////////////////////////////////////////// -void TCRMW_WindConverter::update_input(const std::string &variableName, const std::string &units) { +void TCRMW_WindConverter::update_input(const string &variableName, const string &units) { if (_computeWinds) { if (variableName == _conf->u_wind_field_name.string()) { _foundUInInput = true; @@ -126,9 +127,9 @@ void TCRMW_WindConverter::update_input(const std::string &variableName, const st //////////////////////////////////////////////////////////////////////// -void TCRMW_WindConverter::append_nc_output_vars(std::map > &variable_levels, - std::map &variable_long_names, - std::map &variable_units) { +void TCRMW_WindConverter::append_nc_output_vars(map > &variable_levels, + map &variable_long_names, + map &variable_units) { if (!_computeWinds) { return; } @@ -158,8 +159,8 @@ void TCRMW_WindConverter::append_nc_output_vars(std::map #include #include @@ -75,7 +77,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// -const std::string get_tool_name() { +const string get_tool_name() { return "tc_stat"; } @@ -270,7 +272,7 @@ void open_out_file() { if(out_file.empty()) return; // Create an output file and point to it - tc_stat_out = new std::ofstream; + tc_stat_out = new ofstream; tc_stat_out->open(out_file.c_str()); if(!(*tc_stat_out)) { @@ -288,7 +290,7 @@ void open_out_file() { void close_out_file() { // Close the output file - if(tc_stat_out != (std::ofstream *) 0) { + if(tc_stat_out != (ofstream *) 0) { // List the file being closed mlog << Debug(1) @@ -297,7 +299,7 @@ void close_out_file() { // Close the output file tc_stat_out->close(); delete tc_stat_out; - tc_stat_out = (std::ofstream *) 0; + tc_stat_out = (ofstream *) 0; } return; @@ -307,40 +309,40 @@ void close_out_file() { void usage() { - std::cout << "\n*** Model Evaluation Tools (MET" << met_version + cout << "\n*** Model Evaluation Tools (MET" << met_version << ") ***\n\n" - << "Usage: " << program_name << "\n" - << "\t-lookin source\n" - << "\t[-out file]\n" - << "\t[-log file]\n" - << "\t[-v level]\n" - << "\t[-config file] | [JOB COMMAND LINE]\n\n" + << "Usage: " << program_name << "\n" + << "\t-lookin source\n" + << "\t[-out file]\n" + << "\t[-log file]\n" + << "\t[-v level]\n" + << "\t[-config file] | [JOB COMMAND LINE]\n\n" - << "\twhere\t\"-lookin source\" is used one or more times to " - << "specify a file or top-level directory containing TC-MET " - << "files \"" << tc_stat_file_ext << "\" data to process " - << "(required).\n" + << "\twhere\t\"-lookin source\" is used one or more times to " + << "specify a file or top-level directory containing TC-MET " + << "files \"" << tc_stat_file_ext << "\" data to process " + << "(required).\n" - << "\t\t\"-out file\" to redirect the job output to a " - << "file (optional).\n" + << "\t\t\"-out file\" to redirect the job output to a " + << "file (optional).\n" - << "\t\t\"-log file\" outputs log messages to the specified " - << "file (optional).\n" + << "\t\t\"-log file\" outputs log messages to the specified " + << "file (optional).\n" - << "\t\t\"-v level\" overrides the default level of logging (" - << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-v level\" overrides the default level of logging (" + << mlog.verbosity_level() << ") (optional).\n" - << "\t\t\"-config file\" specifies the TCStatConfig file " - << "containing the desired configuration settings.\n" + << "\t\t\"-config file\" specifies the TCStatConfig file " + << "containing the desired configuration settings.\n" - << "\t\t\"JOB COMMAND LINE\" specifies all the arguments " - << "necessary to perform a single job.\n\n" + << "\t\t\"JOB COMMAND LINE\" specifies all the arguments " + << "necessary to perform a single job.\n\n" - << "\tNOTE: Refer to a TCStatConfig file for details " - << "on how to specify the JOB COMMAND LINE.\n\n" + << "\tNOTE: Refer to a TCStatConfig file for details " + << "on how to specify the JOB COMMAND LINE.\n\n" - << std::flush; + << flush; exit(1); } diff --git a/src/tools/tc_utils/tc_stat/tc_stat.h b/src/tools/tc_utils/tc_stat/tc_stat.h index 70da1913f3..e037f69bb5 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.h +++ b/src/tools/tc_utils/tc_stat/tc_stat.h @@ -15,8 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04/03/12 Halley Gotway New -// 001 09/28/22 Prestopnik Adding "std::"; Removing namespace -// from header files +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc index 8ea0cb55b0..d2edb908df 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc @@ -27,10 +27,10 @@ using namespace std; // Functions for parsing config entries static void parse_conf_thresh_map(MetConfig &, const char *, const char *, - std::map &); + map &); static void parse_conf_string_map(MetConfig &, const char *, const char *, - std::map &); + map &); //////////////////////////////////////////////////////////////////////// // @@ -262,7 +262,7 @@ void TCStatConfInfo::process_config() { void parse_conf_thresh_map(MetConfig &conf, const char *conf_key_name, const char *conf_key_val, - std::map &m) { + map &m) { StringArray sa; ThreshArray ta_val, ta_new; @@ -297,7 +297,7 @@ void parse_conf_thresh_map(MetConfig &conf, void parse_conf_string_map(MetConfig &conf, const char *conf_key_name, const char *conf_key_val, - std::map &m) { + map &m) { StringArray sa, sa_val, sa_new; sa = conf.lookup_string_array(conf_key_name); diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 9cc54447f7..79e217ffa4 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -39,8 +39,8 @@ static const char *TCStatJobType_ProbRIRWStr = "probrirw"; //////////////////////////////////////////////////////////////////////// // Functions for parsing command line options -static void parse_thresh_option(const char *, const char *, std::map &); -static void parse_string_option(const char *, const char *, std::map &); +static void parse_thresh_option(const char *, const char *, map &); +static void parse_string_option(const char *, const char *, map &); static void setup_table (AsciiTable &, int, int); static ConcatString build_map_key (const char *, const TCStatLine &, const StringArray &); static bool check_masks (const MaskPoly &, const Grid &, const MaskPlane &, @@ -57,7 +57,7 @@ TCStatJob *TCStatJobFactory::new_tc_stat_job_type(const char *type_str) { TCStatJobType type = NoTCStatJobType; // Determine the TCStatJobType - type = string_to_tcstatjobtype((std::string)type_str); + type = string_to_tcstatjobtype((string)type_str); // Switch on job type and instantiate the appropriate class. // The TCStatJob object is allocated and needs to be deleted by caller. @@ -355,10 +355,10 @@ void TCStatJob::assign(const TCStatJob & j) { //////////////////////////////////////////////////////////////////////// -void TCStatJob::dump(std::ostream & out, int depth) const { +void TCStatJob::dump(ostream & out, int depth) const { Indent prefix(depth); - std::map::const_iterator thr_it; - std::map::const_iterator str_it; + map::const_iterator thr_it; + map::const_iterator str_it; out << prefix << "JobType = " << tcstatjobtype_to_string(JobType) << "\n"; @@ -512,8 +512,8 @@ bool TCStatJob::is_keeper_track(const TrackPairInfo &pair, int i, i_init; double v_dbl; ConcatString v_str; - std::map::const_iterator thr_it; - std::map::const_iterator str_it; + map::const_iterator thr_it; + map::const_iterator str_it; // Check TrackWatchWarn for each TrackPoint if(TrackWatchWarn.n() > 0) { @@ -670,8 +670,8 @@ bool TCStatJob::is_keeper_line(const TCStatLine &line, double v_dbl, alat, alon, blat, blon; ConcatString v_str; StringArray sa; - std::map::const_iterator thr_it; - std::map::const_iterator str_it; + map::const_iterator thr_it; + map::const_iterator str_it; // Check TC-STAT header columns if(AModel.n() > 0 && @@ -1162,8 +1162,8 @@ void TCStatJob::dump_line(const TCStatLine &line, ofstream *out) { ConcatString TCStatJob::serialize() const { ConcatString s; int i; - std::map::const_iterator thr_it; - std::map::const_iterator str_it; + map::const_iterator thr_it; + map::const_iterator str_it; // Initialize the jobstring s.clear(); @@ -1334,8 +1334,8 @@ void TCStatJob::event_equalize_tracks() { int i; // Event equalization case map - std::map case_map; - std::map::iterator it; + map case_map; + map::iterator it; mlog << Debug(3) << "Applying track-based event equalization logic.\n"; @@ -1422,8 +1422,8 @@ void TCStatJob::event_equalize_lines() { int i; // Event equalization case map - std::map case_map; - std::map::iterator it; + map case_map; + map::iterator it; mlog << Debug(3) << "Applying line-based event equalization logic.\n"; @@ -1673,7 +1673,7 @@ void TCStatJobFilter::do_job(const StringArray &file_list, // Process the filter output if(JobOut) do_output(*JobOut); - else do_output(std::cout); + else do_output(cout); return; } @@ -1756,7 +1756,7 @@ void TCStatJobFilter::filter_lines(TCLineCounts &n) { //////////////////////////////////////////////////////////////////////// -void TCStatJobFilter::do_output(std::ostream &out) { +void TCStatJobFilter::do_output(ostream &out) { ConcatString line; // Build a simple output line @@ -2012,7 +2012,7 @@ void TCStatJobSummary::do_job(const StringArray &file_list, // Process the filter output if(JobOut) do_output(*JobOut); - else do_output(std::cout); + else do_output(cout); return; } @@ -2103,7 +2103,7 @@ void TCStatJobSummary::summarize_lines(TCLineCounts &n) { void TCStatJobSummary::process_pair(TrackPairInfo &pair) { int i, j; - std::map cur_map; + map cur_map; ConcatString prefix, key, cur; SummaryMapData data; double val; @@ -2148,7 +2148,7 @@ void TCStatJobSummary::process_pair(TrackPairInfo &pair) { void TCStatJobSummary::process_line(TCStatLine &line) { int i; - std::map cur_map; + map cur_map; ConcatString prefix, key, cur; SummaryMapData data; double val; @@ -2186,8 +2186,8 @@ void TCStatJobSummary::process_line(TCStatLine &line) { //////////////////////////////////////////////////////////////////////// -void TCStatJobSummary::add_map(std::map&m) { - std::map::iterator it; +void TCStatJobSummary::add_map(map&m) { + map::iterator it; // Loop over the input map entries for(it=m.begin(); it!= m.end(); it++) { @@ -2226,8 +2226,8 @@ void TCStatJobSummary::add_map(std::map&m) { //////////////////////////////////////////////////////////////////////// -void TCStatJobSummary::do_output(std::ostream &out) { - std::map::iterator it; +void TCStatJobSummary::do_output(ostream &out) { + map::iterator it; StringArray sa; ConcatString line; AsciiTable out_at; @@ -2376,7 +2376,7 @@ void TCStatJobSummary::do_output(std::ostream &out) { out << line; // Write the table - out << out_at << "\n" << std::flush; + out << out_at << "\n" << flush; return; } @@ -2385,7 +2385,7 @@ void TCStatJobSummary::do_output(std::ostream &out) { void TCStatJobSummary::compute_fsp(NumArray &total, NumArray &best, NumArray &ties) { - std::map::iterator it; + map::iterator it; StringArray case_list; double v, best_val; ConcatString best_mod, s; @@ -2708,7 +2708,7 @@ StringArray intersection(const StringArray &s1, const StringArray &s2) { //////////////////////////////////////////////////////////////////////// void parse_thresh_option(const char *col_name, const char *col_val, - std::map &m) { + map &m) { ConcatString cs = to_upper((string)col_name); ThreshArray ta; ta.add_css(col_val); @@ -2723,7 +2723,7 @@ void parse_thresh_option(const char *col_name, const char *col_val, //////////////////////////////////////////////////////////////////////// void parse_string_option(const char *col_name, const char *col_val, - std::map &m) { + map &m) { ConcatString cs = to_upper((string)col_name); StringArray sa; sa.set_ignore_case(1); @@ -3009,7 +3009,7 @@ void TCStatJobRIRW::do_job(const StringArray &file_list, // Process the RI/RW job output if(JobOut) do_output(*JobOut); - else do_output(std::cout); + else do_output(cout); return; } @@ -3018,7 +3018,7 @@ void TCStatJobRIRW::do_job(const StringArray &file_list, void TCStatJobRIRW::process_pair(TrackPairInfo &pair) { int i, j, a, b, cur_dt, min_dt, i_min_dt, lead; - std::map cur_map; + map cur_map; ConcatString key, cur, cat; RIRWMapData data; TrackPairInfo pair_pt; @@ -3157,7 +3157,7 @@ void TCStatJobRIRW::process_pair(TrackPairInfo &pair) { //////////////////////////////////////////////////////////////////////// void TCStatJobRIRW::add_map(map&m) { - std::map::iterator it; + map::iterator it; // Loop over the input map entries for(it=m.begin(); it!= m.end(); it++) { @@ -3209,7 +3209,7 @@ void TCStatJobRIRW::add_map(map&m) { //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_output(std::ostream &out) { +void TCStatJobRIRW::do_output(ostream &out) { ConcatString line; // Build a simple output line @@ -3225,8 +3225,8 @@ void TCStatJobRIRW::do_output(std::ostream &out) { //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_ctc_output(std::ostream &out) { - std::map::iterator it; +void TCStatJobRIRW::do_ctc_output(ostream &out) { + map::iterator it; StringArray sa; int i, r, c; AsciiTable out_at; @@ -3292,15 +3292,15 @@ void TCStatJobRIRW::do_ctc_output(std::ostream &out) { } // Write the table - out << out_at << "\n" << std::flush; + out << out_at << "\n" << flush; return; } //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_cts_output(std::ostream &out) { - std::map::iterator it; +void TCStatJobRIRW::do_cts_output(ostream &out) { + map::iterator it; StringArray sa; int i, r, c; AsciiTable out_at; @@ -3374,15 +3374,15 @@ void TCStatJobRIRW::do_cts_output(std::ostream &out) { } // Write the table - out << out_at << "\n" << std::flush; + out << out_at << "\n" << flush; return; } //////////////////////////////////////////////////////////////////////// -void TCStatJobRIRW::do_mpr_output(std::ostream &out) { - std::map::iterator it; +void TCStatJobRIRW::do_mpr_output(ostream &out) { + map::iterator it; StringArray sa; int i, j, r, c; AsciiTable out_at; @@ -3474,7 +3474,7 @@ void TCStatJobRIRW::do_mpr_output(std::ostream &out) { } // Write the table - out << out_at << "\n" << std::flush; + out << out_at << "\n" << flush; return; } @@ -3782,7 +3782,7 @@ void TCStatJobProbRIRW::do_job(const StringArray &file_list, // Process the ProbRIRW job output if(JobOut) do_output(*JobOut); - else do_output(std::cout); + else do_output(cout); return; } @@ -3856,8 +3856,8 @@ void TCStatJobProbRIRW::process_pair(ProbRIRWPairInfo &pair) { //////////////////////////////////////////////////////////////////////// -void TCStatJobProbRIRW::do_output(std::ostream &out) { - std::map::iterator it; +void TCStatJobProbRIRW::do_output(ostream &out) { + map::iterator it; StringArray sa; int n, i, j, r, c; int lt_cols = 0; @@ -3886,7 +3886,7 @@ void TCStatJobProbRIRW::do_output(std::ostream &out) { else if(out_lt == stat_prc) lt_cols = get_n_prc_columns (n); else if(out_lt == stat_pjc) lt_cols = get_n_pjc_columns (n); else { - mlog << Error << "\nvoid TCStatJobProbRIRW::do_output(std::ostream &out) -> " + mlog << Error << "\nvoid TCStatJobProbRIRW::do_output(ostream &out) -> " << "unsupported output line type \"" << OutLineType[i] << "\"\n\n"; exit(1); } @@ -3958,7 +3958,7 @@ void TCStatJobProbRIRW::do_output(std::ostream &out) { } // end for it // Write the table for the current output line type - out << out_at << "\n" << std::flush; + out << out_at << "\n" << flush; } // end for i From 3877b64024226eb3d9496973986c533e528bc924 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 3 Oct 2022 16:00:21 -0600 Subject: [PATCH 14/26] Per #2227, changes to remove namespace std and netCDF from header files --- src/basic/vx_util/crr_array.h | 4 +- .../vx_data2d_factory/is_netcdf_file.cc | 3 + src/libcode/vx_data2d_nc_met/data2d_nc_met.h | 3 - src/libcode/vx_data2d_nc_met/get_met_grid.cc | 3 + src/libcode/vx_data2d_nc_met/get_met_grid.h | 5 +- src/libcode/vx_data2d_nc_met/met_file.cc | 3 + src/libcode/vx_data2d_nc_met/met_file.h | 12 +- .../vx_data2d_nc_pinterp/data2d_nc_pinterp.h | 1 - .../vx_data2d_nc_pinterp/get_pinterp_grid.h | 3 +- .../vx_data2d_nc_pinterp/pinterp_file.cc | 3 + .../vx_data2d_nc_pinterp/pinterp_file.h | 17 +- src/libcode/vx_data2d_nccf/data2d_nccf.cc | 3 + src/libcode/vx_data2d_nccf/data2d_nccf.h | 3 - src/libcode/vx_data2d_nccf/nccf_file.cc | 3 + src/libcode/vx_data2d_nccf/nccf_file.h | 61 ++- src/libcode/vx_nc_obs/nc_obs_util.cc | 3 + src/libcode/vx_nc_obs/nc_obs_util.h | 95 +++-- src/libcode/vx_nc_obs/nc_point_obs.cc | 3 + src/libcode/vx_nc_obs/nc_point_obs.h | 4 +- src/libcode/vx_nc_obs/nc_summary.cc | 3 + src/libcode/vx_nc_obs/nc_summary.h | 3 +- src/libcode/vx_nc_util/grid_output.cc | 3 + src/libcode/vx_nc_util/grid_output.h | 3 +- src/libcode/vx_nc_util/nc_utils.h | 356 +++++++++--------- src/libcode/vx_nc_util/nc_utils.hpp | 84 ++--- src/libcode/vx_nc_util/nc_var_info.cc | 3 + src/libcode/vx_nc_util/nc_var_info.h | 11 +- src/libcode/vx_nc_util/write_netcdf.cc | 3 + src/libcode/vx_nc_util/write_netcdf.h | 13 +- src/libcode/vx_seeps/seeps.cc | 3 + src/libcode/vx_series_data/series_pdf.cc | 3 + src/libcode/vx_series_data/series_pdf.h | 3 +- src/libcode/vx_shapedata/interest.h | 4 +- src/libcode/vx_shapedata/mode_columns.h | 4 +- src/libcode/vx_shapedata/set.h | 5 +- src/libcode/vx_shapedata/shape.h | 5 +- src/libcode/vx_statistics/obs_error.h | 4 +- .../vx_statistics/pair_data_ensemble.h | 8 +- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 3 + src/libcode/vx_tc_util/vx_tc_nc_util.h | 63 ++-- src/tools/core/ensemble_stat/ensemble_stat.cc | 4 + src/tools/core/ensemble_stat/ensemble_stat.h | 7 +- src/tools/core/grid_stat/grid_stat.cc | 4 + src/tools/core/grid_stat/grid_stat.h | 13 +- src/tools/core/mode/mode_exec.cc | 3 + src/tools/core/mode/mode_exec.h | 5 +- src/tools/core/pcp_combine/pcp_combine.cc | 4 + src/tools/core/point_stat/point_stat.cc | 4 + src/tools/core/point_stat/point_stat.h | 5 +- .../core/series_analysis/series_analysis.cc | 4 + .../core/series_analysis/series_analysis.h | 11 +- .../stat_analysis/skill_score_index_job.h | 2 - src/tools/core/wavelet_stat/wavelet_stat.cc | 4 + src/tools/core/wavelet_stat/wavelet_stat.h | 19 +- src/tools/dev_utils/gen_climo_bin.cc | 4 + src/tools/dev_utils/insitu_nc_file.cc | 3 + src/tools/dev_utils/insitu_nc_file.h | 5 +- src/tools/dev_utils/met_nc_file.cc | 3 + src/tools/dev_utils/met_nc_file.h | 53 ++- src/tools/other/ascii2nc/ascii2nc.cc | 3 + src/tools/other/ascii2nc/file_handler.cc | 3 + src/tools/other/ascii2nc/file_handler.h | 3 +- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 6 + src/tools/other/gen_ens_prod/gen_ens_prod.h | 9 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 5 +- src/tools/other/grid_diag/grid_diag.cc | 8 +- src/tools/other/grid_diag/grid_diag.h | 11 +- src/tools/other/gsi_tools/gsid2mpr.cc | 5 +- src/tools/other/gsi_tools/gsidens2orank.cc | 3 + src/tools/other/ioda2nc/ioda2nc.cc | 6 + src/tools/other/madis2nc/madis2nc.cc | 5 +- .../other/mode_graphics/mode_nc_output_file.h | 35 +- src/tools/other/mode_time_domain/3d_conv.cc | 3 + src/tools/other/mode_time_domain/mtd.cc | 2 + .../other/mode_time_domain/mtd_file_base.cc | 3 + .../other/mode_time_domain/mtd_file_base.h | 5 +- .../other/mode_time_domain/mtd_file_float.cc | 3 + .../other/mode_time_domain/mtd_file_float.h | 4 +- .../other/mode_time_domain/mtd_file_int.cc | 3 + .../other/mode_time_domain/mtd_file_int.h | 4 +- .../other/mode_time_domain/mtd_nc_output.cc | 3 + src/tools/other/mode_time_domain/nc_grid.cc | 3 + src/tools/other/mode_time_domain/nc_grid.h | 4 +- .../other/mode_time_domain/nc_utils_local.cc | 3 + .../other/mode_time_domain/nc_utils_local.h | 8 +- src/tools/other/pb2nc/pb2nc.cc | 6 +- .../other/plot_point_obs/plot_point_obs.h | 4 +- src/tools/other/point2grid/point2grid.cc | 6 + .../regrid_data_plane/regrid_data_plane.cc | 6 + .../shift_data_plane/shift_data_plane.cc | 6 +- src/tools/other/wwmca_tool/nc_output.cc | 3 + .../tc_utils/rmw_analysis/rmw_analysis.cc | 3 + .../tc_utils/rmw_analysis/rmw_analysis.h | 17 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 6 +- src/tools/tc_utils/tc_gen/tc_gen.cc | 5 +- src/tools/tc_utils/tc_gen/tc_gen.h | 7 +- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 5 +- src/tools/tc_utils/tc_rmw/tc_rmw.h | 35 +- 98 files changed, 682 insertions(+), 553 deletions(-) diff --git a/src/basic/vx_util/crr_array.h b/src/basic/vx_util/crr_array.h index 9dca709f86..ec3c4d252f 100644 --- a/src/basic/vx_util/crr_array.h +++ b/src/basic/vx_util/crr_array.h @@ -65,7 +65,7 @@ class CRR_Array { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -282,7 +282,7 @@ return; template -void CRR_Array::dump(ostream & out, int depth) const +void CRR_Array::dump(std::ostream & out, int depth) const { diff --git a/src/libcode/vx_data2d_factory/is_netcdf_file.cc b/src/libcode/vx_data2d_factory/is_netcdf_file.cc index 805ce8ee81..3e72029514 100644 --- a/src/libcode/vx_data2d_factory/is_netcdf_file.cc +++ b/src/libcode/vx_data2d_factory/is_netcdf_file.cc @@ -25,6 +25,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "is_netcdf_file.h" #include "vx_nc_util.h" diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h index 206cc48681..3cd2d02bb3 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h @@ -17,9 +17,6 @@ //////////////////////////////////////////////////////////////////////// -#include -using namespace netCDF; - #include "data_plane.h" #include "data_class.h" #include "var_info_nc_met.h" diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index c6882057e3..576ef42435 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -18,6 +18,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "get_met_grid.h" #include "nc_utils.h" diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.h b/src/libcode/vx_data2d_nc_met/get_met_grid.h index 5315025b6e..dee95da870 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.h +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.h @@ -14,15 +14,14 @@ //////////////////////////////////////////////////////////////////////// #include -using namespace netCDF; #include "vx_grid.h" //////////////////////////////////////////////////////////////////////// -extern void read_netcdf_grid(NcFile *, Grid &); +extern void read_netcdf_grid(netCDF::NcFile *, Grid &); -extern int has_variable(NcFile *, const char *); +extern int has_variable(netCDF::NcFile *, const char *); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/met_file.cc b/src/libcode/vx_data2d_nc_met/met_file.cc index 306abee1c2..decf37371c 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.cc +++ b/src/libcode/vx_data2d_nc_met/met_file.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nc_met/met_file.h b/src/libcode/vx_data2d_nc_met/met_file.h index ab33ee5b4c..e3a9070a43 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.h +++ b/src/libcode/vx_data2d_nc_met/met_file.h @@ -59,7 +59,7 @@ class MetNcFile { void dump(std::ostream &, int = 0) const; - NcFile * Nc; // allocated + netCDF::NcFile * Nc; // allocated // // dimensions @@ -67,12 +67,12 @@ class MetNcFile { int Ndims; - NcDim ** Dim; // allocated + netCDF::NcDim ** Dim; // allocated StringArray DimNames; - NcDim * Xdim; // not allocated - NcDim * Ydim; // not allocated + netCDF::NcDim * Xdim; // not allocated + netCDF::NcDim * Ydim; // not allocated // // variables @@ -92,9 +92,9 @@ class MetNcFile { // data // - double data(NcVar *, const LongArray &) const; + double data(netCDF::NcVar *, const LongArray &) const; - bool data(NcVar *, const LongArray &, DataPlane &) const; + bool data(netCDF::NcVar *, const LongArray &, DataPlane &) const; bool data(const char *, const LongArray &, DataPlane &, NcVarInfo *&) const; diff --git a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h index a52a3d0e3e..9356cd5128 100644 --- a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h +++ b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "data_plane.h" #include "data_class.h" diff --git a/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h b/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h index 6294ed82cf..190de35fa0 100644 --- a/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h +++ b/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h @@ -22,7 +22,6 @@ #include -using namespace netCDF; #include "vx_grid.h" @@ -32,7 +31,7 @@ using namespace netCDF; extern bool get_pinterp_grid(const char * pinterp_filename, Grid &); -extern bool get_pinterp_grid(NcFile &, Grid &); +extern bool get_pinterp_grid(netCDF::NcFile &, Grid &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc index 964d32cad6..c718944ad3 100644 --- a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc +++ b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h index 29c0a42077..2947562bd1 100644 --- a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h +++ b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h @@ -24,7 +24,6 @@ #include #include -using namespace netCDF; #include "vx_grid.h" #include "data_plane.h" @@ -56,7 +55,7 @@ class PinterpFile { void dump(std::ostream &, int = 0) const; - NcFile * Nc; // allocated + netCDF::NcFile * Nc; // allocated // // time @@ -77,14 +76,14 @@ class PinterpFile { int Ndims; - NcDim ** Dim; // allocated + netCDF::NcDim ** Dim; // allocated StringArray DimNames; - NcDim * Xdim; // not allocated - NcDim * Ydim; // not allocated - NcDim * Zdim; // not allocated - NcDim * Tdim; // not allocated + netCDF::NcDim * Xdim; // not allocated + netCDF::NcDim * Ydim; // not allocated + netCDF::NcDim * Zdim; // not allocated + netCDF::NcDim * Tdim; // not allocated // // variables @@ -108,9 +107,9 @@ class PinterpFile { // data // - double data(NcVar *, const LongArray &) const; + double data(netCDF::NcVar *, const LongArray &) const; - bool data(NcVar *, const LongArray &, DataPlane &, double & pressure) const; + bool data(netCDF::NcVar *, const LongArray &, DataPlane &, double & pressure) const; bool data(const char *, const LongArray &, DataPlane &, double & pressure, NcVarInfo *&) const; diff --git a/src/libcode/vx_data2d_nccf/data2d_nccf.cc b/src/libcode/vx_data2d_nccf/data2d_nccf.cc index c36f55fef6..61a87cf472 100644 --- a/src/libcode/vx_data2d_nccf/data2d_nccf.cc +++ b/src/libcode/vx_data2d_nccf/data2d_nccf.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "data2d_nccf.h" #include "vx_math.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nccf/data2d_nccf.h b/src/libcode/vx_data2d_nccf/data2d_nccf.h index 4abc64d934..1340b62e2b 100644 --- a/src/libcode/vx_data2d_nccf/data2d_nccf.h +++ b/src/libcode/vx_data2d_nccf/data2d_nccf.h @@ -17,9 +17,6 @@ //////////////////////////////////////////////////////////////////////// -#include -using namespace netCDF; - #include "data_plane.h" #include "data_class.h" #include "var_info_nccf.h" diff --git a/src/libcode/vx_data2d_nccf/nccf_file.cc b/src/libcode/vx_data2d_nccf/nccf_file.cc index 0f45544ae3..3e3cfcdbad 100644 --- a/src/libcode/vx_data2d_nccf/nccf_file.cc +++ b/src/libcode/vx_data2d_nccf/nccf_file.cc @@ -22,6 +22,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nccf/nccf_file.h b/src/libcode/vx_data2d_nccf/nccf_file.h index 9aa9308f16..8d7f0e7abf 100644 --- a/src/libcode/vx_data2d_nccf/nccf_file.h +++ b/src/libcode/vx_data2d_nccf/nccf_file.h @@ -23,9 +23,6 @@ #include -#include -using namespace netCDF; - #include "vx_grid.h" #include "nc_utils.h" #include "data_plane.h" @@ -107,9 +104,9 @@ class NcCfFile { // data // - double getData(NcVar *, const LongArray &) const; + double getData(netCDF::NcVar *, const LongArray &) const; - bool getData(NcVar *, const LongArray &, DataPlane &) const; + bool getData(netCDF::NcVar *, const LongArray &, DataPlane &) const; bool getData(const char *, const LongArray &, DataPlane &, NcVarInfo *&) const; @@ -120,7 +117,7 @@ class NcCfFile { static const double DELTA_TOLERANCE; - NcFile * _ncFile; // allocated + netCDF::NcFile * _ncFile; // allocated // // dimensions @@ -128,7 +125,7 @@ class NcCfFile { int _numDims; - NcDim ** _dims; // allocated + netCDF::NcDim ** _dims; // allocated StringArray _dimNames; @@ -136,14 +133,14 @@ class NcCfFile { // variables. Note that these are pointers into the _dims and Var // arrays so should not be deleted. - NcDim *_xDim; - NcDim *_yDim; - NcDim *_tDim; + netCDF::NcDim *_xDim; + netCDF::NcDim *_yDim; + netCDF::NcDim *_tDim; - NcVar *_latVar; - NcVar *_lonVar; - NcVar *_xCoordVar; - NcVar *_yCoordVar; + netCDF::NcVar *_latVar; + netCDF::NcVar *_lonVar; + netCDF::NcVar *_xCoordVar; + netCDF::NcVar *_yCoordVar; NcVarInfo *_time_var_info; void init_from_scratch(); @@ -163,29 +160,29 @@ class NcCfFile { // grid member with that information. void read_netcdf_grid(); - void get_grid_from_grid_mapping(const NcVarAtt *grid_mapping_att); + void get_grid_from_grid_mapping(const netCDF::NcVarAtt *grid_mapping_att); - void get_grid_mapping_albers_conical_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_azimuthal_equidistant(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_azimuthal_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_conformal_conic(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_cylindrical_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_latitude_longitude(const NcVar *grid_mapping_var); - void get_grid_mapping_mercator(const NcVar *grid_mapping_var); - void get_grid_mapping_orthographic(const NcVar *grid_mapping_var); - void get_grid_mapping_polar_stereographic(const NcVar *grid_mapping_var); - void get_grid_mapping_rotated_latitude_longitude(const NcVar *grid_mapping_var); - void get_grid_mapping_stereographic(const NcVar *grid_mapping_var); - void get_grid_mapping_transverse_mercator(const NcVar *grid_mapping_var); - void get_grid_mapping_vertical_perspective(const NcVar *grid_mapping_var); - void get_grid_mapping_geostationary(const NcVar *grid_mapping_var); + void get_grid_mapping_albers_conical_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_azimuthal_equidistant(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_azimuthal_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_conformal_conic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_cylindrical_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_latitude_longitude(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_mercator(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_orthographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_polar_stereographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_rotated_latitude_longitude(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_stereographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_transverse_mercator(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_vertical_perspective(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_geostationary(const netCDF::NcVar *grid_mapping_var); - bool get_grid_from_coordinates(const NcVar *data_var); + bool get_grid_from_coordinates(const netCDF::NcVar *data_var); bool get_grid_from_dimensions(); - void get_grid_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + void get_grid_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, const long lat_counts, const long lon_counts); - LatLonData get_data_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + LatLonData get_data_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, const long lat_counts, const long lon_counts, bool &swap_to_north); }; diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index 036122b8a3..c867298c07 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -18,6 +18,9 @@ using namespace std; #include +#include +using namespace netCDF; + #include "vx_nc_util.h" #include "nc_obs_util.h" diff --git a/src/libcode/vx_nc_obs/nc_obs_util.h b/src/libcode/vx_nc_obs/nc_obs_util.h index 0a119cad21..30586f6a4c 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.h +++ b/src/libcode/vx_nc_obs/nc_obs_util.h @@ -14,7 +14,6 @@ #define __NC_OBS_UTIL_H__ #include -using namespace netCDF; #include "nc_summary.h" #include "met_point_data.h" @@ -88,61 +87,61 @@ struct NetcdfObsVars { int raw_hdr_cnt ; // raw data (PrepBufr) header array count int deflate_level; - NcDim strl_dim ; // header string dimension (16 bytes) - NcDim strl2_dim ; // header string dimension (40 bytes) - NcDim strl3_dim ; // header string dimension (80 bytes) - NcDim hdr_typ_dim ; // header message type dimension - NcDim hdr_sid_dim ; // header station id dimension - NcDim hdr_vld_dim ; // header valid time dimension - NcDim hdr_arr_dim ; // Header array width (V1.0, not used from V1.2) - NcDim obs_arr_dim ; // Observation array width (V1.0, not used from V1.2) - NcDim obs_dim ; // Observation array length (V1.0) - NcDim hdr_dim ; // Header array length (V1.0) - NcDim pb_hdr_dim ; // PrepfBufr Header array length (V1.2) - - NcVar hdr_typ_tbl_var ; // Message type (string) (V1.1) - NcVar hdr_sid_tbl_var ; // Station ID (string) (V1.1) - NcVar hdr_vld_tbl_var ; // Valid time (string) (V1.1) - NcVar obs_qty_tbl_var ; // Quality flag (V1.0) - NcVar hdr_typ_var ; // Message type (string to index with V1.2) - NcVar hdr_sid_var ; // Station ID (string to index with V1.2) - NcVar hdr_vld_var ; // Valid time (string to index with V1.2) - NcVar hdr_arr_var ; // Header array (V1.0, Removed from V1.2) - NcVar hdr_lat_var ; // Header array (latitude) (V1.2) - NcVar hdr_lon_var ; // Header array (longitude) (V1.2) - NcVar hdr_elv_var ; // Header array (elevation) (V1.2) - NcVar hdr_prpt_typ_var ; // Header array (PB report type) (V1.2) - NcVar hdr_irpt_typ_var ; // Header array (In report type) (V1.2) - NcVar hdr_inst_typ_var ; // Header array (instrument type) (V1.2) - NcVar obs_qty_var ; // Quality flag (unlimited dimension) (V1.2: Changed data type to int - was string) - NcVar obs_arr_var ; // Observation array (unlimited dimension) (V1.0, Removed from V1.2) - NcVar obs_hid_var ; // Observation header index array (unlimited dimension) (V1.2) - NcVar obs_gc_var ; // Observation GRIB code array (unlimited dimension) (V1.2) - NcVar obs_vid_var ; // Observation variable index array (unlimited dimension) (V1.2) - NcVar obs_lvl_var ; // Observation level array (unlimited dimension) (V1.2) - NcVar obs_hgt_var ; // Observation hight array (unlimited dimension) (V1.2) - NcVar obs_val_var ; // Observation value array (unlimited dimension) (V1.2) + netCDF::NcDim strl_dim ; // header string dimension (16 bytes) + netCDF::NcDim strl2_dim ; // header string dimension (40 bytes) + netCDF::NcDim strl3_dim ; // header string dimension (80 bytes) + netCDF::NcDim hdr_typ_dim ; // header message type dimension + netCDF::NcDim hdr_sid_dim ; // header station id dimension + netCDF::NcDim hdr_vld_dim ; // header valid time dimension + netCDF::NcDim hdr_arr_dim ; // Header array width (V1.0, not used from V1.2) + netCDF::NcDim obs_arr_dim ; // Observation array width (V1.0, not used from V1.2) + netCDF::NcDim obs_dim ; // Observation array length (V1.0) + netCDF::NcDim hdr_dim ; // Header array length (V1.0) + netCDF::NcDim pb_hdr_dim ; // PrepfBufr Header array length (V1.2) + + netCDF::NcVar hdr_typ_tbl_var ; // Message type (string) (V1.1) + netCDF::NcVar hdr_sid_tbl_var ; // Station ID (string) (V1.1) + netCDF::NcVar hdr_vld_tbl_var ; // Valid time (string) (V1.1) + netCDF::NcVar obs_qty_tbl_var ; // Quality flag (V1.0) + netCDF::NcVar hdr_typ_var ; // Message type (string to index with V1.2) + netCDF::NcVar hdr_sid_var ; // Station ID (string to index with V1.2) + netCDF::NcVar hdr_vld_var ; // Valid time (string to index with V1.2) + netCDF::NcVar hdr_arr_var ; // Header array (V1.0, Removed from V1.2) + netCDF::NcVar hdr_lat_var ; // Header array (latitude) (V1.2) + netCDF::NcVar hdr_lon_var ; // Header array (longitude) (V1.2) + netCDF::NcVar hdr_elv_var ; // Header array (elevation) (V1.2) + netCDF::NcVar hdr_prpt_typ_var ; // Header array (PB report type) (V1.2) + netCDF::NcVar hdr_irpt_typ_var ; // Header array (In report type) (V1.2) + netCDF::NcVar hdr_inst_typ_var ; // Header array (instrument type) (V1.2) + netCDF::NcVar obs_qty_var ; // Quality flag (unlimited dimension) (V1.2: Changed data type to int - was string) + netCDF::NcVar obs_arr_var ; // Observation array (unlimited dimension) (V1.0, Removed from V1.2) + netCDF::NcVar obs_hid_var ; // Observation header index array (unlimited dimension) (V1.2) + netCDF::NcVar obs_gc_var ; // Observation GRIB code array (unlimited dimension) (V1.2) + netCDF::NcVar obs_vid_var ; // Observation variable index array (unlimited dimension) (V1.2) + netCDF::NcVar obs_lvl_var ; // Observation level array (unlimited dimension) (V1.2) + netCDF::NcVar obs_hgt_var ; // Observation hight array (unlimited dimension) (V1.2) + netCDF::NcVar obs_val_var ; // Observation value array (unlimited dimension) (V1.2) // Optional variables - NcVar obs_var ; // Observation variable name (V1.1) - NcVar unit_var ; // The unit of the observation variable (V1.1) - NcVar desc_var ; // The description of the observation variable (V1.1) + netCDF::NcVar obs_var ; // Observation variable name (V1.1) + netCDF::NcVar unit_var ; // The unit of the observation variable (V1.1) + netCDF::NcVar desc_var ; // The description of the observation variable (V1.1) NetcdfObsVars(); bool is_valid(bool exit_on_error=false); void reset(bool _use_var_id = true); - void create_dimensions(NcFile *f_out); - void create_hdr_vars (NcFile *f_out, const int hdr_count); - void create_obs_vars (NcFile *f_out); - void create_obs_name_vars (NcFile *f_out, const int var_count, const int unit_count); - void create_table_vars (NcFile *f_out, MetPointHeader &hdr_data, NcDataBuffer &data_buffer); - void create_pb_hdrs (NcFile *f_out, const int hdr_count); - NcDim create_var_obs_var (NcFile *f_out, int var_count); + void create_dimensions(netCDF::NcFile *f_out); + void create_hdr_vars (netCDF::NcFile *f_out, const int hdr_count); + void create_obs_vars (netCDF::NcFile *f_out); + void create_obs_name_vars (netCDF::NcFile *f_out, const int var_count, const int unit_count); + void create_table_vars (netCDF::NcFile *f_out, MetPointHeader &hdr_data, NcDataBuffer &data_buffer); + void create_pb_hdrs (netCDF::NcFile *f_out, const int hdr_count); + netCDF::NcDim create_var_obs_var (netCDF::NcFile *f_out, int var_count); int get_hdr_index(); int get_obs_index(); - void read_dims_vars(NcFile *f_in); + void read_dims_vars(netCDF::NcFile *f_in); void read_header_data(MetPointHeader &hdr_data); bool read_obs_data(int buf_size, int offset, int qty_len, float *obs_arr, int *qty_idx_arr, char *obs_qty_buf); @@ -181,7 +180,7 @@ extern int get_nc_hdr_cur_index(); extern int get_nc_obs_buf_index(); extern bool is_using_var_id (const char * nc_name); -extern bool is_using_var_id (NcFile * nc_file); +extern bool is_using_var_id (netCDF::NcFile * nc_file); extern void reset_header_buffer(int buf_size, bool reset_all=false); extern void set_header_buffer (int buf_size, bool reset_all=false); @@ -189,7 +188,7 @@ extern void set_header_buffer (int buf_size, bool reset_all=false); extern std::string seconds_to_time_string(const int secs); extern void write_nc_obs_buffer (const int buf_size); -extern int write_nc_string_array (NcVar *ncVar, StringArray &strArray, +extern int write_nc_string_array (netCDF::NcVar *ncVar, StringArray &strArray, const int str_len); #endif /* __NC_OBS_UTIL_H__ */ diff --git a/src/libcode/vx_nc_obs/nc_point_obs.cc b/src/libcode/vx_nc_obs/nc_point_obs.cc index 559693e462..fa0f49c2fb 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "is_bad_data.h" diff --git a/src/libcode/vx_nc_obs/nc_point_obs.h b/src/libcode/vx_nc_obs/nc_point_obs.h index 4b957638f4..a678dc16c3 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.h +++ b/src/libcode/vx_nc_obs/nc_point_obs.h @@ -35,7 +35,7 @@ class MetNcPointObs : public MetPointData { protected: bool keep_nc; - NcFile *obs_nc; // allocated + netCDF::NcFile *obs_nc; // allocated NetcdfObsVars obs_vars; void init_from_scratch(); @@ -47,7 +47,7 @@ class MetNcPointObs : public MetPointData { bool open(const char * filename); void close(); - bool set_netcdf(NcFile *nc_file, bool _keep_nc=false); + bool set_netcdf(netCDF::NcFile *nc_file, bool _keep_nc=false); bool is_using_obs_arr(); diff --git a/src/libcode/vx_nc_obs/nc_summary.cc b/src/libcode/vx_nc_obs/nc_summary.cc index 2dba528bb0..8a8cdb57b9 100644 --- a/src/libcode/vx_nc_obs/nc_summary.cc +++ b/src/libcode/vx_nc_obs/nc_summary.cc @@ -18,6 +18,9 @@ using namespace std; #include +#include +using namespace netCDF; + #include "write_netcdf.h" #include "nc_obs_util.h" diff --git a/src/libcode/vx_nc_obs/nc_summary.h b/src/libcode/vx_nc_obs/nc_summary.h index 788af6232d..b1b7614a4c 100644 --- a/src/libcode/vx_nc_obs/nc_summary.h +++ b/src/libcode/vx_nc_obs/nc_summary.h @@ -14,7 +14,6 @@ #define __NC_SUMMARY_H__ #include -using namespace netCDF; #include "nc_utils.h" #include "nc_obs_util.h" #include "vx_summary.h" @@ -36,7 +35,7 @@ extern std::string _secsToTimeString(const int secs); // Not moved to nc_obs_util to reduce the dependency (library) -extern void write_summary_attributes(NcFile *, TimeSummaryInfo); +extern void write_summary_attributes(netCDF::NcFile *, TimeSummaryInfo); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/grid_output.cc b/src/libcode/vx_nc_util/grid_output.cc index 1b9a0b1ccd..50823033bd 100644 --- a/src/libcode/vx_nc_util/grid_output.cc +++ b/src/libcode/vx_nc_util/grid_output.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "grid_output.h" #include "vx_log.h" #include "nc_utils.h" diff --git a/src/libcode/vx_nc_util/grid_output.h b/src/libcode/vx_nc_util/grid_output.h index 671ebaa43a..a06fbaa183 100644 --- a/src/libcode/vx_nc_util/grid_output.h +++ b/src/libcode/vx_nc_util/grid_output.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "vx_grid.h" @@ -26,7 +25,7 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -extern void grid_output(const GridInfo &, NcFile *, NcDim &, NcDim &); +extern void grid_output(const GridInfo &, netCDF::NcFile *, netCDF::NcDim &, netCDF::NcDim &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/nc_utils.h b/src/libcode/vx_nc_util/nc_utils.h index 5196559be1..199173e263 100644 --- a/src/libcode/vx_nc_util/nc_utils.h +++ b/src/libcode/vx_nc_util/nc_utils.h @@ -17,7 +17,7 @@ #include #include -using namespace netCDF; + #ifndef ncbyte typedef signed char ncbyte; // from ncvalues.h #endif /* ncbyte */ @@ -157,206 +157,206 @@ static const int exit_code_no_obs_vars = 4; //////////////////////////////////////////////////////////////////////// -extern bool get_att_value(const NcAtt *, int &value); -extern bool get_att_value(const NcAtt *, float &value); -extern bool get_att_value(const NcAtt *, double &value); - -extern bool get_att_value_chars (const NcAtt *, ConcatString &); -extern int get_att_value_int (const NcAtt *); -extern long long get_att_value_llong (const NcAtt *); -extern double get_att_value_double (const NcAtt *); -extern void get_att_value_doubles(const NcAtt *, NumArray &); -extern float get_att_value_float (const NcAtt *); - -extern bool get_att_value_string(const NcVar *, const ConcatString &, ConcatString &); -extern int get_att_value_int (const NcVar *, const ConcatString &); -extern long long get_att_value_llong (const NcVar *, const ConcatString &); -extern double get_att_value_double(const NcVar *, const ConcatString &); - -extern bool get_att_value_string(const NcFile *, const ConcatString& , ConcatString &); -extern int get_att_value_int (const NcFile *, const ConcatString& ); -extern long long get_att_value_llong (const NcFile *, const ConcatString& ); -extern double get_att_value_double(const NcFile *, const ConcatString& ); -extern bool get_att_no_leap_year(const NcVar *); - -extern NcVarAtt *get_nc_att(const NcVar *, const ConcatString &, bool exit_on_error = false); -extern NcGroupAtt *get_nc_att(const NcFile *, const ConcatString &, bool exit_on_error = false); - -extern bool get_nc_att_value(const NcVarAtt *, std::string &); -extern bool get_nc_att_value(const NcVarAtt *, int &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVarAtt *, float &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVarAtt *, double &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, ConcatString &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, int &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, float &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, double &, bool exit_on_error = false); - -extern bool has_att(NcFile *, const ConcatString name, bool exit_on_error=false); -extern bool has_att(NcVar *, const ConcatString name, bool do_log=false); -extern bool has_unsigned_attribute(NcVar *); - -extern bool get_global_att(const NcGroupAtt *, ConcatString &); +extern bool get_att_value(const netCDF::NcAtt *, int &value); +extern bool get_att_value(const netCDF::NcAtt *, float &value); +extern bool get_att_value(const netCDF::NcAtt *, double &value); + +extern bool get_att_value_chars (const netCDF::NcAtt *, ConcatString &); +extern int get_att_value_int (const netCDF::NcAtt *); +extern long long get_att_value_llong (const netCDF::NcAtt *); +extern double get_att_value_double (const netCDF::NcAtt *); +extern void get_att_value_doubles(const netCDF::NcAtt *, NumArray &); +extern float get_att_value_float (const netCDF::NcAtt *); + +extern bool get_att_value_string(const netCDF::NcVar *, const ConcatString &, ConcatString &); +extern int get_att_value_int (const netCDF::NcVar *, const ConcatString &); +extern long long get_att_value_llong (const netCDF::NcVar *, const ConcatString &); +extern double get_att_value_double(const netCDF::NcVar *, const ConcatString &); + +extern bool get_att_value_string(const netCDF::NcFile *, const ConcatString& , ConcatString &); +extern int get_att_value_int (const netCDF::NcFile *, const ConcatString& ); +extern long long get_att_value_llong (const netCDF::NcFile *, const ConcatString& ); +extern double get_att_value_double(const netCDF::NcFile *, const ConcatString& ); +extern bool get_att_no_leap_year(const netCDF::NcVar *); + +extern netCDF::NcVarAtt *get_nc_att(const netCDF::NcVar *, const ConcatString &, bool exit_on_error = false); +extern netCDF::NcGroupAtt *get_nc_att(const netCDF::NcFile *, const ConcatString &, bool exit_on_error = false); + +extern bool get_nc_att_value(const netCDF::NcVarAtt *, std::string &); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, int &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, float &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, double &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, ConcatString &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, int &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, float &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, double &, bool exit_on_error = false); + +extern bool has_att(netCDF::NcFile *, const ConcatString name, bool exit_on_error=false); +extern bool has_att(netCDF::NcVar *, const ConcatString name, bool do_log=false); +extern bool has_unsigned_attribute(netCDF::NcVar *); + +extern bool get_global_att(const netCDF::NcGroupAtt *, ConcatString &); extern bool get_global_att(const char *, const ConcatString &, bool &); extern bool get_global_att(const char *, const ConcatString &, ConcatString &); -extern bool get_global_att(const NcFile *, const ConcatString &, ConcatString &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, int &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, bool &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, float &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, double &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, ConcatString &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, int &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, bool &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, float &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, double &, bool error_out = false); -extern int get_version_no(const NcFile *); -extern bool is_version_less_than_1_02(const NcFile *nc); +extern int get_version_no(const netCDF::NcFile *); +extern bool is_version_less_than_1_02(const netCDF::NcFile *nc); -extern void add_att(NcFile *, const std::string &, const int ); -extern void add_att(NcFile *, const std::string &, const std::string); -extern void add_att(NcFile *, const std::string &, const char *); -extern void add_att(NcFile *, const std::string &, const ConcatString); -extern void add_att(NcVar *, const std::string &, const std::string); -extern void add_att(NcVar *, const std::string &, const int ); -extern void add_att(NcVar *, const std::string &, const float ); -extern void add_att(NcVar *, const std::string &, const double); +extern void add_att(netCDF::NcFile *, const std::string &, const int ); +extern void add_att(netCDF::NcFile *, const std::string &, const std::string); +extern void add_att(netCDF::NcFile *, const std::string &, const char *); +extern void add_att(netCDF::NcFile *, const std::string &, const ConcatString); +extern void add_att(netCDF::NcVar *, const std::string &, const std::string); +extern void add_att(netCDF::NcVar *, const std::string &, const int ); +extern void add_att(netCDF::NcVar *, const std::string &, const float ); +extern void add_att(netCDF::NcVar *, const std::string &, const double); -extern int get_var_names(NcFile *, StringArray *varNames); +extern int get_var_names(netCDF::NcFile *, StringArray *varNames); -extern bool get_var_att_float (const NcVar *, const ConcatString &, float &); -extern bool get_var_att_double(const NcVar *, const ConcatString &, double &); +extern bool get_var_att_float (const netCDF::NcVar *, const ConcatString &, float &); +extern bool get_var_att_double(const netCDF::NcVar *, const ConcatString &, double &); template -extern bool get_var_fill_value(const NcVar *var, T &att_val); -extern bool get_var_axis(const NcVar *var, ConcatString &att_val); -extern bool get_var_grid_mapping(const NcVar *var, ConcatString &att_val); -extern bool get_var_grid_mapping_name(const NcVar *var, ConcatString &att_val); -extern bool get_var_long_name(const NcVar *, ConcatString &); -extern double get_var_missing_value(const NcVar *); -extern bool get_var_standard_name(const NcVar *, ConcatString &); -extern bool get_var_units(const NcVar *, ConcatString &); +extern bool get_var_fill_value(const netCDF::NcVar *var, T &att_val); +extern bool get_var_axis(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_grid_mapping(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_grid_mapping_name(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_long_name(const netCDF::NcVar *, ConcatString &); +extern double get_var_missing_value(const netCDF::NcVar *); +extern bool get_var_standard_name(const netCDF::NcVar *, ConcatString &); +extern bool get_var_units(const netCDF::NcVar *, ConcatString &); extern bool args_ok(const LongArray &); -extern char get_char_val(NcFile *, const char * var_name, const int index); -extern char get_char_val(NcVar *var, const int index); +extern char get_char_val(netCDF::NcFile *, const char * var_name, const int index); +extern char get_char_val(netCDF::NcVar *var, const int index); -extern int get_int_var(NcFile *, const char * var_name, const int index); -extern int get_int_var(NcVar *, const int index); +extern int get_int_var(netCDF::NcFile *, const char * var_name, const int index); +extern int get_int_var(netCDF::NcVar *, const int index); -extern double get_nc_time(NcVar *, int index = 0); +extern double get_nc_time(netCDF::NcVar *, int index = 0); -extern float get_float_var(NcFile *, const char * var_name, const int index = 0); -extern float get_float_var(NcVar *, int const index = 0); +extern float get_float_var(netCDF::NcFile *, const char * var_name, const int index = 0); +extern float get_float_var(netCDF::NcVar *, int const index = 0); -extern ConcatString* get_string_val(NcFile *, const char * var_name, const int index, +extern ConcatString* get_string_val(netCDF::NcFile *, const char * var_name, const int index, const int len, ConcatString &tmp_cs); -extern ConcatString* get_string_val(NcVar *var, const int index, const int len, ConcatString &tmp_cs); - -extern bool get_nc_data(NcVar *, int *data); -extern bool get_nc_data(NcVar *, char *data); -extern bool get_nc_data(NcVar *, uchar *data); -extern bool get_nc_data(NcVar *, float *data); -extern bool get_nc_data(NcVar *, double *data); -extern bool get_nc_data(NcVar *, time_t *data); -extern bool get_nc_data(NcVar *, ncbyte *data); -extern bool get_nc_data(NcVar *, unsigned short *data); - -extern bool get_nc_data(NcVar *, int *data, const long *curs); -extern bool get_nc_data(NcVar *, char *data, const long *curs); -extern bool get_nc_data(NcVar *, short *data, const long *curs); -extern bool get_nc_data(NcVar *, float *data, const long *curs); -extern bool get_nc_data(NcVar *, double *data, const long *curs); - -extern bool get_nc_data(NcVar *, int *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, char *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, float *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, double *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, ncbyte *data, const long dim, const long cur=0); - -extern bool get_nc_data(NcVar *, int *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, char *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, short *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, float *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, double *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, ncbyte *data, const long *dims, const long *curs); - -extern bool get_nc_data_to_array(NcVar *, StringArray *); -extern bool get_nc_data_to_array(NcFile *, const char *, StringArray *); -extern int get_nc_string_length(NcVar *); -extern int get_nc_string_length(NcFile *, NcVar, const char *var_name); - -extern bool put_nc_data(NcVar *, const int *data ); -extern bool put_nc_data(NcVar *, const char *data ); -extern bool put_nc_data(NcVar *, const float *data ); -extern bool put_nc_data(NcVar *, const double *data ); -extern bool put_nc_data(NcVar *, const ncbyte *data ); - -extern bool put_nc_data(NcVar *, const int data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const char data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const float data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const double data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const ncbyte data, const long offset0=0, const long offset1=-1, const long c2=-1); - -extern bool put_nc_data(NcVar *, const int *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const char *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const float *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const double *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const ncbyte *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const int *data, const long *lengths, const long *offsets); -extern bool put_nc_data(NcVar *, const char *data, const long *lengths, const long *offsets); -extern bool put_nc_data(NcVar *, const float *data, const long *lengths, const long *offsets); - -extern bool put_nc_data_with_dims(NcVar *, const int *data, const int len0, +extern ConcatString* get_string_val(netCDF::NcVar *var, const int index, const int len, ConcatString &tmp_cs); + +extern bool get_nc_data(netCDF::NcVar *, int *data); +extern bool get_nc_data(netCDF::NcVar *, char *data); +extern bool get_nc_data(netCDF::NcVar *, uchar *data); +extern bool get_nc_data(netCDF::NcVar *, float *data); +extern bool get_nc_data(netCDF::NcVar *, double *data); +extern bool get_nc_data(netCDF::NcVar *, time_t *data); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data); +extern bool get_nc_data(netCDF::NcVar *, unsigned short *data); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, short *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long *curs); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data, const long dim, const long cur=0); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, short *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data, const long *dims, const long *curs); + +extern bool get_nc_data_to_array(netCDF::NcVar *, StringArray *); +extern bool get_nc_data_to_array(netCDF::NcFile *, const char *, StringArray *); +extern int get_nc_string_length(netCDF::NcVar *); +extern int get_nc_string_length(netCDF::NcFile *, netCDF::NcVar, const char *var_name); + +extern bool put_nc_data(netCDF::NcVar *, const int *data ); +extern bool put_nc_data(netCDF::NcVar *, const char *data ); +extern bool put_nc_data(netCDF::NcVar *, const float *data ); +extern bool put_nc_data(netCDF::NcVar *, const double *data ); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte *data ); + +extern bool put_nc_data(netCDF::NcVar *, const int data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const char data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const float data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const double data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte data, const long offset0=0, const long offset1=-1, const long c2=-1); + +extern bool put_nc_data(netCDF::NcVar *, const int *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const char *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const float *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const double *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const int *data, const long *lengths, const long *offsets); +extern bool put_nc_data(netCDF::NcVar *, const char *data, const long *lengths, const long *offsets); +extern bool put_nc_data(netCDF::NcVar *, const float *data, const long *lengths, const long *offsets); + +extern bool put_nc_data_with_dims(netCDF::NcVar *, const int *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const int *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const int *data, const long len0, const long len1=0, const long len2=0); -extern bool put_nc_data_with_dims(NcVar *, const float *data, const int len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const float *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const float *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const float *data, const long len0, const long len1=0, const long len2=0); -extern bool put_nc_data_with_dims(NcVar *, const double *data, const int len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const double *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const double *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const double *data, const long len0, const long len1=0, const long len2=0); -extern NcVar get_var(NcFile *, const char * var_name); // exit if not exists -extern NcVar get_nc_var(NcFile *, const char * var_name, bool log_as_error=false); // continue even though not exists - -extern NcVar *copy_nc_var(NcFile *, NcVar *, const int deflate_level=DEF_DEFLATE_LEVEL, const bool all_attrs=true); -extern void copy_nc_att(NcFile *, NcVar *, const ConcatString attr_name); -extern void copy_nc_att( NcVar *, NcVar *, const ConcatString attr_name); -extern void copy_nc_atts(NcFile *, NcFile *, const bool all_attrs=true); -extern void copy_nc_atts( NcVar *, NcVar *, const bool all_attrs=true); -extern void copy_nc_var_data(NcVar *, NcVar *); - -extern bool has_var(NcFile *, const char * var_name); - -extern NcVar add_var(NcFile *, const std::string &, const NcType, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const std::string &, const NcType, const NcDim, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const std::string &, const NcType, const std::vector, const int deflate_level=DEF_DEFLATE_LEVEL); - -extern NcDim add_dim(NcFile *, const std::string &); -extern NcDim add_dim(NcFile *, const std::string &, const size_t); -extern bool has_dim(NcFile *, const char *dim_name); -extern bool get_dim(const NcFile *, const ConcatString &, int &, bool error_out = false); -extern int get_dim_count(const NcVar *); -extern int get_dim_count(const NcFile *); -extern int get_dim_size(const NcDim *); -extern int get_dim_size(const NcVar *, const int dim_offset); -extern int get_dim_value(const NcFile *, const std::string &, const bool error_out = false); -extern NcDim get_nc_dim(const NcFile *, const std::string &dim_name); -extern NcDim get_nc_dim(const NcVar *, const std::string &dim_name); -extern NcDim get_nc_dim(const NcVar *, const int dim_offset); -extern bool get_dim_names(const NcVar *var, StringArray *dimNames); -extern bool get_dim_names(const NcFile *nc, StringArray *dimNames); - -extern NcVar get_nc_var_lat(const NcFile *nc); -extern NcVar get_nc_var_lon(const NcFile *nc); -extern NcVar get_nc_var_time(const NcFile *nc); -extern int get_index_at_nc_data(NcVar *var, double value, const std::string dim_name, bool is_time=false); -extern NcFile* open_ncfile(const char * nc_name, bool write = false); - -extern int get_data_size(NcVar *); -extern unixtime get_reference_unixtime(NcVar *time_var, int &sec_per_unit, +extern netCDF::NcVar get_var(netCDF::NcFile *, const char * var_name); // exit if not exists +extern netCDF::NcVar get_nc_var(netCDF::NcFile *, const char * var_name, bool log_as_error=false); // continue even though not exists + +extern netCDF::NcVar *copy_nc_var(netCDF::NcFile *, netCDF::NcVar *, const int deflate_level=DEF_DEFLATE_LEVEL, const bool all_attrs=true); +extern void copy_nc_att(netCDF::NcFile *, netCDF::NcVar *, const ConcatString attr_name); +extern void copy_nc_att( netCDF::NcVar *, netCDF::NcVar *, const ConcatString attr_name); +extern void copy_nc_atts(netCDF::NcFile *, netCDF::NcFile *, const bool all_attrs=true); +extern void copy_nc_atts( netCDF::NcVar *, netCDF::NcVar *, const bool all_attrs=true); +extern void copy_nc_var_data(netCDF::NcVar *, netCDF::NcVar *); + +extern bool has_var(netCDF::NcFile *, const char * var_name); + +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const std::vector, const int deflate_level=DEF_DEFLATE_LEVEL); + +extern netCDF::NcDim add_dim(netCDF::NcFile *, const std::string &); +extern netCDF::NcDim add_dim(netCDF::NcFile *, const std::string &, const size_t); +extern bool has_dim(netCDF::NcFile *, const char *dim_name); +extern bool get_dim(const netCDF::NcFile *, const ConcatString &, int &, bool error_out = false); +extern int get_dim_count(const netCDF::NcVar *); +extern int get_dim_count(const netCDF::NcFile *); +extern int get_dim_size(const netCDF::NcDim *); +extern int get_dim_size(const netCDF::NcVar *, const int dim_offset); +extern int get_dim_value(const netCDF::NcFile *, const std::string &, const bool error_out = false); +extern netCDF::NcDim get_nc_dim(const netCDF::NcFile *, const std::string &dim_name); +extern netCDF::NcDim get_nc_dim(const netCDF::NcVar *, const std::string &dim_name); +extern netCDF::NcDim get_nc_dim(const netCDF::NcVar *, const int dim_offset); +extern bool get_dim_names(const netCDF::NcVar *var, StringArray *dimNames); +extern bool get_dim_names(const netCDF::NcFile *nc, StringArray *dimNames); + +extern netCDF::NcVar get_nc_var_lat(const netCDF::NcFile *nc); +extern netCDF::NcVar get_nc_var_lon(const netCDF::NcFile *nc); +extern netCDF::NcVar get_nc_var_time(const netCDF::NcFile *nc); +extern int get_index_at_nc_data(netCDF::NcVar *var, double value, const std::string dim_name, bool is_time=false); +extern netCDF::NcFile* open_ncfile(const char * nc_name, bool write = false); + +extern int get_data_size(netCDF::NcVar *); +extern unixtime get_reference_unixtime(netCDF::NcVar *time_var, int &sec_per_unit, bool &no_leap_year); extern bool is_nc_unit_time(const char *units); diff --git a/src/libcode/vx_nc_util/nc_utils.hpp b/src/libcode/vx_nc_util/nc_utils.hpp index 7783219985..ceb5bd2807 100644 --- a/src/libcode/vx_nc_util/nc_utils.hpp +++ b/src/libcode/vx_nc_util/nc_utils.hpp @@ -13,21 +13,21 @@ //////////////////////////////////////////////////////////////////////// -extern bool get_att_value(const NcAtt *att, int &att_val); -extern bool get_att_value(const NcAtt *att, ConcatString &value); -extern bool get_att_value(const NcAtt *att, ncbyte &att_val); -extern bool get_att_value(const NcAtt *att, short &att_val); -extern bool get_att_value(const NcAtt *att, int &att_val); -extern bool get_att_value(const NcAtt *att, unsigned int &att_val); -extern bool get_att_value(const NcAtt *att, float &att_val); -extern bool get_att_value(const NcAtt *att, double &att_val); -extern ConcatString get_log_msg_for_att(const NcVarAtt *att); -extern ConcatString get_log_msg_for_att(const NcVarAtt *att, std::string var_name, +extern bool get_att_value(const netCDF::NcAtt *att, int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, ConcatString &value); +extern bool get_att_value(const netCDF::NcAtt *att, ncbyte &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, short &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, unsigned int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, float &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, double &att_val); +extern ConcatString get_log_msg_for_att(const netCDF::NcVarAtt *att); +extern ConcatString get_log_msg_for_att(const netCDF::NcVarAtt *att, std::string var_name, const ConcatString att_name); -extern double get_var_add_offset(const NcVar *var); -extern double get_var_scale_factor(const NcVar *var); -extern bool has_add_offset_attr(NcVar *var); -extern bool has_scale_factor_attr(NcVar *var); +extern double get_var_add_offset(const netCDF::NcVar *var); +extern double get_var_scale_factor(const netCDF::NcVar *var); +extern bool has_add_offset_attr(netCDF::NcVar *var); +extern bool has_scale_factor_attr(netCDF::NcVar *var); extern void set_def_fill_value(ncbyte *val); extern void set_def_fill_value(char *val); extern void set_def_fill_value(double *val); @@ -45,7 +45,7 @@ extern void set_def_fill_value(unsigned short *val); //////////////////////////////////////////////////////////////////////// template -bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { +bool get_att_num_value_(const netCDF::NcAtt *att, T &att_val, int matching_type) { bool status = false; if (IS_VALID_NC_P(att)) { int nc_type_id = GET_NC_TYPE_ID_P(att); @@ -71,7 +71,7 @@ bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, +bool get_nc_att_value_(const netCDF::NcVar *var, const ConcatString &att_name, T &att_val, bool exit_on_error, T bad_data, const char *caller_name) { bool status = false; @@ -82,8 +82,8 @@ bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, // // Retrieve the NetCDF variable attribute. // - NcVarAtt *att = get_nc_att(var, att_name); - status = get_att_value((NcAtt *)att, att_val); + netCDF::NcVarAtt *att = get_nc_att(var, att_name); + status = get_att_value((netCDF::NcAtt *)att, att_val); if (!status) { mlog << Error << "\n" << caller_name << get_log_msg_for_att(att, GET_SAFE_NC_NAME_P(var), att_name); @@ -100,7 +100,7 @@ bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, //////////////////////////////////////////////////////////////////////// template -bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, +bool get_nc_att_value_(const netCDF::NcVarAtt *att, T &att_val, bool exit_on_error, T bad_data, const char *caller_name) { bool status = true; @@ -110,7 +110,7 @@ bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, // // Retrieve the NetCDF variable attribute. // - status = get_att_value((NcAtt *)att, att_val); + status = get_att_value((netCDF::NcAtt *)att, att_val); if (!status) { mlog << Error << "\n" << caller_name << get_log_msg_for_att(att); @@ -123,15 +123,15 @@ bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, //////////////////////////////////////////////////////////////////////// template -bool get_global_att_value_(const NcFile *nc, const ConcatString& att_name, +bool get_global_att_value_(const netCDF::NcFile *nc, const ConcatString& att_name, T &att_val, T bad_data, bool error_out, const char *caller_name) { bool status = false; // Initialize att_val = bad_data; - NcGroupAtt *nc_att = get_nc_att(nc, att_name); + netCDF::NcGroupAtt *nc_att = get_nc_att(nc, att_name); if (IS_VALID_NC_P(nc_att)) { - status = get_att_value((NcAtt *)nc_att, att_val); + status = get_att_value((netCDF::NcAtt *)nc_att, att_val); std::string data_type = GET_NC_TYPE_NAME_P(nc_att); if (error_out && !status) { mlog << Error << caller_name @@ -154,14 +154,14 @@ bool get_global_att_value_(const NcFile *nc, const ConcatString& att_name, //////////////////////////////////////////////////////////////////////// template -bool get_var_att_num_(const NcVar *var, const ConcatString &att_name, +bool get_var_att_num_(const netCDF::NcVar *var, const ConcatString &att_name, T &att_val, T bad_data) { bool status = false; // Initialize att_val = bad_data; - NcVarAtt *att = get_nc_att(var, att_name); + netCDF::NcVarAtt *att = get_nc_att(var, att_name); // Look for a match if (IS_VALID_NC_P(att)) { att->getValues(&att_val); @@ -175,10 +175,10 @@ bool get_var_att_num_(const NcVar *var, const ConcatString &att_name, //////////////////////////////////////////////////////////////////////// template -bool get_var_fill_value(const NcVar *var, T &att_val) { +bool get_var_fill_value(const netCDF::NcVar *var, T &att_val) { bool found = false; - NcVarAtt *att = get_nc_att(var, fill_value_att_name); + netCDF::NcVarAtt *att = get_nc_att(var, fill_value_att_name); if (IS_INVALID_NC_P(att)) { if (att) delete att; att = get_nc_att(var, missing_value_att_name); @@ -258,7 +258,7 @@ void apply_scale_factor_(T *data, const int cell_count, // - template _ reads data and applies scale_factor and add_offset. template -bool get_nc_data_t(NcVar *var, T *data) { +bool get_nc_data_t(netCDF::NcVar *var, T *data) { bool return_status = false; if (IS_VALID_NC_P(var)) { @@ -272,7 +272,7 @@ bool get_nc_data_t(NcVar *var, T *data) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, const T met_missing) { +bool get_nc_data_(netCDF::NcVar *var, T *data, const T met_missing) { //const char *method_name = "get_nc_data_() "; int data_size = get_data_size(var); @@ -302,7 +302,7 @@ bool get_nc_data_(NcVar *var, T *data, const T met_missing) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long *curs) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const long *dims, const long *curs) { bool return_status = false; const char *method_name = "get_nc_data_(T, *dims, *curs) "; @@ -315,7 +315,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long for (int idx = 0 ; idx < dimC; idx++) { int dim_size = get_dim_size(var, idx); if ((curs[idx]+dims[idx]) > dim_size) { - NcDim nc_dim = get_nc_dim(var, idx); + netCDF::NcDim nc_dim = get_nc_dim(var, idx); mlog << Error << "\n" << method_name << "The start offset and count (" << curs[idx] << ", " << dims[idx] << ") exceeds the dimension[" << idx << "] " << dim_size << " " @@ -358,7 +358,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, T met_missing, const long dim, const long cur) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T met_missing, const long dim, const long cur) { bool return_status = false; const char *method_name = "get_nc_data_(T, dim, cur) "; for (int idx=0; idx dim_size) && (0 < dim_size)) { - NcDim nc_dim = get_nc_dim(var, dim_idx); + netCDF::NcDim nc_dim = get_nc_dim(var, dim_idx); mlog << Error << "\n" << method_name << "The start offset and count (" << cur << " + " << dim << ") exceeds the dimension " << dim_size << " " << (IS_VALID_NC(nc_dim) ? GET_NC_NAME(nc_dim) : " ") @@ -415,7 +415,7 @@ bool get_nc_data_(NcVar *var, T *data, T met_missing, const long dim, const long // read a single data template -bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *curs) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const long *curs) { bool return_status = false; const char *method_name = "get_nc_data_(*curs) "; @@ -436,7 +436,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *curs) { //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_t(NcVar *var, float *data, const T *packed_data, +void copy_nc_data_t(netCDF::NcVar *var, float *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor, bool has_missing, T missing_value) { @@ -525,7 +525,7 @@ void copy_nc_data_t(NcVar *var, float *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_(NcVar *var, float *data, const T *packed_data, +void copy_nc_data_(netCDF::NcVar *var, float *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor) { T missing_value; @@ -538,7 +538,7 @@ void copy_nc_data_(NcVar *var, float *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_t(NcVar *var, double *data, const T *packed_data, +void copy_nc_data_t(netCDF::NcVar *var, double *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor, bool has_missing, T missing_value) { @@ -622,7 +622,7 @@ void copy_nc_data_t(NcVar *var, double *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_(NcVar *var, double *data, const T *packed_data, +void copy_nc_data_(netCDF::NcVar *var, double *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor) { T missing_value; @@ -635,7 +635,7 @@ void copy_nc_data_(NcVar *var, double *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long offset2) { +bool put_nc_data_T(netCDF::NcVar *var, const T data, long offset0, long offset1, long offset2) { std::vector offsets; offsets.push_back((size_t)offset0); if (0 <= offset1) { @@ -651,7 +651,7 @@ bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long of //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T *data, const long length, const long offset) { +bool put_nc_data_T(netCDF::NcVar *var, const T *data, const long length, const long offset) { std::vector offsets, counts; int dim_count = get_dim_count(var); offsets.push_back(offset); @@ -667,7 +667,7 @@ bool put_nc_data_T(NcVar *var, const T *data, const long length, const long o //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long *offsets) { +bool put_nc_data_T(netCDF::NcVar *var, const T *data , const long *lengths, const long *offsets) { int dim = get_dim_count(var); std::vector nc_offsets, counts; for (int idx = 0 ; idx < dim; idx++) { @@ -683,7 +683,7 @@ bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long * //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T_with_dims(NcVar *var, const T *data, +bool put_nc_data_T_with_dims(netCDF::NcVar *var, const T *data, const long len0, const long len1, const long len2) { std::vector offsets, counts; if (0 < len0) { diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4c3e9173cd..1764eb9bce 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -12,6 +12,9 @@ using namespace std; +#include +using namespace netCDF; + #include #include #include diff --git a/src/libcode/vx_nc_util/nc_var_info.h b/src/libcode/vx_nc_util/nc_var_info.h index d1a8b08e35..ab01c5869b 100644 --- a/src/libcode/vx_nc_util/nc_var_info.h +++ b/src/libcode/vx_nc_util/nc_var_info.h @@ -22,7 +22,6 @@ #include -using namespace netCDF; #include "vx_util.h" @@ -60,7 +59,7 @@ class NcVarInfo { void dump(std::ostream &, int = 0) const; - NcVar * var; // not allocated + netCDF::NcVar * var; // not allocated ConcatString name; @@ -82,7 +81,7 @@ class NcVarInfo { int Ndims; - NcDim ** Dims; // allocated + netCDF::NcDim ** Dims; // allocated int x_slot; // starting from zero int y_slot; // @@ -102,12 +101,12 @@ extern bool get_att_level(const NcVarInfo &, ConcatString &); extern bool get_att_name(const NcVarInfo &, ConcatString &); // unixtimes could be ints or strings -extern bool get_att_unixtime(const NcVar *, const ConcatString, unixtime &); +extern bool get_att_unixtime(const netCDF::NcVar *, const ConcatString, unixtime &); extern bool get_att_unixtime(const NcVarInfo &, const ConcatString, unixtime &); -extern unixtime get_att_value_unixtime(const NcAtt *); +extern unixtime get_att_value_unixtime(const netCDF::NcAtt *); -extern unixtime get_att_value_unixtime(const NcAtt *); +extern unixtime get_att_value_unixtime(const netCDF::NcAtt *); extern NcVarInfo* find_var_info_by_dim_name(NcVarInfo *vars, const std::string dim_name, const int nvars); diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc index e3d30cb787..7d5e037007 100644 --- a/src/libcode/vx_nc_util/write_netcdf.cc +++ b/src/libcode/vx_nc_util/write_netcdf.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_cal.h" #include "vx_util.h" diff --git a/src/libcode/vx_nc_util/write_netcdf.h b/src/libcode/vx_nc_util/write_netcdf.h index 79f76e044c..3b5e1339e9 100644 --- a/src/libcode/vx_nc_util/write_netcdf.h +++ b/src/libcode/vx_nc_util/write_netcdf.h @@ -14,7 +14,6 @@ //////////////////////////////////////////////////////////////////////// #include -using namespace netCDF; #include "vx_grid.h" #include "vx_config.h" @@ -27,15 +26,15 @@ static const float FILL_VALUE = -9999.f; //////////////////////////////////////////////////////////////////////// -extern void write_netcdf_global (NcFile *, const char *, const char *, +extern void write_netcdf_global (netCDF::NcFile *, const char *, const char *, const char *model_name = (const char *) 0, const char *obtype = (const char *) 0, const char *desc = (const char *) 0); -extern void write_netcdf_proj (NcFile *, const Grid &, NcDim &, NcDim &); -extern void write_netcdf_latlon (NcFile *, NcDim *, NcDim *, const Grid &); -extern void write_netcdf_grid_weight(NcFile *, NcDim *, NcDim *, const GridWeightType, const DataPlane &); -extern void write_netcdf_var_times (NcVar *, const DataPlane &); -extern void write_netcdf_var_times (NcVar *, const unixtime, const unixtime, const int); +extern void write_netcdf_proj (netCDF::NcFile *, const Grid &, netCDF::NcDim &, netCDF::NcDim &); +extern void write_netcdf_latlon (netCDF::NcFile *, netCDF::NcDim *, netCDF::NcDim *, const Grid &); +extern void write_netcdf_grid_weight(netCDF::NcFile *, netCDF::NcDim *, netCDF::NcDim *, const GridWeightType, const DataPlane &); +extern void write_netcdf_var_times (netCDF::NcVar *, const DataPlane &); +extern void write_netcdf_var_times (netCDF::NcVar *, const unixtime, const unixtime, const int); diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index fa8ce18715..9b53ad9dc9 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -13,6 +13,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "file_exists.h" #include "string_fxns.h" diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index eca0375312..95e0c598a2 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -18,6 +18,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "series_pdf.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_series_data/series_pdf.h b/src/libcode/vx_series_data/series_pdf.h index ec0792bcec..96c629c8d4 100644 --- a/src/libcode/vx_series_data/series_pdf.h +++ b/src/libcode/vx_series_data/series_pdf.h @@ -17,7 +17,6 @@ #include #include -using namespace netCDF; #include "vx_util.h" #include "vx_log.h" @@ -79,7 +78,7 @@ void print_pdf( //////////////////////////////////////////////////////////////////////// void write_nc_pdf( - NcFile* nc_out, + netCDF::NcFile* nc_out, const VarInfo& info, double min, double delta, diff --git a/src/libcode/vx_shapedata/interest.h b/src/libcode/vx_shapedata/interest.h index 3bed46f2b5..2afe66661b 100644 --- a/src/libcode/vx_shapedata/interest.h +++ b/src/libcode/vx_shapedata/interest.h @@ -85,7 +85,7 @@ class SingleFeature { //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const SingleFeature &); +extern std::ostream & operator<<(std::ostream &, const SingleFeature &); //////////////////////////////////////////////////////////////////////// @@ -134,7 +134,7 @@ class PairFeature { //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const PairFeature &); +extern std::ostream & operator<<(std::ostream &, const PairFeature &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/mode_columns.h b/src/libcode/vx_shapedata/mode_columns.h index b37a057b5e..d8528bc361 100644 --- a/src/libcode/vx_shapedata/mode_columns.h +++ b/src/libcode/vx_shapedata/mode_columns.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////// -static const string mode_hdr_columns [] = { +static const std::string mode_hdr_columns [] = { "VERSION", // 1 "MODEL", // 2 @@ -43,7 +43,7 @@ static const string mode_hdr_columns [] = { }; -static const string mode_obj_columns [] = { +static const std::string mode_obj_columns [] = { "OBJECT_ID", // 23 "OBJECT_CAT", // 24 diff --git a/src/libcode/vx_shapedata/set.h b/src/libcode/vx_shapedata/set.h index 5aa0fecb12..c110e77dc1 100644 --- a/src/libcode/vx_shapedata/set.h +++ b/src/libcode/vx_shapedata/set.h @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04-15-05 Halley Gotway +// 001 10-03-22 Prestopnik MET #2227 Remove using namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -89,7 +90,7 @@ extern FcstObsSet union_fcst_obs_sets(const FcstObsSet &, const FcstObsSet &); extern int fcst_obs_sets_overlap(const FcstObsSet &, const FcstObsSet &); -extern ostream & operator<<(ostream &, const FcstObsSet &); +extern std::ostream & operator<<(std::ostream &, const FcstObsSet &); /////////////////////////////////////////////////////////////////////////////// @@ -159,7 +160,7 @@ class SetCollection { /////////////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const SetCollection &); +extern std::ostream & operator<<(std::ostream &, const SetCollection &); inline void SetCollection::make_room(const int __n) { if ( __n > 0 ) extend(n_sets + __n); return; } diff --git a/src/libcode/vx_shapedata/shape.h b/src/libcode/vx_shapedata/shape.h index f3b677ad3e..288106d197 100644 --- a/src/libcode/vx_shapedata/shape.h +++ b/src/libcode/vx_shapedata/shape.h @@ -17,8 +17,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-03-06 Halley Gotway New -// 001 22-09-28 Prestopnik Added "std::"; removing namespace -// from header files +// 001 22-09-28 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -27,8 +26,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "moments.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 27bb488ffb..3abeb3fd5f 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -34,7 +34,7 @@ class ObsErrorEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // Line number of the table int line_number; @@ -111,7 +111,7 @@ class ObsErrorTable { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index 6159fbb9c7..17501d867a 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -39,10 +39,10 @@ struct ens_ssvar_pt { double w; }; -typedef deque ssvar_pt_list; -typedef map ssvar_bin_map; // Indexed by bin min -typedef CRC_Array BoolArray; -typedef CRC_Array ObsErrorEntryPtrArray; +typedef std::deque ssvar_pt_list; +typedef std::map ssvar_bin_map; // Indexed by bin min +typedef CRC_Array BoolArray; +typedef CRC_Array ObsErrorEntryPtrArray; // Number of SSVAR bins to produce a warning static const int n_warn_ssvar_bins = 1000; diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.cc b/src/libcode/vx_tc_util/vx_tc_nc_util.cc index 796468a71f..9f166f3d73 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.cc +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.cc @@ -10,6 +10,9 @@ using namespace std; +#include +using namespace netCDF; + #include "vx_tc_nc_util.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.h b/src/libcode/vx_tc_util/vx_tc_nc_util.h index 679742ba00..e90a34fb5c 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.h +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.h @@ -14,7 +14,6 @@ //////////////////////////////////////////////////////////////////////// #include -using namespace netCDF; #include "vx_log.h" #include "vx_data2d.h" @@ -24,8 +23,8 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -extern void write_tc_tracks(NcFile*, - const NcDim&, const TrackInfoArray&); +extern void write_tc_tracks(netCDF::NcFile*, + const netCDF::NcDim&, const TrackInfoArray&); extern std::set get_pressure_level_strings( std::map >); @@ -42,49 +41,49 @@ extern std::map get_pressure_level_indices( extern std::map get_pressure_level_indices( std::set, std::set); -extern void def_tc_pressure(NcFile*, - const NcDim&, std::set); +extern void def_tc_pressure(netCDF::NcFile*, + const netCDF::NcDim&, std::set); -extern void def_tc_range_azimuth(NcFile*, - const NcDim&, const NcDim&, const TcrmwGrid&, double); +extern void def_tc_range_azimuth(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const TcrmwGrid&, double); -extern void def_tc_lat_lon_time(NcFile*, - const NcDim&, const NcDim&, const NcDim&, - NcVar&, NcVar&, NcVar&); +extern void def_tc_lat_lon_time(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, netCDF::NcVar&, netCDF::NcVar&); -extern void def_tc_variables(NcFile*, +extern void def_tc_variables(netCDF::NcFile*, std::map >, std::map, std::map, - const NcDim&, const NcDim&, const NcDim&, const NcDim&, - std::map&); + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + std::map&); -extern void def_tc_data(NcFile*, - const NcDim&, const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_data(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void def_tc_data_3d(NcFile*, - const NcDim&, const NcDim&, const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_data_3d(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void def_tc_azi_mean_data(NcFile*, - const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_azi_mean_data(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void write_tc_valid_time(NcFile*, - const int&, const NcVar&, const long&); +extern void write_tc_valid_time(netCDF::NcFile*, + const int&, const netCDF::NcVar&, const long&); -extern void write_tc_data(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_data(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_data_rev(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_data_rev(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_azi_mean_data(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_azi_mean_data(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_pressure_level_data(NcFile*, const TcrmwGrid&, +extern void write_tc_pressure_level_data(netCDF::NcFile*, const TcrmwGrid&, std::map, const std::string&, - const int&, const NcVar&, const double*); + const int&, const netCDF::NcVar&, const double*); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 6d3309289e..aea1980c72 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -68,6 +68,7 @@ // 036 02/20/22 Halley Gotway MET #1259 Write probabilistic statistics. // 037 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main. // 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic. +// 039 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -83,6 +84,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "ensemble_stat.h" diff --git a/src/tools/core/ensemble_stat/ensemble_stat.h b/src/tools/core/ensemble_stat/ensemble_stat.h index 3714d0b12c..7559c71525 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.h +++ b/src/tools/core/ensemble_stat/ensemble_stat.h @@ -27,7 +27,6 @@ #include #include -using namespace netCDF; #include "ensemble_stat_conf_info.h" @@ -124,9 +123,9 @@ static int compress_level = -1; // Output NetCDF file static bool out_nc_flag = false; static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_ens_var_sa; diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index a7ed788b3c..3912a3866a 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -110,6 +110,7 @@ // 052 05/28/21 Halley Gotway Add MCTS HSS_EC output. // 053 12/11/21 Halley Gotway MET #1991 Fix VCNT output. // 054 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 055 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -125,6 +126,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "handle_openmp.h" diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index 4b3a0c4ace..555941e10c 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -18,7 +18,7 @@ // 001 05/03/10 Halley Gotway Add fcst/obs/diff variable name // arrays to keep track of NetCDF variables. // 002 05/10/16 Halley Gotway Add grid weighting. -// 003 09/28/22 Prestopnik MET #2227 Remove namespace std +// 003 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -41,7 +41,6 @@ #include #include -using namespace netCDF; #include "grid_stat_conf_info.h" @@ -122,11 +121,11 @@ static ConcatString out_dir; // //////////////////////////////////////////////////////////////////////// -// Output NetCDF file -static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +// Output Netcdf file +static ConcatString out_nc_file; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_var_sa; diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index 8c93b2530a..984fc0aee9 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mode_exec.h" #include "nc_utils.h" #include "vx_regrid.h" diff --git a/src/tools/core/mode/mode_exec.h b/src/tools/core/mode/mode_exec.h index 934f674a30..718841b093 100644 --- a/src/tools/core/mode/mode_exec.h +++ b/src/tools/core/mode/mode_exec.h @@ -19,7 +19,6 @@ #include #include -using namespace netCDF; #include "vx_data2d.h" #include "vx_data2d_factory.h" @@ -132,8 +131,8 @@ class ModeExecutive { void write_obj_stats(); void write_obj_netcdf(const ModeNcOutInfo &); - void write_poly_netcdf(NcFile *); - void write_poly_netcdf(NcFile *, const ObjPolyType); + void write_poly_netcdf(netCDF::NcFile *); + void write_poly_netcdf(netCDF::NcFile *, const ObjPolyType); void write_ct_stats(); }; diff --git a/src/tools/core/pcp_combine/pcp_combine.cc b/src/tools/core/pcp_combine/pcp_combine.cc index d70047ebbb..7ba1f7d803 100644 --- a/src/tools/core/pcp_combine/pcp_combine.cc +++ b/src/tools/core/pcp_combine/pcp_combine.cc @@ -76,6 +76,7 @@ // 023 08/29/19 Halley Gotway Support multiple arguments for the // the -pcpdir option. // 024 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 025 09/29/22 Prestopnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -92,6 +93,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index d14c149cd8..aa3f0c02b9 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -101,6 +101,7 @@ // 049 12/11/21 Halley Gotway MET #1991 Fix VCNT output. // 050 02/11/22 Halley Gotway MET #2045 Fix HiRA output. // 051 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 052 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -116,6 +117,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "point_stat.h" diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 1d0cb938c9..1c75d7e8ea 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // // //////////////////////////////////////////////////////////////////////// @@ -40,9 +40,6 @@ #include #include -#include -using namespace netCDF; - #include "point_stat_conf_info.h" #include "vx_data2d_factory.h" diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index c0533c16bf..d62e401109 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -33,6 +33,7 @@ // 012 01/20/22 Halley Gotway MET #2003 Add PSTD BRIERCL output. // 013 05/25/22 Halley Gotway MET #2147 Add CTS HSS_EC output. // 014 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 015 10/03/22 Presotpnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -49,6 +50,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "series_analysis.h" diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index 0e8e918a27..d591837294 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 12/10/12 Halley Gotway New -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // // //////////////////////////////////////////////////////////////////////// @@ -39,7 +39,6 @@ #include #include -using namespace netCDF; #include "series_analysis_conf_info.h" @@ -89,13 +88,13 @@ static SeriesAnalysisConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim ; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim ; // Structure to store computed statistics and corresponding metadata struct NcVarData { - NcVar * var; // Pointer to NetCDF variable + netCDF::NcVar * var; // Pointer to NetCDF variable }; // Mapping of NetCDF variable name to computed statistic diff --git a/src/tools/core/stat_analysis/skill_score_index_job.h b/src/tools/core/stat_analysis/skill_score_index_job.h index 1dcf3df387..b00c4e93db 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.h +++ b/src/tools/core/stat_analysis/skill_score_index_job.h @@ -25,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index fba1cc753d..233f261384 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -38,6 +38,7 @@ // 013 04/01/19 Fillmore Add FCST and OBS units. // 014 07/09/21 Linden MET #1746 Skip thresholding. // 015 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 016 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -56,6 +57,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "wavelet_stat.h" #include "vx_statistics.h" diff --git a/src/tools/core/wavelet_stat/wavelet_stat.h b/src/tools/core/wavelet_stat/wavelet_stat.h index 40f38f382a..57155d4d8b 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.h +++ b/src/tools/core/wavelet_stat/wavelet_stat.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -40,7 +40,6 @@ #include #include -using namespace netCDF; #include "wavelet_stat_conf_info.h" @@ -94,14 +93,14 @@ static ConcatString out_dir; // Output NetCDF file static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim x_dim ; -static NcDim y_dim ; -static NcDim scale_dim ; -static NcDim tile_dim ; -static NcVar fcst_var ; -static NcVar obs_var ; -static NcVar diff_var ; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim x_dim ; +static netCDF::NcDim y_dim ; +static netCDF::NcDim scale_dim ; +static netCDF::NcDim tile_dim ; +static netCDF::NcVar fcst_var ; +static netCDF::NcVar obs_var ; +static netCDF::NcVar diff_var ; // Output PostScript file static ConcatString out_ps_file; diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index 5983eba9aa..a063fd9df8 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 09/29/22 Prestopnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -31,6 +32,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_util.h" #include "vx_nc_util.h" diff --git a/src/tools/dev_utils/insitu_nc_file.cc b/src/tools/dev_utils/insitu_nc_file.cc index d1bde55beb..db3955924d 100644 --- a/src/tools/dev_utils/insitu_nc_file.cc +++ b/src/tools/dev_utils/insitu_nc_file.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/tools/dev_utils/insitu_nc_file.h b/src/tools/dev_utils/insitu_nc_file.h index f4b316d344..473dc4af5e 100644 --- a/src/tools/dev_utils/insitu_nc_file.h +++ b/src/tools/dev_utils/insitu_nc_file.h @@ -23,9 +23,6 @@ #include -#include -using namespace netCDF; - #include "vx_grid.h" #include "data_plane.h" #include "long_array.h" @@ -53,7 +50,7 @@ class InsituNcFile { void close(); - NcFile * _ncFile; // allocated + netCDF::NcFile * _ncFile; // allocated long _numRecords; long _currRecord; diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 20e11cbeaf..264d222536 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -14,6 +14,9 @@ using namespace std; +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_math.h" diff --git a/src/tools/dev_utils/met_nc_file.h b/src/tools/dev_utils/met_nc_file.h index adbc568a4f..81b702e2b9 100644 --- a/src/tools/dev_utils/met_nc_file.h +++ b/src/tools/dev_utils/met_nc_file.h @@ -23,9 +23,6 @@ #include #include -#include -using namespace netCDF; - #include "vx_time_series.h" //////////////////////////////////////////////////////////////////////// @@ -54,32 +51,32 @@ class MetNcFile std::string _filePath; - NcFile *_ncFile; - - NcDim *_hdrArrDim; - NcDim *_obsArrDim; - NcDim *_nhdrDim; - NcDim *_nobsDim; - NcDim *_strlDim; - - NcDim hdrArrDim; - NcDim obsArrDim; - NcDim nhdrDim; - NcDim nobsDim; - NcDim strlDim; - NcDim strllDim; - - NcVar *_hdrArrVar; - NcVar *_hdrTypeVar; - NcVar *_hdrSidVar; - NcVar *_hdrVldVar; - NcVar *_obsArrVar; + netCDF::NcFile *_ncFile; + + netCDF::NcDim *_hdrArrDim; + netCDF::NcDim *_obsArrDim; + netCDF::NcDim *_nhdrDim; + netCDF::NcDim *_nobsDim; + netCDF::NcDim *_strlDim; + + netCDF::NcDim hdrArrDim; + netCDF::NcDim obsArrDim; + netCDF::NcDim nhdrDim; + netCDF::NcDim nobsDim; + netCDF::NcDim strlDim; + netCDF::NcDim strllDim; + + netCDF::NcVar *_hdrArrVar; + netCDF::NcVar *_hdrTypeVar; + netCDF::NcVar *_hdrSidVar; + netCDF::NcVar *_hdrVldVar; + netCDF::NcVar *_obsArrVar; - NcVar hdrArrVar; - NcVar hdrTypeVar; - NcVar hdrSidVar; - NcVar hdrVldVar; - NcVar obsArrVar; + netCDF::NcVar hdrArrVar; + netCDF::NcVar hdrTypeVar; + netCDF::NcVar hdrSidVar; + netCDF::NcVar hdrVldVar; + netCDF::NcVar obsArrVar; /////////////////////// // Protected methods // diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index e1be8ba119..2e4eaf960b 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -47,9 +47,12 @@ // ascii. // 019 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 020 08/26/22 Dave Albo Add AirNow observations. +// 021 10/03/22 Prestopnik MET #2227 Remove using namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 9be6e86495..492398c89b 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -15,6 +15,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_nc_util.h" diff --git a/src/tools/other/ascii2nc/file_handler.h b/src/tools/other/ascii2nc/file_handler.h index 092fd0340a..495705b803 100644 --- a/src/tools/other/ascii2nc/file_handler.h +++ b/src/tools/other/ascii2nc/file_handler.h @@ -23,7 +23,6 @@ #include #include -using namespace netCDF; #include "mask_poly.h" #include "vx_grid.h" @@ -85,7 +84,7 @@ class FileHandler // Variables for writing output NetCDF file - NcFile *_ncFile; + netCDF::NcFile *_ncFile; MetNcPointObsOut nc_point_obs; long _nhdr; diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index 32948bf06a..f0140b840e 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -19,9 +19,12 @@ // 002 01/14/21 McCabe MET #1695 All members in one file. // 003 02/17/22 Halley Gotway MET #1918 Add normalize config option. // 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 005 10/03/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -33,6 +36,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "gen_ens_prod.h" diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.h b/src/tools/other/gen_ens_prod/gen_ens_prod.h index a3367364fe..cfe0120a8e 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.h +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 09/10/21 Halley Gotway MET #1904 Initial version. -// 001 09/29/22 Prestopnik MET #2227 Remove namespace std from header files +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -38,7 +38,6 @@ #include #include -using namespace netCDF; #include "gen_ens_prod_conf_info.h" @@ -82,9 +81,9 @@ static unixtime ens_valid_ut = (unixtime) 0; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_ens_var_sa; diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 7f4c4299b5..f65d466fd6 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -29,7 +29,7 @@ // 011 12/13/21 Halley Gotway MET #1993 Fix -type grid. // 012 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. // 013 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 014 09/28/22 Prestopnik MET #2227 Remove namespace std +// 014 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -46,6 +46,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "gen_vx_mask.h" diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index a8e2212371..96e3be2a94 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -18,10 +18,13 @@ // 001 07/28/20 Halley Gotway Updates for #1391. // 002 03/04/21 Halley Gotway Bugfix #1694. // 003 08/20/21 Halley Gotway Bugfix #1886 for integer overflow. -// 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 005 10/03/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -33,6 +36,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "grid_diag.h" #include "series_data.h" diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 59af967e46..18b18d3326 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 10/01/19 Fillmore New -// 001 09/29/22 Prestopnik MET #2227 Remove namespace std from header files +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -39,7 +39,6 @@ #include #include -using namespace netCDF; #include "grid_diag_conf_info.h" @@ -86,10 +85,10 @@ static GridDiagConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -vector data_var_dims; -vector hist_vars; -vector joint_hist_vars; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +vector data_var_dims; +vector hist_vars; +vector joint_hist_vars; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/other/gsi_tools/gsid2mpr.cc b/src/tools/other/gsi_tools/gsid2mpr.cc index 33b841d370..83527ea9e1 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.cc +++ b/src/tools/other/gsi_tools/gsid2mpr.cc @@ -16,10 +16,13 @@ // ---- ---- ---- ----------- // 000 06/09/15 Bullock New // 001 01/26/16 Halley Gotway Add -no_check_dup option. -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 10/03/22 Prestopnik MET #2227 Remove using namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/gsi_tools/gsidens2orank.cc b/src/tools/other/gsi_tools/gsidens2orank.cc index 903960793f..744ba5fff6 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.cc +++ b/src/tools/other/gsi_tools/gsidens2orank.cc @@ -16,9 +16,12 @@ // ---- ---- ---- ----------- // 000 07/09/15 Halley Gotway New // 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 10/03/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/ioda2nc/ioda2nc.cc b/src/tools/other/ioda2nc/ioda2nc.cc index 90c6c75c34..1aaef67ba1 100644 --- a/src/tools/other/ioda2nc/ioda2nc.cc +++ b/src/tools/other/ioda2nc/ioda2nc.cc @@ -21,9 +21,12 @@ // ---- ---- ---- ----------- // 000 07-21-20 Howard Soh New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -31,6 +34,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "apply_mask.h" #include "ioda2nc_conf_info.h" diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index aa0c6d4d8e..ecf635a539 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -33,7 +33,7 @@ // 006 07-23-18 Halley Gotway Support masks from gen_vx_mask. // 007 01-11-19 Howard Soh Added config file option. // 008 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 009 09-29-22 Prestopnik MET #2227 Remove namespace std from header files +// 009 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -50,6 +50,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "madis2nc.h" diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.h b/src/tools/other/mode_graphics/mode_nc_output_file.h index d883d74152..68a398017e 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.h +++ b/src/tools/other/mode_graphics/mode_nc_output_file.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "data_plane.h" #include "vx_grid.h" @@ -50,36 +49,36 @@ class ModeNcOutputFile { ConcatString Filename; - int get_int (NcVar *, int x, int y) const; - double get_float (NcVar *, int x, int y) const; + int get_int (netCDF::NcVar *, int x, int y) const; + double get_float (netCDF::NcVar *, int x, int y) const; - int count_objects(NcVar *) const; + int count_objects(netCDF::NcVar *) const; DataPlane select_obj(ModeObjectField, int) const; - void calc_data_range(NcVar *, double & min_value, double & max_value); + void calc_data_range(netCDF::NcVar *, double & min_value, double & max_value); - NcFile * f; // allocated + netCDF::NcFile * f; // allocated Grid * _Grid; // allocated - NcVar * FcstObjId; // NOT allocated - NcVar * FcstClusId; // NOT allocated + netCDF::NcVar * FcstObjId; // NOT allocated + netCDF::NcVar * FcstClusId; // NOT allocated - NcVar * ObsObjId; // NOT allocated - NcVar * ObsClusId; // NOT allocated + netCDF::NcVar * ObsObjId; // NOT allocated + netCDF::NcVar * ObsClusId; // NOT allocated - NcVar * FcstRaw; // NOT allocated - NcVar * ObsRaw; // NOT allocated + netCDF::NcVar * FcstRaw; // NOT allocated + netCDF::NcVar * ObsRaw; // NOT allocated - NcVar _FcstObjId; // - NcVar _FcstClusId; // + netCDF::NcVar _FcstObjId; // + netCDF::NcVar _FcstClusId; // - NcVar _ObsObjId; // - NcVar _ObsClusId; // + netCDF::NcVar _ObsObjId; // + netCDF::NcVar _ObsClusId; // - NcVar _FcstRaw; // - NcVar _ObsRaw; // + netCDF::NcVar _FcstRaw; // + netCDF::NcVar _ObsRaw; // ModeNcOutputFile(const ModeNcOutputFile &); ModeNcOutputFile & operator=(const ModeNcOutputFile &); diff --git a/src/tools/other/mode_time_domain/3d_conv.cc b/src/tools/other/mode_time_domain/3d_conv.cc index 5a4027eafb..bc28ed8d7e 100644 --- a/src/tools/other/mode_time_domain/3d_conv.cc +++ b/src/tools/other/mode_time_domain/3d_conv.cc @@ -28,6 +28,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_cal.h" #include "vx_util.h" #include "vx_pxm.h" diff --git a/src/tools/other/mode_time_domain/mtd.cc b/src/tools/other/mode_time_domain/mtd.cc index 7038fee0d8..5cb1c982af 100644 --- a/src/tools/other/mode_time_domain/mtd.cc +++ b/src/tools/other/mode_time_domain/mtd.cc @@ -21,6 +21,7 @@ // 003 04-25-19 Halley Gotway Add percentiles to 2D output // 004 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main // 005 08-01-22 Albo MET #1971 Differing time steps +// 006 10-03-22 Prestopnik MET #2227 Remove using namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -42,6 +43,7 @@ static const char default_prefix [] = "mtd"; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/other/mode_time_domain/mtd_file_base.cc b/src/tools/other/mode_time_domain/mtd_file_base.cc index f1e3571d17..2c4244ded4 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.cc +++ b/src/tools/other/mode_time_domain/mtd_file_base.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_base.h b/src/tools/other/mode_time_domain/mtd_file_base.h index 98d30f10a1..bc84dbf37b 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.h +++ b/src/tools/other/mode_time_domain/mtd_file_base.h @@ -21,7 +21,6 @@ #include #include -using namespace netCDF; #include "vx_util.h" #include "vx_cal.h" @@ -77,8 +76,8 @@ class MtdFileBase { void base_assign(const MtdFileBase &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; Grid * G; // allocated diff --git a/src/tools/other/mode_time_domain/mtd_file_float.cc b/src/tools/other/mode_time_domain/mtd_file_float.cc index 6d7cb262a4..56304c428b 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.cc +++ b/src/tools/other/mode_time_domain/mtd_file_float.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_float.h b/src/tools/other/mode_time_domain/mtd_file_float.h index 20493e5965..615b9a3c93 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.h +++ b/src/tools/other/mode_time_domain/mtd_file_float.h @@ -47,8 +47,8 @@ class MtdFloatFile : public MtdFileBase { void float_assign(const MtdFloatFile &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; float * Data; // allocated diff --git a/src/tools/other/mode_time_domain/mtd_file_int.cc b/src/tools/other/mode_time_domain/mtd_file_int.cc index 931a3cb994..4bf41a4792 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.cc +++ b/src/tools/other/mode_time_domain/mtd_file_int.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_int.h b/src/tools/other/mode_time_domain/mtd_file_int.h index 8611b25368..098d56d046 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.h +++ b/src/tools/other/mode_time_domain/mtd_file_int.h @@ -43,8 +43,8 @@ class MtdIntFile : public MtdFileBase { void int_assign(const MtdIntFile &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; diff --git a/src/tools/other/mode_time_domain/mtd_nc_output.cc b/src/tools/other/mode_time_domain/mtd_nc_output.cc index 86f1f84c48..7fd50136e2 100644 --- a/src/tools/other/mode_time_domain/mtd_nc_output.cc +++ b/src/tools/other/mode_time_domain/mtd_nc_output.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_nc_output.h" #include "write_netcdf.h" diff --git a/src/tools/other/mode_time_domain/nc_grid.cc b/src/tools/other/mode_time_domain/nc_grid.cc index 516f24756a..e31246ab4d 100644 --- a/src/tools/other/mode_time_domain/nc_grid.cc +++ b/src/tools/other/mode_time_domain/nc_grid.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "nc_utils_local.h" #include "nc_grid.h" diff --git a/src/tools/other/mode_time_domain/nc_grid.h b/src/tools/other/mode_time_domain/nc_grid.h index 47bc766d37..70b45fdef9 100644 --- a/src/tools/other/mode_time_domain/nc_grid.h +++ b/src/tools/other/mode_time_domain/nc_grid.h @@ -25,9 +25,9 @@ //////////////////////////////////////////////////////////////////////// -extern bool read_nc_grid(NcFile &, Grid &); +extern bool read_nc_grid(netCDF::NcFile &, Grid &); -extern bool write_nc_grid(NcFile &, const Grid &); +extern bool write_nc_grid(netCDF::NcFile &, const Grid &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/nc_utils_local.cc b/src/tools/other/mode_time_domain/nc_utils_local.cc index 12a056f376..87af32b3ab 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.cc +++ b/src/tools/other/mode_time_domain/nc_utils_local.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "nc_utils.h" #include "nc_utils_local.h" #include "vx_log.h" diff --git a/src/tools/other/mode_time_domain/nc_utils_local.h b/src/tools/other/mode_time_domain/nc_utils_local.h index 9cf6d18587..528f2b566a 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.h +++ b/src/tools/other/mode_time_domain/nc_utils_local.h @@ -25,10 +25,10 @@ //////////////////////////////////////////////////////////////////////// -extern const char * string_att (const NcFile &, const char * name); -extern int string_att_as_int (const NcFile &, const char * name); -extern long long string_att_as_ll (const NcFile &, const char * name); -extern double string_att_as_double (const NcFile &, const char * name); +extern const char * string_att (const netCDF::NcFile &, const char * name); +extern int string_att_as_int (const netCDF::NcFile &, const char * name); +extern long long string_att_as_ll (const netCDF::NcFile &, const char * name); +extern double string_att_as_double (const netCDF::NcFile &, const char * name); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index cfa0bf329c..e1dc57a6e9 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -54,7 +54,8 @@ // 015 02/10/18 Halley Gotway Add message_type_group_map. // 016 07/23/18 Halley Gotway Support masks defined by gen_vx_mask. // 017 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 018 09/12/22 Prestopnik MET #2227 Remove namespace std from header files +// 018 09/12/22 Prestopnik MET #2227 Remove namespace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// @@ -72,6 +73,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "pb2nc_conf_info.h" #include "data_class.h" diff --git a/src/tools/other/plot_point_obs/plot_point_obs.h b/src/tools/other/plot_point_obs/plot_point_obs.h index 527d7098b5..41c8c0f47b 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.h +++ b/src/tools/other/plot_point_obs/plot_point_obs.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/05/20 Halley Gotway New -// 001 09/29/22 Prestopnik Removing namespace std from header files +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -37,8 +37,6 @@ #include #include -#include -using namespace netCDF; #include "plot_point_obs_conf_info.h" diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 78c622e17c..496e3384e0 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -20,13 +20,19 @@ // 000 12-11-19 Howard Soh Support GOES-16 // 001 01-25-21 Halley Gotway MET #1630 Handle zero obs. // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 10-03-23 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 253fe37c47..8218a7984c 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -24,9 +24,12 @@ // 004 01-28-20 Howard Soh Moved GOES-16/17 to point2grib // 005 04-09-20 Halley Gotway Add convert and censor options. // 006 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 007 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -40,6 +43,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 710f91431a..2600b5b20b 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -22,7 +22,8 @@ // 000 11-12-14 Halley Gotway New // 001 06-07-22 Halley Gotway MET #2173 Fix python embedding // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09-12-22 Prestopnik MET #2227 Remove namespace std from header files +// 003 09-12-22 Prestopnik MET #2227 Remove namespace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// @@ -39,6 +40,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "GridTemplate.h" #include "vx_log.h" diff --git a/src/tools/other/wwmca_tool/nc_output.cc b/src/tools/other/wwmca_tool/nc_output.cc index 5fd8431615..eab5533a57 100644 --- a/src/tools/other/wwmca_tool/nc_output.cc +++ b/src/tools/other/wwmca_tool/nc_output.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_cal.h" diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index 32e12087fb..1465aa706f 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -18,6 +18,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "rmw_analysis.h" diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index 2e490e1807..c4575a1534 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 08/19/19 Fillmore New -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -38,7 +38,6 @@ #include #include -using namespace netCDF; #include "rmw_analysis_conf_info.h" @@ -82,14 +81,14 @@ static ConcatString out_dir; ConcatString out_file; // NetCDF file information -static NcFile* nc_in = (NcFile*) 0; -static NcFile* nc_out = (NcFile*) 0; +static netCDF::NcFile* nc_in = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; // Grid dimension information -static NcDim range_dim; -static NcDim azimuth_dim; -static NcDim level_dim; -static NcDim track_point_dim; +static netCDF::NcDim range_dim; +static netCDF::NcDim azimuth_dim; +static netCDF::NcDim level_dim; +static netCDF::NcDim track_point_dim; static std::string range_name; static std::string range_units; @@ -98,7 +97,7 @@ static std::string azimuth_units; static std::string level_name; static std::string level_units; -static NcVar valid_time_var; +static netCDF::NcVar valid_time_var; // Grid data static int n_range; diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index d3ef66f474..dac4f15243 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -18,7 +18,8 @@ // 001 07/25/14 Halley Gotway Add -land option and update how // distances are computed. // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09/28/22 Prestopnik MET #2227 Remove namspace std from header files +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// @@ -34,6 +35,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "grib_classes.h" diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index a42da71a6a..76f1a09652 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -24,7 +24,7 @@ // 007 11/22/21 Halley Gotway MET #1810 Add -shape option // 008 05/02/22 Halley Gotway MET #2148 Fix init_hour and lead misses // 009 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 010 09/28/22 Prestopnik MET #2227 Remove using namespace std from header files +// 010 09/28/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files // // //////////////////////////////////////////////////////////////////////// @@ -42,6 +42,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "tc_gen.h" #include "pair_data_genesis.h" diff --git a/src/tools/tc_utils/tc_gen/tc_gen.h b/src/tools/tc_utils/tc_gen/tc_gen.h index ab8676991d..ad1d164729 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.h +++ b/src/tools/tc_utils/tc_gen/tc_gen.h @@ -28,7 +28,6 @@ #include #include -using namespace netCDF; #include "tc_gen_conf_info.h" @@ -114,9 +113,9 @@ static ConcatString out_base; // Output NetCDF file static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_var_sa; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 7cffe21f4e..09b60a0336 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -17,7 +17,7 @@ // 000 04/18/19 Fillmore New // 001 05/15/20 Halley Gotway Fix data file list option logic. // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 003 09/28/22 Prestopnik MET #2227 Remove namspace std from header files +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -33,6 +33,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "tc_rmw.h" diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 1763703999..0975708a20 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -15,7 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04/18/19 Fillmore New -// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -39,7 +39,6 @@ #include #include -using namespace netCDF; #include "tc_rmw_conf_info.h" #include "tc_rmw_wind_converter.h" @@ -98,22 +97,22 @@ static ConcatString out_prefix; // Output NetCDF file static ConcatString out_file; -static NcFile* nc_out = (NcFile*) 0; -static NcDim range_dim; -static NcDim azimuth_dim; -static NcDim pressure_dim; -static NcDim track_point_dim; -static NcVar lat_arr_var; -static NcVar lon_arr_var; -static NcVar valid_time_var; -static NcVar data_var; -static NcVar wind_r_var; -static NcVar wind_a_var; - -static std::vector data_vars; -static std::vector azi_mean_data_vars; - -static std::map data_3d_vars; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcDim range_dim; +static netCDF::NcDim azimuth_dim; +static netCDF::NcDim pressure_dim; +static netCDF::NcDim track_point_dim; +static netCDF::NcVar lat_arr_var; +static netCDF::NcVar lon_arr_var; +static netCDF::NcVar valid_time_var; +static netCDF::NcVar data_var; +static netCDF::NcVar wind_r_var; +static netCDF::NcVar wind_a_var; + +static std::vector data_vars; +static std::vector azi_mean_data_vars; + +static std::map data_3d_vars; // List of output NetCDF variable names static StringArray nc_var_sa; From d44937f892be167059054b97b189d6752ea7170e Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 3 Oct 2022 16:22:11 -0600 Subject: [PATCH 15/26] Per #2227, resolve errors in GitHub Actions build --- src/tools/other/lidar2nc/lidar2nc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index 17b61a7f08..49b649059b 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -18,7 +18,7 @@ // ---- ---- ---- ----------- // 000 03-22-17 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main -// 002 09-12-22 Prestopnik MET #2227 Remove namespace std from header files +// 002 09-12-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -43,6 +43,7 @@ using namespace std; #include #include +using namespace netCDF; #include "hdf.h" #include "mfhdf.h" From 3f2b6e35e3e147763eae0d044c473ad675b4e88e Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 3 Oct 2022 16:32:04 -0600 Subject: [PATCH 16/26] Per #2227, resolve new errors in GitHub Actions build --- src/tools/other/modis_regrid/data_plane_to_netcdf.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc index 67baabf37c..e084cf0d97 100644 --- a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc +++ b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "data_plane_to_netcdf.h" #include "vx_log.h" // mlog #include "vx_cal.h" // bad_data_float From acacaeaedc3df032a185dcdbb9b9dcf45940a4d6 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 3 Oct 2022 16:55:45 -0600 Subject: [PATCH 17/26] Per #2227, resolve new errors in GitHub Actions build --- src/tools/other/mode_graphics/plot_mode_field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 9fca9d3049..ebd917c4ef 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -781,7 +781,7 @@ return; //////////////////////////////////////////////////////////////////////// -void get_data_ppm(ModecNOutputFile & mode_in, Ppm & image) +void get_data_ppm(ModeNcOutputFile & mode_in, Ppm & image) { From a10c6e826d80660e93b70cb60514d15d594ed076 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 3 Oct 2022 17:02:16 -0600 Subject: [PATCH 18/26] Per #2227, resolve new errors in GitHub Actions build --- src/tools/other/mode_graphics/mode_nc_output_file.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.cc b/src/tools/other/mode_graphics/mode_nc_output_file.cc index ce45948a81..c50d28554f 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.cc +++ b/src/tools/other/mode_graphics/mode_nc_output_file.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mode_nc_output_file.h" #include "nc_var_info.h" #include "nc_utils.h" From 765ea8d60e81df95ab28931389d71593b394f4fe Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:52:19 -0600 Subject: [PATCH 19/26] Per #2227, realign variables --- src/basic/vx_cal/vx_cal.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/basic/vx_cal/vx_cal.h b/src/basic/vx_cal/vx_cal.h index 2b270769a6..272ee17d75 100644 --- a/src/basic/vx_cal/vx_cal.h +++ b/src/basic/vx_cal/vx_cal.h @@ -180,13 +180,13 @@ static const double TIME_EPSILON = 0.001; // Bad Data Values // -static const int bad_data_int = -9999; -static const long long bad_data_ll = -9999LL; -static const float bad_data_float = -9999.f; -static const double bad_data_double = -9999.0; -static const char bad_data_str[] = "-9999"; -static const char bad_data_char = '\0'; -static const char na_str[] = "NA"; +static const int bad_data_int = -9999; +static const long long bad_data_ll = -9999LL; +static const float bad_data_float = -9999.f; +static const double bad_data_double = -9999.0; +static const char bad_data_str[] = "-9999"; +static const char bad_data_char = '\0'; +static const char na_str[] = "NA"; static const std::string na_string = "NA"; From e3afbecf73dae4fc3a5d03e89475434dc5f6d3b7 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:53:57 -0600 Subject: [PATCH 20/26] Per #2227, updating comment --- src/basic/vx_util/GridOffset.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/basic/vx_util/GridOffset.h b/src/basic/vx_util/GridOffset.h index cea32e3b5d..4af50d0328 100644 --- a/src/basic/vx_util/GridOffset.h +++ b/src/basic/vx_util/GridOffset.h @@ -17,8 +17,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. -// 001 09-06-22 Prestopnik Added "std::"; removing namespace -// from header files +// 001 09-06-22 Prestopnik MET #2227 Remove namesapce std from header files // /////////////////////////////////////////////////////////////////////////////// From b437f3189ba7a63f7bee6da8df2614ceca93c628 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:54:32 -0600 Subject: [PATCH 21/26] Per #2227, updating comment --- src/basic/vx_util/GridTemplate.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index 64d5dfa123..552dcff295 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -18,8 +18,7 @@ // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. // 001 09-07-21 Halley Gotway Add wrap_lon. -// 002 09-07-22 Prestopnik Added "std::"; removing namespace -// from header files +// 002 09-07-22 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// From a0dad9eede367eb53ba9a41e499ced25f48e5085 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:55:14 -0600 Subject: [PATCH 22/26] Per #2227, realign variables --- src/basic/vx_util/ascii_header.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/vx_util/ascii_header.h b/src/basic/vx_util/ascii_header.h index 527ca75ec4..24181e3d2a 100644 --- a/src/basic/vx_util/ascii_header.h +++ b/src/basic/vx_util/ascii_header.h @@ -103,7 +103,7 @@ class AsciiHeader { void assign(const AsciiHeader &); - StringArray Versions; + StringArray Versions; std::vector Headers; public: From d4052537d5404cd4e67fea75450851f30484657a Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:57:28 -0600 Subject: [PATCH 23/26] Per #2227, realign variables --- src/basic/vx_util/observation.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/basic/vx_util/observation.h b/src/basic/vx_util/observation.h index cd18961f93..62dd3fe688 100644 --- a/src/basic/vx_util/observation.h +++ b/src/basic/vx_util/observation.h @@ -203,17 +203,17 @@ class Observation std::string _headerType; std::string _stationId; - time_t _validTime; - double _latitude; - double _longitude; - double _elevation; + time_t _validTime; + double _latitude; + double _longitude; + double _elevation; std::string _qualityFlag; std::string _varName; - int varCode; - long hdrIndex; - double _pressureLevel; - double _height; - double _value; + int varCode; + long hdrIndex; + double _pressureLevel; + double _height; + double _value; /////////////////////// From de41d32779e75e48908ae3249fe937b6760243b0 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 08:58:44 -0600 Subject: [PATCH 24/26] Per #2227, realign variables --- src/libcode/vx_data2d_grib/grib_strings.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_data2d_grib/grib_strings.h b/src/libcode/vx_data2d_grib/grib_strings.h index 665f80bd03..0b51dd9121 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.h +++ b/src/libcode/vx_data2d_grib/grib_strings.h @@ -18,8 +18,8 @@ //////////////////////////////////////////////////////////////////////// static const std::string missing_str = "MISSING"; -static const char ugrd_abbr_str[] = "UGRD"; -static const char vgrd_abbr_str[] = "VGRD"; +static const char ugrd_abbr_str[] = "UGRD"; +static const char vgrd_abbr_str[] = "VGRD"; static const std::string ugrd_vgrd_abbr_str = "UGRD_VGRD"; static const std::string wind_abbr_str = "WIND"; static const std::string wdir_abbr_str = "WDIR"; From c42880a9a29213c4deb173436a9872573a694bc8 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Tue, 4 Oct 2022 09:02:14 -0600 Subject: [PATCH 25/26] Per #2227, updating comment --- src/libcode/vx_shapedata/shapedata.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcode/vx_shapedata/shapedata.h b/src/libcode/vx_shapedata/shapedata.h index 7598474ca0..1ba59f5fa3 100644 --- a/src/libcode/vx_shapedata/shapedata.h +++ b/src/libcode/vx_shapedata/shapedata.h @@ -16,8 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-05-31 Halley Gotway Adapated from wrfdata.h. -// 001 22-09-28 Prestopnik Added "std::"; removing namspace -// from header files +// 001 22-09-28 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// From 5906d022b837f350c8fd4b3956e7f4a2f1bbde4b Mon Sep 17 00:00:00 2001 From: jprestop Date: Tue, 4 Oct 2022 10:05:47 -0600 Subject: [PATCH 26/26] Update src/basic/vx_config/config.tab.cc Co-authored-by: johnhg --- src/basic/vx_config/config.tab.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/vx_config/config.tab.cc b/src/basic/vx_config/config.tab.cc index 43fe74766f..5b67009f59 100644 --- a/src/basic/vx_config/config.tab.cc +++ b/src/basic/vx_config/config.tab.cc @@ -1389,7 +1389,7 @@ yyparse (void) YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; + yystate = 8; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */