diff --git a/.github/workflows/release-checksum.yml b/.github/workflows/release-checksum.yml index 683f258a6c..55d8b41cb0 100644 --- a/.github/workflows/release-checksum.yml +++ b/.github/workflows/release-checksum.yml @@ -9,6 +9,6 @@ jobs: add-checksum: runs-on: ubuntu-latest steps: - - uses: dtcenter/metplus-action-release-checksum@v1 + - uses: dtcenter/metplus-action-release-checksum@v2 with: token: ${{ secrets.METPLUS_BOT_TOKEN }} diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index fb6e4f47eb..5a92571886 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -1626,6 +1626,26 @@ The default setting is >=0.1&&<=0.85. seeps_p1_thresh = >=0.1&&<=0.85; +seeps_grid_climo_name +--------------------- + +The "seeps_grid_climo_name" option sets the location and the filename of the SEEPS climo file for the gridded data. +The default setting is the empty string. It should be configured by the user. It can be overridden by the environment variable, MET_SEEPS_GRID_CLIMO_NAME. + +.. code-block:: none + + seeps_grid_climo_name = ""; + +seeps_point_climo_name +---------------------- + +The "seeps_point_climo_name" option controls the location and the filename of the SEEPS climo file for the point data. +The default setting is the empty string which does not override the default location and name. It can be overridden by the environment variable, MET_SEEPS_POINT_CLIMO_NAME. + +.. code-block:: none + + seeps_point_climo_name = ""; + mask_missing_flag ----------------- diff --git a/docs/Users_Guide/grid-stat.rst b/docs/Users_Guide/grid-stat.rst index c09df58d54..051178cfb1 100644 --- a/docs/Users_Guide/grid-stat.rst +++ b/docs/Users_Guide/grid-stat.rst @@ -428,7 +428,7 @@ The **output_flag** array controls the type of output that the Grid-Stat tool ge Note that the first two line types are easily derived from one another. The user is free to choose which measure is most desired. The output line types are described in more detail in :numref:`grid_stat-output`. -The SEEPS climo file is not distributed with MET tools because of the file size. It should be configured by using the environment variable, MET_SEEPS_GRID_CLIMO_NAME. +The SEEPS climo file is not distributed with MET tools because of the file size. It should be configured by using the configuration file (seeps_grid_climo_name). It can be overridden by the environment variable, MET_SEEPS_GRID_CLIMO_NAME. _____________________ diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index 025b462f23..0f42d54129 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -501,7 +501,7 @@ Note that writing out matched pair data (MPR lines) for a large number of cases If all line types corresponding to a particular verification method are set to NONE, the computation of those statistics will be skipped in the code and thus make the Point-Stat tool run more efficiently. For example, if FHO, CTC, and CTS are all set to NONE, the Point-Stat tool will skip the categorical verification step. -The default SEEPS climo file exists at MET_BASE/climo/seeps/PPT24_seepsweights.nc. It can be overridden by using the environment variable, MET_SEEPS_POINT_CLIMO_NAME. +The default SEEPS climo file exists at MET_BASE/climo/seeps/PPT24_seepsweights.nc. It is configurable by using the configuration file (seeps_point_climo_name). It can be overridden by the environment variable, MET_SEEPS_POINT_CLIMO_NAME. .. _point_stat-output: diff --git a/docs/Users_Guide/reformat_point.rst b/docs/Users_Guide/reformat_point.rst index ec09fa3f83..fb0a7b2766 100644 --- a/docs/Users_Guide/reformat_point.rst +++ b/docs/Users_Guide/reformat_point.rst @@ -1153,7 +1153,7 @@ point2grid Configuration File The default configuration file for the point2grid tool named **Point2GridConfig_default** can be found in the installed *share/met/config* directory. It is recommended that users make a copy of this file prior to modifying its contents. -The point2grid configuration file is optional and only necessary when defining the variable name instead of GRIB code or filtering by time. The contents of the default MADIS2NC configuration file are described below. +The point2grid configuration file is optional and only necessary when defining the variable name instead of GRIB code or filtering by time. The contents of the default point2grid configuration file are described below. _____________________ @@ -1194,6 +1194,16 @@ The configuration option listed above is common to many MET tools and are descri This entry is an array of dictionaries, each containing a **GRIB code** string and mathcing **variable name** string which define a mapping of GRIB code to the output variable names. +.. code-block:: none + + var_name_map = [ + ... + { key = "lat_vname"; val = "NLAT"; }, + { key = "lon_vname"; val = "NLON"; } + ... + ] + +The latitude and longitude variables for NetCDF input can be overridden by the configurations. There are two special keys, **lat_vname** and **lon_vname** which are applied to the NetCDF input, not for GRIB code. Point NetCDF to ASCII Python Utility ==================================== diff --git a/internal/test_unit/config/GridStatConfig_SEEPS b/internal/test_unit/config/GridStatConfig_SEEPS index 8a23c76c45..51bc14e2d6 100644 --- a/internal/test_unit/config/GridStatConfig_SEEPS +++ b/internal/test_unit/config/GridStatConfig_SEEPS @@ -210,6 +210,7 @@ nc_pairs_flag = { // Threshold for SEEPS p1 (Probability of being dry) seeps_p1_thresh = ${SEEPS_P1_THRESH}; +seeps_grid_climo_name = "${SEEPS_GRID_CLIMO_NAME}"; //////////////////////////////////////////////////////////////////////////////// diff --git a/internal/test_unit/config/Point2GridConfig_lat_lon b/internal/test_unit/config/Point2GridConfig_lat_lon new file mode 100644 index 0000000000..80eee8fef6 --- /dev/null +++ b/internal/test_unit/config/Point2GridConfig_lat_lon @@ -0,0 +1,4 @@ +var_name_map = [ + { key = "lat_vname"; val = "NLAT"; }, + { key = "lon_vname"; val = "NLON"; } +]; diff --git a/internal/test_unit/config/PointStatConfig_APCP b/internal/test_unit/config/PointStatConfig_APCP index a6a6f06d64..b1df56e94b 100644 --- a/internal/test_unit/config/PointStatConfig_APCP +++ b/internal/test_unit/config/PointStatConfig_APCP @@ -127,15 +127,10 @@ output_flag = { rps = NONE; eclv = BOTH; mpr = NONE; - seeps = ${SEEPS_FLAG}; - seeps_mpr = ${SEEPS_FLAG}; + seeps = NONE; + seeps_mpr = NONE; } -//////////////////////////////////////////////////////////////////////////////// -// Threshold for SEEPS p1 (Probability of being dry) - -seeps_p1_thresh = ${SEEPS_P1_THRESH}; - //////////////////////////////////////////////////////////////////////////////// duplicate_flag = NONE; diff --git a/internal/test_unit/config/PointStatConfig_SEEPS b/internal/test_unit/config/PointStatConfig_SEEPS new file mode 100644 index 0000000000..20ffa18cfb --- /dev/null +++ b/internal/test_unit/config/PointStatConfig_SEEPS @@ -0,0 +1,149 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Point-Stat configuration file. +// +// For additional information, please see the MET User's Guide. +// Copied from PointStatConfig_APCP +// +//////////////////////////////////////////////////////////////////////////////// + +model = "FCST"; + +// +// Output description to be written +// May be set separately in each "obs.field" entry +// +desc = "NA"; + +//////////////////////////////////////////////////////////////////////////////// + +regrid = { + to_grid = NONE; + method = NEAREST; + width = 1; +} + +//////////////////////////////////////////////////////////////////////////////// + +obs_window = { + beg = ${BEG_DS}; + end = ${END_DS}; +} + +//////////////////////////////////////////////////////////////////////////////// + +mpr_column = []; +mpr_thresh = []; +cnt_thresh = [ NA ]; +cnt_logic = UNION; +wind_thresh = [ NA ]; +wind_logic = UNION; +eclv_points = 0.05; + +cat_thresh = [ >0.254, >0.635, >1.270, >2.540 ]; +message_type = "ADPSFC"; + +fcst = { + sid_inc = []; + sid_exc = []; + obs_quality_inc = []; + obs_quality_exc = []; + + field = [ + { + name = "${FCST_FIELD_NAME}"; + level = "${FCST_FIELD_LEVEL}"; + } + ]; + +} +obs = ${OBS_DICT}; + +//////////////////////////////////////////////////////////////////////////////// + +mask = { + grid = [ "FULL" ]; + poly = []; + sid = []; + llpnt = []; +} + +//////////////////////////////////////////////////////////////////////////////// + +ci_alpha = [ 0.05 ]; + +boot = { + interval = PCTILE; + rep_prop = 1.0; + n_rep = 0; + rng = "mt19937"; + seed = "1"; +} + +//////////////////////////////////////////////////////////////////////////////// + +interp = { + vld_thresh = 1.0; + + type = [ + { method = MEDIAN; width = 3; }, + { method = NEAREST; width = 1; }, + { method = DW_MEAN; width = [ 3, 5 ]; }, + { method = LS_FIT; width = [ 3, 5 ]; }, + { method = BILIN; width = 2; } + ]; +} + +//////////////////////////////////////////////////////////////////////////////// + +hira = { + flag = FALSE; + width = [ 2, 3, 4, 5 ]; + vld_thresh = 1.0; + cov_thresh = [ ==0.25 ]; + shape = SQUARE; + prob_cat_thresh = []; +} + +//////////////////////////////////////////////////////////////////////////////// + +output_flag = { + fho = BOTH; + ctc = BOTH; + cts = BOTH; + mctc = NONE; + mcts = NONE; + cnt = BOTH; + sl1l2 = BOTH; + sal1l2 = NONE; + vl1l2 = NONE; + val1l2 = NONE; + vcnt = NONE; + pct = NONE; + pstd = NONE; + pjc = NONE; + prc = NONE; + ecnt = NONE; + orank = NONE; + rps = NONE; + eclv = BOTH; + mpr = NONE; + seeps = BOTH; + seeps_mpr = BOTH; +} + +//////////////////////////////////////////////////////////////////////////////// +// Threshold for SEEPS p1 (Probability of being dry) + +seeps_p1_thresh = ${SEEPS_P1_THRESH}; +seeps_point_climo_name = "${SEEPS_POINT_CLIMO_NAME}"; + +//////////////////////////////////////////////////////////////////////////////// + +duplicate_flag = NONE; +rank_corr_flag = FALSE; +tmp_dir = "/tmp"; +output_prefix = "${OUTPUT_PREFIX}"; +version = "V12.0.0"; + +//////////////////////////////////////////////////////////////////////////////// diff --git a/internal/test_unit/xml/unit_grid_stat.xml b/internal/test_unit/xml/unit_grid_stat.xml index cc24ad21d3..ad070dff60 100644 --- a/internal/test_unit/xml/unit_grid_stat.xml +++ b/internal/test_unit/xml/unit_grid_stat.xml @@ -296,7 +296,7 @@ SEEPS_FLAG BOTH SEEPS_P1_THRESH NA OUTPUT_PREFIX SEEPS - MET_SEEPS_GRID_CLIMO_NAME&DATA_DIR_CLIMO;/seeps/PPT24_seepsweights_grid.nc + SEEPS_GRID_CLIMO_NAME&DATA_DIR_CLIMO;/seeps/PPT24_seepsweights_grid.nc \ &DATA_DIR_MODEL;/seeps/gpm_2021120100_2021120200_trmmgrid.nc \ diff --git a/internal/test_unit/xml/unit_point2grid.xml b/internal/test_unit/xml/unit_point2grid.xml index 213ffcf756..aa9a1d0410 100644 --- a/internal/test_unit/xml/unit_point2grid.xml +++ b/internal/test_unit/xml/unit_point2grid.xml @@ -249,6 +249,78 @@ + + &MET_BIN;/point2grid + + MET_TMP_DIR &OUTPUT_DIR;/point2grid + + \ + &DATA_DIR_OBS;/point_obs/iceh.2018-01-03.c00.small.nc \ + G171 \ + &OUTPUT_DIR;/point2grid/point2grid_sea_ice.nc \ + -field 'name="uvel_d"; level="(0,*,*)";' -field 'name="hi_d"; level="(0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/point2grid/point2grid_sea_ice.nc + + + + + &MET_BIN;/point2grid + + MET_TMP_DIR &OUTPUT_DIR;/point2grid + + \ + &DATA_DIR_OBS;/point_obs/iceh.2018-01-03.c00.small.nc \ + G171 \ + &OUTPUT_DIR;/point2grid/point2grid_sea_ice_snow.nc \ + -config &CONFIG_DIR;/Point2GridConfig_lat_lon \ + -field 'name="hs_d_without_att"; level="(0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/point2grid/point2grid_sea_ice_snow.nc + + + + + + + &MET_BIN;/point2grid + + MET_TMP_DIR &OUTPUT_DIR;/point2grid + + \ + &DATA_DIR_OBS;/point_obs/rtofs_glo_2ds_f006_ice_coverage.nc \ + "latlon 720 360 -80. -60. 0.5 0.5" \ + &OUTPUT_DIR;/point2grid/point2grid_rtofs_ice_coverage.nc \ + -field 'name="ice_coverage"; level="(0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/point2grid/point2grid_rtofs_ice_coverage.nc + + + &MET_BIN;/point2grid @@ -283,4 +355,5 @@ &OUTPUT_DIR;/point2grid/point2grid_2D_time_west_bering_sea.nc + diff --git a/internal/test_unit/xml/unit_point_stat.xml b/internal/test_unit/xml/unit_point_stat.xml index aea2b8e042..2c90567c80 100644 --- a/internal/test_unit/xml/unit_point_stat.xml +++ b/internal/test_unit/xml/unit_point_stat.xml @@ -168,8 +168,6 @@ FCST_FIELD_NAME APCP FCST_FIELD_LEVEL A3 OBS_DICT fcst - SEEPS_FLAG NONE - SEEPS_P1_THRESH NA OUTPUT_PREFIX GRIB1_NAM_TRMM \ @@ -196,8 +194,6 @@ FCST_FIELD_NAME APCP FCST_FIELD_LEVEL A3 OBS_DICT fcst - SEEPS_FLAG NONE - SEEPS_P1_THRESH NA OUTPUT_PREFIX GRIB2_SREF_TRMM \ @@ -224,8 +220,6 @@ FCST_FIELD_NAME APCP_24 FCST_FIELD_LEVEL (*,*) OBS_DICT { field = [ { name = "APCP"; level = "A24"; } ]; } - SEEPS_FLAG NONE - SEEPS_P1_THRESH NA OUTPUT_PREFIX NCMET_NAM_HMTGAGE \ @@ -252,14 +246,14 @@ FCST_FIELD_NAME APCP_24 FCST_FIELD_LEVEL (*,*) OBS_DICT { field = [ { name = "TP24"; level = "L0"; is_precipitation = TRUE; } ]; } - SEEPS_FLAG BOTH SEEPS_P1_THRESH ge0.1&&le0.85 + SEEPS_POINT_CLIMO_NAME OUTPUT_PREFIX NCMET_NAM_NDAS_SEEPS \ &DATA_DIR_MODEL;/met_nc/nam/nam_2012040900_F036_APCP24.nc \ &OUTPUT_DIR;/pb2nc/ndas.20120410.t12z.prepbufr.tm00.nc \ - &CONFIG_DIR;/PointStatConfig_APCP \ + &CONFIG_DIR;/PointStatConfig_SEEPS \ -outdir &OUTPUT_DIR;/point_stat -v 1 diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index deb9a425fe..d7f2453689 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -612,6 +612,8 @@ static const char conf_key_mask_sid[] = "mask.sid"; static const char conf_key_mask_llpnt[] = "mask.llpnt"; static const char conf_key_lat_thresh[] = "lat_thresh"; static const char conf_key_lon_thresh[] = "lon_thresh"; +static const char conf_key_lat_vname[] = "lat_vname"; +static const char conf_key_lon_vname[] = "lon_vname"; static const char conf_key_ci_alpha[] = "ci_alpha"; static const char conf_key_time_summary[] = "time_summary"; static const char conf_key_flag[] = "flag"; @@ -690,7 +692,9 @@ static const char conf_key_obs_to_qc_map[] = "obs_to_qc_map"; static const char conf_key_missing_thresh[] = "missing_thresh"; static const char conf_key_control_id[] = "control_id"; static const char conf_key_ens_member_ids[] = "ens_member_ids"; -static const char conf_key_seeps_p1_thresh[] = "seeps_p1_thresh"; +static const char conf_key_seeps_grid_climo_name[] = "seeps_grid_climo_name"; +static const char conf_key_seeps_point_climo_name[] = "seeps_point_climo_name"; +static const char conf_key_seeps_p1_thresh[] = "seeps_p1_thresh"; static const char conf_key_ugrid_coordinates_file[] = "ugrid_coordinates_file"; static const char conf_key_ugrid_dataset[] = "ugrid_dataset"; static const char conf_key_ugrid_map_config[] = "ugrid_map_config"; diff --git a/src/basic/vx_config/dictionary.h b/src/basic/vx_config/dictionary.h index 742789000b..97faa4e3dc 100644 --- a/src/basic/vx_config/dictionary.h +++ b/src/basic/vx_config/dictionary.h @@ -154,9 +154,9 @@ class DictionaryEntry { //////////////////////////////////////////////////////////////////////// -inline ConfigObjectType DictionaryEntry::type() const { return ( Type ); } +inline ConfigObjectType DictionaryEntry::type() const { return Type; } -inline ConcatString DictionaryEntry::name() const { return ( Name ); } +inline ConcatString DictionaryEntry::name() const { return Name; } inline bool DictionaryEntry::is_number() const { return ( (Type == IntegerType) || (Type == FloatType) ); } @@ -164,11 +164,11 @@ inline bool DictionaryEntry::is_dictionary() const { return ( Type == Dictionary inline bool DictionaryEntry::is_array() const { return ( Type == ArrayType ); } -inline int DictionaryEntry::n_args() const { return ( Nargs ); } +inline int DictionaryEntry::n_args() const { return Nargs; } -inline const IcodeVector * DictionaryEntry::icv() const { return ( v ); } +inline const IcodeVector * DictionaryEntry::icv() const { return v; } -inline Dictionary * DictionaryEntry::dict() const { return ( Dict ); } +inline Dictionary * DictionaryEntry::dict() const { return Dict; } //////////////////////////////////////////////////////////////////////// @@ -344,15 +344,15 @@ class Dictionary { //////////////////////////////////////////////////////////////////////// -inline int Dictionary::n_entries() const { return ( Nentries ); } +inline int Dictionary::n_entries() const { return Nentries; } -inline const Dictionary * Dictionary::parent() const { return ( Parent ); } +inline const Dictionary * Dictionary::parent() const { return Parent; } inline void Dictionary::set_is_array(bool __tf) { IsArray = __tf; return; } -inline bool Dictionary::is_array() const { return ( IsArray ); } +inline bool Dictionary::is_array() const { return IsArray; } -inline bool Dictionary::last_lookup_status() const { return ( LastLookupStatus ); } +inline bool Dictionary::last_lookup_status() const { return LastLookupStatus; } //////////////////////////////////////////////////////////////////////// @@ -434,7 +434,7 @@ class DictionaryStack { //////////////////////////////////////////////////////////////////////// -inline int DictionaryStack::n_elements () const { return ( Nelements ); } +inline int DictionaryStack::n_elements () const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/icode.h b/src/basic/vx_config/icode.h index d344b797dd..6e99455933 100644 --- a/src/basic/vx_config/icode.h +++ b/src/basic/vx_config/icode.h @@ -216,7 +216,7 @@ class IcodeVector { //////////////////////////////////////////////////////////////////////// -inline int IcodeVector::length() const { return ( Ncells ); } +inline int IcodeVector::length() const { return Ncells; } //////////////////////////////////////////////////////////////////////// @@ -267,7 +267,7 @@ class CellStack { //////////////////////////////////////////////////////////////////////// -inline int CellStack::depth() const { return ( Depth ); } +inline int CellStack::depth() const { return Depth; } //////////////////////////////////////////////////////////////////////// @@ -319,7 +319,7 @@ class ICVStack { //////////////////////////////////////////////////////////////////////// -inline int ICVStack::depth() const { return ( Depth ); } +inline int ICVStack::depth() const { return Depth; } //////////////////////////////////////////////////////////////////////// @@ -358,7 +358,7 @@ class ICVQueue { //////////////////////////////////////////////////////////////////////// -inline int ICVQueue::n_elements() const { return ( Nelements ); } +inline int ICVQueue::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// @@ -402,7 +402,7 @@ class ICVArray { //////////////////////////////////////////////////////////////////////// -inline int ICVArray::n_elements() const { return ( Nelements ); } +inline int ICVArray::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/idstack.h b/src/basic/vx_config/idstack.h index 7c274744d4..ab45105b1c 100644 --- a/src/basic/vx_config/idstack.h +++ b/src/basic/vx_config/idstack.h @@ -101,7 +101,7 @@ class IdentifierQueue { //////////////////////////////////////////////////////////////////////// -inline int IdentifierQueue::n_elements() const { return ( Nelements ); } +inline int IdentifierQueue::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// @@ -153,7 +153,7 @@ class IdentifierArray { //////////////////////////////////////////////////////////////////////// -inline int IdentifierArray::n_elements() const { return ( Nelements ); } +inline int IdentifierArray::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/number_stack.h b/src/basic/vx_config/number_stack.h index 298a1b73ca..0a64f7323b 100644 --- a/src/basic/vx_config/number_stack.h +++ b/src/basic/vx_config/number_stack.h @@ -95,7 +95,7 @@ class NumberStack { //////////////////////////////////////////////////////////////////////// -inline int NumberStack::depth() const { return ( Nelements ); } +inline int NumberStack::depth() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/threshold.h b/src/basic/vx_config/threshold.h index 3eb74b5a0b..0f39bd3413 100644 --- a/src/basic/vx_config/threshold.h +++ b/src/basic/vx_config/threshold.h @@ -221,10 +221,10 @@ class Or_Node : public ThreshNode { //////////////////////////////////////////////////////////////////////// -inline ThreshType Or_Node::type() const { return ( thresh_complex ); } -inline double Or_Node::value() const { return ( bad_data_double ); } -inline PercThreshType Or_Node::ptype() const { return ( no_perc_thresh_type ); } -inline double Or_Node::pvalue() const { return ( bad_data_double ); } +inline ThreshType Or_Node::type() const { return thresh_complex ; } +inline double Or_Node::value() const { return bad_data_double ; } +inline PercThreshType Or_Node::ptype() const { return no_perc_thresh_type ; } +inline double Or_Node::pvalue() const { return bad_data_double ; } //////////////////////////////////////////////////////////////////////// @@ -272,10 +272,10 @@ class And_Node : public ThreshNode { //////////////////////////////////////////////////////////////////////// -inline ThreshType And_Node::type() const { return ( thresh_complex ); } -inline double And_Node::value() const { return ( bad_data_double ); } -inline PercThreshType And_Node::ptype() const { return ( no_perc_thresh_type ); } -inline double And_Node::pvalue() const { return ( bad_data_double ); } +inline ThreshType And_Node::type() const { return thresh_complex ; } +inline double And_Node::value() const { return bad_data_double ; } +inline PercThreshType And_Node::ptype() const { return no_perc_thresh_type ; } +inline double And_Node::pvalue() const { return bad_data_double ; } //////////////////////////////////////////////////////////////////////// @@ -322,10 +322,10 @@ class Not_Node : public ThreshNode { //////////////////////////////////////////////////////////////////////// -inline ThreshType Not_Node::type() const { return ( thresh_complex ); } -inline double Not_Node::value() const { return ( bad_data_double ); } -inline PercThreshType Not_Node::ptype() const { return ( no_perc_thresh_type ); } -inline double Not_Node::pvalue() const { return ( bad_data_double ); } +inline ThreshType Not_Node::type() const { return thresh_complex ; } +inline double Not_Node::value() const { return bad_data_double ; } +inline PercThreshType Not_Node::ptype() const { return no_perc_thresh_type ; } +inline double Not_Node::pvalue() const { return bad_data_double ; } //////////////////////////////////////////////////////////////////////// @@ -394,10 +394,10 @@ class Simple_Node : public ThreshNode { //////////////////////////////////////////////////////////////////////// -inline ThreshType Simple_Node::type() const { return ( op ); } -inline double Simple_Node::value() const { return ( T ); } -inline PercThreshType Simple_Node::ptype() const { return ( Ptype ); } -inline double Simple_Node::pvalue() const { return ( PT ); } +inline ThreshType Simple_Node::type() const { return op ; } +inline double Simple_Node::value() const { return T ; } +inline PercThreshType Simple_Node::ptype() const { return Ptype ; } +inline double Simple_Node::pvalue() const { return PT ; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/logger.h b/src/basic/vx_log/logger.h index d88333e98b..5f2c687e16 100644 --- a/src/basic/vx_log/logger.h +++ b/src/basic/vx_log/logger.h @@ -177,9 +177,9 @@ class LoggerDebug { ////////////////////////////////////////////////////////////////// -inline int LoggerDebug::value() const { return (Value); } +inline int LoggerDebug::value() const { return Value; } -inline LoggerDebug::operator int () const { return (Value); } +inline LoggerDebug::operator int () const { return Value; } ////////////////////////////////////////////////////////////////// @@ -292,9 +292,9 @@ class Logger ////////////////////////////////////////////////////////////////// -inline ConcatString Logger::log_filename() const { return (LogFilename); } +inline ConcatString Logger::log_filename() const { return LogFilename; } -inline int Logger::verbosity_level() const { return (VerbosityLevel); } +inline int Logger::verbosity_level() const { return VerbosityLevel; } inline bool Logger::is_open() const { return (out != nullptr); } diff --git a/src/basic/vx_log/string_array.cc b/src/basic/vx_log/string_array.cc index aacf27baf4..60ebc4190d 100644 --- a/src/basic/vx_log/string_array.cc +++ b/src/basic/vx_log/string_array.cc @@ -363,7 +363,7 @@ void StringArray::add_css(const std::string text) } Sorted = false; - + return; } @@ -450,7 +450,7 @@ void StringArray::insert(int i, const char * text) s.insert(s.begin()+i, text); Sorted = false; - + return; } @@ -464,7 +464,7 @@ bool StringArray::has(const std::string text) const { bool found = false; bool forward = true; - + if (Sorted && !IgnoreCase) { found = binary_search(s.begin(), s.end(), text); } @@ -496,13 +496,13 @@ bool StringArray::has(const std::string text, int & index, bool forward) const // bool found = false; index = -1; - + if (!s.empty()) { int count; std::string lower_text = text; std::vector::const_iterator it; if ( IgnoreCase ) transform(lower_text.begin(), lower_text.end(), lower_text.begin(), ::tolower); - + if (forward) { count = 0; for(it = s.begin(); it != s.end(); it++, count++) { @@ -552,7 +552,7 @@ bool StringArray::has(const std::string text, int & index, bool forward) const } if (found) index = count; } - + return found; } @@ -595,7 +595,7 @@ void StringArray::parse_delim(const std::string text, const char *delim) clear(); std::string str = text; - + size_t start = 0; size_t end = str.find_first_of(delim); while (end != string::npos) { @@ -608,7 +608,7 @@ void StringArray::parse_delim(const std::string text, const char *delim) s.push_back(str.substr(start).c_str()); Sorted = false; - + return; } @@ -729,15 +729,15 @@ void StringArray::sort() Sorted = true; return; } - + if ( !Sorted ) { std::sort(s.begin(), s.end()); } - + Sorted = true; - + return; - + } @@ -751,7 +751,7 @@ StringArray StringArray::uniq() const StringArray sa; sa.s = s; - + std::vector::iterator it; it = std::unique(sa.s.begin(), sa.s.end()); @@ -783,7 +783,7 @@ regex_t buffer; regex_t *preg = &buffer; // Check for null pointers -if( !reg_exp_str || !test_str ) return( false ); +if( !reg_exp_str || !test_str ) return false; if( regcomp(preg, reg_exp_str, REG_EXTENDED*REG_NOSUB) != 0 ) { mlog << Error << "\ncheck_reg_exp(char *, char *) -> " @@ -798,7 +798,7 @@ if( regexec(preg, test_str, 0, 0, 0) == 0 ) { valid = true; } // Free allocated memory. regfree( preg ); -return( valid ); +return valid; } diff --git a/src/basic/vx_log/string_array.h b/src/basic/vx_log/string_array.h index 41103fa513..1061eb83e8 100644 --- a/src/basic/vx_log/string_array.h +++ b/src/basic/vx_log/string_array.h @@ -132,11 +132,11 @@ class StringArray { //////////////////////////////////////////////////////////////////////// -inline int StringArray::n_elements() const { return ( (int) (s.size()) ); } +inline int StringArray::n_elements() const { return (int) s.size(); } -inline int StringArray::n () const { return ( s.size() ); } +inline int StringArray::n () const { return s.size(); } -inline int StringArray::max_length() const { return ( MaxLength ); } +inline int StringArray::max_length() const { return MaxLength; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/affine.cc b/src/basic/vx_math/affine.cc index 9fa0965bd6..75dbc4cac5 100644 --- a/src/basic/vx_math/affine.cc +++ b/src/basic/vx_math/affine.cc @@ -1262,7 +1262,7 @@ rho = image_aspect/view_aspect; mag = min(rho, 1.0); -mag *= (view_width)/(image_width); +mag *= view_width/image_width; return mag; diff --git a/src/basic/vx_math/affine.h b/src/basic/vx_math/affine.h index 38f744a010..4c2bf5001c 100644 --- a/src/basic/vx_math/affine.h +++ b/src/basic/vx_math/affine.h @@ -129,17 +129,17 @@ class Box { //////////////////////////////////////////////////////////////////////// -inline double Box::left () const { return ( Left ); } -inline double Box::right() const { return ( Right ); } +inline double Box::left () const { return Left; } +inline double Box::right() const { return Right; } -inline double Box::bottom () const { return ( Bottom ); } -inline double Box::top () const { return ( Top ); } +inline double Box::bottom () const { return Bottom; } +inline double Box::top () const { return Top; } -inline double Box::x_ll () const { return ( Left ); } -inline double Box::y_ll () const { return ( Bottom ); } +inline double Box::x_ll () const { return Left; } +inline double Box::y_ll () const { return Bottom; } -inline double Box::x_ur () const { return ( Right ); } -inline double Box::y_ur () const { return ( Top ); } +inline double Box::x_ur () const { return Right; } +inline double Box::y_ur () const { return Top; } inline double Box::width () const { return ( Right - Left ); } inline double Box::height () const { return ( Top - Bottom ); } @@ -287,15 +287,15 @@ class Affine : public GeneralAffine { //////////////////////////////////////////////////////////////////////// -inline double Affine::m11() const { return ( M11 ); } -inline double Affine::m12() const { return ( M12 ); } -inline double Affine::m21() const { return ( M21 ); } -inline double Affine::m22() const { return ( M22 ); } +inline double Affine::m11() const { return M11; } +inline double Affine::m12() const { return M12; } +inline double Affine::m21() const { return M21; } +inline double Affine::m22() const { return M22; } -inline double Affine::tx () const { return ( TX ); } -inline double Affine::ty () const { return ( TY ); } +inline double Affine::tx () const { return TX; } +inline double Affine::ty () const { return TY; } -inline double Affine::det() const { return ( Det ); } +inline double Affine::det() const { return Det; } inline void Affine::calc_det() { Det = M11*M22 - M21*M12; return; } @@ -428,21 +428,21 @@ class ConformalAffine : public GeneralAffine { //////////////////////////////////////////////////////////////////////// -inline double ConformalAffine::angle() const { return ( Angle ); } +inline double ConformalAffine::angle() const { return Angle; } -inline double ConformalAffine::scale() const { return ( Scale ); } +inline double ConformalAffine::scale() const { return Scale; } -inline bool ConformalAffine::is_conformal() const { return ( true ); } +inline bool ConformalAffine::is_conformal() const { return true; } -inline double ConformalAffine::m11() const { return ( Scale*CosAngle ); } -inline double ConformalAffine::m12() const { return ( Scale*SinAngle ); } +inline double ConformalAffine::m11() const { return Scale*CosAngle; } +inline double ConformalAffine::m12() const { return Scale*SinAngle; } -inline double ConformalAffine::m21() const { return ( -Scale*SinAngle ); } -inline double ConformalAffine::m22() const { return ( Scale*CosAngle ); } +inline double ConformalAffine::m21() const { return -Scale*SinAngle; } +inline double ConformalAffine::m22() const { return Scale*CosAngle; } -inline double ConformalAffine::tx () const { return ( TX ); } -inline double ConformalAffine::ty () const { return ( TY ); } +inline double ConformalAffine::tx () const { return TX; } +inline double ConformalAffine::ty () const { return TY; } inline double ConformalAffine::det() const { return ( Scale*Scale ); } diff --git a/src/basic/vx_math/hist.h b/src/basic/vx_math/hist.h index dbee0e445b..f88f2c00b3 100644 --- a/src/basic/vx_math/hist.h +++ b/src/basic/vx_math/hist.h @@ -100,16 +100,16 @@ class Histogram { //////////////////////////////////////////////////////////////////////// -inline int Histogram::nbins () const { return ( Nbins ); } +inline int Histogram::nbins () const { return Nbins ; } -inline double Histogram::bottom () const { return ( Bottom ); } -inline double Histogram::delta () const { return ( Delta ); } +inline double Histogram::bottom () const { return Bottom; } +inline double Histogram::delta () const { return Delta ; } -inline double Histogram::min_data_value () const { return ( MinValue ); } -inline double Histogram::max_data_value () const { return ( MaxValue ); } +inline double Histogram::min_data_value () const { return MinValue; } +inline double Histogram::max_data_value () const { return MaxValue; } -inline int Histogram::too_big_count () const { return ( TooBigCount ); } -inline int Histogram::too_small_count () const { return ( TooSmallCount ); } +inline int Histogram::too_big_count () const { return TooBigCount; } +inline int Histogram::too_small_count () const { return TooSmallCount; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/is_bad_data.h b/src/basic/vx_math/is_bad_data.h index 8b3f3ce7f7..d8d7b334c3 100644 --- a/src/basic/vx_math/is_bad_data.h +++ b/src/basic/vx_math/is_bad_data.h @@ -28,23 +28,23 @@ inline int is_bad_data(int a) { - if(a == bad_data_int || std::isnan(a)) return(1); - else return(0); + 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 || std::isnan(a)) return(1); - else return(0); + 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 || std::isnan(a)) return(1); - else return(0); + 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 || std::isnan(a)) return(1); - else return(0); + if(fabs(a - bad_data_float) < default_tol || std::isnan(a)) return 1; + else return 0; } inline int is_bad_data(char a) { @@ -52,12 +52,12 @@ inline int is_bad_data(char a) { } inline int is_eq(double a, double b, double tol) { - if(fabs(a - b) < tol) return(1); - else return(0); + if(fabs(a - b) < tol) return 1; + else return 0; } inline int is_eq(double a, double b) { - return(is_eq(a, b, default_tol)); + return is_eq(a, b, default_tol); } diff --git a/src/basic/vx_math/legendre.h b/src/basic/vx_math/legendre.h index 6fcb1b508a..4d0265801f 100644 --- a/src/basic/vx_math/legendre.h +++ b/src/basic/vx_math/legendre.h @@ -90,15 +90,15 @@ class Legendre { //////////////////////////////////////////////////////////////////////// -inline double Legendre::value() const { return ( P[MaxDegree] ); } +inline double Legendre::value() const { return P[MaxDegree]; } -inline double Legendre::last_x() const { return ( X ); } +inline double Legendre::last_x() const { return X; } -inline double Legendre::value(int __n__) const { return ( P[__n__] ); } +inline double Legendre::value(int __n__) const { return P[__n__]; } -inline double Legendre::der_value() const { return ( PP[MaxDegree] ); } +inline double Legendre::der_value() const { return PP[MaxDegree]; } -inline double Legendre::der_value(int __n__) const { return ( PP[__n__] ); } +inline double Legendre::der_value(int __n__) const { return PP[__n__]; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 44156fb3fb..e3253631f6 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -298,7 +298,7 @@ if(ties_current != 0) { if(rank_info) { delete [] rank_info; rank_info = (RankInfo *) nullptr; } if(ordered_array) { delete [] ordered_array; ordered_array = (double *) nullptr; } -return(ties_total); +return ties_total; } diff --git a/src/basic/vx_math/vx_vector.h b/src/basic/vx_math/vx_vector.h index 425287b564..faa523241f 100644 --- a/src/basic/vx_math/vx_vector.h +++ b/src/basic/vx_math/vx_vector.h @@ -111,9 +111,9 @@ class Vector { //////////////////////////////////////////////////////////////////////// -inline double Vector::x() const { return ( X ); } -inline double Vector::y() const { return ( Y ); } -inline double Vector::z() const { return ( Z ); } +inline double Vector::x() const { return X; } +inline double Vector::y() const { return Y; } +inline double Vector::z() const { return Z; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/CircularTemplate.h b/src/basic/vx_util/CircularTemplate.h index 9ba5d9417c..29b38f1980 100644 --- a/src/basic/vx_util/CircularTemplate.h +++ b/src/basic/vx_util/CircularTemplate.h @@ -61,7 +61,7 @@ class CircularTemplate : public GridTemplate { // Return the class name for error messages. static const char* _className(void) { - return("CircleTemplate"); + return "CircleTemplate"; } }; diff --git a/src/basic/vx_util/GridPoint.h b/src/basic/vx_util/GridPoint.h index 4e3cacd53e..accb34da02 100644 --- a/src/basic/vx_util/GridPoint.h +++ b/src/basic/vx_util/GridPoint.h @@ -103,14 +103,14 @@ class GridPoint bool operator==(const GridPoint &other) const { return (this->x == other.x && - this->y == other.y); + this->y == other.y); } bool operator!=(const GridPoint &other) const { return (this->x != other.x || - this->y != other.y); + this->y != other.y); } @@ -134,7 +134,7 @@ class GridPoint static const char *_className(void) { - return("GridPoint"); + return "GridPoint"; } }; diff --git a/src/basic/vx_util/RectangularTemplate.h b/src/basic/vx_util/RectangularTemplate.h index 768315b68e..c6efef462d 100644 --- a/src/basic/vx_util/RectangularTemplate.h +++ b/src/basic/vx_util/RectangularTemplate.h @@ -66,7 +66,7 @@ class RectangularTemplate : public GridTemplate { // Return the class name for error messages. static const char* _className(void) { - return("RectangularTemplate"); + return "RectangularTemplate"; } }; diff --git a/src/basic/vx_util/ascii_header.h b/src/basic/vx_util/ascii_header.h index 499803bbab..a75074228b 100644 --- a/src/basic/vx_util/ascii_header.h +++ b/src/basic/vx_util/ascii_header.h @@ -86,12 +86,12 @@ inline void AsciiHeaderLine::set_version (const char *s) { Version = s; Versi inline void AsciiHeaderLine::set_data_type(const char *s) { DataType = s; DataType.ws_strip(); } inline void AsciiHeaderLine::set_line_type(const char *s) { LineType = s; LineType.ws_strip(); } -inline const char * AsciiHeaderLine::version() const { return(Version.c_str()); } -inline const char * AsciiHeaderLine::data_type() const { return(DataType.c_str()); } -inline const char * AsciiHeaderLine::line_type() const { return(LineType.c_str()); } -inline const char * AsciiHeaderLine::var_index_name() const { return(VarIndexName.c_str()); } -inline int AsciiHeaderLine::var_index_offset() const { return(VarIndexOffset); } -inline int AsciiHeaderLine::var_beg_offset() const { return(VarBegOffset); } +inline const char * AsciiHeaderLine::version() const { return Version.c_str(); } +inline const char * AsciiHeaderLine::data_type() const { return DataType.c_str(); } +inline const char * AsciiHeaderLine::line_type() const { return LineType.c_str(); } +inline const char * AsciiHeaderLine::var_index_name() const { return VarIndexName.c_str(); } +inline int AsciiHeaderLine::var_index_offset() const { return VarIndexOffset; } +inline int AsciiHeaderLine::var_beg_offset() const { return VarBegOffset; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ascii_table.h b/src/basic/vx_util/ascii_table.h index 5e6de9b239..c7a47b0c86 100644 --- a/src/basic/vx_util/ascii_table.h +++ b/src/basic/vx_util/ascii_table.h @@ -328,34 +328,34 @@ class AsciiTable { //////////////////////////////////////////////////////////////////////// -inline int AsciiTable::nrows() const { return ( Nrows ); } +inline int AsciiTable::nrows() const { return Nrows; } -inline int AsciiTable::ncols() const { return ( Ncols ); } +inline int AsciiTable::ncols() const { return Ncols; } -inline char AsciiTable::col_sep_char() const { return ( ColSepChar ); } +inline char AsciiTable::col_sep_char() const { return ColSepChar; } -inline char AsciiTable::pad_char() const { return ( PadChar ); } +inline char AsciiTable::pad_char() const { return PadChar; } -inline bool AsciiTable::fill_blank () const { return ( FillBlank ); } +inline bool AsciiTable::fill_blank () const { return FillBlank; } inline void AsciiTable::set_fill_blank (bool tf) { FillBlank = tf; return; } -inline int AsciiTable::table_indent () const { return ( TableIndent ); } +inline int AsciiTable::table_indent () const { return TableIndent; } -inline int AsciiTable::precision() const { return ( Precision ); } +inline int AsciiTable::precision() const { return Precision; } -inline const char * AsciiTable::f_float_format() const { return ( f_FloatFormat ); } -inline const char * AsciiTable::g_float_format() const { return ( g_FloatFormat ); } +inline const char * AsciiTable::f_float_format() const { return f_FloatFormat; } +inline const char * AsciiTable::g_float_format() const { return g_FloatFormat; } -inline bool AsciiTable::comma_string() const { return ( DoCommaString ); } +inline bool AsciiTable::comma_string() const { return DoCommaString; } -inline bool AsciiTable::delete_trailing_blank_rows() const { return ( DeleteTrailingBlankRows ); } +inline bool AsciiTable::delete_trailing_blank_rows() const { return DeleteTrailingBlankRows; } -inline bool AsciiTable::elim_trailing_whitespace() const { return ( ElimTrailingWhitespace ); } +inline bool AsciiTable::elim_trailing_whitespace() const { return ElimTrailingWhitespace; } -inline bool AsciiTable::align_decimal_points() const { return ( AlignDecimalPoints ); } +inline bool AsciiTable::align_decimal_points() const { return AlignDecimalPoints; } -inline bool AsciiTable::decimal_points_aligned() const { return ( DecimalPointsAligned ); } +inline bool AsciiTable::decimal_points_aligned() const { return DecimalPointsAligned; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/check_endian.h b/src/basic/vx_util/check_endian.h index d81b6db824..de682470ff 100644 --- a/src/basic/vx_util/check_endian.h +++ b/src/basic/vx_util/check_endian.h @@ -85,8 +85,8 @@ extern void shuffle_8(void *); inline void handle_big_4 (void *) { return; } inline void handle_big_8 (void *) { return; } - inline bool is_little_endian () { return ( false ); } - inline bool is_big_endian () { return ( true ); } + inline bool is_little_endian () { return false; } + inline bool is_big_endian () { return true ; } #else @@ -98,8 +98,8 @@ extern void shuffle_8(void *); inline void handle_big_4 (void * p) { shuffle_4(p); return; } inline void handle_big_8 (void * p) { shuffle_8(p); return; } - inline bool is_little_endian () { return ( true ); } - inline bool is_big_endian () { return ( false ); } + inline bool is_little_endian () { return true ; } + inline bool is_big_endian () { return false; } #endif diff --git a/src/basic/vx_util/command_line.h b/src/basic/vx_util/command_line.h index 9c8f25592a..b4734e855f 100644 --- a/src/basic/vx_util/command_line.h +++ b/src/basic/vx_util/command_line.h @@ -120,7 +120,7 @@ class CLOptionInfoArray { //////////////////////////////////////////////////////////////////////// -inline int CLOptionInfoArray::n_elements() const { return ( Nelements ); } +inline int CLOptionInfoArray::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// @@ -219,9 +219,9 @@ class CommandLine { //////////////////////////////////////////////////////////////////////// -inline int CommandLine::n() const { return ( args.n_elements() ); } +inline int CommandLine::n() const { return args.n_elements(); } -inline int CommandLine::max_length() const { return ( args.max_length() ); } +inline int CommandLine::max_length() const { return args.max_length(); } inline void CommandLine::set_usage(UsageFunction f) { Usage = f; return; } diff --git a/src/basic/vx_util/crc_array.h b/src/basic/vx_util/crc_array.h index 5603c1eb78..02805d1bf5 100644 --- a/src/basic/vx_util/crc_array.h +++ b/src/basic/vx_util/crc_array.h @@ -65,11 +65,11 @@ class CRC_Array { CRC_Array & operator=(const CRC_Array & _a) { - if ( this == &_a ) return ( * this ); + if ( this == &_a ) return *this; assign(_a); - return ( * this ); + return *this; } @@ -94,8 +94,8 @@ class CRC_Array { // get stuff // - int n_elements() const { return ( Nelements ); } - int n () const { return ( Nelements ); } + int n_elements() const { return Nelements; } + int n () const { return Nelements; } T operator[] (int) const; @@ -145,7 +145,7 @@ clear(); for(int j=0; j::operator==(const CRC_Array & a) const { -if ( Nelements != a.Nelements ) return ( false ); +if ( Nelements != a.Nelements ) return false; for(int j=0; j= Nelements) ) { } -return ( e[i] ); +return e[i]; } @@ -424,7 +424,7 @@ else { } } -return ( found ); +return found; } @@ -454,7 +454,7 @@ else { } } -return ( found ); +return found; } @@ -577,7 +577,7 @@ for(j=0, count=0; j::min() const { -if ( Nelements == 0 ) return ( bad_data_int ); +if ( Nelements == 0 ) return bad_data_int; int j; @@ -605,7 +605,7 @@ for(j=0; j::max() const { -if(Nelements == 0) return(bad_data_int); +if(Nelements == 0) return bad_data_int; int j; @@ -633,7 +633,7 @@ for(j=0; j & DataPlane::buf() { return ( Data ); } +inline const double * DataPlane::data() const { return Data.data(); } +inline std::vector & DataPlane::buf() { return Data; } //////////////////////////////////////////////////////////////////////// @@ -244,7 +244,7 @@ class DataPlaneArray { //////////////////////////////////////////////////////////////////////// -inline int DataPlaneArray::n_planes () const { return ( Nplanes ); } +inline int DataPlaneArray::n_planes () const { return Nplanes; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/is_number.h b/src/basic/vx_util/is_number.h index 991416d2d1..2807ae7c9f 100644 --- a/src/basic/vx_util/is_number.h +++ b/src/basic/vx_util/is_number.h @@ -45,7 +45,7 @@ inline std::ostream & operator<<(std::ostream & __out, const Number & __n) if ( __n.is_int ) __out << (__n.i); else __out << (__n.d); -return ( __out ); +return __out; } diff --git a/src/basic/vx_util/long_array.h b/src/basic/vx_util/long_array.h index 99380b88ad..83864f9684 100644 --- a/src/basic/vx_util/long_array.h +++ b/src/basic/vx_util/long_array.h @@ -78,9 +78,9 @@ class LongArray { //////////////////////////////////////////////////////////////////////// -inline int LongArray::n_elements() const { return ( Nelements ); } +inline int LongArray::n_elements() const { return Nelements; } -inline LongArray::operator long * () const { return ( e ); } +inline LongArray::operator long * () const { return e; } inline void LongArray::erase() { Nelements = 0; return; } diff --git a/src/basic/vx_util/mask_poly.h b/src/basic/vx_util/mask_poly.h index 0b9c3c1b30..76f3f0ef1a 100644 --- a/src/basic/vx_util/mask_poly.h +++ b/src/basic/vx_util/mask_poly.h @@ -95,9 +95,9 @@ class MaskPoly { //////////////////////////////////////////////////////////////////////// -inline ConcatString MaskPoly::name() const { return ( Name ); } -inline ConcatString MaskPoly::file_name() const { return ( FileName ); } -inline int MaskPoly::n_points() const { return ( Npoints ); } +inline ConcatString MaskPoly::name() const { return Name ; } +inline ConcatString MaskPoly::file_name() const { return FileName; } +inline int MaskPoly::n_points() const { return Npoints ; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/met_buffer.h b/src/basic/vx_util/met_buffer.h index 2f6ff02f42..0386e906a8 100644 --- a/src/basic/vx_util/met_buffer.h +++ b/src/basic/vx_util/met_buffer.h @@ -98,10 +98,10 @@ class MetBuffer { //////////////////////////////////////////////////////////////////////// -inline unsigned char * MetBuffer::operator()() const { return ( Buf ); } +inline unsigned char * MetBuffer::operator()() const { return Buf; } -inline bigint MetBuffer::n_bytes() const { return ( Nbytes ); } -inline bigint MetBuffer::n_alloc() const { return ( Nalloc ); } +inline bigint MetBuffer::n_bytes() const { return Nbytes; } +inline bigint MetBuffer::n_alloc() const { return Nalloc; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ncrr_array.h b/src/basic/vx_util/ncrr_array.h index b802b7372c..e4b1fdc511 100644 --- a/src/basic/vx_util/ncrr_array.h +++ b/src/basic/vx_util/ncrr_array.h @@ -67,11 +67,11 @@ class NCRR_Array { NCRR_Array & operator=(const NCRR_Array & _a) { - if ( this == _a ) return ( * this ); + if ( this == _a ) return *this; assign(_a); - return ( * this ); + return *this; } @@ -89,9 +89,9 @@ class NCRR_Array { // get stuff // - int n_elements() const { return ( Nelements );} + int n_elements() const { return Nelements;} - int n () const { return ( Nelements );} + int n () const { return Nelements;} T & operator[](int) const; diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index baaac11c6a..e2a8c79ff0 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -1127,7 +1127,7 @@ double NumArray::mean_sqrt() const // for simple mean, call weighted mean with constant weight wgt.add_const(1.0, n_elements()); - return(wmean_sqrt(wgt)); + return wmean_sqrt(wgt); } @@ -1144,7 +1144,7 @@ double NumArray::mean_fisher() const // for simple mean, call weighted mean with constant weight wgt.add_const(1.0, n_elements()); - return(wmean_fisher(wgt)); + return wmean_fisher(wgt); } @@ -1177,7 +1177,7 @@ double NumArray::wmean(const NumArray &wgt) const if(count == 0) wmn = bad_data_double; else wmn = s/w; - return(wmn); + return wmn; } @@ -1267,7 +1267,7 @@ double NumArray::variance(int skip_index) const var = bad_data_double; } - return(var); + return var; } @@ -1335,7 +1335,7 @@ double NumArray::wmean_abs_diff() const else wmad = wgt * mad; - return(wmad); + return wmad; } diff --git a/src/basic/vx_util/polyline.cc b/src/basic/vx_util/polyline.cc index f75ee6ef50..5d96776544 100644 --- a/src/basic/vx_util/polyline.cc +++ b/src/basic/vx_util/polyline.cc @@ -655,7 +655,7 @@ double polyline_dist(const Polyline & a, const Polyline & b) { // done // - return ( min_dist ); + return min_dist; } /////////////////////////////////////////////////////////////////////////////// @@ -679,9 +679,9 @@ double polyline_pw_ls_mean_dist(const Polyline &a, const Polyline &b) { for(j=0; j qmp ) { dx = x_test - qx; dy = y_test - qy; - return ( sqrt( dx*dx + dy*dy ) ); + return sqrt( dx*dx + dy*dy ); } vx = rmpx - t0*cx; vy = rmpy - t0*cy; - return ( sqrt( vx*vx + vy*vy ) ); + return sqrt( vx*vx + vy*vy ); } diff --git a/src/basic/vx_util/smart_buffer.h b/src/basic/vx_util/smart_buffer.h index 2d85465381..bad1524476 100644 --- a/src/basic/vx_util/smart_buffer.h +++ b/src/basic/vx_util/smart_buffer.h @@ -90,13 +90,13 @@ class SmartBuffer { //////////////////////////////////////////////////////////////////////// -inline int SmartBuffer::size() const { return ( Size ); } +inline int SmartBuffer::size() const { return Size; } -inline bool SmartBuffer::is_empty() const { return ( Buf == 0 ); } +inline bool SmartBuffer::is_empty() const { return ( Buf == nullptr ); } -inline SmartBuffer::operator unsigned char * () const { return ( Buf ); } +inline SmartBuffer::operator unsigned char * () const { return Buf; } -inline SmartBuffer::operator void * () const { return ( Buf ); } +inline SmartBuffer::operator void * () const { return Buf; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/string_fxns.cc b/src/basic/vx_util/string_fxns.cc index e0e0d37f6b..df21a7d754 100644 --- a/src/basic/vx_util/string_fxns.cc +++ b/src/basic/vx_util/string_fxns.cc @@ -192,7 +192,7 @@ void strip_char(char *str, const char c) ptr = str + m_strlen(str) - 1; if(*ptr == c) { - *(ptr) = 0; + *ptr = 0; } return; diff --git a/src/basic/vx_util/thresh_array.h b/src/basic/vx_util/thresh_array.h index 4ad5cf5146..20a88193ad 100644 --- a/src/basic/vx_util/thresh_array.h +++ b/src/basic/vx_util/thresh_array.h @@ -93,10 +93,10 @@ class ThreshArray { //////////////////////////////////////////////////////////////////////// -inline int ThreshArray::n_elements() const { return ( Nelements ); } -inline int ThreshArray::n() const { return ( Nelements ); } -inline const SingleThresh * ThreshArray::thresh() const { return ( t ); } -inline SingleThresh * ThreshArray::buf() const { return ( t ); } +inline int ThreshArray::n_elements() const { return Nelements; } +inline int ThreshArray::n() const { return Nelements; } +inline const SingleThresh * ThreshArray::thresh() const { return t; } +inline SingleThresh * ThreshArray::buf() const { return t; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/two_d_array.h b/src/basic/vx_util/two_d_array.h index 3fac01a76b..1907d37644 100644 --- a/src/basic/vx_util/two_d_array.h +++ b/src/basic/vx_util/two_d_array.h @@ -54,11 +54,11 @@ class TwoD_Array { TwoD_Array & operator=(const TwoD_Array & _t) { - if ( this == &_t ) return ( * this ); + if ( this == &_t ) return *this; assign(_t); - return ( * this ); + return *this; } @@ -78,14 +78,14 @@ class TwoD_Array { // get stuff // - int nx() const { return ( Nx ); } - int ny() const { return ( Ny ); } + int nx() const { return Nx; } + int ny() const { return Ny; } bool is_empty() const { return ( Nx*Ny == 0 ); } int count() const; - const T * data() const { return ( E ); } + const T * data() const { return E; } - T * buf() { return ( E ); } // careful with this + T * buf() { return E; } // careful with this T operator()(int, int) const; @@ -244,7 +244,7 @@ for (j=0,n=0; j::operator()(int _x, int _y) const { -return ( get(_x, _y) ); +return get(_x, _y); } @@ -292,7 +292,7 @@ if (E == nullptr) { exit ( 1 ); } -return ( E[two_to_one(_x, _y)] ); +return E[two_to_one(_x, _y)]; } @@ -320,15 +320,15 @@ bool TwoD_Array::f_is_on(int _x, int _y) const { -if ( s_is_on(_x, _y) ) return ( true ); +if ( s_is_on(_x, _y) ) return true; -if( (_x > 0) && s_is_on(_x - 1, _y) ) return ( true ); +if( (_x > 0) && s_is_on(_x - 1, _y) ) return true; -if( (_x > 0) && (_y > 0) && s_is_on(_x - 1, _y - 1)) return ( true ); +if( (_x > 0) && (_y > 0) && s_is_on(_x - 1, _y - 1)) return true; -if( (_y > 0 ) && s_is_on(_x, _y - 1) ) return ( true ); +if( (_y > 0 ) && s_is_on(_x, _y - 1) ) return true; -return ( false ); +return false; } @@ -355,12 +355,12 @@ int j; for (j=0; j=0; --j) { - if ( f_is_on(j, _y) ) return ( j ); + if ( f_is_on(j, _y) ) return j; } -return ( -1 ); +return -1; } diff --git a/src/libcode/vx_analysis_util/mode_atts.cc b/src/libcode/vx_analysis_util/mode_atts.cc index e51f63cef8..3538f47c84 100644 --- a/src/libcode/vx_analysis_util/mode_atts.cc +++ b/src/libcode/vx_analysis_util/mode_atts.cc @@ -1367,8 +1367,8 @@ if ( is_fcst_toggle_set ) { i = L.is_fcst(); - if ( ( is_fcst) && ( !i ) ) return 0; - if ( (!is_fcst) && ( i ) ) return 0; + if ( is_fcst && !i ) return 0; + if ( !is_fcst && i ) return 0; } @@ -1376,8 +1376,8 @@ if ( is_single_toggle_set ) { i = L.is_single(); - if ( ( is_single) && ( !i ) ) return 0; - if ( (!is_single) && ( i ) ) return 0; + if ( is_single && !i ) return 0; + if ( !is_single && i ) return 0; } @@ -1385,8 +1385,8 @@ if ( is_simple_toggle_set ) { i = L.is_simple(); - if ( ( is_simple) && ( !i ) ) return 0; - if ( (!is_simple) && ( i ) ) return 0; + if ( is_simple && !i ) return 0; + if ( !is_simple && i ) return 0; } @@ -1394,8 +1394,8 @@ if ( is_matched_toggle_set ) { i = L.is_matched(); - if ( ( is_matched) && ( !i ) ) return 0; - if ( (!is_matched) && ( i ) ) return 0; + if ( is_matched && !i ) return 0; + if ( !is_matched && i ) return 0; } diff --git a/src/libcode/vx_analysis_util/mode_job.cc b/src/libcode/vx_analysis_util/mode_job.cc index 368a968ea1..e97c8c3994 100644 --- a/src/libcode/vx_analysis_util/mode_job.cc +++ b/src/libcode/vx_analysis_util/mode_job.cc @@ -138,7 +138,7 @@ if ( accums ) { delete [] accums; accums = (NumArray *) nullptr; } n_lines_read = n_lines_kept = 0; // Write any remaning lines to the dump file -if ( dumpfile ) *(dumpfile) << dump_at; +if ( dumpfile ) *dumpfile << dump_at; dumpfile = (ostream *) nullptr; // don't delete @@ -346,7 +346,7 @@ n_dump++; // Write the buffer, if full if ( n_dump%dump_at.nrows() == 0 ) { - *(dumpfile) << dump_at; + *dumpfile << dump_at; dump_at.erase(); } diff --git a/src/libcode/vx_analysis_util/mode_job.h b/src/libcode/vx_analysis_util/mode_job.h index 57354a04b9..a84306c85b 100644 --- a/src/libcode/vx_analysis_util/mode_job.h +++ b/src/libcode/vx_analysis_util/mode_job.h @@ -100,7 +100,7 @@ class BasicModeAnalysisJob { inline void BasicModeAnalysisJob::set_precision (int p) { precision = p; return; } -inline int BasicModeAnalysisJob::get_precision () const { return(precision); } +inline int BasicModeAnalysisJob::get_precision () const { return precision; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index ced4361068..820f8839b2 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -1216,7 +1216,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "unrecognized job type specified \"" << jc_array[i] << "\" in job command line: " << jobstring << "\n\n"; if(line) { delete [] line; line = (char *) nullptr; } - throw(1); + throw 1; } i++; } @@ -1638,7 +1638,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "\" in job command line: " << jobstring << "\n\n"; if(line) { delete [] line; line = (char *) nullptr; } - throw(1); + throw 1; } // end if } // end for @@ -1660,7 +1660,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << (line_type.n() == 1 ? line_type[0] : "header") << " column named \"" << hdr_name[i] << "\"\n\n"; if(line) { delete [] line; line = (char *) nullptr; } - throw(1); + throw 1; } } // end for } @@ -1897,7 +1897,7 @@ void STATAnalysisJob::open_dump_row_file() { << "can't open the output file \"" << dump_row << "\" for writing!\n\n"; - throw(1); + throw 1; } return; @@ -1912,7 +1912,7 @@ void STATAnalysisJob::close_dump_row_file() { // // Write any remaining lines // - *(dr_out) << dump_at; + *dr_out << dump_at; dr_out->close(); delete dr_out; @@ -1941,7 +1941,7 @@ void STATAnalysisJob::open_stat_file() { << "can't open the output STAT file \"" << stat_file << "\" for writing!\n\n"; - throw(1); + throw 1; } return; @@ -2133,7 +2133,7 @@ void STATAnalysisJob::close_stat_file() { // // Write any remaining lines // - *(stat_out) << stat_at; + *stat_out << stat_at; stat_out->close(); delete stat_out; @@ -2284,7 +2284,7 @@ void STATAnalysisJob::dump_stat_line(const STATLine &line, default: mlog << Error << "\ndump_stat_line() -> " << "unexpected line type value " << line_type[0] << "\n\n"; - throw(1); + throw 1; } // end switch } // @@ -2325,7 +2325,7 @@ void STATAnalysisJob::dump_stat_line(const STATLine &line, // Write the buffer, if full // if(n_dump%dump_at.nrows() == 0) { - *(dr_out) << dump_at; + *dr_out << dump_at; dump_at.erase(); } diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 88b709adf7..6e69316aab 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -364,7 +364,7 @@ class STATAnalysisJob { inline void STATAnalysisJob::set_job_type (const STATJobType t) { job_type = t; return; } inline void STATAnalysisJob::set_precision (int p) { precision = p; return; } -inline int STATAnalysisJob::get_precision () const { return(precision); } +inline int STATAnalysisJob::get_precision () const { return precision; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/stat_line.h b/src/libcode/vx_analysis_util/stat_line.h index 9a30820fcc..6d099a8e59 100644 --- a/src/libcode/vx_analysis_util/stat_line.h +++ b/src/libcode/vx_analysis_util/stat_line.h @@ -118,7 +118,7 @@ class STATLine : public DataLine { //////////////////////////////////////////////////////////////////////// -inline STATLineType STATLine::type () const { return ( Type ); } +inline STATLineType STATLine::type () const { return Type; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/time_series.h b/src/libcode/vx_analysis_util/time_series.h index 48e523e6c8..fe3d7469ff 100644 --- a/src/libcode/vx_analysis_util/time_series.h +++ b/src/libcode/vx_analysis_util/time_series.h @@ -72,10 +72,10 @@ class TimeSeries { //////////////////////////////////////////////////////////////////////// -inline unixtime TimeSeries::time_start() const { return ( TimeStart ); } -inline int TimeSeries::time_delta() const { return ( TimeDelta ); } +inline unixtime TimeSeries::time_start() const { return TimeStart; } +inline int TimeSeries::time_delta() const { return TimeDelta; } -inline int TimeSeries::n_elements() const { return ( Nelements ); } +inline int TimeSeries::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/token_stack.h b/src/libcode/vx_bool_calc/token_stack.h index 4f4cd898d4..0987216a73 100644 --- a/src/libcode/vx_bool_calc/token_stack.h +++ b/src/libcode/vx_bool_calc/token_stack.h @@ -74,7 +74,7 @@ class TokenStack { //////////////////////////////////////////////////////////////////////// -inline int TokenStack::depth() const { return ( Nelements ); } +inline int TokenStack::depth() const { return Nelements; } inline bool TokenStack::empty() const { return ( Nelements == 0 ); } diff --git a/src/libcode/vx_color/color.h b/src/libcode/vx_color/color.h index cdf84f5113..8837f13c4c 100644 --- a/src/libcode/vx_color/color.h +++ b/src/libcode/vx_color/color.h @@ -77,9 +77,9 @@ class Color { //////////////////////////////////////////////////////////////////////// -inline unsigned char Color::red () const { return ( R ); } -inline unsigned char Color::green () const { return ( G ); } -inline unsigned char Color::blue () const { return ( B ); } +inline unsigned char Color::red () const { return R; } +inline unsigned char Color::green () const { return G; } +inline unsigned char Color::blue () const { return B; } inline bool Color::is_gray() const { return ( (R == G) && (G == B) ); } @@ -182,10 +182,10 @@ class CtableEntry { inline void CtableEntry::set_color(const Color & c) { C = c; return; } -inline const Color & CtableEntry::color() const { return ( C ); } +inline const Color & CtableEntry::color() const { return C; } -inline double CtableEntry::value_low() const { return ( ValueLo ); } -inline double CtableEntry::value_high() const { return ( ValueHi ); } +inline double CtableEntry::value_low() const { return ValueLo; } +inline double CtableEntry::value_high() const { return ValueHi; } //////////////////////////////////////////////////////////////////////// @@ -282,9 +282,9 @@ class ColorTable { //////////////////////////////////////////////////////////////////////// -inline int ColorTable::n_entries() const { return ( Nentries ); } +inline int ColorTable::n_entries() const { return Nentries; } -inline double ColorTable::gamma() const { return ( Gamma ); } +inline double ColorTable::gamma() const { return Gamma; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/color_list.h b/src/libcode/vx_color/color_list.h index 218c9344f0..9489e5cbb5 100644 --- a/src/libcode/vx_color/color_list.h +++ b/src/libcode/vx_color/color_list.h @@ -63,9 +63,9 @@ class ClistEntry { //////////////////////////////////////////////////////////////////////// -inline Dcolor ClistEntry::dc() const { return ( D ); } +inline Dcolor ClistEntry::dc() const { return D; } -inline const char * ClistEntry::name() const { return ( Name.c_str() ); } +inline const char * ClistEntry::name() const { return Name.c_str(); } //////////////////////////////////////////////////////////////////////// @@ -118,7 +118,7 @@ class ColorList { //////////////////////////////////////////////////////////////////////// -inline int ColorList::n_elements() const { return ( Nelements ); } +inline int ColorList::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/color_table.cc b/src/libcode/vx_color/color_table.cc index 7a7698c487..bb63ab05fb 100644 --- a/src/libcode/vx_color/color_table.cc +++ b/src/libcode/vx_color/color_table.cc @@ -1068,7 +1068,7 @@ if(is_eq(old_v_lo, bad_data_value)) { new_v_lo = bad_data_value; } else { - v_lo = (old_v_lo - old_b)/(old_m); + v_lo = (old_v_lo - old_b)/old_m; new_v_lo = v_lo*new_m + new_b; } @@ -1080,7 +1080,7 @@ if(is_eq(old_v_hi, bad_data_value)) { new_v_hi = bad_data_value; } else { - v_hi = (old_v_hi - old_b)/(old_m); + v_hi = (old_v_hi - old_b)/old_m; new_v_hi = v_hi*new_m + new_b; } diff --git a/src/libcode/vx_data2d/data_class.h b/src/libcode/vx_data2d/data_class.h index 2e2bf2c7e1..5fbf07e266 100644 --- a/src/libcode/vx_data2d/data_class.h +++ b/src/libcode/vx_data2d/data_class.h @@ -174,9 +174,9 @@ inline int Met2dDataFile::ny() const { return ( Dest_Grid ? (Dest_Grid->ny()) : inline int Met2dDataFile::raw_nx() const { return ( Raw_Grid ? (Raw_Grid->nx()) : 0 ); } inline int Met2dDataFile::raw_ny() const { return ( Raw_Grid ? (Raw_Grid->ny()) : 0 ); } -inline const char * Met2dDataFile::filename() const { return ( Filename.c_str() ); } +inline const char * Met2dDataFile::filename() const { return Filename.c_str(); } -inline int Met2dDataFile::shift_right() const { return ( ShiftRight ); } +inline int Met2dDataFile::shift_right() const { return ShiftRight; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/level_info.h b/src/libcode/vx_data2d/level_info.h index 4a1dc28f1d..d6956ca4f4 100644 --- a/src/libcode/vx_data2d/level_info.h +++ b/src/libcode/vx_data2d/level_info.h @@ -98,15 +98,15 @@ class LevelInfo /////////////////////////////////////////////////////////////////////////////// -inline LevelType LevelInfo::type() const { return(Type); } -inline int LevelInfo::type_num() const { return(TypeNum); } -inline ConcatString LevelInfo::req_name() const { return(ReqName); } -inline ConcatString LevelInfo::name() const { return(Name); } -inline ConcatString LevelInfo::units() const { return(Units); } -inline double LevelInfo::upper() const { return(Upper); } -inline double LevelInfo::lower() const { return(Lower); } -inline double LevelInfo::increment()const { return(Increment);} -inline bool LevelInfo::is_offset()const { return(Is_offset);} +inline LevelType LevelInfo::type() const { return Type; } +inline int LevelInfo::type_num() const { return TypeNum; } +inline ConcatString LevelInfo::req_name() const { return ReqName; } +inline ConcatString LevelInfo::name() const { return Name; } +inline ConcatString LevelInfo::units() const { return Units; } +inline double LevelInfo::upper() const { return Upper; } +inline double LevelInfo::lower() const { return Lower; } +inline double LevelInfo::increment()const { return Increment;} +inline bool LevelInfo::is_offset()const { return Is_offset;} /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/table_lookup.cc b/src/libcode/vx_data2d/table_lookup.cc index e0db7aab3b..8ab83eeae2 100644 --- a/src/libcode/vx_data2d/table_lookup.cc +++ b/src/libcode/vx_data2d/table_lookup.cc @@ -1083,9 +1083,9 @@ bool TableFlatFile::lookup_grib1(const char * parm_name, int table_number, int c for(vector::iterator it = matches.begin(); it < matches.end(); it++) - mlog << Debug(3) << " parm_name: " << (it)->parm_name - << ", table_number = " << (it)->table_number - << ", code = " << (it)->code << "\n"; + mlog << Debug(3) << " parm_name: " << it->parm_name + << ", table_number = " << it->table_number + << ", code = " << it->code << "\n"; mlog << Debug(3) << "Using the first match found: " << " parm_name: " << e.parm_name @@ -1146,11 +1146,11 @@ bool TableFlatFile::lookup_grib1(const char * parm_name, int table_number, int c for(vector::iterator it = matches.begin(); it < matches.end(); it++) { - mlog << Debug(3) << " parm_name: " << (it)->parm_name - << ", table_number = " << (it)->table_number - << ", code = " << (it)->code - << ", center = " << (it)->center - << ", subcenter = " << (it)->subcenter << "\n"; + mlog << Debug(3) << " parm_name: " << it->parm_name + << ", table_number = " << it->table_number + << ", code = " << it->code + << ", center = " << it->center + << ", subcenter = " << it->subcenter << "\n"; } mlog << Debug(3) << "Using the first match found: " @@ -1282,10 +1282,10 @@ bool TableFlatFile::lookup_grib2(const char * parm_name, int a, int b, int c, for(vector::iterator it = matches.begin(); it < matches.end(); it++) - mlog << Debug(3) << " parm_name: " << (it)->parm_name - << ", index_a = " << (it)->index_a - << ", index_b = " << (it)->index_b - << ", index_c = " << (it)->index_c << "\n"; + mlog << Debug(3) << " parm_name: " << it->parm_name + << ", index_a = " << it->index_a + << ", index_b = " << it->index_b + << ", index_c = " << it->index_c << "\n"; mlog << Debug(3) << "Using the first match found: " << " parm_name: " << e.parm_name @@ -1349,13 +1349,13 @@ bool TableFlatFile::lookup_grib2(const char * parm_name, for(vector::iterator it = matches.begin(); it < matches.end(); it++) - mlog << Debug(3) << " parm_name: " << (it)->parm_name - << ", index_a = " << (it)->index_a - << ", grib2_mtab = " << (it)->mtab_set - << ", grib2_cntr = " << (it)->cntr - << ", grib2_ltab = " << (it)->ltab - << ", index_b = " << (it)->index_b - << ", index_c = " << (it)->index_c + mlog << Debug(3) << " parm_name: " << it->parm_name + << ", index_a = " << it->index_a + << ", grib2_mtab = " << it->mtab_set + << ", grib2_cntr = " << it->cntr + << ", grib2_ltab = " << it->ltab + << ", index_b = " << it->index_b + << ", index_c = " << it->index_c << "\n"; mlog << Debug(3) << "Using the first match found: " diff --git a/src/libcode/vx_data2d/table_lookup.h b/src/libcode/vx_data2d/table_lookup.h index a1a1d56c0e..39dd488e23 100644 --- a/src/libcode/vx_data2d/table_lookup.h +++ b/src/libcode/vx_data2d/table_lookup.h @@ -209,8 +209,8 @@ class TableFlatFile { //////////////////////////////////////////////////////////////////////// -inline int TableFlatFile::n_grib1_elements() const { return ( N_grib1_elements ); } -inline int TableFlatFile::n_grib2_elements() const { return ( N_grib2_elements ); } +inline int TableFlatFile::n_grib1_elements() const { return N_grib1_elements; } +inline int TableFlatFile::n_grib2_elements() const { return N_grib2_elements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/var_info.h b/src/libcode/vx_data2d/var_info.h index ccb58a93f1..0d8717f416 100644 --- a/src/libcode/vx_data2d/var_info.h +++ b/src/libcode/vx_data2d/var_info.h @@ -98,7 +98,7 @@ class VarInfo void clear(); void clone_base() const; - + virtual void dump(std::ostream &) const; // @@ -212,48 +212,48 @@ class VarInfo inline void VarInfo::add_grib_code(Dictionary &d) { return; } -inline ConcatString VarInfo::magic_str() const { return(MagicStr); } -inline ConcatString VarInfo::req_name() const { return(ReqName); } -inline ConcatString VarInfo::name() const { return(Name); } -inline ConcatString VarInfo::units() const { return(Units); } -inline LevelInfo VarInfo::level() const { return(Level); } -inline ConcatString VarInfo::req_level_name() const { return(Level.req_name()); } -inline ConcatString VarInfo::level_name() const { return(Level.name()); } -inline ConcatString VarInfo::long_name() const { return(LongName); } -inline ConcatString VarInfo::ens() const { return(Ensemble); } +inline ConcatString VarInfo::magic_str() const { return MagicStr; } +inline ConcatString VarInfo::req_name() const { return ReqName; } +inline ConcatString VarInfo::name() const { return Name; } +inline ConcatString VarInfo::units() const { return Units; } +inline LevelInfo VarInfo::level() const { return Level; } +inline ConcatString VarInfo::req_level_name() const { return Level.req_name(); } +inline ConcatString VarInfo::level_name() const { return Level.name(); } +inline ConcatString VarInfo::long_name() const { return LongName; } +inline ConcatString VarInfo::ens() const { return Ensemble; } -inline bool VarInfo::p_flag() const { return(PFlag); } -inline ConcatString VarInfo::p_name() const { return(PName); } -inline ConcatString VarInfo::p_units() const { return(PUnits); } -inline SingleThresh VarInfo::p_thresh_lo() const { return(PThreshLo); } -inline SingleThresh VarInfo::p_thresh_hi() const { return(PThreshHi); } -inline bool VarInfo::p_as_scalar() const { return(PAsScalar); } +inline bool VarInfo::p_flag() const { return PFlag; } +inline ConcatString VarInfo::p_name() const { return PName; } +inline ConcatString VarInfo::p_units() const { return PUnits; } +inline SingleThresh VarInfo::p_thresh_lo() const { return PThreshLo; } +inline SingleThresh VarInfo::p_thresh_hi() const { return PThreshHi; } +inline bool VarInfo::p_as_scalar() const { return PAsScalar; } -inline int VarInfo::uv_index() const { return(UVIndex); } +inline int VarInfo::uv_index() const { return UVIndex; } -inline unixtime VarInfo::init() const { return(Init); } -inline unixtime VarInfo::valid() const { return(Valid); } -inline int VarInfo::lead() const { return(Lead); } +inline unixtime VarInfo::init() const { return Init; } +inline unixtime VarInfo::valid() const { return Valid; } +inline int VarInfo::lead() const { return Lead; } -inline ThreshArray VarInfo::censor_thresh() const { return(CensorThresh); } -inline NumArray VarInfo::censor_val() const { return(CensorVal); } +inline ThreshArray VarInfo::censor_thresh() const { return CensorThresh; } +inline NumArray VarInfo::censor_val() const { return CensorVal; } -inline int VarInfo::n_bins() const { return(nBins); } -inline NumArray VarInfo::range() const { return(Range); } +inline int VarInfo::n_bins() const { return nBins; } +inline NumArray VarInfo::range() const { return Range; } -inline RegridInfo VarInfo::regrid() const { return(Regrid); } +inline RegridInfo VarInfo::regrid() const { return Regrid; } inline ConcatString VarInfo::name_attr() const { return(SetAttrName.empty() ? name() : SetAttrName); } inline ConcatString VarInfo::units_attr() const { return(SetAttrUnits.empty() ? units() : SetAttrUnits); } inline ConcatString VarInfo::level_attr() const { return(SetAttrLevel.empty() ? level_name() : SetAttrLevel); } inline ConcatString VarInfo::long_name_attr() const { return(SetAttrLongName.empty() ? long_name() : SetAttrLongName); } -inline Grid VarInfo::grid_attr() const { return(SetAttrGrid); } +inline Grid VarInfo::grid_attr() const { return SetAttrGrid; } -inline unixtime VarInfo::init_attr() const { return(SetAttrInit); } -inline unixtime VarInfo::valid_attr() const { return(SetAttrValid); } -inline int VarInfo::lead_attr() const { return(SetAttrLead); } -inline int VarInfo::accum_attr() const { return(SetAttrAccum); } +inline unixtime VarInfo::init_attr() const { return SetAttrInit; } +inline unixtime VarInfo::valid_attr() const { return SetAttrValid; } +inline int VarInfo::lead_attr() const { return SetAttrLead; } +inline int VarInfo::accum_attr() const { return SetAttrAccum; } //////////////////////////////////////////////////////////////////////// @@ -294,7 +294,7 @@ class EnsVarInfo { void set_ctrl(VarInfo *); VarInfo * get_ctrl(int); - // Get VarInfo from first InputInfo if requested VarInfo is nullptr + // Get VarInfo from first InputInfo if requested VarInfo is nullptr VarInfo * get_var_info(int index=0); ConcatString get_file(int index=0); int get_file_index(int index=0); diff --git a/src/libcode/vx_data2d_grib/data2d_grib.h b/src/libcode/vx_data2d_grib/data2d_grib.h index 103413652c..bcfbc45ab9 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.h +++ b/src/libcode/vx_data2d_grib/data2d_grib.h @@ -102,8 +102,8 @@ class MetGrib1DataFile : public Met2dDataFile { //////////////////////////////////////////////////////////////////////// -inline double MetGrib1DataFile::operator () (int x, int y) const { return ( get(x, y) ); } -inline GrdFileType MetGrib1DataFile::file_type () const { return ( FileType_Gb1 ); } +inline double MetGrib1DataFile::operator () (int x, int y) const { return get(x, y) ; } +inline GrdFileType MetGrib1DataFile::file_type () const { return FileType_Gb1; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_classes.cc b/src/libcode/vx_data2d_grib/grib_classes.cc index 5e3a26ab42..8a0c626eb1 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.cc +++ b/src/libcode/vx_data2d_grib/grib_classes.cc @@ -1805,7 +1805,7 @@ else if ((h.type == 3) || (h.type == 13)) file << " lat_sp: " << char3_to_int(h.grid_type.lambert_conf.lat_sp) << "\n"; file << " lon_sp: " << char3_to_int(h.grid_type.lambert_conf.lon_sp) << "\n\n"; } -else if ((h.type == 5)) +else if (h.type == 5) { file << " lat1: " << char3_to_int(h.grid_type.stereographic.lat1) << "\n"; @@ -1822,7 +1822,7 @@ else if ((h.type == 5)) file << " scan_flag: " << (int) h.grid_type.stereographic.scan_flag << "\n\n"; } -else if ((h.type == 10)) +else if (h.type == 10) { file << " lat1: " << char3_to_int(h.grid_type.rot_latlon_grid.lat1) << "\n"; diff --git a/src/libcode/vx_data2d_grib/grib_strings.cc b/src/libcode/vx_data2d_grib/grib_strings.cc index d8239f7e3d..b8707b9040 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.cc +++ b/src/libcode/vx_data2d_grib/grib_strings.cc @@ -111,11 +111,11 @@ ConcatString get_grib_level_list_str(int k, int grib_level) if(match > 0) { switch(k) { - case(0): // GRIB Level Name + case 0: // GRIB Level Name str = grib_level_list[match].name; break; - case(1): // GRIB Level Abbreviation + case 1: // GRIB Level Abbreviation str = grib_level_list[match].abbr; break; diff --git a/src/libcode/vx_data2d_grib/grib_utils.cc b/src/libcode/vx_data2d_grib/grib_utils.cc index e353471d3d..e89c51d806 100644 --- a/src/libcode/vx_data2d_grib/grib_utils.cc +++ b/src/libcode/vx_data2d_grib/grib_utils.cc @@ -676,7 +676,7 @@ c[0] &= 127; else if ( n == 3 ) answer = (double) 0.001*parity*char3_to_int(c); else answer = (double) bad_data_float; -return ( answer ); +return answer; } diff --git a/src/libcode/vx_data2d_grib/var_info_grib.h b/src/libcode/vx_data2d_grib/var_info_grib.h index 4d37432e9f..d4a5aa2a10 100644 --- a/src/libcode/vx_data2d_grib/var_info_grib.h +++ b/src/libcode/vx_data2d_grib/var_info_grib.h @@ -116,15 +116,15 @@ class VarInfoGrib : public VarInfo /////////////////////////////////////////////////////////////////////////////// -inline GrdFileType VarInfoGrib::file_type() const { return(FileType_Gb1); } -inline int VarInfoGrib::ptv() const { return(PTV); } -inline int VarInfoGrib::code() const { return(Code); } -inline int VarInfoGrib::lvl_type() const { return(LvlType); } -inline int VarInfoGrib::p_code() const { return(PCode); } -inline int VarInfoGrib::center() const { return(Center); } -inline int VarInfoGrib::subcenter() const { return(Subcenter); } -inline int VarInfoGrib::field_rec() const { return(FieldRec); } -inline int VarInfoGrib::tri() const { return(TRI); } +inline GrdFileType VarInfoGrib::file_type() const { return FileType_Gb1; } +inline int VarInfoGrib::ptv() const { return PTV; } +inline int VarInfoGrib::code() const { return Code; } +inline int VarInfoGrib::lvl_type() const { return LvlType; } +inline int VarInfoGrib::p_code() const { return PCode; } +inline int VarInfoGrib::center() const { return Center; } +inline int VarInfoGrib::subcenter() const { return Subcenter; } +inline int VarInfoGrib::field_rec() const { return FieldRec; } +inline int VarInfoGrib::tri() const { return TRI; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib2/data2d_grib2.h b/src/libcode/vx_data2d_grib2/data2d_grib2.h index 46c50ee2f5..3811f7cfa8 100644 --- a/src/libcode/vx_data2d_grib2/data2d_grib2.h +++ b/src/libcode/vx_data2d_grib2/data2d_grib2.h @@ -164,7 +164,7 @@ class MetGrib2DataFile : public Met2dDataFile { //////////////////////////////////////////////////////////////////////// -inline GrdFileType MetGrib2DataFile::file_type () const { return ( FileType_Gb2 ); } +inline GrdFileType MetGrib2DataFile::file_type () const { return FileType_Gb2; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib2/var_info_grib2.h b/src/libcode/vx_data2d_grib2/var_info_grib2.h index 7848aefb7f..2ce946d0db 100644 --- a/src/libcode/vx_data2d_grib2/var_info_grib2.h +++ b/src/libcode/vx_data2d_grib2/var_info_grib2.h @@ -147,31 +147,31 @@ class VarInfoGrib2 : public VarInfo /////////////////////////////////////////////////////////////////////////////// -inline GrdFileType VarInfoGrib2::file_type() const { return(FileType_Gb2); } -inline int VarInfoGrib2::record() const { return(Record); } -inline int VarInfoGrib2::discipline() const { return(Discipline); } -inline int VarInfoGrib2::m_table() const { return(MTable); } -inline int VarInfoGrib2::l_table() const { return(LTable); } -inline int VarInfoGrib2::parm_cat() const { return(ParmCat); } -inline int VarInfoGrib2::parm() const { return(Parm); } -inline int VarInfoGrib2::pdt() const { return(PDTmpl); } -inline int VarInfoGrib2::process() const { return(Process); } -inline int VarInfoGrib2::ens_type() const { return(EnsType); } -inline int VarInfoGrib2::der_type() const { return(DerType); } -inline int VarInfoGrib2::stat_type() const { return(StatType); } -inline int VarInfoGrib2::perc_val() const { return(PercVal); } - -inline int VarInfoGrib2::aerosol_type() const { return(AerosolType); } -inline int VarInfoGrib2::aerosol_interval_type() const { return(AerosolIntervalType); } -inline double VarInfoGrib2::aerosol_size_lower() const { return(AerosolSizeLower); } -inline double VarInfoGrib2::aerosol_size_upper() const { return(AerosolSizeUpper); } - -inline int VarInfoGrib2::n_ipdtmpl() const { - return(IPDTmplIndex.n()); } +inline GrdFileType VarInfoGrib2::file_type() const { return FileType_Gb2; } +inline int VarInfoGrib2::record() const { return Record; } +inline int VarInfoGrib2::discipline() const { return Discipline; } +inline int VarInfoGrib2::m_table() const { return MTable; } +inline int VarInfoGrib2::l_table() const { return LTable; } +inline int VarInfoGrib2::parm_cat() const { return ParmCat; } +inline int VarInfoGrib2::parm() const { return Parm; } +inline int VarInfoGrib2::pdt() const { return PDTmpl; } +inline int VarInfoGrib2::process() const { return Process; } +inline int VarInfoGrib2::ens_type() const { return EnsType; } +inline int VarInfoGrib2::der_type() const { return DerType; } +inline int VarInfoGrib2::stat_type() const { return StatType; } +inline int VarInfoGrib2::perc_val() const { return PercVal; } + +inline int VarInfoGrib2::aerosol_type() const { return AerosolType; } +inline int VarInfoGrib2::aerosol_interval_type() const { return AerosolIntervalType; } +inline double VarInfoGrib2::aerosol_size_lower() const { return AerosolSizeLower; } +inline double VarInfoGrib2::aerosol_size_upper() const { return AerosolSizeUpper; } + +inline int VarInfoGrib2::n_ipdtmpl() const { + return IPDTmplIndex.n(); } inline int VarInfoGrib2::ipdtmpl_index(int i) const { - return(IPDTmplIndex[i]); } + return IPDTmplIndex[i]; } inline int VarInfoGrib2::ipdtmpl_val(int i) const { - return(IPDTmplVal[i]); } + return IPDTmplVal[i]; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc index 1a11af2b0d..8c4373a62c 100644 --- a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc @@ -673,4 +673,12 @@ long MetNcCFDataFile::convert_value_to_offset(double z_value, string z_dim_name) return z_offset; } +//////////////////////////////////////////////////////////////////////// + +Grid MetNcCFDataFile::build_grid_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + const long lat_counts, const long lon_counts) { + return (nullptr != _file) ? _file->build_grid_from_lat_lon_vars(lat_var, lon_var, lat_counts, lon_counts) : grid(); +} + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.h b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.h index a80b176c3a..05e68fc54f 100644 --- a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.h +++ b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.h @@ -102,6 +102,9 @@ class MetNcCFDataFile : public Met2dDataFile { void dump(std::ostream &, int = 0) const; + Grid build_grid_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, + const long lat_counts, const long lon_counts); + }; diff --git a/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc b/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc index eebf2ae1b6..3038965ab6 100644 --- a/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc +++ b/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc @@ -880,7 +880,7 @@ double NcCfFile::getData(NcVar * var, const LongArray & a) const if (dim_count != a.n_elements()) { mlog << Error << "\n" << method_name - << "needed " << (dim_count) << " arguments for variable " + << "needed " << dim_count << " arguments for variable " << (GET_NC_NAME_P(var)) << ", got " << (a.n_elements()) << "\n\n"; exit(1); } @@ -914,7 +914,7 @@ double NcCfFile::getData(NcVar * var, const LongArray & a) const if (!status) { - mlog << Error << "\nNcCfFile::getData(NcVar *, const LongArray &) const -> " + mlog << Error << "\n" << method_name << "bad status for var->get()\n\n"; exit(1); } @@ -951,7 +951,7 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const if (dim_count != a.n_elements()) { mlog << Error << "\n" << method_name - << "needed " << (dim_count) << " arguments for variable " + << "needed " << dim_count << " arguments for variable " << (GET_NC_NAME_P(v)) << ", got " << (a.n_elements()) << "\n\n"; exit(1); } @@ -1091,8 +1091,8 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const plane.set(value, x, y_offset); - } // for x - } // for y + } /* for y */ + } /* for x */ } else { for (int x = 0; x< nx; ++x) { @@ -1108,8 +1108,8 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const plane.set(value, x, y_offset); - } // for y - } // for x + } /* for y */ + } /* for x */ } delete [] d; @@ -1130,7 +1130,7 @@ bool NcCfFile::getData(const char *var_name, NcVarInfo *&info) const { info = find_var_name(var_name); - if (info == 0) + if (info == nullptr) return false; bool found = getData(info->var, a, plane); @@ -1475,6 +1475,25 @@ void NcCfFile::read_netcdf_grid() //////////////////////////////////////////////////////////////////////// +Grid NcCfFile::build_grid_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + const long lat_counts, const long lon_counts) { + Grid grid_ll; + bool swap_to_north; + LatLonData data = get_data_from_lat_lon_vars(lat_var, lon_var, + lat_counts, lon_counts, + swap_to_north); + + data.dump(); + + grid_ll.set(data); // resets swap_to_north to false + if (swap_to_north) grid_ll.set_swap_to_north(true); + return grid_ll; +} + + +//////////////////////////////////////////////////////////////////////// + + void NcCfFile::get_grid_from_grid_mapping(const NcVarAtt *grid_mapping_att) { static const string method_name = "NcCfFile::get_grid_from_grid_mapping()"; @@ -3180,7 +3199,7 @@ bool NcCfFile::get_grid_from_dimensions() } if (!has_var(_ncFile, dim_name.c_str())) { - mlog << Debug(4) << method_name << " -> " << "The coordinate variable \"" + mlog << Debug(6) << method_name << " -> " << "The coordinate variable \"" << _dims[dim_num]->getName() << "\" does not exist.\n"; continue; } diff --git a/src/libcode/vx_data2d_nc_cf/nc_cf_file.h b/src/libcode/vx_data2d_nc_cf/nc_cf_file.h index d3e50a30d0..5e29896459 100644 --- a/src/libcode/vx_data2d_nc_cf/nc_cf_file.h +++ b/src/libcode/vx_data2d_nc_cf/nc_cf_file.h @@ -61,7 +61,7 @@ class NcCfFile { return GET_NC_SIZE_P(_xDim); } - + int getNy() const { if (_yDim == 0) @@ -69,9 +69,10 @@ class NcCfFile { return GET_NC_SIZE_P(_yDim); } - + NcVarInfo *get_time_var_info() const { return _time_var_info; } - + + // // time // @@ -93,6 +94,7 @@ class NcCfFile { int Nvars; NcVarInfo * Var; // allocated + StringArray coord_var_names; // // Grid @@ -110,13 +112,15 @@ class NcCfFile { bool getData(const char *, const LongArray &, DataPlane &, NcVarInfo *&) const; + Grid build_grid_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, + const long lat_counts, const long lon_counts); NcVarInfo* find_var_name(const char * var_name) const; NcVarInfo* find_var_by_dim_name(const char *dim_name) const; private: static const double DELTA_TOLERANCE; - + netCDF::NcFile * _ncFile; // allocated // @@ -142,7 +146,7 @@ class NcCfFile { netCDF::NcVar *_xCoordVar; netCDF::NcVar *_yCoordVar; NcVarInfo *_time_var_info; - + void init_from_scratch(); NcCfFile(const NcCfFile &); @@ -164,7 +168,7 @@ class NcCfFile { void read_netcdf_grid(); void get_grid_from_grid_mapping(const netCDF::NcVarAtt *grid_mapping_att); - + 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); @@ -179,7 +183,7 @@ class NcCfFile { 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 netCDF::NcVar *data_var); bool get_grid_from_dimensions(); void get_grid_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, diff --git a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.h b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.h index 36b3f7b892..439369d95f 100644 --- a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.h +++ b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.h @@ -86,14 +86,14 @@ class VarInfoNcCF : public VarInfo /////////////////////////////////////////////////////////////////////////////// -inline GrdFileType VarInfoNcCF::file_type() const { return(FileType_NcCF); } -inline const LongArray & VarInfoNcCF::dimension() const { return(Dimension); } -inline int VarInfoNcCF::dimension(int i) const { return(Dimension[i]); } -inline int VarInfoNcCF::n_dimension() const { return(Dimension.n_elements());} -inline const NumArray & VarInfoNcCF::dim_value() const { return(Dim_value); } -inline double VarInfoNcCF::dim_value(int i) const { return(Dim_value[i]); } -inline const BoolArray & VarInfoNcCF::is_offset() const { return(Is_offset); } -inline bool VarInfoNcCF::is_offset(int i) const { return(Is_offset[i]); } +inline GrdFileType VarInfoNcCF::file_type() const { return FileType_NcCF; } +inline const LongArray & VarInfoNcCF::dimension() const { return Dimension; } +inline int VarInfoNcCF::dimension(int i) const { return Dimension[i]; } +inline int VarInfoNcCF::n_dimension() const { return Dimension.n_elements();} +inline const NumArray & VarInfoNcCF::dim_value() const { return Dim_value; } +inline double VarInfoNcCF::dim_value(int i) const { return Dim_value[i]; } +inline const BoolArray & VarInfoNcCF::is_offset() const { return Is_offset; } +inline bool VarInfoNcCF::is_offset(int i) const { return Is_offset[i]; } /////////////////////////////////////////////////////////////////////////////// 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 db7f166ce1..d4ae16fc55 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h @@ -85,7 +85,7 @@ class MetNcMetDataFile : public Met2dDataFile { //////////////////////////////////////////////////////////////////////// -inline GrdFileType MetNcMetDataFile::file_type () const { return ( FileType_NcMet ); } +inline GrdFileType MetNcMetDataFile::file_type () const { return FileType_NcMet; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/met_file.cc b/src/libcode/vx_data2d_nc_met/met_file.cc index 32fe15c4c7..d937950aeb 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.cc +++ b/src/libcode/vx_data2d_nc_met/met_file.cc @@ -264,7 +264,7 @@ for (j=0; jgetName()) << ", got " << (a.n_elements()) << "\n\n"; + << "needed " << dimCount << " arguments for variable " + << var->getName() << ", got " << a.n_elements() << "\n\n"; exit ( 1 ); @@ -457,7 +457,7 @@ int dimCount = GET_NC_DIM_COUNT_P(v); if ( dimCount != a.n_elements() ) { mlog << Error << "\n" << method_name - << "needed " << (dimCount) << " arguments for variable " + << "needed " << dimCount << " arguments for variable " << (GET_NC_NAME_P(v)) << ", got " << (a.n_elements()) << "\n\n"; exit ( 1 ); 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 737a22a714..750662da18 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 @@ -78,10 +78,10 @@ class VarInfoNcMet : public VarInfo /////////////////////////////////////////////////////////////////////////////// -inline GrdFileType VarInfoNcMet::file_type() const { return(FileType_NcMet); } -inline const LongArray & VarInfoNcMet::dimension() const { return(Dimension); } -inline int VarInfoNcMet::dimension(int i) const { return(Dimension[i]); } -inline int VarInfoNcMet::n_dimension() const { return(Dimension.n_elements()); } +inline GrdFileType VarInfoNcMet::file_type() const { return FileType_NcMet; } +inline const LongArray & VarInfoNcMet::dimension() const { return Dimension; } +inline int VarInfoNcMet::dimension(int i) const { return Dimension[i]; } +inline int VarInfoNcMet::n_dimension() const { return Dimension.n_elements(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc b/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc index 312a5397a4..801ceeb253 100644 --- a/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc +++ b/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc @@ -439,7 +439,7 @@ lon_rad = -u; lon_deg = lon_rad*deg_per_rad; -return ( lon_deg ); +return lon_deg; } @@ -455,7 +455,7 @@ double lat; lat = 2.0*atand(exp(v)) - 90.0; -return ( lat ); +return lat; } diff --git a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.h b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.h index 4bb201cb15..44f4f48cfd 100644 --- a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.h +++ b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.h @@ -247,14 +247,14 @@ class VarInfoNcWrf : public VarInfo /////////////////////////////////////////////////////////////////////////////// -inline GrdFileType VarInfoNcWrf::file_type() const { return(FileType_NcWrf); } -inline const LongArray & VarInfoNcWrf::dimension() const { return(Dimension); } -inline int VarInfoNcWrf::dimension(int i) const { return(Dimension[i]); } -inline int VarInfoNcWrf::n_dimension() const { return(Dimension.n_elements()); } -inline const NumArray & VarInfoNcWrf::dim_value() const { return(Dim_value); } -inline double VarInfoNcWrf::dim_value(int i) const { return(Dim_value[i]); } -inline const BoolArray & VarInfoNcWrf::is_offset() const { return(Is_offset); } -inline bool VarInfoNcWrf::is_offset(int i) const { return(Is_offset[i]); } +inline GrdFileType VarInfoNcWrf::file_type() const { return FileType_NcWrf; } +inline const LongArray & VarInfoNcWrf::dimension() const { return Dimension; } +inline int VarInfoNcWrf::dimension(int i) const { return Dimension[i]; } +inline int VarInfoNcWrf::n_dimension() const { return Dimension.n_elements(); } +inline const NumArray & VarInfoNcWrf::dim_value() const { return Dim_value; } +inline double VarInfoNcWrf::dim_value(int i) const { return Dim_value[i]; } +inline const BoolArray & VarInfoNcWrf::is_offset() const { return Is_offset; } +inline bool VarInfoNcWrf::is_offset(int i) const { return Is_offset[i]; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc index f950201ea3..5279ca49f7 100644 --- a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc +++ b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc @@ -317,7 +317,7 @@ InitTime = parse_init_time(att_value.c_str()); dimNames.clear(); get_dim_names(&v, &dimNames); string c; - for (k=0; k<(dim_count); ++k) { + for (k=0; kgetDimCount(); if ( dim_count != a.n_elements() ) { mlog << Error << "\n" << method_name - << "needed " << (dim_count) << " arguments for variable " + << "needed " << dim_count << " arguments for variable " << (GET_NC_NAME_P(var)) << ", got " << (a.n_elements()) << "\n\n"; exit ( 1 ); @@ -585,7 +585,7 @@ if ( dim_count != a.n_elements() ) { mlog << Warning << "\n" << method_name << "needed " << dim_count << " arguments for variable " - << (var_name) << ", got " << (a.n_elements()) << "\n\n"; + << var_name << ", got " << a.n_elements() << "\n\n"; exit ( 1 ); @@ -594,7 +594,7 @@ if ( dim_count != a.n_elements() ) { if (dim_count >= max_wrf_args ) { mlog << Warning << "\n" << method_name - << " too may arguments for variable \"" << (var_name) << "\"\n\n"; + << " too may arguments for variable \"" << var_name << "\"\n\n"; return false; @@ -626,7 +626,7 @@ for (j=0; j= 0 ); } diff --git a/src/libcode/vx_gis/shp_array.h b/src/libcode/vx_gis/shp_array.h index f0bfe543c0..cf3f4b846b 100644 --- a/src/libcode/vx_gis/shp_array.h +++ b/src/libcode/vx_gis/shp_array.h @@ -67,11 +67,11 @@ class Shp_Array { Shp_Array & operator=(const Shp_Array & _a) { - if ( this == &_a ) return ( * this ); + if ( this == &_a ) return *this; assign(_a); - return ( * this ); + return *this; } @@ -95,9 +95,9 @@ class Shp_Array { // get stuff // - int n() const { return ( Nelements ); } + int n() const { return Nelements; } - int n_elements() const { return ( Nelements ); } + int n_elements() const { return Nelements; } // // do stuff @@ -371,7 +371,7 @@ if ( (N < 0) || (N >= Nelements) ) { exit ( 1 ); } -return ( E[N] ); +return E[N]; } @@ -385,7 +385,7 @@ T * Shp_Array::buf() const { -return ( E ); +return E; } diff --git a/src/libcode/vx_gis/shp_file.h b/src/libcode/vx_gis/shp_file.h index 2dd900aefc..64ae681880 100644 --- a/src/libcode/vx_gis/shp_file.h +++ b/src/libcode/vx_gis/shp_file.h @@ -159,11 +159,11 @@ class ShpFile { //////////////////////////////////////////////////////////////////////// -inline const ShpFileHeader * ShpFile::header() const { return ( &Header ); } +inline const ShpFileHeader * ShpFile::header() const { return &Header; } -inline int ShpFile::shape_type() const { return ( Header.shape_type ); } +inline int ShpFile::shape_type() const { return Header.shape_type; } -inline bool ShpFile::at_eof() const { return ( At_Eof ); } +inline bool ShpFile::at_eof() const { return At_Eof; } inline bool ShpFile::is_open() const { return ( fd >= 0 ); } diff --git a/src/libcode/vx_grid/goes_grid.cc b/src/libcode/vx_grid/goes_grid.cc index 58c5c143b0..c00babc717 100644 --- a/src/libcode/vx_grid/goes_grid.cc +++ b/src/libcode/vx_grid/goes_grid.cc @@ -121,22 +121,21 @@ void GoesImagerGrid::latlon_to_xy(double lat, double lon, double & x_idx, double float sy = -rc*cos_clat*sin(del_lon_angle); float sz = rc*sin(c_lat); - // // check that point is on disk of the earth + // check that point is on disk of the earth if((Data.H*(Data.H - sx)) < (sy*sy + Data.radius_ratio2*sz*sz)) { x_idx = -1; y_idx = -1; return; } - float rl = sqrt((sx*sx + sy*sy + sz*sz)); - float xx = asin((-sy/rl)); - float yy = atan((sz/sx)); + float rl = sqrt(sx*sx + sy*sy + sz*sz); + float xx = asin(-sy/rl); + float yy = atan(sz/sx); x_idx = round((xx - Data.x_image_bounds[0])/Data.dx_rad); y_idx = round((Data.y_image_bounds[0] - yy)/Data.dy_rad); - // cerr << "lat: " << lat << " lon: " << lon << " ximage: " << xx << " yimage: " << yy << endl; return; } diff --git a/src/libcode/vx_grid/goes_grid.h b/src/libcode/vx_grid/goes_grid.h index 039d75c638..b3157bfeac 100644 --- a/src/libcode/vx_grid/goes_grid.h +++ b/src/libcode/vx_grid/goes_grid.h @@ -80,7 +80,7 @@ class GoesImagerGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline double GoesImagerGrid::scale_km() const { return ( 1.0 ); } +inline double GoesImagerGrid::scale_km() const { return 1.0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/laea_grid.h b/src/libcode/vx_grid/laea_grid.h index 3a9c92751a..ea1b78315a 100644 --- a/src/libcode/vx_grid/laea_grid.h +++ b/src/libcode/vx_grid/laea_grid.h @@ -144,9 +144,9 @@ class LaeaGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline bool LaeaGrid::is_north () const { return ( true ); } -inline bool LaeaGrid::is_south () const { return ( false ); } -inline double LaeaGrid::scale_km() const { return ( -1.0 ); } +inline bool LaeaGrid::is_north () const { return true; } +inline bool LaeaGrid::is_south () const { return false; } +inline double LaeaGrid::scale_km() const { return -1.0; } inline void LaeaGrid::set_so2(double) { return; } diff --git a/src/libcode/vx_grid/latlon_grid.h b/src/libcode/vx_grid/latlon_grid.h index bcac543474..c4dd812bc2 100644 --- a/src/libcode/vx_grid/latlon_grid.h +++ b/src/libcode/vx_grid/latlon_grid.h @@ -89,8 +89,8 @@ class LatLonGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline double LatLonGrid::scale_km() const { return ( -1.0 ); } -inline bool LatLonGrid::wrap_lon() const { return ( wrapLon ); } +inline double LatLonGrid::scale_km() const { return -1.0; } +inline bool LatLonGrid::wrap_lon() const { return wrapLon; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/lc_grid.h b/src/libcode/vx_grid/lc_grid.h index 26134eab3d..be111dd40e 100644 --- a/src/libcode/vx_grid/lc_grid.h +++ b/src/libcode/vx_grid/lc_grid.h @@ -128,14 +128,14 @@ class LambertGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline bool LambertGrid::is_north() const { return ( IsNorthHemisphere ); } -inline bool LambertGrid::is_south() const { return ( ! IsNorthHemisphere ); } +inline bool LambertGrid::is_north() const { return IsNorthHemisphere; } +inline bool LambertGrid::is_south() const { return !IsNorthHemisphere; } -inline double LambertGrid::scale_km() const { return ( Data.d_km ); } +inline double LambertGrid::scale_km() const { return Data.d_km; } -inline bool LambertGrid::has_so2() const { return ( Has_SO2 ); } +inline bool LambertGrid::has_so2() const { return Has_SO2; } -inline double LambertGrid::so2_angle() const { return ( SO2_Angle ); } +inline double LambertGrid::so2_angle() const { return SO2_Angle; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/st_grid.cc b/src/libcode/vx_grid/st_grid.cc index 840a6a69f8..762f7d4968 100644 --- a/src/libcode/vx_grid/st_grid.cc +++ b/src/libcode/vx_grid/st_grid.cc @@ -791,7 +791,7 @@ double stereographic_alpha(double scale_lat, double r_km, double d_km) double alpha; -alpha = (1.0 + sind(fabs(scale_lat)))*((r_km)/(d_km)); +alpha = (1.0 + sind(fabs(scale_lat)))*(r_km/d_km); return alpha; diff --git a/src/libcode/vx_grid/st_grid.h b/src/libcode/vx_grid/st_grid.h index 3d23bfe514..8f251871a7 100644 --- a/src/libcode/vx_grid/st_grid.h +++ b/src/libcode/vx_grid/st_grid.h @@ -107,10 +107,10 @@ class StereographicGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline bool StereographicGrid::is_north () const { return ( IsNorthHemisphere ); } -inline bool StereographicGrid::is_south () const { return ( ! IsNorthHemisphere ); } +inline bool StereographicGrid::is_north () const { return IsNorthHemisphere; } +inline bool StereographicGrid::is_south () const { return !IsNorthHemisphere; } -inline double StereographicGrid::scale_km () const { return ( Data.d_km ); } +inline double StereographicGrid::scale_km () const { return Data.d_km; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/tcrmw_grid.h b/src/libcode/vx_grid/tcrmw_grid.h index b7304b614e..ee45b5e228 100644 --- a/src/libcode/vx_grid/tcrmw_grid.h +++ b/src/libcode/vx_grid/tcrmw_grid.h @@ -101,17 +101,17 @@ class TcrmwGrid : public RotatedLatLonGrid { //////////////////////////////////////////////////////////////////////// -inline int TcrmwGrid::range_n () const { return ( Range_n ); } -inline int TcrmwGrid::azimuth_n () const { return ( Azimuth_n ); } +inline int TcrmwGrid::range_n () const { return Range_n; } +inline int TcrmwGrid::azimuth_n () const { return Azimuth_n; } -inline double TcrmwGrid::range_max_km () const { return ( Range_max_km ); } +inline double TcrmwGrid::range_max_km () const { return Range_max_km; } -inline double TcrmwGrid::range_delta_km () const { return ( Range_max_km/(Range_n - 1) ); } +inline double TcrmwGrid::range_delta_km () const { return Range_max_km/(Range_n - 1); } -inline double TcrmwGrid::azimuth_delta_deg () const { return ( 360.0/Azimuth_n ); } +inline double TcrmwGrid::azimuth_delta_deg () const { return 360.0/Azimuth_n; } -inline double TcrmwGrid::lat_center_deg () const { return ( Lat_Center_Deg ); } -inline double TcrmwGrid::lon_center_deg () const { return ( Lon_Center_Deg ); } +inline double TcrmwGrid::lat_center_deg () const { return Lat_Center_Deg; } +inline double TcrmwGrid::lon_center_deg () const { return Lon_Center_Deg; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/unstructured_grid.cc b/src/libcode/vx_grid/unstructured_grid.cc index d1a56ff9f0..98cf8bccb9 100644 --- a/src/libcode/vx_grid/unstructured_grid.cc +++ b/src/libcode/vx_grid/unstructured_grid.cc @@ -421,7 +421,7 @@ void UnstructuredData::set_points(int count, const std::vector &ptL n_face = count; point_lonlat.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(int, std::vector &) first: (" diff --git a/src/libcode/vx_grid/unstructured_grid.h b/src/libcode/vx_grid/unstructured_grid.h index d3c0d40c66..3f46913472 100644 --- a/src/libcode/vx_grid/unstructured_grid.h +++ b/src/libcode/vx_grid/unstructured_grid.h @@ -85,8 +85,8 @@ class UnstructuredGrid : public GridRep { //////////////////////////////////////////////////////////////////////// -inline double UnstructuredGrid::scale_km() const { return ( -1.0 ); } -inline bool UnstructuredGrid::wrap_lon() const { return ( wrapLon ); } +inline double UnstructuredGrid::scale_km() const { return -1.0; } +inline bool UnstructuredGrid::wrap_lon() const { return wrapLon; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gsl_prob/gsl_cdf.cc b/src/libcode/vx_gsl_prob/gsl_cdf.cc index 414ad355e0..6b2cfb8f17 100644 --- a/src/libcode/vx_gsl_prob/gsl_cdf.cc +++ b/src/libcode/vx_gsl_prob/gsl_cdf.cc @@ -259,7 +259,7 @@ bot = gsl_ran_fdist_pdf(x, deg_freedom_1, deg_freedom_2); x_new = x - (top/bot); -return ( x_new ); +return x_new; } diff --git a/src/libcode/vx_gsl_prob/gsl_randist.cc b/src/libcode/vx_gsl_prob/gsl_randist.cc index 956e912727..755ce1f4c3 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.cc +++ b/src/libcode/vx_gsl_prob/gsl_randist.cc @@ -219,31 +219,31 @@ double ran_draw(const gsl_rng *r, DistType t, double p1, double p2) { // Switch on the distribution type switch(t) { - case(DistType::Normal): + case DistType::Normal: v = gsl_ran_gaussian(r, p1); break; - case(DistType::Exponential): + case DistType::Exponential: v = gsl_ran_exponential(r, p1); break; - case(DistType::ChiSquared): + case DistType::ChiSquared: v = gsl_ran_chisq(r, p1); break; - case(DistType::Gamma): + case DistType::Gamma: v = gsl_ran_gamma(r, p1, p2); break; - case(DistType::Uniform): + case DistType::Uniform: v = gsl_ran_flat(r, p1, p2); break; - case(DistType::Beta): + case DistType::Beta: v = gsl_ran_beta(r, p1, p2); break; - case(DistType::None): + case DistType::None: default: v = 0.0; break; @@ -269,31 +269,31 @@ double dist_var(DistType t, double p1, double p2) { // Switch on the distribution type switch(t) { - case(DistType::Normal): + case DistType::Normal: v = p1*p1; break; - case(DistType::Exponential): + case DistType::Exponential: v = 1.0 / (p1*p1); break; - case(DistType::ChiSquared): + case DistType::ChiSquared: v = 2*p1; break; - case(DistType::Gamma): + case DistType::Gamma: v = p1 / (p2*p2); break; - case(DistType::Uniform): + case DistType::Uniform: v = ((p2-p1)*(p2-p1)) / 12.0; break; - case(DistType::Beta): + case DistType::Beta: v = (p1*p2) / ((p1+p2)*(p1+p2)*(p1+p2+1.0)); break; - case(DistType::None): + case DistType::None: default: v = 0.0; break; @@ -312,7 +312,7 @@ int get_seed() { curr_time = time(nullptr); // Swap the first and fourth bytes and the second and third bytes - u = (unsigned char *) &(curr_time); + u = (unsigned char *) &curr_time; t = u[0]; u[0] = u[3]; u[3] = t; diff --git a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc index b13af92956..eee5c46905 100644 --- a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc +++ b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc @@ -89,7 +89,7 @@ gsl_wavelet_workspace * wavelet_workspace_set(int n) { exit(1); } - return(work); + return work; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nav/nav.cc b/src/libcode/vx_nav/nav.cc index 6109be7192..3ebcfe2596 100644 --- a/src/libcode/vx_nav/nav.cc +++ b/src/libcode/vx_nav/nav.cc @@ -514,7 +514,7 @@ else { } -lon += twopi*floor( 0.5 - ((lon)/twopi) ); +lon += twopi*floor( 0.5 - (lon/twopi) ); lon = lon * deg_per_rad; //lon *= cf; diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index 0b6fa731e3..5380923944 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -327,7 +327,7 @@ void NetcdfObsVars::create_obs_vars (NcFile *f_out) { add_att(&obs_lvl_var, "long_name", "pressure level (hPa) or accumulation interval (sec)"); add_att(&obs_lvl_var, "_FillValue", FILL_VALUE); - long_name_str = (attr_agl) + long_name_str = attr_agl ? "height in meters above sea level or ground level (msl or agl)" : "height in meters above sea level (msl)"; add_att(&obs_hgt_var, "long_name", long_name_str); @@ -589,7 +589,7 @@ void NetcdfObsVars::read_header_data(MetPointHeader &hdr_data) { hdr_data.vld_idx_array.extend(nhdr_count); int buf_size = ((nhdr_count > NC_BUFFER_SIZE_32K) - ? NC_BUFFER_SIZE_32K : (nhdr_count)); + ? NC_BUFFER_SIZE_32K : nhdr_count); // // Allocate space to store the data @@ -948,7 +948,7 @@ void NetcdfObsVars::read_pb_hdr_data(MetPointHeader &hdr_data) { // Read PB report type int buf_size = ((pb_hdr_count > NC_BUFFER_SIZE_32K) - ? NC_BUFFER_SIZE_32K : (pb_hdr_count)); + ? NC_BUFFER_SIZE_32K : pb_hdr_count); int *hdr_prpt_typ_block = new int[buf_size]; int *hdr_irpt_typ_block = new int[buf_size]; int *hdr_inst_typ_block = new int[buf_size]; diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index 3698dbe41a..f773d5178b 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -887,14 +887,12 @@ void add_att(NcVar *var, const string &att_name, const double att_val) { int get_var_names(NcFile *nc, StringArray *var_names) { - NcVar var; int i = 0; int var_count = nc->getVarCount(); multimap mapVar = GET_NC_VARS_P(nc); - for (multimap::iterator it_var = mapVar.begin(); - it_var != mapVar.end(); ++it_var) { - var = (*it_var).second; + for (auto &kv : mapVar) { + NcVar var = kv.second; var_names->add(var.getName()); i++; } @@ -3323,22 +3321,21 @@ bool is_nc_name_time(const ConcatString name) { //////////////////////////////////////////////////////////////////////// bool is_nc_attr_lat(const ConcatString name) { - bool is_latitude = (is_nc_name_lat(name) || name == "x" || name == "X"); + bool is_latitude = (is_nc_name_lat(name) || name == "y" || name == "Y"); return is_latitude; } //////////////////////////////////////////////////////////////////////// bool is_nc_attr_lon(const ConcatString name) { - bool is_longitude = (is_nc_name_lon(name) || name == "y" || name == "Y"); + bool is_longitude = (is_nc_name_lon(name) || name == "x" || name == "X"); return is_longitude; } //////////////////////////////////////////////////////////////////////// bool is_nc_attr_time(const ConcatString name) { - bool is_time = (is_nc_name_time(name) || name == "T"); - return is_time; + return is_nc_name_time(name); } //////////////////////////////////////////////////////////////////////// @@ -3346,31 +3343,49 @@ bool is_nc_attr_time(const ConcatString name) { NcVar get_nc_var_lat(const NcFile *nc) { NcVar var; bool found = false; + int max_dim_cnt = 0; + ConcatString att_val; + ConcatString coordinates_att; multimap mapVar = GET_NC_VARS_P(nc); static const char *method_name = "get_nc_var_lat() "; - for (multimap::iterator it_var = mapVar.begin(); - it_var != mapVar.end(); ++it_var) { - ConcatString name = (*it_var).first; - //if (is_nc_name_lat(name)) found = true; - if (get_var_standard_name(&(*it_var).second, name)) { - if (is_nc_name_lat(name)) found = true; + for (const auto &kv : mapVar) { + ConcatString name = kv.first; + if (is_nc_name_lat(name)) found = true; + if (!found && get_var_standard_name(&kv.second, att_val)) { + if (is_nc_name_lat(att_val)) found = true; } - if (!found && get_var_units(&(*it_var).second, name)) { - if (is_nc_unit_latitude(name.c_str())) { - if (get_nc_att_value(&(*it_var).second, axis_att_name, name)) { - if (is_nc_attr_lat(name)) found = true; - } - else if (get_nc_att_value(&(*it_var).second, - coordinate_axis_type_att_name, name)) { - if (is_nc_attr_lat(name)) found = true; - } + if (!found && get_var_units(&kv.second, att_val) + && is_nc_unit_latitude(att_val.c_str())) { + if (get_nc_att_value(&kv.second, axis_att_name, att_val)) { + if (is_nc_attr_lat(att_val)) found = true; + } + else if (get_nc_att_value(&kv.second, + coordinate_axis_type_att_name, att_val)) { + if (is_nc_attr_lat(att_val)) found = true; } } if (found) { - var = (*it_var).second; + var = kv.second; break; } + int dim_count = GET_NC_DIM_COUNT(kv.second); + if (dim_count > max_dim_cnt) { + max_dim_cnt = dim_count; + if (get_nc_att_value(&kv.second, coordinates_att_name, att_val)) coordinates_att = att_val; + } + } + + if (!found && !coordinates_att.empty()) { + StringArray coord_names = coordinates_att.split(" "); + for (int i=0; i< coord_names.n(); i++) { + NcVar var_lat = get_nc_var((NcFile *)nc, coord_names[i].c_str()); + if (get_var_units(&var_lat, att_val) && is_nc_unit_latitude(att_val.c_str())) { + found = true; + var = var_lat; + break; + } + } } if (found) { @@ -3388,31 +3403,50 @@ NcVar get_nc_var_lat(const NcFile *nc) { NcVar get_nc_var_lon(const NcFile *nc) { NcVar var; bool found = false; + int max_dim_cnt = 0; + ConcatString att_val; + ConcatString coordinates_att; multimap mapVar = GET_NC_VARS_P(nc); static const char *method_name = "get_nc_var_lon() "; - for (multimap::iterator it_var = mapVar.begin(); - it_var != mapVar.end(); ++it_var) { - ConcatString name = (*it_var).first; - //if (is_nc_name_lon(name)) found = true; - if (get_var_standard_name(&(*it_var).second, name)) { - if (is_nc_name_lon(name)) found = true; + for (const auto &kv : mapVar) { + ConcatString name = kv.first; + if (is_nc_name_lon(name)) found = true; + if (!found && get_var_standard_name(&kv.second, att_val)) { + if (is_nc_name_lon(att_val)) found = true; } - if (!found && get_var_units(&(*it_var).second, name)) { - if (is_nc_unit_longitude(name.c_str())) { - if (get_nc_att_value(&(*it_var).second, axis_att_name, name)) { - if (is_nc_attr_lon(name)) found = true; - } - else if (get_nc_att_value(&(*it_var).second, - coordinate_axis_type_att_name, name)) { - if (is_nc_attr_lon(name)) found = true; - } + if (!found && get_var_units(&kv.second, att_val) + && is_nc_unit_longitude(att_val.c_str())) { + if (get_nc_att_value(&kv.second, axis_att_name, att_val)) { + if (is_nc_attr_lon(att_val)) found = true; + } + else if (get_nc_att_value(&kv.second, + coordinate_axis_type_att_name, att_val)) { + if (is_nc_attr_lon(att_val)) found = true; } } if (found) { - var = (*it_var).second; + var = kv.second; break; } + + int dim_count = GET_NC_DIM_COUNT(kv.second); + if (dim_count > max_dim_cnt) { + max_dim_cnt = dim_count; + if (get_nc_att_value(&kv.second, coordinates_att_name, att_val)) coordinates_att = att_val; + } + } + + if (!found && !coordinates_att.empty()) { + StringArray coord_names = coordinates_att.split(" "); + for (int i=0; i< coord_names.n(); i++) { + NcVar var_lon = get_nc_var((NcFile *)nc, coord_names[i].c_str()); + if (get_var_units(&var_lon, att_val) && is_nc_unit_longitude(att_val.c_str())) { + found = true; + var = var_lon; + break; + } + } } if (found) { @@ -3430,33 +3464,51 @@ NcVar get_nc_var_lon(const NcFile *nc) { NcVar get_nc_var_time(const NcFile *nc) { NcVar var; bool found = false; + int max_dim_cnt = 0; + ConcatString att_val; + ConcatString coordinates_att; multimap mapVar = GET_NC_VARS_P(nc); static const char *method_name = "get_nc_var_time() "; - for (multimap::iterator it_var = mapVar.begin(); - it_var != mapVar.end(); ++it_var) { - ConcatString name = (*it_var).first; - //if (is_nc_name_time(name)) found = true; - if (get_var_standard_name(&(*it_var).second, name)) { - if (is_nc_name_time(name)) found = true; + for (auto &kv : mapVar) { + ConcatString name = kv.first; + if (!found && is_nc_name_time(name)) found = true; + if (get_var_standard_name(&kv.second, att_val)) { + if (is_nc_name_time(att_val)) found = true; mlog << Debug(7) << method_name << "checked variable \"" << name << "\" is_time: " << found << "\n"; } - if (!found && get_var_units(&(*it_var).second, name)) { - if (is_nc_unit_time(name.c_str())) { - if (get_nc_att_value(&(*it_var).second, axis_att_name, name)) { - if (is_nc_attr_time(name)) found = true; - } - else if (get_nc_att_value(&(*it_var).second, - coordinate_axis_type_att_name, name)) { - if (is_nc_attr_time(name)) found = true; - } + if (!found && get_var_units(&kv.second, att_val) + && is_nc_unit_time(att_val.c_str())) { + if (get_nc_att_value(&kv.second, axis_att_name, att_val)) { + if (is_nc_attr_time(att_val)) found = true; + } + else if (get_nc_att_value(&kv.second, + coordinate_axis_type_att_name, att_val)) { + if (is_nc_attr_time(att_val)) found = true; } } if (found) { - var = (*it_var).second; + var = kv.second; break; } + int dim_count = GET_NC_DIM_COUNT(kv.second); + if (dim_count > max_dim_cnt) { + max_dim_cnt = dim_count; + if (get_nc_att_value(&kv.second, coordinates_att_name, att_val)) coordinates_att = att_val; + } + } + + if (!found && !coordinates_att.empty()) { + StringArray coord_names = coordinates_att.split(" "); + for (int i=0; i< coord_names.n(); i++) { + NcVar var_time = get_nc_var((NcFile *)nc, coord_names[i].c_str()); + if (get_var_units(&var_time, att_val) && is_nc_unit_time(att_val.c_str())) { + found = true; + var = var_time; + break; + } + } } if (found) { @@ -3494,10 +3546,8 @@ NcFile *open_ncfile(const char * nc_name, bool write) { // Implement the old API var->num_vals() int get_data_size(NcVar *var) { - int dimCount = 0; int data_size = 1; - - dimCount = var->getDimCount(); + int dimCount = var->getDimCount(); for (int i=0; igetDim(i).getSize(); } diff --git a/src/libcode/vx_nc_util/nc_utils.hpp b/src/libcode/vx_nc_util/nc_utils.hpp index f86cb472e9..c9024a471d 100644 --- a/src/libcode/vx_nc_util/nc_utils.hpp +++ b/src/libcode/vx_nc_util/nc_utils.hpp @@ -221,7 +221,7 @@ bool get_var_fill_value(const netCDF::NcVar *var, T &att_val) { if (att) delete att; - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -294,7 +294,7 @@ bool get_nc_data_t(netCDF::NcVar *var, T *data) { if (return_status) { var->getVar(data); } - return(return_status); + return return_status; } //////////////////////////////////////////////////////////////////////// @@ -324,7 +324,7 @@ bool get_nc_data_(netCDF::NcVar *var, T *data, const T met_missing) { "", GET_NC_NAME_P(var).c_str()); } } - return(return_status); + return return_status; } //////////////////////////////////////////////////////////////////////// @@ -393,7 +393,7 @@ bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const LongArray &dims "", GET_NC_NAME_P(var).c_str()); } } - return(return_status); + return return_status; } //////////////////////////////////////////////////////////////////////// @@ -449,7 +449,7 @@ bool get_nc_data_(netCDF::NcVar *var, T *data, T met_missing, const long dim, co "", GET_NC_NAME_P(var).c_str()); } } - return(return_status); + return return_status; } //////////////////////////////////////////////////////////////////////// @@ -472,7 +472,7 @@ bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const LongArray &curs // Retrieve the NetCDF value from the NetCDF variable. return_status = get_nc_data_(var, data, bad_data, dims, curs); } - return(return_status); + return return_status; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/ps_text.h b/src/libcode/vx_ps/ps_text.h index b068f461f2..3d594d7cc8 100644 --- a/src/libcode/vx_ps/ps_text.h +++ b/src/libcode/vx_ps/ps_text.h @@ -121,21 +121,21 @@ class VxpsTextNode { //////////////////////////////////////////////////////////////////////// -inline int VxpsTextNode::font_number() const { return ( FontNumber ); } -inline double VxpsTextNode::font_size() const { return ( FontSize ); } +inline int VxpsTextNode::font_number() const { return FontNumber; } +inline double VxpsTextNode::font_size() const { return FontSize ; } -inline const char * VxpsTextNode::text() const { return ( Text ); } +inline const char * VxpsTextNode::text() const { return Text; } -inline double VxpsTextNode::width () const { return ( Width ); } +inline double VxpsTextNode::width () const { return Width ; } -inline double VxpsTextNode::right () const { return ( Right ); } -inline double VxpsTextNode::left () const { return ( Left ); } -inline double VxpsTextNode::bottom () const { return ( Bottom ); } -inline double VxpsTextNode::top () const { return ( Top ); } +inline double VxpsTextNode::right () const { return Right ; } +inline double VxpsTextNode::left () const { return Left ; } +inline double VxpsTextNode::bottom () const { return Bottom; } +inline double VxpsTextNode::top () const { return Top ; } -inline int VxpsTextNode::nchars() const { return ( Nchars ); } +inline int VxpsTextNode::nchars() const { return Nchars; } -inline double VxpsTextNode::dx () const { return ( Dx ); } +inline double VxpsTextNode::dx () const { return Dx; } inline int VxpsTextNode::is_empty() const { return ( Text ? 0 : 1 ); } diff --git a/src/libcode/vx_ps/table_helper.h b/src/libcode/vx_ps/table_helper.h index 2aa510f7b2..d38399ecdd 100644 --- a/src/libcode/vx_ps/table_helper.h +++ b/src/libcode/vx_ps/table_helper.h @@ -166,8 +166,8 @@ class TableHelper { //////////////////////////////////////////////////////////////////////// -inline int TableHelper::nrows() const { return ( Nrows ); } -inline int TableHelper::ncols() const { return ( Ncols ); } +inline int TableHelper::nrows() const { return Nrows; } +inline int TableHelper::ncols() const { return Ncols; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/vx_ps.h b/src/libcode/vx_ps/vx_ps.h index 33b14d4779..bec3d46bed 100644 --- a/src/libcode/vx_ps/vx_ps.h +++ b/src/libcode/vx_ps/vx_ps.h @@ -293,12 +293,12 @@ class PSfile { ////////////////////////////////////////////////////////////// -inline PSFilter & PSfile::file() const { return ( *Head ); } +inline PSFilter & PSfile::file() const { return *Head; } -inline DocumentOrientation PSfile::orientation () const { return ( Orientation ); } -inline DocumentMedia PSfile::media () const { return ( Media ); } +inline DocumentOrientation PSfile::orientation () const { return Orientation; } +inline DocumentMedia PSfile::media () const { return Media; } -inline ConcatString PSfile::output_filename () const { return ( OutputFilename ); } +inline ConcatString PSfile::output_filename () const { return OutputFilename; } inline double PSfile::page_width () const { return ( (Orientation == OrientationPortrait) ? MediaWidth : MediaHeight); } inline double PSfile::page_height () const { return ( (Orientation == OrientationPortrait) ? MediaHeight : MediaWidth ); } @@ -318,7 +318,7 @@ inline void PSfile::setlinejoin_miter() { setlinejoin(0); return; }; inline void PSfile::setlinejoin_round() { setlinejoin(1); return; }; inline void PSfile::setlinejoin_bevel() { setlinejoin(2); return; }; -inline FontFamily PSfile::family () const { return ( Family ); } +inline FontFamily PSfile::family () const { return Family; } ////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pcm.h b/src/libcode/vx_pxm/pcm.h index bf07e8593a..6912964471 100644 --- a/src/libcode/vx_pxm/pcm.h +++ b/src/libcode/vx_pxm/pcm.h @@ -103,9 +103,9 @@ class Pcm : public PxmBase { //////////////////////////////////////////////////////////////////////// -inline int Pcm::n_colors() const { return ( Ncolors ); } +inline int Pcm::n_colors() const { return Ncolors; } -inline int Pcm::n_data_bytes() const { return ( Nalloc ); } +inline int Pcm::n_data_bytes() const { return Nalloc; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pxm_base.h b/src/libcode/vx_pxm/pxm_base.h index 04a4ed3d31..dd00b45382 100644 --- a/src/libcode/vx_pxm/pxm_base.h +++ b/src/libcode/vx_pxm/pxm_base.h @@ -137,15 +137,15 @@ class PxmBase { //////////////////////////////////////////////////////////////////////// -inline const char * PxmBase::name() const { return ( Name ); } +inline const char * PxmBase::name() const { return Name; } -inline int PxmBase::nrows() const { return ( Nrows ); } -inline int PxmBase::ncols() const { return ( Ncols ); } +inline int PxmBase::nrows() const { return Nrows; } +inline int PxmBase::ncols() const { return Ncols; } -inline int PxmBase::ny() const { return ( Nrows ); } -inline int PxmBase::nx() const { return ( Ncols ); } +inline int PxmBase::ny() const { return Nrows; } +inline int PxmBase::nx() const { return Ncols; } -inline int PxmBase::n_comments() const { return ( Ncomments ); } +inline int PxmBase::n_comments() const { return Ncomments; } inline int PxmBase::ok() const { return ( data ? 1 : 0 ); } diff --git a/src/libcode/vx_python3_utils/python3_dict.h b/src/libcode/vx_python3_utils/python3_dict.h index 851c22b15c..e073af2354 100644 --- a/src/libcode/vx_python3_utils/python3_dict.h +++ b/src/libcode/vx_python3_utils/python3_dict.h @@ -80,7 +80,7 @@ class Python3_Dict { //////////////////////////////////////////////////////////////////////// -inline int Python3_Dict::size() const { return ( Size ); } +inline int Python3_Dict::size() const { return Size; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_list.h b/src/libcode/vx_python3_utils/python3_list.h index 76e877754a..5b45f82432 100644 --- a/src/libcode/vx_python3_utils/python3_list.h +++ b/src/libcode/vx_python3_utils/python3_list.h @@ -71,7 +71,7 @@ class Python3_List { //////////////////////////////////////////////////////////////////////// -inline int Python3_List::size() const { return ( Size ); } +inline int Python3_List::size() const { return Size; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_numpy.h b/src/libcode/vx_python3_utils/python3_numpy.h index 2ead2cf900..d8f2cee6c6 100644 --- a/src/libcode/vx_python3_utils/python3_numpy.h +++ b/src/libcode/vx_python3_utils/python3_numpy.h @@ -122,23 +122,23 @@ class Python3_Numpy { //////////////////////////////////////////////////////////////////////// -inline int Python3_Numpy::n_dims() const { return ( N_Dims ); } +inline int Python3_Numpy::n_dims() const { return N_Dims; } -inline int Python3_Numpy::n_data() const { return ( N_Data ); } +inline int Python3_Numpy::n_data() const { return N_Data; } -inline long Python3_Numpy::item_size() const { return ( Item_Size ); } +inline long Python3_Numpy::item_size() const { return Item_Size; } -inline PyObject * Python3_Numpy::object() const { return ( Object ); } +inline PyObject * Python3_Numpy::object() const { return Object; } -inline PyObject * Python3_Numpy::data_obj() const { return ( Data_Obj ); } +inline PyObject * Python3_Numpy::data_obj() const { return Data_Obj; } -inline Py_buffer & Python3_Numpy::view() { return ( View ); } +inline Py_buffer & Python3_Numpy::view() { return View; } -inline void * Python3_Numpy::buffer() const { return ( Buffer ); } +inline void * Python3_Numpy::buffer() const { return Buffer; } -inline const char * Python3_Numpy::name() const { return ( Name.text() ); } +inline const char * Python3_Numpy::name() const { return Name.text(); } -inline const char * Python3_Numpy::dtype() const { return ( Dtype.text() ); } +inline const char * Python3_Numpy::dtype() const { return Dtype.text(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_script.h b/src/libcode/vx_python3_utils/python3_script.h index 10b648b853..572b1c1fff 100644 --- a/src/libcode/vx_python3_utils/python3_script.h +++ b/src/libcode/vx_python3_utils/python3_script.h @@ -92,15 +92,15 @@ class Python3_Script { //////////////////////////////////////////////////////////////////////// -inline PyObject * Python3_Script::get_module() { return ( Module ); } +inline PyObject * Python3_Script::get_module() { return Module; } -inline PyObject * Python3_Script::dict() { return ( Dict ); } +inline PyObject * Python3_Script::dict() { return Dict; } -inline PyObject * Python3_Script::module_ascii() { return ( ModuleAscii ); } +inline PyObject * Python3_Script::module_ascii() { return ModuleAscii; } -inline PyObject * Python3_Script::dict_ascii() { return ( DictAscii ); } +inline PyObject * Python3_Script::dict_ascii() { return DictAscii; } -inline ConcatString Python3_Script::filename() const { return ( Script_Filename ); } +inline ConcatString Python3_Script::filename() const { return Script_Filename; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/wchar_argv.h b/src/libcode/vx_python3_utils/wchar_argv.h index 9d602de0c0..fa9816d3c6 100644 --- a/src/libcode/vx_python3_utils/wchar_argv.h +++ b/src/libcode/vx_python3_utils/wchar_argv.h @@ -79,9 +79,9 @@ class Wchar_Argv { //////////////////////////////////////////////////////////////////////// -inline int Wchar_Argv::wargc() const { return ( Argc ); } +inline int Wchar_Argv::wargc() const { return Argc; } -inline wchar_t ** Wchar_Argv::wargv() const { return ( W_Argv ); } +inline wchar_t ** Wchar_Argv::wargv() const { return W_Argv; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/renderinfo.h b/src/libcode/vx_render/renderinfo.h index 20bab130f3..57fe1dbc5e 100644 --- a/src/libcode/vx_render/renderinfo.h +++ b/src/libcode/vx_render/renderinfo.h @@ -94,16 +94,16 @@ class RenderInfo { //////////////////////////////////////////////////////////////////////// -inline double RenderInfo::x_ll () const { return ( X_ll ); } -inline double RenderInfo::y_ll () const { return ( Y_ll ); } +inline double RenderInfo::x_ll () const { return X_ll; } +inline double RenderInfo::y_ll () const { return Y_ll; } -inline double RenderInfo::x_mag() const { return ( X_mag ); } -inline double RenderInfo::y_mag() const { return ( Y_mag ); } +inline double RenderInfo::x_mag() const { return X_mag; } +inline double RenderInfo::y_mag() const { return Y_mag; } -inline int RenderInfo::n_filters() const { return ( Nfilters ); } +inline int RenderInfo::n_filters() const { return Nfilters; } -inline bool RenderInfo::is_bw () const { return ( BW ); } -inline bool RenderInfo::is_color () const { return ( ! BW ); } +inline bool RenderInfo::is_bw () const { return BW; } +inline bool RenderInfo::is_color () const { return !BW; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index 406a09ee94..c3114acffc 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -35,14 +35,9 @@ using namespace netCDF; bool standalone_debug_seeps = false; -static SeepsClimo *seeps_climo = 0; +static SeepsClimo *seeps_climo = nullptr; static std::map seeps_climo_grid_map_00; -static const char *def_seeps_filename = - "MET_BASE/climo/seeps/PPT24_seepsweights.nc"; -static const char *def_seeps_grid_filename = - "MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc"; - static const char *var_name_sid = "sid"; static const char *var_name_lat = "lat"; static const char *var_name_lon = "lon"; @@ -55,20 +50,20 @@ double weighted_average(double, double, double, double); //////////////////////////////////////////////////////////////////////// -SeepsClimo *get_seeps_climo() { - if (! seeps_climo) seeps_climo = new SeepsClimo(); +SeepsClimo *get_seeps_climo(ConcatString seeps_point_climo_name) { + if (! seeps_climo) seeps_climo = new SeepsClimo(seeps_point_climo_name); return seeps_climo; } //////////////////////////////////////////////////////////////////////// void release_seeps_climo() { - if (seeps_climo) { delete seeps_climo; seeps_climo = 0; } + if (seeps_climo) { delete seeps_climo; seeps_climo = nullptr; } } //////////////////////////////////////////////////////////////////////// -SeepsClimoGrid *get_seeps_climo_grid(int month, int hour) { +SeepsClimoGrid *get_seeps_climo_grid(int month, ConcatString seeps_grid_climo_name, int hour) { bool not_found = true; SeepsClimoGrid *seeps_climo_grid = nullptr; for (map::iterator it=seeps_climo_grid_map_00.begin(); @@ -81,7 +76,7 @@ SeepsClimoGrid *get_seeps_climo_grid(int month, int hour) { } if (not_found) { - seeps_climo_grid = new SeepsClimoGrid(month, hour); + seeps_climo_grid = new SeepsClimoGrid(month, hour, seeps_grid_climo_name); seeps_climo_grid_map_00[month] = seeps_climo_grid; } return seeps_climo_grid; @@ -174,9 +169,11 @@ SeepsAggScore & SeepsAggScore::operator+=(const SeepsAggScore &c) { //////////////////////////////////////////////////////////////////////// +SeepsClimoBase::SeepsClimoBase(ConcatString seeps_climo_name) : climo_file_name{seeps_climo_name} { -SeepsClimoBase::SeepsClimoBase() { clear(); + seeps_ready = false; + } //////////////////////////////////////////////////////////////////////// @@ -188,13 +185,56 @@ SeepsClimoBase::~SeepsClimoBase() { //////////////////////////////////////////////////////////////////////// void SeepsClimoBase::clear() { - seeps_ready = false; filtered_count = 0; seeps_p1_thresh.clear(); } //////////////////////////////////////////////////////////////////////// +ConcatString SeepsClimoBase::get_climo_filename() { + ConcatString log_seeps_filename; + ConcatString seeps_filename; + const char *method_name = "SeepsClimoBase::get_climo_filename() -> "; + + // Use the environment variable, if set. + ConcatString env_climo_name = get_env_climo_name(); + bool use_env = get_env(env_climo_name.c_str(), seeps_filename); + if(!use_env) { + seeps_filename = climo_file_name.nonempty() ? climo_file_name : get_def_climo_name(); + } + seeps_filename = replace_path(seeps_filename); + + seeps_ready = file_exists(seeps_filename.c_str()); + if (seeps_ready) { + mlog << Debug(7) << method_name << "SEEPS climo name=\"" + << seeps_filename.c_str() << "\"\n"; + } + else { + ConcatString message = ""; + ConcatString message2 = ""; + if (use_env) { + message.add("from the environment variable "); + message.add(env_climo_name); + message2.add("Correct the environment variable"); + } + else { + message.add(climo_file_name.nonempty() + ? "from the configuration" : "from the default"); + message2.add("Correct the configuration"); + } + mlog << Warning << "\n" << method_name + << "The SEEPS climo name \"" << seeps_filename.c_str() + << "\" " << message << " does not exist!\n" + << message2 << " to set its location " + << "or disable output for SEEPS and SEEPS_MPR.\n\n"; + exit(1); + } + + return seeps_filename; +} + +//////////////////////////////////////////////////////////////////////// + void SeepsClimoBase::set_p1_thresh(const SingleThresh &p1_thresh) { seeps_p1_thresh = p1_thresh; } @@ -203,19 +243,12 @@ void SeepsClimoBase::set_p1_thresh(const SingleThresh &p1_thresh) { //////////////////////////////////////////////////////////////////////// -SeepsClimo::SeepsClimo() { +SeepsClimo::SeepsClimo(ConcatString seeps_climo_name) : SeepsClimoBase{seeps_climo_name} { + + clear(); + ConcatString seeps_name = get_climo_filename(); + if (file_exists(seeps_name.c_str())) read_seeps_scores(seeps_name); - ConcatString seeps_name = get_seeps_climo_filename(); - seeps_ready = file_exists(seeps_name.c_str()); - if (seeps_ready) read_seeps_scores(seeps_name); - else { - mlog << Error << "\nSeepsClimo::SeepsClimo() -> " - << "The SEEPS point climo data \"" << seeps_name << "\" is missing!\n" - << "Set the " << MET_ENV_SEEPS_POINT_CLIMO_NAME - << " environment variable to define its location " - << "or disable output for SEEPS and SEEPS_MPR.\n\n"; - exit(1); - } } //////////////////////////////////////////////////////////////////////// @@ -287,7 +320,7 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { SeepsRecord *record = nullptr; const char *method_name = "SeepsClimo::get_record() -> "; - if (seeps_ready) { + if (is_seeps_ready()) { SeepsClimoRecord *climo_record = nullptr; map::iterator it; if (hour < 6 || hour >= 18) { @@ -300,7 +333,7 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { } if (nullptr != climo_record) { double p1 = climo_record->p1[month-1]; - if (seeps_p1_thresh.check(p1)) { + if (check_seeps_p1_thresh(p1)) { record = new SeepsRecord; record->sid = climo_record->sid; record->lat = climo_record->lat; @@ -316,7 +349,7 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { } } else if (!is_eq(p1, bad_data_double)) { - filtered_count++; + increase_filtered_count(); mlog << Debug(7) << method_name << " filtered by threshold p1=" << climo_record->p1[month-1] <<"\n"; } @@ -336,35 +369,6 @@ SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { //////////////////////////////////////////////////////////////////////// -ConcatString SeepsClimo::get_seeps_climo_filename() { - ConcatString seeps_filename; - const char *method_name = "SeepsClimo::get_seeps_climo_filename() -> "; - - // Use the environment variable, if set. - bool use_env = get_env(MET_ENV_SEEPS_POINT_CLIMO_NAME, seeps_filename); - if(use_env) seeps_filename = replace_path(seeps_filename); - else seeps_filename = replace_path(def_seeps_filename); - - if (seeps_ready = file_exists(seeps_filename.c_str())) { - mlog << Debug(7) << method_name << "SEEPS point climo name=\"" - << seeps_filename.c_str() << "\"\n"; - } - else { - ConcatString message = ""; - if (use_env) { - message.add("from the env. name "); - message.add(MET_ENV_SEEPS_POINT_CLIMO_NAME); - } - mlog << Warning << "\n" << method_name - << "The SEEPS point climo name \"" << seeps_filename.c_str() - << "\"" << message << " does not exist!\n\n"; - } - - return seeps_filename; -} - -//////////////////////////////////////////////////////////////////////// - double SeepsClimo::get_score(int sid, double p_fcst, double p_obs, int month, int hour) { double score = bad_data_double; @@ -484,6 +488,8 @@ void SeepsClimo::read_seeps_scores(ConcatString filename) { double matrix_12_buf[SEEPS_MONTH*SEEPS_MATRIX_SIZE]; NcFile *nc_file = open_ncfile(filename.c_str()); + clear(); + // dimensions: month = 12 ; nstn = 5293 ; nmatrix = 9 ; get_dim(nc_file, dim_name_nstn, nstn, true); mlog << Debug(6) << method_name << "dimensions nstn = " << nstn << "\n"; @@ -642,7 +648,7 @@ void SeepsClimo::read_seeps_scores(ConcatString filename) { } catch(int i_err) { - seeps_ready = false; + set_seeps_ready(false); mlog << Error << "\n" << method_name << "encountered an error on reading " << filename << ". ecception_code=" << i_err << "\n\n"; @@ -656,23 +662,16 @@ void SeepsClimo::read_seeps_scores(ConcatString filename) { //////////////////////////////////////////////////////////////////////// -SeepsClimoGrid::SeepsClimoGrid(int month, int hour) : month{month}, hour{hour} +SeepsClimoGrid::SeepsClimoGrid(int month, int hour, ConcatString seeps_climo_name) + : month{month}, hour{hour}, SeepsClimoBase{seeps_climo_name} { + clear(); p1_buf = p2_buf = t1_buf = t2_buf = nullptr; s12_buf = s13_buf = s21_buf = s23_buf = s31_buf = s32_buf = nullptr; - ConcatString seeps_name = get_seeps_climo_filename(); - seeps_ready = file_exists(seeps_name.c_str()); - if (seeps_ready) read_seeps_scores(seeps_name); - else { - mlog << Error << "\nSeepsClimoGrid::SeepsClimoGrid -> " - << "The SEEPS grid climo data \"" << seeps_name << "\" is missing!\n" - << "Set the " << MET_ENV_SEEPS_GRID_CLIMO_NAME - << " environment variable to define its location " - << "or disable output for SEEPS.\n\n"; - exit(1); - } + ConcatString seeps_name = get_climo_filename(); + if (file_exists(seeps_name.c_str())) read_seeps_scores(seeps_name); } @@ -708,7 +707,7 @@ SeepsScore *SeepsClimoGrid::get_record(int ix, int iy, int offset = iy * nx + ix; double p1 = p1_buf[offset]; - if (seeps_p1_thresh.check(p1)) { + if (check_seeps_p1_thresh(p1)) { // Determine location in contingency table int ic = (p_obs>t1_buf[offset])+(p_obs>t2_buf[offset]); int jc = (p_fcst>t1_buf[offset])+(p_fcst>t2_buf[offset]); @@ -725,7 +724,7 @@ SeepsScore *SeepsClimoGrid::get_record(int ix, int iy, seeps_record->score = score; } else if (~is_eq(p1, bad_data_double)) { - filtered_count++; + increase_filtered_count(); mlog << Debug(7) << method_name << " filtered by threshold p1=" << p1_buf[offset] <<"\n"; } } @@ -781,37 +780,6 @@ double SeepsClimoGrid::get_score(int ix, int iy, double p_fcst, double p_obs) { //////////////////////////////////////////////////////////////////////// -ConcatString SeepsClimoGrid::get_seeps_climo_filename() { - ConcatString seeps_filename; - const char *method_name = "SeepsClimoGrid::get_seeps_climo_filename() -> "; - - // Use the environment variable, if set. - bool use_env = get_env(MET_ENV_SEEPS_GRID_CLIMO_NAME, seeps_filename); - if(use_env) { - seeps_filename = replace_path(seeps_filename); - } - else seeps_filename = replace_path(def_seeps_grid_filename); - - if (seeps_ready = file_exists(seeps_filename.c_str())) { - mlog << Debug(7) << method_name << "SEEPS grid climo name=\"" - << seeps_filename.c_str() << "\"\n"; - } - else { - ConcatString message = ""; - if (use_env) { - message.add("from the env. name "); - message.add(MET_ENV_SEEPS_GRID_CLIMO_NAME); - } - mlog << Warning << "\n" << method_name - << "The SEEPS grid climo name \"" << seeps_filename.c_str() - << "\"" << message << " does not exist!\n\n"; - } - - return seeps_filename; -} - -//////////////////////////////////////////////////////////////////////// - void SeepsClimoGrid::read_seeps_scores(ConcatString filename) { clock_t clock_time = clock(); const char *method_name = "SeepsClimoGrid::read_seeps_scores() -> "; @@ -922,7 +890,7 @@ void SeepsClimoGrid::read_seeps_scores(ConcatString filename) { } catch(...) { - seeps_ready = false; + set_seeps_ready(false); mlog << Error << "\n" << method_name << "encountered an error on reading " << filename << ".\n\n"; diff --git a/src/libcode/vx_seeps/seeps.h b/src/libcode/vx_seeps/seeps.h index 60bca4468b..208275e7cd 100644 --- a/src/libcode/vx_seeps/seeps.h +++ b/src/libcode/vx_seeps/seeps.h @@ -17,44 +17,49 @@ //////////////////////////////////////////////////////////////////////// -#define SEEPS_MONTH 12 -#define SEEPS_MATRIX_SIZE 9 +constexpr int SEEPS_MONTH = 12; +constexpr int SEEPS_MATRIX_SIZE = 9; -#define SAMPLE_STATION_ID 11035 +constexpr int SAMPLE_STATION_ID = 11035; //////////////////////////////////////////////////////////////////////// -static const char *MET_ENV_SEEPS_POINT_CLIMO_NAME = "MET_SEEPS_POINT_CLIMO_NAME"; -static const char *MET_ENV_SEEPS_GRID_CLIMO_NAME = "MET_SEEPS_GRID_CLIMO_NAME"; - -static const char *dim_name_nstn = "nstn"; - -static const char *var_name_p1_00 = "p1_00"; -static const char *var_name_p2_00 = "p2_00"; -static const char *var_name_t1_00 = "t1_00"; -static const char *var_name_t2_00 = "t2_00"; -static const char *var_name_p1_12 = "p1_12"; -static const char *var_name_p2_12 = "p2_12"; -static const char *var_name_t1_12 = "t1_12"; -static const char *var_name_t2_12 = "t2_12"; -static const char *var_name_matrix_00 = "matrix_00"; -static const char *var_name_matrix_12 = "matrix_12"; -static const char *var_name_s12_00 = "s12_00"; -static const char *var_name_s13_00 = "s13_00"; -static const char *var_name_s21_00 = "s21_00"; -static const char *var_name_s23_00 = "s23_00"; -static const char *var_name_s31_00 = "s31_00"; -static const char *var_name_s32_00 = "s32_00"; -static const char *var_name_s12_12 = "s12_12"; -static const char *var_name_s13_12 = "s13_12"; -static const char *var_name_s21_12 = "s21_12"; -static const char *var_name_s23_12 = "s23_12"; -static const char *var_name_s31_12 = "s31_12"; -static const char *var_name_s32_12 = "s32_12"; +constexpr char MET_ENV_SEEPS_POINT_CLIMO_NAME[] = "MET_SEEPS_POINT_CLIMO_NAME"; +constexpr char MET_ENV_SEEPS_GRID_CLIMO_NAME[] = "MET_SEEPS_GRID_CLIMO_NAME"; + +constexpr char dim_name_nstn[] = "nstn"; + +constexpr char var_name_p1_00[] = "p1_00"; +constexpr char var_name_p2_00[] = "p2_00"; +constexpr char var_name_t1_00[] = "t1_00"; +constexpr char var_name_t2_00[] = "t2_00"; +constexpr char var_name_p1_12[] = "p1_12"; +constexpr char var_name_p2_12[] = "p2_12"; +constexpr char var_name_t1_12[] = "t1_12"; +constexpr char var_name_t2_12[] = "t2_12"; +constexpr char var_name_matrix_00[] = "matrix_00"; +constexpr char var_name_matrix_12[] = "matrix_12"; +constexpr char var_name_s12_00[] = "s12_00"; +constexpr char var_name_s13_00[] = "s13_00"; +constexpr char var_name_s21_00[] = "s21_00"; +constexpr char var_name_s23_00[] = "s23_00"; +constexpr char var_name_s31_00[] = "s31_00"; +constexpr char var_name_s32_00[] = "s32_00"; +constexpr char var_name_s12_12[] = "s12_12"; +constexpr char var_name_s13_12[] = "s13_12"; +constexpr char var_name_s21_12[] = "s21_12"; +constexpr char var_name_s23_12[] = "s23_12"; +constexpr char var_name_s31_12[] = "s31_12"; +constexpr char var_name_s32_12[] = "s32_12"; + +constexpr char def_seeps_point_filename[] = + "MET_BASE/climo/seeps/PPT24_seepsweights.nc"; +constexpr char def_seeps_grid_filename[] = + "MET_BASE/climo/seeps/PPT24_seepsweights_grid.nc"; //density_radius = 0.75 degrees (83km; this is described as “the smallest possible // value that ensures approximately equal representation of all subregions of Europe”.) -static double density_radius = 0.75; +constexpr double density_radius = 0.75; const double density_radius_rad = density_radius * rad_per_deg; //////////////////////////////////////////////////////////////////////// @@ -135,21 +140,31 @@ struct SeepsClimoRecord { class SeepsClimoBase { - protected: - + private: bool seeps_ready; int filtered_count; - SingleThresh seeps_p1_thresh; // Range of SEEPS p1 (probability of being dry)std::map seeps_score_00_map; + SingleThresh seeps_p1_thresh; // Range of SEEPS p1 (probability of being dry) + ConcatString climo_file_name; + + protected: + + bool is_seeps_ready() { return seeps_ready; }; + void increase_filtered_count() { filtered_count++; }; + bool check_seeps_p1_thresh(double p1) { return seeps_p1_thresh.check(p1); }; + ConcatString get_climo_filename(); virtual void clear(); + virtual ConcatString get_env_climo_name() { return "not defined"; }; + virtual char *get_def_climo_name() { return nullptr; }; + virtual void read_seeps_scores(ConcatString filename) {}; + void set_seeps_ready(bool _seeps_ready) { seeps_ready = _seeps_ready; }; public: - SeepsClimoBase(); - ~SeepsClimoBase(); - + SeepsClimoBase(ConcatString seeps_climo_name); + virtual ~SeepsClimoBase(); void set_p1_thresh(const SingleThresh &p1_thresh); - int get_filtered_count(); + int get_filtered_count() const; }; @@ -169,15 +184,17 @@ class SeepsClimo : public SeepsClimoBase { void print_record(SeepsClimoRecord *record, bool with_header=false); void read_records(ConcatString filename); - ConcatString get_seeps_climo_filename(); - void read_seeps_scores(ConcatString filename); + protected: + void clear() override; + ConcatString get_env_climo_name() override { return MET_ENV_SEEPS_POINT_CLIMO_NAME; }; + char *get_def_climo_name() override { return (char *)def_seeps_point_filename; }; + void read_seeps_scores(ConcatString filename) override; public: - SeepsClimo(); + SeepsClimo(ConcatString seeps_climo_name); ~SeepsClimo(); - void clear(); SeepsRecord *get_record(int sid, int month, int hour); double get_score(int sid, double p_fcst, double p_obs, int month, int hour); SeepsScore *get_seeps_score(int sid, double p_fcst, double p_obs, int month, int hour); @@ -199,7 +216,7 @@ class SeepsClimoGrid : public SeepsClimoBase { private: int month; - int hour; + int hour; // not implemented int nx; int ny; double *p1_buf; @@ -213,15 +230,17 @@ class SeepsClimoGrid : public SeepsClimoBase { double *s31_buf; double *s32_buf; - ConcatString get_seeps_climo_filename(); - void read_seeps_scores(ConcatString filename); + protected: + void clear() override; + ConcatString get_env_climo_name() override { return MET_ENV_SEEPS_GRID_CLIMO_NAME; }; + char *get_def_climo_name() override { return (char *)def_seeps_grid_filename; }; + void read_seeps_scores(ConcatString filename) override; public: - SeepsClimoGrid(int month, int hour); + SeepsClimoGrid(int month, int hour, ConcatString seeps_climo_name); ~SeepsClimoGrid(); - void clear(); SeepsScore *get_record(int ix, int iy, double p_fcst, double p_obs); double get_score(int offset, int obs_cat, int fcst_cat); double get_score(int ix, int iy, double p_fcst, double p_obs); @@ -236,12 +255,12 @@ class SeepsClimoGrid : public SeepsClimoBase { //////////////////////////////////////////////////////////////////////// -inline int SeepsClimoBase::get_filtered_count() { return filtered_count; } +inline int SeepsClimoBase::get_filtered_count() const { return filtered_count; } //////////////////////////////////////////////////////////////////////// -extern SeepsClimo *get_seeps_climo(); -extern SeepsClimoGrid *get_seeps_climo_grid(int month, int hour=0); +extern SeepsClimo *get_seeps_climo(ConcatString seeps_point_climo_name); +extern SeepsClimoGrid *get_seeps_climo_grid(int month, ConcatString seeps_grid_climo_name, int hour=0); extern void release_seeps_climo(); extern void release_seeps_climo_grid(); diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index dcc5840a47..ffaba59145 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -1752,20 +1752,20 @@ void ModeFuzzyEngine::do_fcst_merge_engine(const char *default_config, // this will capture any previous merging performed // in the current forecast field. // - *(fcst_engine->fcst_raw) = *(fcst_raw); - *(fcst_engine->obs_raw) = *(fcst_raw); + *(fcst_engine->fcst_raw) = *fcst_raw; + *(fcst_engine->obs_raw) = *fcst_raw; - *(fcst_engine->fcst_conv) = *(fcst_conv); - *(fcst_engine->obs_conv) = *(fcst_conv); + *(fcst_engine->fcst_conv) = *fcst_conv; + *(fcst_engine->obs_conv) = *fcst_conv; - *(fcst_engine->fcst_thresh) = *(fcst_thresh); - *(fcst_engine->obs_thresh) = *(fcst_thresh); + *(fcst_engine->fcst_thresh) = *fcst_thresh; + *(fcst_engine->obs_thresh) = *fcst_thresh; - *(fcst_engine->fcst_mask) = *(fcst_mask); - *(fcst_engine->obs_mask) = *(fcst_mask); + *(fcst_engine->fcst_mask) = *fcst_mask; + *(fcst_engine->obs_mask) = *fcst_mask; - *(fcst_engine->fcst_split) = *(fcst_split); - *(fcst_engine->obs_split) = *(fcst_split); + *(fcst_engine->fcst_split) = *fcst_split; + *(fcst_engine->obs_split) = *fcst_split; fcst_engine->n_fcst = n_fcst; fcst_engine->n_obs = n_fcst; @@ -1919,20 +1919,20 @@ void ModeFuzzyEngine::do_obs_merge_engine(const char *default_config, // this will capture any previous merging performed // in the current observation field. // - *(obs_engine->fcst_raw) = *(obs_raw); - *(obs_engine->obs_raw) = *(obs_raw); + *(obs_engine->fcst_raw) = *obs_raw; + *(obs_engine->obs_raw) = *obs_raw; - *(obs_engine->fcst_conv) = *(obs_conv); - *(obs_engine->obs_conv) = *(obs_conv); + *(obs_engine->fcst_conv) = *obs_conv; + *(obs_engine->obs_conv) = *obs_conv; - *(obs_engine->fcst_thresh) = *(obs_thresh); - *(obs_engine->obs_thresh) = *(obs_thresh); + *(obs_engine->fcst_thresh) = *obs_thresh; + *(obs_engine->obs_thresh) = *obs_thresh; - *(obs_engine->fcst_mask) = *(obs_mask); - *(obs_engine->obs_mask) = *(obs_mask); + *(obs_engine->fcst_mask) = *obs_mask; + *(obs_engine->obs_mask) = *obs_mask; - *(obs_engine->fcst_split) = *(obs_split); - *(obs_engine->obs_split) = *(obs_split); + *(obs_engine->fcst_split) = *obs_split; + *(obs_engine->obs_split) = *obs_split; obs_engine->n_fcst = n_obs; obs_engine->n_obs = n_obs; diff --git a/src/libcode/vx_shapedata/ihull.h b/src/libcode/vx_shapedata/ihull.h index 3206ed2883..c662ad2eb4 100644 --- a/src/libcode/vx_shapedata/ihull.h +++ b/src/libcode/vx_shapedata/ihull.h @@ -48,7 +48,7 @@ const int y2 = p2.y - p0.y; const int k = x1*y2 - x2*y1; -if ( k > 0 ) return ( 1 ); +if ( k > 0 ) return 1; return ( (k < 0) ? -1 : 0 ); diff --git a/src/libcode/vx_shapedata/node.cc b/src/libcode/vx_shapedata/node.cc index 74310ea451..329bd9f961 100644 --- a/src/libcode/vx_shapedata/node.cc +++ b/src/libcode/vx_shapedata/node.cc @@ -143,7 +143,7 @@ void Node::add_child(const Polyline * poly) { exit(1); } - child->p = *(poly); + child->p = *poly; child->child = nullptr; child->sibling = nullptr; @@ -171,7 +171,7 @@ void Node::add_child(const Polyline * poly) { exit(1); } - n_ptr->sibling->p = *(poly); + n_ptr->sibling->p = *poly; n_ptr->sibling->child = nullptr; n_ptr->sibling->sibling = nullptr; diff --git a/src/libcode/vx_shapedata/shapedata.h b/src/libcode/vx_shapedata/shapedata.h index 9654844047..5c1252dbc7 100644 --- a/src/libcode/vx_shapedata/shapedata.h +++ b/src/libcode/vx_shapedata/shapedata.h @@ -186,13 +186,13 @@ class ShapeData { /////////////////////////////////////////////////////////////////////////////// -inline Moments ShapeData::moments() const { return(mom); } +inline Moments ShapeData::moments() const { return mom; } -inline bool ShapeData::is_valid_xy (int x, int y) const { return ( ! ::is_bad_data(data(x, y)) ); } -inline bool ShapeData::is_bad_data (int x, int y) const { return ( ::is_bad_data(data(x, y)) ); } +inline bool ShapeData::is_valid_xy (int x, int y) const { return ! ::is_bad_data(data(x, y) ); } +inline bool ShapeData::is_bad_data (int x, int y) const { return ::is_bad_data(data(x, y) ); } -inline bool ShapeData::is_zero (int x, int y) const { return ( is_eq(data(x, y), 0.0) ); } -inline bool ShapeData::is_nonzero (int x, int y) const { return ( ! is_eq(data(x, y), 0.0) ); } +inline bool ShapeData::is_zero (int x, int y) const { return is_eq(data(x, y), 0.0); } +inline bool ShapeData::is_nonzero (int x, int y) const { return !is_eq(data(x, y), 0.0); } inline void ShapeData::debug_examine() const { data.debug_examine(); } inline std::string ShapeData::sdebug_examine() const { return data.sdebug_examine(); } diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index c6c6244f67..0bd1c9393a 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -39,7 +39,7 @@ void parse_row_col(const char *col_name, int &r, int &c) { mlog << Error << "\nparse_row_col() -> " << "unexpected column name specified: \"" << col_name << "\"\n\n"; - throw(1); + throw 1; } return; diff --git a/src/libcode/vx_stat_out/stat_hdr_columns.h b/src/libcode/vx_stat_out/stat_hdr_columns.h index 8fb9e4f564..0eab56d6bd 100644 --- a/src/libcode/vx_stat_out/stat_hdr_columns.h +++ b/src/libcode/vx_stat_out/stat_hdr_columns.h @@ -214,55 +214,55 @@ class StatHdrColumns { //////////////////////////////////////////////////////////////////////// -inline ConcatString StatHdrColumns::get_model () const { return(model.contents(na_str)); } -inline ConcatString StatHdrColumns::get_desc () const { return(desc.contents(na_str)); } +inline ConcatString StatHdrColumns::get_model () const { return model.contents(na_str); } +inline ConcatString StatHdrColumns::get_desc () const { return desc.contents(na_str); } -inline int StatHdrColumns::get_fcst_lead_sec () const { return(fcst_lead_sec); } -inline ConcatString StatHdrColumns::get_fcst_lead_str () const { return(fcst_lead_str.contents(na_str)); } +inline int StatHdrColumns::get_fcst_lead_sec () const { return fcst_lead_sec; } +inline ConcatString StatHdrColumns::get_fcst_lead_str () const { return fcst_lead_str.contents(na_str); } -inline unixtime StatHdrColumns::get_fcst_valid_beg () const { return(fcst_valid_beg); } -inline ConcatString StatHdrColumns::get_fcst_valid_beg_str() const { return(fcst_valid_beg_str.contents(na_str)); } +inline unixtime StatHdrColumns::get_fcst_valid_beg () const { return fcst_valid_beg; } +inline ConcatString StatHdrColumns::get_fcst_valid_beg_str() const { return fcst_valid_beg_str.contents(na_str); } -inline unixtime StatHdrColumns::get_fcst_valid_end () const { return(fcst_valid_end); } -inline ConcatString StatHdrColumns::get_fcst_valid_end_str() const { return(fcst_valid_end_str.contents(na_str)); } +inline unixtime StatHdrColumns::get_fcst_valid_end () const { return fcst_valid_end; } +inline ConcatString StatHdrColumns::get_fcst_valid_end_str() const { return fcst_valid_end_str.contents(na_str); } -inline int StatHdrColumns::get_obs_lead_sec () const { return(obs_lead_sec); } -inline ConcatString StatHdrColumns::get_obs_lead_str () const { return(obs_lead_str.contents(na_str)); } +inline int StatHdrColumns::get_obs_lead_sec () const { return obs_lead_sec; } +inline ConcatString StatHdrColumns::get_obs_lead_str () const { return obs_lead_str.contents(na_str); } -inline unixtime StatHdrColumns::get_obs_valid_beg () const { return(obs_valid_beg); } -inline ConcatString StatHdrColumns::get_obs_valid_beg_str () const { return(obs_valid_beg_str.contents(na_str)); } +inline unixtime StatHdrColumns::get_obs_valid_beg () const { return obs_valid_beg; } +inline ConcatString StatHdrColumns::get_obs_valid_beg_str () const { return obs_valid_beg_str.contents(na_str); } -inline unixtime StatHdrColumns::get_obs_valid_end () const { return(obs_valid_end); } -inline ConcatString StatHdrColumns::get_obs_valid_end_str () const { return(obs_valid_end_str.contents(na_str)); } +inline unixtime StatHdrColumns::get_obs_valid_end () const { return obs_valid_end; } +inline ConcatString StatHdrColumns::get_obs_valid_end_str () const { return obs_valid_end_str.contents(na_str); } -inline ConcatString StatHdrColumns::get_fcst_var () const { return(fcst_var.contents(na_str)); } -inline ConcatString StatHdrColumns::get_fcst_units () const { return(fcst_units.contents(na_str)); } -inline ConcatString StatHdrColumns::get_fcst_lev () const { return(fcst_lev.contents(na_str)); } +inline ConcatString StatHdrColumns::get_fcst_var () const { return fcst_var.contents(na_str); } +inline ConcatString StatHdrColumns::get_fcst_units () const { return fcst_units.contents(na_str); } +inline ConcatString StatHdrColumns::get_fcst_lev () const { return fcst_lev.contents(na_str); } -inline ConcatString StatHdrColumns::get_obs_var () const { return(obs_var.contents(na_str)); } -inline ConcatString StatHdrColumns::get_obs_units () const { return(obs_units.contents(na_str)); } -inline ConcatString StatHdrColumns::get_obs_lev () const { return(obs_lev.contents(na_str)); } +inline ConcatString StatHdrColumns::get_obs_var () const { return obs_var.contents(na_str); } +inline ConcatString StatHdrColumns::get_obs_units () const { return obs_units.contents(na_str); } +inline ConcatString StatHdrColumns::get_obs_lev () const { return obs_lev.contents(na_str); } -inline ConcatString StatHdrColumns::get_obtype () const { return(obtype.contents(na_str)); } -inline ConcatString StatHdrColumns::get_mask () const { return(mask.contents(na_str)); } +inline ConcatString StatHdrColumns::get_obtype () const { return obtype.contents(na_str); } +inline ConcatString StatHdrColumns::get_mask () const { return mask.contents(na_str); } -inline ConcatString StatHdrColumns::get_interp_mthd () const { return(interp_mthd.contents(na_str)); } -inline int StatHdrColumns::get_interp_pnts () const { return(interp_pnts); } -inline ConcatString StatHdrColumns::get_interp_pnts_str () const { return(interp_pnts_str.contents(na_str)); } +inline ConcatString StatHdrColumns::get_interp_mthd () const { return interp_mthd.contents(na_str); } +inline int StatHdrColumns::get_interp_pnts () const { return interp_pnts; } +inline ConcatString StatHdrColumns::get_interp_pnts_str () const { return interp_pnts_str.contents(na_str); } -inline ConcatString StatHdrColumns::get_line_type () const { return(line_type.contents(na_str)); } +inline ConcatString StatHdrColumns::get_line_type () const { return line_type.contents(na_str); } -inline ThreshArray StatHdrColumns::get_fcst_thresh () const { return(fcst_thresh); } +inline ThreshArray StatHdrColumns::get_fcst_thresh () const { return fcst_thresh; } -inline ThreshArray StatHdrColumns::get_obs_thresh () const { return(obs_thresh); } -inline ConcatString StatHdrColumns::get_obs_thresh_str () const { return(obs_thresh.get_str()); } +inline ThreshArray StatHdrColumns::get_obs_thresh () const { return obs_thresh; } +inline ConcatString StatHdrColumns::get_obs_thresh_str () const { return obs_thresh.get_str(); } -inline SetLogic StatHdrColumns::get_thresh_logic () const { return(thresh_logic); } +inline SetLogic StatHdrColumns::get_thresh_logic () const { return thresh_logic; } -inline ThreshArray StatHdrColumns::get_cov_thresh () const { return(cov_thresh); } -inline ConcatString StatHdrColumns::get_cov_thresh_str () const { return(prob_thresh_to_string(cov_thresh)); } +inline ThreshArray StatHdrColumns::get_cov_thresh () const { return cov_thresh; } +inline ConcatString StatHdrColumns::get_cov_thresh_str () const { return prob_thresh_to_string(cov_thresh); } -inline double StatHdrColumns::get_alpha () const { return(alpha); } +inline double StatHdrColumns::get_alpha () const { return alpha; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/compute_ci.cc b/src/libcode/vx_statistics/compute_ci.cc index e444ab59e5..3edbc66a8f 100644 --- a/src/libcode/vx_statistics/compute_ci.cc +++ b/src/libcode/vx_statistics/compute_ci.cc @@ -384,7 +384,7 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) nullptr; } if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) nullptr; } if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) nullptr; } - throw(1); + throw 1; } } @@ -812,7 +812,7 @@ void compute_mcts_stats_ci_bca(const gsl_rng *rng_ptr, << "can't open one or more temporary files for writing:\n" << mcts_i_file << "\n" << mcts_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -1024,7 +1024,7 @@ void compute_cnt_stats_ci_bca(const gsl_rng *rng_ptr, << "can't open one or more temporary files for writing:\n" << cnt_i_file << "\n" << cnt_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -1512,7 +1512,7 @@ void compute_cts_stats_ci_perc(const gsl_rng *rng_ptr, if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) nullptr; } if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) nullptr; } - throw(1); + throw 1; } } @@ -1897,7 +1897,7 @@ void compute_mcts_stats_ci_perc(const gsl_rng *rng_ptr, mlog << Error << "\ncompute_mcts_stats_ci_perc() -> " << "can't open the temporary file for writing:\n" << mcts_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -2086,7 +2086,7 @@ void compute_cnt_stats_ci_perc(const gsl_rng *rng_ptr, mlog << Error << "\ncompute_cnt_stats_ci_perc() -> " << "can't open the temporary file for writing:\n" << cnt_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -2543,7 +2543,7 @@ void compute_nbrcts_stats_ci_bca(const gsl_rng *rng_ptr, if(nbrcts_i_file) { delete [] nbrcts_i_file; nbrcts_i_file = (ConcatString *) nullptr; } if(nbrcts_r_file) { delete [] nbrcts_r_file; nbrcts_r_file = (ConcatString *) nullptr; } - throw(1); + throw 1; } } @@ -2943,7 +2943,7 @@ void compute_nbrcnt_stats_ci_bca(const gsl_rng *rng_ptr, << "can't open one or more temporary files for writing:\n" << nbrcnt_i_file << "\n" << nbrcnt_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -3184,7 +3184,7 @@ void compute_nbrcts_stats_ci_perc(const gsl_rng *rng_ptr, if(nbrcts_r_out) { delete [] nbrcts_r_out; nbrcts_r_out = (ofstream *) nullptr; } if(nbrcts_r_file) { delete [] nbrcts_r_file; nbrcts_r_file = (ConcatString *) nullptr; } - throw(1); + throw 1; } } @@ -3543,7 +3543,7 @@ void compute_nbrcnt_stats_ci_perc(const gsl_rng *rng_ptr, mlog << Error << "\ncompute_nbrcnt_stats_ci_perc() -> " << "can't open the temporary file for writing:\n" << nbrcnt_r_file << "\n\n"; - throw(1); + throw 1; } // @@ -4009,7 +4009,7 @@ void read_ldf(const ConcatString file_name, int col, NumArray &na) { mlog << Error << "\nread_ldf() -> " << "can't open file: " << file_name << "\n\n" ; - throw(1); + throw 1; } // diff --git a/src/libcode/vx_statistics/compute_stats.cc b/src/libcode/vx_statistics/compute_stats.cc index e4fe518558..d775637dd3 100644 --- a/src/libcode/vx_statistics/compute_stats.cc +++ b/src/libcode/vx_statistics/compute_stats.cc @@ -1547,7 +1547,8 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps) { void compute_aggregated_seeps_grid(const DataPlane &fcst_dp, const DataPlane &obs_dp, DataPlane &seeps_dp, DataPlane &seeps_dp_fcat, DataPlane &seeps_dp_ocat,SeepsAggScore *seeps, - int month, int hour, const SingleThresh &seeps_p1_thresh) { + int month, int hour, const SingleThresh &seeps_p1_thresh, + const ConcatString &seeps_climo_name) { int fcst_cat, obs_cat; int seeps_count, count_diagonal, nan_count, bad_count; int nx = fcst_dp.nx(); @@ -1569,7 +1570,7 @@ void compute_aggregated_seeps_grid(const DataPlane &fcst_dp, const DataPlane &ob c12 = c13 = c21 = c23 = c31 = c32 = 0; seeps->clear(); - SeepsClimoGrid *seeps_climo = get_seeps_climo_grid(month); + SeepsClimoGrid *seeps_climo = get_seeps_climo_grid(month, seeps_climo_name); seeps_climo->set_p1_thresh(seeps_p1_thresh); for (int i=0; i &density_vector); diff --git a/src/libcode/vx_statistics/contable.h b/src/libcode/vx_statistics/contable.h index a605300e08..cae46f880a 100644 --- a/src/libcode/vx_statistics/contable.h +++ b/src/libcode/vx_statistics/contable.h @@ -139,11 +139,11 @@ class ContingencyTable { //////////////////////////////////////////////////////////////////////// -inline int ContingencyTable::nrows() const { return ( Nrows ); } -inline int ContingencyTable::ncols() const { return ( Ncols ); } +inline int ContingencyTable::nrows() const { return Nrows; } +inline int ContingencyTable::ncols() const { return Ncols; } -inline double ContingencyTable::ec_value() const { return ( ECvalue ); } -inline ConcatString ContingencyTable::name() const { return ( Name ); } +inline double ContingencyTable::ec_value() const { return ECvalue; } +inline ConcatString ContingencyTable::name() const { return Name; } //////////////////////////////////////////////////////////////////////// @@ -252,11 +252,11 @@ class Nx2ContingencyTable : public ContingencyTable { //////////////////////////////////////////////////////////////////////// -inline int Nx2ContingencyTable::event_col_total () const { return ( col_total(nx2_event_column) ); } -inline int Nx2ContingencyTable::nonevent_col_total () const { return ( col_total(nx2_nonevent_column) ); } +inline int Nx2ContingencyTable::event_col_total () const { return col_total(nx2_event_column); } +inline int Nx2ContingencyTable::nonevent_col_total () const { return col_total(nx2_nonevent_column); } -inline int Nx2ContingencyTable::event_count_by_row (int row) const { return ( entry(row, nx2_event_column) ); } -inline int Nx2ContingencyTable::nonevent_count_by_row (int row) const { return ( entry(row, nx2_nonevent_column) ); } +inline int Nx2ContingencyTable::event_count_by_row (int row) const { return entry(row, nx2_event_column); } +inline int Nx2ContingencyTable::nonevent_count_by_row (int row) const { return entry(row, nx2_nonevent_column); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/contable_nx2.cc b/src/libcode/vx_statistics/contable_nx2.cc index e9964a3b28..9af0358511 100644 --- a/src/libcode/vx_statistics/contable_nx2.cc +++ b/src/libcode/vx_statistics/contable_nx2.cc @@ -472,7 +472,7 @@ double Nx2ContingencyTable::baser() const { if( n() == 0 ) v = bad_data_double; else v = (double) event_col_total()/n(); - return ( v ); + return v; } diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index d0c795f2a2..7e7194c11d 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -737,7 +737,7 @@ double TTContingencyTable::sedi_ci(double alpha, double TTContingencyTable::cost_loss(double r) const { double num, den, h, m, f, b, v; - if(n() == 0) return(bad_data_double); + if(n() == 0) return bad_data_double; // Total proportion of hits, misses, false alarms, and observations h = (double) fy_oy() / n(); diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index 7f2af8b534..b5a9199ced 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -3458,7 +3458,7 @@ double compute_mean(double sum, int n) { v = sum / n; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -3579,7 +3579,7 @@ double compute_ufss(double o_rate) { if(is_bad_data(o_rate)) ufss = bad_data_double; else ufss = 0.5 + o_rate/2.0; - return(ufss); + return ufss; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index 36a9e2f01d..a89a8fc355 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -675,7 +675,7 @@ class DMAPInfo { //////////////////////////////////////////////////////////////////////// -inline double DMAPInfo::get_beta_value() const { return(beta_value); } +inline double DMAPInfo::get_beta_value() const { return beta_value; } //////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 11cce141dc..ec6d3878b5 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -149,8 +149,8 @@ class ObsErrorTable { //////////////////////////////////////////////////////////////////////// -inline int ObsErrorTable::n() const { return(N_elements); } -inline bool ObsErrorTable::is_set() const { return(IsSet); } +inline int ObsErrorTable::n() const { return N_elements; } +inline bool ObsErrorTable::is_set() const { return IsSet; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_base.h b/src/libcode/vx_statistics/pair_base.h index 3a0f869edb..b0881ae34e 100644 --- a/src/libcode/vx_statistics/pair_base.h +++ b/src/libcode/vx_statistics/pair_base.h @@ -181,7 +181,7 @@ class PairBase { //////////////////////////////////////////////////////////////////////// -inline bool PairBase::is_point_vx() const { return(IsPointVx); } +inline bool PairBase::is_point_vx() const { return IsPointVx; } //////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index d33d8f2311..5088c22564 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -183,8 +183,8 @@ bool PairDataPoint::add_point_pair(const char *sid, double lat, double lon, //////////////////////////////////////////////////////////////////////// -void PairDataPoint::load_seeps_climo() { - if (nullptr == seeps_climo) seeps_climo = get_seeps_climo(); +void PairDataPoint::load_seeps_climo(const ConcatString &seeps_climo_name) { + if (nullptr == seeps_climo) seeps_climo = get_seeps_climo(seeps_climo_name); } //////////////////////////////////////////////////////////////////////// @@ -1674,11 +1674,11 @@ void VxPairDataPoint::set_obs_perc_value(int percentile) { //////////////////////////////////////////////////////////////////////// -void VxPairDataPoint::load_seeps_climo() { +void VxPairDataPoint::load_seeps_climo(const ConcatString &seeps_climo_name) { for(int i=0; i < n_msg_typ; i++){ for(int j=0; j < n_mask; j++){ for(int k=0; k < n_interp; k++){ - pd[i][j][k].load_seeps_climo(); + pd[i][j][k].load_seeps_climo(seeps_climo_name); } } } @@ -1792,15 +1792,15 @@ bool check_fo_thresh(double f, double o, double cmn, double csd, } switch(t) { - case(SetLogic::Union): + case SetLogic::Union: if(!fcheck && !ocheck) status = false; break; - case(SetLogic::Intersection): + case SetLogic::Intersection: if(!fcheck || !ocheck) status = false; break; - case(SetLogic::SymDiff): + case SetLogic::SymDiff: if(fcheck == ocheck) status = false; break; @@ -1810,7 +1810,7 @@ bool check_fo_thresh(double f, double o, double cmn, double csd, exit(1); } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_point.h b/src/libcode/vx_statistics/pair_data_point.h index c68ddf1f33..166e177b84 100644 --- a/src/libcode/vx_statistics/pair_data_point.h +++ b/src/libcode/vx_statistics/pair_data_point.h @@ -59,7 +59,7 @@ class PairDataPoint : public PairBase { bool add_point_pair(const char *, double, double, double, double, unixtime, double, double, double, double, const char *, double, double, double); - void load_seeps_climo(); + void load_seeps_climo(const ConcatString &seeps_climo_name); void set_seeps_thresh(const SingleThresh &p1_thresh); void set_seeps_score(SeepsScore *, int index=-1); @@ -229,7 +229,7 @@ class VxPairDataPoint { void set_mpr_thresh(const StringArray &, const ThreshArray &); - void load_seeps_climo(); + void load_seeps_climo(const ConcatString &seeps_climo_name); void set_seeps_thresh(const SingleThresh &p1_thresh); void set_climo_cdf_info_ptr(const ClimoCDFInfo *); diff --git a/src/libcode/vx_tc_util/atcf_line_base.h b/src/libcode/vx_tc_util/atcf_line_base.h index 8b1141ffad..0547b7d5b0 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.h +++ b/src/libcode/vx_tc_util/atcf_line_base.h @@ -131,13 +131,13 @@ class ATCFLineBase : public DataLine { //////////////////////////////////////////////////////////////////////// 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; } -inline void ATCFLineBase::set_tech_suffix (const ConcatString *s) { TechSuffix = s; } -inline void ATCFLineBase::set_technique (const ConcatString &s) { Technique = s; } -inline bool ATCFLineBase::is_best_track () const { return(IsBestTrack); } -inline bool ATCFLineBase::is_oper_track () const { return(IsOperTrack); } + { BasinMap = m; } +inline void ATCFLineBase::set_best_technique(const StringArray *s) { BestTechnique = s; } +inline void ATCFLineBase::set_oper_technique(const StringArray *s) { OperTechnique = s; } +inline void ATCFLineBase::set_tech_suffix (const ConcatString *s) { TechSuffix = s; } +inline void ATCFLineBase::set_technique (const ConcatString &s) { Technique = s; } +inline bool ATCFLineBase::is_best_track () const { return IsBestTrack; } +inline bool ATCFLineBase::is_oper_track () const { return IsOperTrack; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/diag_file.h b/src/libcode/vx_tc_util/diag_file.h index 9c302d5528..f387625758 100644 --- a/src/libcode/vx_tc_util/diag_file.h +++ b/src/libcode/vx_tc_util/diag_file.h @@ -135,17 +135,17 @@ class DiagFile : public LineDataFile { //////////////////////////////////////////////////////////////////////// -inline const ConcatString & DiagFile::storm_id() const { return(StormId); } -inline const ConcatString & DiagFile::basin() const { return(Basin); } -inline const ConcatString & DiagFile::cyclone() const { return(Cyclone); } -inline const StringArray & DiagFile::technique() const { return(Technique); } -inline unixtime DiagFile::init() const { return(InitTime); } -inline int DiagFile::n_time() const { return(NTime); } -inline DiagType DiagFile::diag_source() const { return(DiagSource); } -inline const ConcatString & DiagFile::track_source() const { return(TrackSource); } -inline const ConcatString & DiagFile::field_source() const { return(FieldSource); } -inline int DiagFile::n_diag() const { return(DiagName.n()); } -inline const StringArray & DiagFile::diag_name() const { return(DiagName); } +inline const ConcatString & DiagFile::storm_id() const { return StormId; } +inline const ConcatString & DiagFile::basin() const { return Basin; } +inline const ConcatString & DiagFile::cyclone() const { return Cyclone; } +inline const StringArray & DiagFile::technique() const { return Technique; } +inline unixtime DiagFile::init() const { return InitTime; } +inline int DiagFile::n_time() const { return NTime; } +inline DiagType DiagFile::diag_source() const { return DiagSource; } +inline const ConcatString & DiagFile::track_source() const { return TrackSource; } +inline const ConcatString & DiagFile::field_source() const { return FieldSource; } +inline int DiagFile::n_diag() const { return DiagName.n(); } +inline const StringArray & DiagFile::diag_name() const { return DiagName; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/gen_shape_info.h b/src/libcode/vx_tc_util/gen_shape_info.h index 58ea1d9a6a..f27af62aac 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.h +++ b/src/libcode/vx_tc_util/gen_shape_info.h @@ -91,11 +91,11 @@ class GenShapeInfo { //////////////////////////////////////////////////////////////////////// -inline const ConcatString & GenShapeInfo::basin() const { return(Basin); } +inline const ConcatString & GenShapeInfo::basin() const { return Basin; } -inline unixtime GenShapeInfo::file_time() const { return(FileTime); } -inline unixtime GenShapeInfo::issue_time() const { return(IssueTime); } -inline int GenShapeInfo::issue_hour() const { return(unix_to_sec_of_day(IssueTime)); } +inline unixtime GenShapeInfo::file_time() const { return FileTime ; } +inline unixtime GenShapeInfo::issue_time() const { return IssueTime; } +inline int GenShapeInfo::issue_hour() const { return unix_to_sec_of_day(IssueTime); } //////////////////////////////////////////////////////////////////////// // @@ -140,7 +140,7 @@ class GenShapeInfoArray { //////////////////////////////////////////////////////////////////////// -inline int GenShapeInfoArray::n() const { return(GenShape.size()); } +inline int GenShapeInfoArray::n() const { return GenShape.size(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/genesis_info.h b/src/libcode/vx_tc_util/genesis_info.h index 11df94257e..5ab8da740c 100644 --- a/src/libcode/vx_tc_util/genesis_info.h +++ b/src/libcode/vx_tc_util/genesis_info.h @@ -112,11 +112,11 @@ class GenesisInfo : public TrackInfo { //////////////////////////////////////////////////////////////////////// -inline double GenesisInfo::lat() const { return(Lat); } -inline double GenesisInfo::lon() const { return(Lon); } -inline double GenesisInfo::dland() const { return(DLand); } -inline unixtime GenesisInfo::genesis_time() const { return(GenesisTime); } -inline int GenesisInfo::genesis_lead() const { return(GenesisLead); } +inline double GenesisInfo::lat() const { return Lat; } +inline double GenesisInfo::lon() const { return Lon; } +inline double GenesisInfo::dland() const { return DLand; } +inline unixtime GenesisInfo::genesis_time() const { return GenesisTime; } +inline int GenesisInfo::genesis_lead() const { return GenesisLead; } //////////////////////////////////////////////////////////////////////// // @@ -167,7 +167,7 @@ class GenesisInfoArray { //////////////////////////////////////////////////////////////////////// -inline int GenesisInfoArray::n() const { return(Genesis.size()); } +inline int GenesisInfoArray::n() const { return Genesis.size(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/pair_data_genesis.h b/src/libcode/vx_tc_util/pair_data_genesis.h index 89b0a5b2f6..25fbd653f5 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.h +++ b/src/libcode/vx_tc_util/pair_data_genesis.h @@ -142,13 +142,13 @@ inline void PairDataGenesis::set_desc (const ConcatString &s) { Desc = s; } inline void PairDataGenesis::set_mask (const ConcatString &s) { Mask = s; } inline void PairDataGenesis::set_model(const ConcatString &s) { Model = s; } -inline ConcatString PairDataGenesis::desc() const { return(Desc); } -inline ConcatString PairDataGenesis::mask() const { return(Mask); } -inline ConcatString PairDataGenesis::model() const { return(Model); } -inline int PairDataGenesis::n_pair() const { return(NPair); } -inline const std::string PairDataGenesis::best_storm_id(int i) const { return(BestStormId[i]); } -inline unixtime PairDataGenesis::init(int i) const { return(InitTime[i]); } -inline int PairDataGenesis::lead_time(int i) const { return(LeadTime[i]); } +inline ConcatString PairDataGenesis::desc() const { return Desc; } +inline ConcatString PairDataGenesis::mask() const { return Mask; } +inline ConcatString PairDataGenesis::model() const { return Model; } +inline int PairDataGenesis::n_pair() const { return NPair; } +inline const std::string PairDataGenesis::best_storm_id(int i) const { return BestStormId[i]; } +inline unixtime PairDataGenesis::init(int i) const { return InitTime[i]; } +inline int PairDataGenesis::lead_time(int i) const { return LeadTime[i]; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_gen_info.h b/src/libcode/vx_tc_util/prob_gen_info.h index 514fa9c337..5d5a03c5bc 100644 --- a/src/libcode/vx_tc_util/prob_gen_info.h +++ b/src/libcode/vx_tc_util/prob_gen_info.h @@ -86,10 +86,10 @@ class ProbGenInfo : public ProbInfoBase { //////////////////////////////////////////////////////////////////////// -inline const ConcatString & ProbGenInfo::initials() const { return(Initials); } -inline const ConcatString & ProbGenInfo::gen_or_dis() const { return(GenOrDis); } -inline unixtime ProbGenInfo::genesis_time() const { return(GenesisTime); } -inline int ProbGenInfo::genesis_lead() const { return(GenesisLead); } +inline const ConcatString & ProbGenInfo::initials() const { return Initials; } +inline const ConcatString & ProbGenInfo::gen_or_dis() const { return GenOrDis; } +inline unixtime ProbGenInfo::genesis_time() const { return GenesisTime; } +inline int ProbGenInfo::genesis_lead() const { return GenesisLead; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_info_array.cc b/src/libcode/vx_tc_util/prob_info_array.cc index 35a37708e2..0caaa7ed73 100644 --- a/src/libcode/vx_tc_util/prob_info_array.cc +++ b/src/libcode/vx_tc_util/prob_info_array.cc @@ -244,7 +244,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { // Store based on the input line type switch(l.type()) { - case(ATCFLineType::ProbRI): + case ATCFLineType::ProbRI: // Add line to an existing entry if(ProbRIRW.size() > 0 && @@ -260,7 +260,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { } break; - case(ATCFLineType::ProbGN): + case ATCFLineType::ProbGN: // Add line to an existing entry if(ProbGen.size() > 0 && diff --git a/src/libcode/vx_tc_util/prob_info_array.h b/src/libcode/vx_tc_util/prob_info_array.h index 53856a4a98..182fffd046 100644 --- a/src/libcode/vx_tc_util/prob_info_array.h +++ b/src/libcode/vx_tc_util/prob_info_array.h @@ -79,8 +79,8 @@ class ProbInfoArray { //////////////////////////////////////////////////////////////////////// inline int ProbInfoArray::n_probs() const { return(ProbRIRW.size() + ProbGen.size()); } -inline int ProbInfoArray::n_prob_rirw() const { return(ProbRIRW.size()); } -inline int ProbInfoArray::n_prob_gen() const { return(ProbGen.size()); } +inline int ProbInfoArray::n_prob_rirw() const { return ProbRIRW.size(); } +inline int ProbInfoArray::n_prob_gen() const { return ProbGen.size(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_info_base.h b/src/libcode/vx_tc_util/prob_info_base.h index 09473eb1ab..1bae207793 100644 --- a/src/libcode/vx_tc_util/prob_info_base.h +++ b/src/libcode/vx_tc_util/prob_info_base.h @@ -114,21 +114,21 @@ class ProbInfoBase { //////////////////////////////////////////////////////////////////////// -inline ATCFLineType ProbInfoBase::type() const { return(Type); } -inline const ConcatString & ProbInfoBase::storm_id() const { return(StormId); } -inline const ConcatString & ProbInfoBase::basin() const { return(Basin); } -inline const ConcatString & ProbInfoBase::cyclone() const { return(Cyclone); } -inline const ConcatString & ProbInfoBase::technique() const { return(Technique); } -inline unixtime ProbInfoBase::init() const { return(InitTime); } -inline int ProbInfoBase::init_hour() const { return(unix_to_sec_of_day(InitTime)); } -inline unixtime ProbInfoBase::valid() const { return(ValidTime); } -inline int ProbInfoBase::valid_hour() const { return(unix_to_sec_of_day(ValidTime)); } -inline double ProbInfoBase::lat() const { return(Lat); } -inline double ProbInfoBase::lon() const { return(Lon); } -inline double ProbInfoBase::dland() const { return(DLand); } -inline int ProbInfoBase::n_prob() const { return(NProb); } -inline double ProbInfoBase::prob(int i) const { return(Prob[i]); } -inline double ProbInfoBase::prob_item(int i) const { return(ProbItem[i]); } +inline ATCFLineType ProbInfoBase::type() const { return Type; } +inline const ConcatString & ProbInfoBase::storm_id() const { return StormId; } +inline const ConcatString & ProbInfoBase::basin() const { return Basin; } +inline const ConcatString & ProbInfoBase::cyclone() const { return Cyclone; } +inline const ConcatString & ProbInfoBase::technique() const { return Technique; } +inline unixtime ProbInfoBase::init() const { return InitTime; } +inline int ProbInfoBase::init_hour() const { return unix_to_sec_of_day(InitTime); } +inline unixtime ProbInfoBase::valid() const { return ValidTime; } +inline int ProbInfoBase::valid_hour() const { return unix_to_sec_of_day(ValidTime); } +inline double ProbInfoBase::lat() const { return Lat; } +inline double ProbInfoBase::lon() const { return Lon; } +inline double ProbInfoBase::dland() const { return DLand; } +inline int ProbInfoBase::n_prob() const { return NProb; } +inline double ProbInfoBase::prob(int i) const { return Prob[i]; } +inline double ProbInfoBase::prob_item(int i) const { return ProbItem[i]; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_rirw_info.cc b/src/libcode/vx_tc_util/prob_rirw_info.cc index ea662ef4c3..f12a2d66c5 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_info.cc @@ -143,8 +143,8 @@ void ProbRIRWInfo::assign(const ProbRIRWInfo &p) { //////////////////////////////////////////////////////////////////////// int ProbRIRWInfo::rirw_window() const { - return((is_bad_data(rirw_beg()) || is_bad_data(rirw_end()) ? - bad_data_int : rirw_end() - rirw_beg())); + return (is_bad_data(rirw_beg()) || is_bad_data(rirw_end()) ? + bad_data_int : rirw_end() - rirw_beg()); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_rirw_info.h b/src/libcode/vx_tc_util/prob_rirw_info.h index fd1ced2893..e2636ea284 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_info.h @@ -78,10 +78,10 @@ class ProbRIRWInfo : public ProbInfoBase { //////////////////////////////////////////////////////////////////////// -inline double ProbRIRWInfo::value() const { return(Value); } -inline const ConcatString & ProbRIRWInfo::initials() const { return(Initials); } -inline int ProbRIRWInfo::rirw_beg() const { return(RIRWBeg); } -inline int ProbRIRWInfo::rirw_end() const { return(RIRWEnd); } +inline double ProbRIRWInfo::value() const { return Value; } +inline const ConcatString & ProbRIRWInfo::initials() const { return Initials; } +inline int ProbRIRWInfo::rirw_beg() const { return RIRWBeg; } +inline int ProbRIRWInfo::rirw_end() const { return RIRWEnd; } //////////////////////////////////////////////////////////////////////// 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 e809bc3198..f81dd22b37 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.h @@ -111,24 +111,24 @@ class ProbRIRWPairInfo { //////////////////////////////////////////////////////////////////////// -inline const ProbRIRWInfo & ProbRIRWPairInfo::prob_rirw() const { return(ProbRIRW); } -inline const TrackInfo * ProbRIRWPairInfo::bdeck() const { return(BDeck); } -inline const ConcatString & ProbRIRWPairInfo::storm_name() const { return(StormName); } -inline const ConcatString & ProbRIRWPairInfo::bmodel() const { return(BModel); } -inline double ProbRIRWPairInfo::blat() const { return(BLat); } -inline double ProbRIRWPairInfo::blon() const { return(BLon); } -inline double ProbRIRWPairInfo::adland() const { return(ADLand); } -inline double ProbRIRWPairInfo::bdland() const { return(BDLand); } -inline double ProbRIRWPairInfo::track_err() const { return(TrackErr); } -inline double ProbRIRWPairInfo::x_err() const { return(XErr); } -inline double ProbRIRWPairInfo::y_err() const { return(YErr); } -inline double ProbRIRWPairInfo::bbegv() const { return(BBegV); } -inline double ProbRIRWPairInfo::bendv() const { return(BEndV); } -inline double ProbRIRWPairInfo::bminv() const { return(BMinV); } -inline double ProbRIRWPairInfo::bmaxv() const { return(BMaxV); } -inline CycloneLevel ProbRIRWPairInfo::bbeglev() const { return(BBegLev); } -inline CycloneLevel ProbRIRWPairInfo::bendlev() const { return(BEndLev); } -inline const TCStatLine & ProbRIRWPairInfo::line() const { return(Line); } +inline const ProbRIRWInfo & ProbRIRWPairInfo::prob_rirw() const { return ProbRIRW; } +inline const TrackInfo * ProbRIRWPairInfo::bdeck() const { return BDeck; } +inline const ConcatString & ProbRIRWPairInfo::storm_name() const { return StormName; } +inline const ConcatString & ProbRIRWPairInfo::bmodel() const { return BModel; } +inline double ProbRIRWPairInfo::blat() const { return BLat; } +inline double ProbRIRWPairInfo::blon() const { return BLon; } +inline double ProbRIRWPairInfo::adland() const { return ADLand; } +inline double ProbRIRWPairInfo::bdland() const { return BDLand; } +inline double ProbRIRWPairInfo::track_err() const { return TrackErr; } +inline double ProbRIRWPairInfo::x_err() const { return XErr; } +inline double ProbRIRWPairInfo::y_err() const { return YErr; } +inline double ProbRIRWPairInfo::bbegv() const { return BBegV; } +inline double ProbRIRWPairInfo::bendv() const { return BEndV; } +inline double ProbRIRWPairInfo::bminv() const { return BMinV; } +inline double ProbRIRWPairInfo::bmaxv() const { return BMaxV; } +inline CycloneLevel ProbRIRWPairInfo::bbeglev() const { return BBegLev; } +inline CycloneLevel ProbRIRWPairInfo::bendlev() const { return BEndLev; } +inline const TCStatLine & ProbRIRWPairInfo::line() const { return Line; } inline void ProbRIRWPairInfo::set_adland(double d) { ADLand = d; return; } inline void ProbRIRWPairInfo::set_bdland(double d) { BDLand = d; return; } @@ -183,7 +183,7 @@ class ProbRIRWPairInfoArray { //////////////////////////////////////////////////////////////////////// -inline int ProbRIRWPairInfoArray::n_pairs() const { return(Pairs.size()); } +inline int ProbRIRWPairInfoArray::n_pairs() const { return Pairs.size(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/tc_hdr_columns.h b/src/libcode/vx_tc_util/tc_hdr_columns.h index 60ecf39260..a2e31a6533 100644 --- a/src/libcode/vx_tc_util/tc_hdr_columns.h +++ b/src/libcode/vx_tc_util/tc_hdr_columns.h @@ -108,21 +108,21 @@ inline void TcHdrColumns::set_init_mask (const ConcatString &s) { InitMask = s inline void TcHdrColumns::set_valid_mask (const ConcatString &s) { ValidMask = s; } inline void TcHdrColumns::set_line_type (const ConcatString &s) { LineType = s; } -inline ConcatString TcHdrColumns::adeck_model () const { return(ADeckModel); } -inline ConcatString TcHdrColumns::bdeck_model () const { return(BDeckModel); } -inline ConcatString TcHdrColumns::desc () const { return(Desc); } -inline ConcatString TcHdrColumns::storm_id () const { return(StormId); } -inline ConcatString TcHdrColumns::basin () const { return(Basin); } -inline ConcatString TcHdrColumns::cyclone () const { return(Cyclone); } -inline ConcatString TcHdrColumns::storm_name () const { return(StormName); } -inline int TcHdrColumns::lead () const { return(LeadTime); } -inline unixtime TcHdrColumns::init () const { return(InitTime); } -inline int TcHdrColumns::init_hour () const { return(unix_to_sec_of_day(InitTime)); } -inline unixtime TcHdrColumns::valid () const { return(ValidTime); } -inline int TcHdrColumns::valid_hour () const { return(unix_to_sec_of_day(ValidTime)); } -inline ConcatString TcHdrColumns::init_mask () const { return(InitMask); } -inline ConcatString TcHdrColumns::valid_mask () const { return(ValidMask); } -inline ConcatString TcHdrColumns::line_type () const { return(LineType); } +inline ConcatString TcHdrColumns::adeck_model () const { return ADeckModel; } +inline ConcatString TcHdrColumns::bdeck_model () const { return BDeckModel; } +inline ConcatString TcHdrColumns::desc () const { return Desc; } +inline ConcatString TcHdrColumns::storm_id () const { return StormId; } +inline ConcatString TcHdrColumns::basin () const { return Basin; } +inline ConcatString TcHdrColumns::cyclone () const { return Cyclone; } +inline ConcatString TcHdrColumns::storm_name () const { return StormName; } +inline int TcHdrColumns::lead () const { return LeadTime; } +inline unixtime TcHdrColumns::init () const { return InitTime; } +inline int TcHdrColumns::init_hour () const { return unix_to_sec_of_day(InitTime); } +inline unixtime TcHdrColumns::valid () const { return ValidTime; } +inline int TcHdrColumns::valid_hour () const { return unix_to_sec_of_day(ValidTime); } +inline ConcatString TcHdrColumns::init_mask () const { return InitMask; } +inline ConcatString TcHdrColumns::valid_mask () const { return ValidMask; } +inline ConcatString TcHdrColumns::line_type () const { return LineType; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_info.h b/src/libcode/vx_tc_util/track_info.h index 5b4bfd298a..fdc127e633 100644 --- a/src/libcode/vx_tc_util/track_info.h +++ b/src/libcode/vx_tc_util/track_info.h @@ -182,9 +182,9 @@ class TrackInfo { //////////////////////////////////////////////////////////////////////// -inline bool TrackInfo::is_best_track() const { return(IsBestTrack); } -inline bool TrackInfo::is_oper_track() const { return(IsOperTrack); } -inline bool TrackInfo::is_anly_track() const { return(IsAnlyTrack); } +inline bool TrackInfo::is_best_track() const { return IsBestTrack; } +inline bool TrackInfo::is_oper_track() const { return IsOperTrack; } +inline bool TrackInfo::is_anly_track() const { return IsAnlyTrack; } inline void TrackInfo::set_storm_id(const char *s) { StormId = s; } inline void TrackInfo::set_basin(const char *s) { Basin = s; } inline void TrackInfo::set_cyclone(const char *s) { Cyclone = s; } @@ -200,28 +200,28 @@ inline void TrackInfo::set_track_source(const char *s) { TrackSource = s; inline void TrackInfo::set_field_source(const char *s) { FieldSource = s; } inline void TrackInfo::set_diag_name(const StringArray &s) { DiagName = s; } -inline const ConcatString & TrackInfo::storm_id() const { return(StormId); } -inline const ConcatString & TrackInfo::basin() const { return(Basin); } -inline const ConcatString & TrackInfo::cyclone() const { return(Cyclone); } -inline const ConcatString & TrackInfo::storm_name() const { return(StormName); } -inline int TrackInfo::technique_number() const { return(TechniqueNumber); } -inline const ConcatString & TrackInfo::technique() const { return(Technique); } -inline const ConcatString & TrackInfo::initials() const { return(Initials); } -inline unixtime TrackInfo::init() const { return(InitTime); } -inline int TrackInfo::init_hour() const { return(unix_to_sec_of_day(InitTime)); } -inline unixtime TrackInfo::valid_min() const { return(MinValidTime); } -inline unixtime TrackInfo::valid_max() const { return(MaxValidTime); } -inline unixtime TrackInfo::warm_core_min() const { return(MinWarmCore); } -inline unixtime TrackInfo::warm_core_max() const { return(MaxWarmCore); } -inline int TrackInfo::n_points() const { return(NPoints); } - -inline DiagType TrackInfo::diag_source() const { return(DiagSource); } -inline const ConcatString & TrackInfo::track_source() const { return(TrackSource); } -inline const ConcatString & TrackInfo::field_source() const { return(FieldSource); } -inline int TrackInfo::n_diag() const { return(DiagName.n()); } -inline const StringArray & TrackInfo::diag_name() const { return(DiagName); } - -inline StringArray TrackInfo::track_lines() const { return(TrackLines); } +inline const ConcatString & TrackInfo::storm_id() const { return StormId; } +inline const ConcatString & TrackInfo::basin() const { return Basin; } +inline const ConcatString & TrackInfo::cyclone() const { return Cyclone; } +inline const ConcatString & TrackInfo::storm_name() const { return StormName; } +inline int TrackInfo::technique_number() const { return TechniqueNumber; } +inline const ConcatString & TrackInfo::technique() const { return Technique; } +inline const ConcatString & TrackInfo::initials() const { return Initials; } +inline unixtime TrackInfo::init() const { return InitTime; } +inline int TrackInfo::init_hour() const { return unix_to_sec_of_day(InitTime); } +inline unixtime TrackInfo::valid_min() const { return MinValidTime; } +inline unixtime TrackInfo::valid_max() const { return MaxValidTime; } +inline unixtime TrackInfo::warm_core_min() const { return MinWarmCore; } +inline unixtime TrackInfo::warm_core_max() const { return MaxWarmCore; } +inline int TrackInfo::n_points() const { return NPoints; } + +inline DiagType TrackInfo::diag_source() const { return DiagSource; } +inline const ConcatString & TrackInfo::track_source() const { return TrackSource; } +inline const ConcatString & TrackInfo::field_source() const { return FieldSource; } +inline int TrackInfo::n_diag() const { return DiagName.n(); } +inline const StringArray & TrackInfo::diag_name() const { return DiagName; } + +inline StringArray TrackInfo::track_lines() const { return TrackLines; } //////////////////////////////////////////////////////////////////////// // @@ -279,7 +279,7 @@ class TrackInfoArray { //////////////////////////////////////////////////////////////////////// -inline int TrackInfoArray::n() const { return(Track.size()); } +inline int TrackInfoArray::n() const { return Track.size(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_pair_info.h b/src/libcode/vx_tc_util/track_pair_info.h index 3b3a884992..4797a8996e 100644 --- a/src/libcode/vx_tc_util/track_pair_info.h +++ b/src/libcode/vx_tc_util/track_pair_info.h @@ -151,24 +151,24 @@ class TrackPairInfo { //////////////////////////////////////////////////////////////////////// -inline int TrackPairInfo::n_points() const { return(NPoints); } -inline const TrackInfo & TrackPairInfo::adeck() const { return(ADeck); } -inline const TrackInfo & TrackPairInfo::bdeck() const { return(BDeck); } -inline double TrackPairInfo::adeck_dland(int i) const { return(ADeckDLand[i]); } -inline double TrackPairInfo::bdeck_dland(int i) const { return(BDeckDLand[i]); } -inline double TrackPairInfo::track_err(int i) const { return(TrackErr[i]); } -inline double TrackPairInfo::x_err(int i) const { return(XErr[i]); } -inline double TrackPairInfo::y_err(int i) const { return(YErr[i]); } -inline double TrackPairInfo::along_track_err(int i) const { return(AlongTrackErr[i]); } -inline double TrackPairInfo::cross_track_err(int i) const { return(CrossTrackErr[i]); } -inline int TrackPairInfo::adeck_rirw(int i) const { return(nint(ADeckRIRW[i])); } -inline int TrackPairInfo::bdeck_rirw(int i) const { return(nint(BDeckRIRW[i])); } -inline int TrackPairInfo::adeck_prv_int(int i) const { return(nint(ADeckPrvInt[i])); } -inline int TrackPairInfo::bdeck_prv_int(int i) const { return(nint(BDeckPrvInt[i])); } -inline int TrackPairInfo::n_lines() const { return(NLines); } -inline const TCStatLine * TrackPairInfo::tcmpr_line(int i) const { return(&TCMPRLine[i]); } -inline const TCStatLine * TrackPairInfo::tcdiag_line(int i) const { return(&TCDIAGLine[i]); } -inline bool TrackPairInfo::keep(int i) const { return(Keep[i] != 0); } +inline int TrackPairInfo::n_points() const { return NPoints; } +inline const TrackInfo & TrackPairInfo::adeck() const { return ADeck; } +inline const TrackInfo & TrackPairInfo::bdeck() const { return BDeck; } +inline double TrackPairInfo::adeck_dland(int i) const { return ADeckDLand[i]; } +inline double TrackPairInfo::bdeck_dland(int i) const { return BDeckDLand[i]; } +inline double TrackPairInfo::track_err(int i) const { return TrackErr[i]; } +inline double TrackPairInfo::x_err(int i) const { return XErr[i]; } +inline double TrackPairInfo::y_err(int i) const { return YErr[i]; } +inline double TrackPairInfo::along_track_err(int i) const { return AlongTrackErr[i]; } +inline double TrackPairInfo::cross_track_err(int i) const { return CrossTrackErr[i]; } +inline int TrackPairInfo::adeck_rirw(int i) const { return nint(ADeckRIRW[i]); } +inline int TrackPairInfo::bdeck_rirw(int i) const { return nint(BDeckRIRW[i]); } +inline int TrackPairInfo::adeck_prv_int(int i) const { return nint(ADeckPrvInt[i]); } +inline int TrackPairInfo::bdeck_prv_int(int i) const { return nint(BDeckPrvInt[i]); } +inline int TrackPairInfo::n_lines() const { return NLines; } +inline const TCStatLine * TrackPairInfo::tcmpr_line(int i) const { return &TCMPRLine[i]; } +inline const TCStatLine * TrackPairInfo::tcdiag_line(int i) const { return &TCDIAGLine[i]; } +inline bool TrackPairInfo::keep(int i) const { return (Keep[i] != 0); } //////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_tc_util/track_point.h b/src/libcode/vx_tc_util/track_point.h index cffb79c488..0aede58974 100644 --- a/src/libcode/vx_tc_util/track_point.h +++ b/src/libcode/vx_tc_util/track_point.h @@ -103,12 +103,12 @@ inline void QuadInfo::set_se_val(double v) { SEVal = v; } inline void QuadInfo::set_sw_val(double v) { SWVal = v; } inline void QuadInfo::set_nw_val(double v) { NWVal = v; } -inline int QuadInfo::intensity() const { return(Intensity); } -inline double QuadInfo::al_val() const { return(ALVal); } -inline double QuadInfo::ne_val() const { return(NEVal); } -inline double QuadInfo::se_val() const { return(SEVal); } -inline double QuadInfo::sw_val() const { return(SWVal); } -inline double QuadInfo::nw_val() const { return(NWVal); } +inline int QuadInfo::intensity() const { return Intensity; } +inline double QuadInfo::al_val() const { return ALVal; } +inline double QuadInfo::ne_val() const { return NEVal; } +inline double QuadInfo::se_val() const { return SEVal; } +inline double QuadInfo::sw_val() const { return SWVal; } +inline double QuadInfo::nw_val() const { return NWVal; } //////////////////////////////////////////////////////////////////////// // @@ -296,31 +296,31 @@ inline void TrackPoint::set_track_stdev(const double v) { TrackStdev = v; } inline void TrackPoint::set_v_max_stdev(const double v) { VmaxStdev = v; } inline void TrackPoint::set_mslp_stdev(const double v) { MSLPStdev = v; } -inline unixtime TrackPoint::valid() const { return(ValidTime); } -inline int TrackPoint::valid_hour() const { return(unix_to_sec_of_day(ValidTime)); } -inline int TrackPoint::lead() const { return(LeadTime); } -inline double TrackPoint::lat() const { return(Lat); } -inline double TrackPoint::lon() const { return(Lon); } -inline double TrackPoint::v_max() const { return(Vmax); } -inline double TrackPoint::mslp() const { return(MSLP); } -inline CycloneLevel TrackPoint::level() const { return(Level); } -inline double TrackPoint::radp() const { return(RadP); } -inline double TrackPoint::rrp() const { return(RRP); } -inline double TrackPoint::mrd() const { return(MRD); } -inline double TrackPoint::gusts() const { return(Gusts); } -inline double TrackPoint::eye() const { return(Eye); } -inline double TrackPoint::direction() const { return(Direction); } -inline double TrackPoint::speed() const { return(Speed); } -inline SystemsDepth TrackPoint::depth() const { return(Depth); } -inline bool TrackPoint::warm_core() const { return(WarmCore); } -inline WatchWarnType TrackPoint::watch_warn() const { return(WatchWarn); } - -inline int TrackPoint::num_members() const { return(NumMembers); } -inline double TrackPoint::track_spread() const { return(TrackSpread); } -inline double TrackPoint::track_stdev() const { return(TrackStdev); } -inline double TrackPoint::v_max_stdev() const { return(VmaxStdev); } -inline double TrackPoint::mslp_stdev() const { return(MSLPStdev); } -inline int TrackPoint::n_diag() const { return(DiagVal.n()); } +inline unixtime TrackPoint::valid() const { return ValidTime; } +inline int TrackPoint::valid_hour() const { return unix_to_sec_of_day(ValidTime); } +inline int TrackPoint::lead() const { return LeadTime; } +inline double TrackPoint::lat() const { return Lat; } +inline double TrackPoint::lon() const { return Lon; } +inline double TrackPoint::v_max() const { return Vmax; } +inline double TrackPoint::mslp() const { return MSLP; } +inline CycloneLevel TrackPoint::level() const { return Level; } +inline double TrackPoint::radp() const { return RadP; } +inline double TrackPoint::rrp() const { return RRP; } +inline double TrackPoint::mrd() const { return MRD; } +inline double TrackPoint::gusts() const { return Gusts; } +inline double TrackPoint::eye() const { return Eye; } +inline double TrackPoint::direction() const { return Direction; } +inline double TrackPoint::speed() const { return Speed; } +inline SystemsDepth TrackPoint::depth() const { return Depth; } +inline bool TrackPoint::warm_core() const { return WarmCore; } +inline WatchWarnType TrackPoint::watch_warn() const { return WatchWarn; } + +inline int TrackPoint::num_members() const { return NumMembers; } +inline double TrackPoint::track_spread() const { return TrackSpread; } +inline double TrackPoint::track_stdev() const { return TrackStdev; } +inline double TrackPoint::v_max_stdev() const { return VmaxStdev; } +inline double TrackPoint::mslp_stdev() const { return MSLPStdev; } +inline int TrackPoint::n_diag() const { return DiagVal.n(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_time_series/time_series_util.cc b/src/libcode/vx_time_series/time_series_util.cc index d3e40c1201..e92d493f3f 100644 --- a/src/libcode/vx_time_series/time_series_util.cc +++ b/src/libcode/vx_time_series/time_series_util.cc @@ -40,9 +40,9 @@ const char * timeseriestype_to_string(const TimeSeriesType t) { const char *s = (const char *) nullptr; switch(t) { - case(TimeSeriesType::DyDt): s = timeseriestype_dydt_str; break; - case(TimeSeriesType::Swing): s = timeseriestype_swing_str; break; - default: s = na_str; break; + case TimeSeriesType::DyDt: s = timeseriestype_dydt_str; break; + case TimeSeriesType::Swing: s = timeseriestype_swing_str; break; + default: s = na_str; break; } return s; diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index b0fadc0c3a..cab5405f19 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -986,11 +986,11 @@ void process_point_obs(int i_nc) { int hdr_count = met_point_obs->get_hdr_cnt(); int obs_count = met_point_obs->get_obs_cnt(); - mlog << Debug(2) << "Searching " << (obs_count) - << " observations from " << (hdr_count) + mlog << Debug(2) << "Searching " << obs_count + << " observations from " << hdr_count << " header messages.\n"; - const int buf_size = ((obs_count > DEF_NC_BUFFER_SIZE) ? DEF_NC_BUFFER_SIZE : (obs_count)); + const int buf_size = ((obs_count > DEF_NC_BUFFER_SIZE) ? DEF_NC_BUFFER_SIZE : obs_count); int obs_qty_idx_block[buf_size]; float obs_arr_block[buf_size][OBS_ARRAY_LEN]; @@ -1666,7 +1666,7 @@ void process_grid_scores(int i_vx, pd.add_obs_error_entry(e); // Add the ensemble mean value for this point - pd.mn_na.add((emn_flag ? emn_dp(x, y) : bad_data_double)); + pd.mn_na.add(emn_flag ? emn_dp(x, y) : bad_data_double); } // end for y } // end for x @@ -1901,39 +1901,39 @@ void setup_txt_files() { // Get the maximum number of columns for this line type switch(i) { - case(i_rhist): + case i_rhist: max_col = get_n_rhist_columns(max_n_ens+1) + n_header_columns + 1; break; - case(i_phist): + case i_phist: max_col = get_n_phist_columns(n_phist_bin) + n_header_columns + 1; break; - case(i_relp): + case i_relp: max_col = get_n_relp_columns(max_n_ens) + n_header_columns + 1; break; - case(i_orank): + case i_orank: max_col = get_n_orank_columns(max_n_ens) + n_header_columns + 1; break; - case(i_pct): + case i_pct: max_col = get_n_pct_columns(n_prob) + n_header_columns + 1; break; - case(i_pstd): + case i_pstd: max_col = get_n_pstd_columns(n_prob) + n_header_columns + 1; break; - case(i_pjc): + case i_pjc: max_col = get_n_pjc_columns(n_prob) + n_header_columns + 1; break; - case(i_prc): + case i_prc: max_col = get_n_prc_columns(n_prob) + n_header_columns + 1; break; - case(i_eclv): + case i_eclv: max_col = get_n_eclv_columns(n_eclv) + n_header_columns + 1; break; @@ -1949,39 +1949,39 @@ void setup_txt_files() { // Write the text header row switch(i) { - case(i_rhist): + case i_rhist: write_rhist_header_row(1, max_n_ens+1, txt_at[i], 0, 0); break; - case(i_phist): + case i_phist: write_phist_header_row(1, n_phist_bin, txt_at[i], 0, 0); break; - case(i_relp): + case i_relp: write_relp_header_row(1, max_n_ens, txt_at[i], 0, 0); break; - case(i_orank): + case i_orank: write_orank_header_row(1, max_n_ens, txt_at[i], 0, 0); break; - case(i_pct): + case i_pct: write_pct_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pstd): + case i_pstd: write_pstd_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pjc): + case i_pjc: write_pjc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_prc): + case i_prc: write_prc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_eclv): + case i_eclv: write_eclv_header_row(1, n_eclv, txt_at[i], 0, 0); break; diff --git a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc index e9c7b81182..6f31073d20 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -1051,8 +1051,8 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { // Switch on the index of the line type switch(i_txt_row) { - case(i_ecnt): - case(i_rps): + case i_ecnt: + case i_rps: // Maximum number of ECNT and RPS lines possible = // Point Vx: Message Types * Masks * Interpolations * Obs Thresholds * Alphas @@ -1061,9 +1061,9 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { get_n_obs_thresh() * get_n_ci_alpha(); break; - case(i_rhist): - case(i_phist): - case(i_relp): + case i_rhist: + case i_phist: + case i_relp: // Maximum number of RHIST, PHIST, and RELP lines possible = // Point Vx: Message Types * Masks * Interpolations * Obs Thresholds @@ -1072,7 +1072,7 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { get_n_obs_thresh(); break; - case(i_orank): + case i_orank: // Compute the maximum number of matched pairs to be written // out by summing the number for each VxPairDataEnsemble object @@ -1082,16 +1082,16 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { n = vx_pd.get_n_pair() * get_n_obs_thresh(); break; - case(i_ssvar): + case i_ssvar: // Just return zero since we'll resize the output AsciiTables // to accomodate the SSVAR output n = 0; break; - case(i_pct): - case(i_pjc): - case(i_prc): + case i_pct: + case i_pjc: + case i_prc: // Maximum number of PCT, PJC, and PRC lines possible = // Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds * Climo CDF Bins @@ -1100,7 +1100,7 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { max(fcat_ta.n(), 1) * cdf_info.cdf_ta.n(); break; - case(i_pstd): + case i_pstd: // Maximum number of PSTD lines possible = // Point Vx: Message Types * Masks * Interpolations * Categorical Thresholds * Climo CDF Bins * Alphas @@ -1109,7 +1109,7 @@ int EnsembleStatVxOpt::n_txt_row(int i_txt_row) const { max(fcat_ta.n(), 1) * cdf_info.cdf_ta.n() * get_n_ci_alpha(); break; - case(i_eclv): + case i_eclv: // Maximum number of ECLV lines possible = // Point Vx: Message Types * Masks * Interpolations * Probability Thresholds * Climo CDF Bins diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index 6d8e13864d..56be2071cf 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -492,27 +492,27 @@ void setup_txt_files(unixtime valid_ut, int lead_sec) { // Get the maximum number of columns for this line type switch(i) { - case(i_mctc): + case i_mctc: max_col = get_n_mctc_columns(n_cat) + n_header_columns + 1; break; - case(i_pct): + case i_pct: max_col = get_n_pct_columns(n_prob) + n_header_columns + 1; break; - case(i_pstd): + case i_pstd: max_col = get_n_pstd_columns(n_prob) + n_header_columns + 1; break; - case(i_pjc): + case i_pjc: max_col = get_n_pjc_columns(n_prob) + n_header_columns + 1; break; - case(i_prc): + case i_prc: max_col = get_n_prc_columns(n_prob) + n_header_columns + 1; break; - case(i_eclv): + case i_eclv: max_col = get_n_eclv_columns(n_eclv) + n_header_columns + 1; break; @@ -528,27 +528,27 @@ void setup_txt_files(unixtime valid_ut, int lead_sec) { // Write the text header row switch(i) { - case(i_mctc): + case i_mctc: write_mctc_header_row(1, n_cat, txt_at[i], 0, 0); break; - case(i_pct): + case i_pct: write_pct_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pstd): + case i_pstd: write_pstd_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pjc): + case i_pjc: write_pjc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_prc): + case i_prc: write_prc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_eclv): + case i_eclv: write_eclv_header_row(1, n_eclv, txt_at[i], 0, 0); break; @@ -1206,7 +1206,7 @@ void process_scores() { compute_aggregated_seeps_grid(fcst_dp_smooth, obs_dp_smooth, seeps_dp, seeps_dp_fcat, seeps_dp_ocat, &seeps, month, hour, - conf_info.vx_opt[i].seeps_p1_thresh); + conf_info.seeps_p1_thresh, conf_info.seeps_climo_name); write_nc("SEEPS_MPR_SCORE", seeps_dp, i, mthd, pnts, conf_info.vx_opt[i].interp_info.field); diff --git a/src/tools/core/grid_stat/grid_stat_conf_info.cc b/src/tools/core/grid_stat/grid_stat_conf_info.cc index db34b15925..a2d64873b3 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -84,6 +84,9 @@ void GridStatConfInfo::clear() { output_ascii_flag = false; output_nc_flag = false; + seeps_climo_name.clear(); + seeps_p1_thresh.clear(); + // Deallocate memory if(vx_opt) { delete [] vx_opt; vx_opt = (GridStatVxOpt *) nullptr; } @@ -162,6 +165,12 @@ void GridStatConfInfo::process_config(GrdFileType ftype, // Conf: tmp_dir tmp_dir = parse_conf_tmp_dir(&conf); + // Conf: threshold for SEEPS p1 + seeps_p1_thresh = conf.lookup_thresh(conf_key_seeps_p1_thresh); + + // Conf: SEEPS climo filename + seeps_climo_name = conf.lookup_string(conf_key_seeps_grid_climo_name, false); + #ifdef WITH_UGRID // Conf: ugrid_dataset if (!ignore_ugrid_dataset) ugrid_dataset = parse_conf_ugrid_dataset(&conf); @@ -618,8 +627,6 @@ void GridStatVxOpt::clear() { hss_ec_value = bad_data_double; rank_corr_flag = false; - seeps_p1_thresh.clear(); - for(i=0; i ECLV lines = // Masks * Smoothing Methods * Thresholds n = (prob_flag ? 0 : @@ -1202,21 +1206,21 @@ int GridStatVxOpt::n_txt_row(int i_txt_row) const { get_n_fprob_thresh() * n_bin); break; - case(i_grad): + case i_grad: // Number of GRAD lines = // Masks * Smoothing Methods * Gradient Sizes n = (prob_flag ? 0 : get_n_mask() * get_n_interp() * get_n_grad()); break; - case(i_dmap): + case i_dmap: // Number of DMAP lines = // Masks * Smoothing Methods * Thresholds n = (prob_flag ? 0 : get_n_mask() * get_n_interp() * get_n_cat_thresh()); break; - case(i_seeps): + case i_seeps: n = (prob_flag ? 0 : get_n_mask() * get_n_interp()); break; diff --git a/src/tools/core/grid_stat/grid_stat_conf_info.h b/src/tools/core/grid_stat/grid_stat_conf_info.h index ca529a27e1..c3e72ee3a4 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.h +++ b/src/tools/core/grid_stat/grid_stat_conf_info.h @@ -162,8 +162,6 @@ class GridStatVxOpt { ThreshArray owind_ta; // obs wind speed thresholds SetLogic wind_logic; // wind speed field logic - SingleThresh seeps_p1_thresh; // SEESP p1 threshold - StringArray mask_grid; // Masking grid strings StringArray mask_poly; // Masking polyline strings @@ -236,15 +234,15 @@ class GridStatVxOpt { //////////////////////////////////////////////////////////////////////// -inline int GridStatVxOpt::get_n_mask() const { return(mask_name.n_elements()); } -inline int GridStatVxOpt::get_n_interp() const { return(interp_info.n_interp); } -inline int GridStatVxOpt::get_n_eclv_points() const { return(eclv_points.n_elements()); } -inline int GridStatVxOpt::get_n_cdf_bin() const { return(cdf_info.n_bin); } -inline int GridStatVxOpt::get_n_nbrhd_wdth() const { return(nbrhd_info.width.n_elements()); } -inline int GridStatVxOpt::get_n_cov_thresh() const { return(nbrhd_info.cov_ta.n_elements()); } -inline int GridStatVxOpt::get_n_wave_1d() const { return(wave_1d_beg.n_elements()); } -inline int GridStatVxOpt::get_n_grad() const { return(grad_dx.n_elements()); } -inline int GridStatVxOpt::get_n_ci_alpha() const { return(ci_alpha.n_elements()); } +inline int GridStatVxOpt::get_n_mask() const { return mask_name.n_elements(); } +inline int GridStatVxOpt::get_n_interp() const { return interp_info.n_interp; } +inline int GridStatVxOpt::get_n_eclv_points() const { return eclv_points.n_elements(); } +inline int GridStatVxOpt::get_n_cdf_bin() const { return cdf_info.n_bin; } +inline int GridStatVxOpt::get_n_nbrhd_wdth() const { return nbrhd_info.width.n_elements(); } +inline int GridStatVxOpt::get_n_cov_thresh() const { return nbrhd_info.cov_ta.n_elements(); } +inline int GridStatVxOpt::get_n_wave_1d() const { return wave_1d_beg.n_elements(); } +inline int GridStatVxOpt::get_n_grad() const { return grad_dx.n_elements(); } +inline int GridStatVxOpt::get_n_ci_alpha() const { return ci_alpha.n_elements(); } //////////////////////////////////////////////////////////////////////// @@ -283,6 +281,10 @@ class GridStatConfInfo { ConcatString tmp_dir; // Directory for temporary files ConcatString output_prefix; // String to customize output file name ConcatString version; // Config file version + + ConcatString seeps_climo_name; // SEESP climo filename + SingleThresh seeps_p1_thresh; // SEESP p1 threshold + #ifdef WITH_UGRID bool ignore_ugrid_dataset; ConcatString ugrid_nc; // NetCDF for coordinate variables of unstructured grid @@ -331,10 +333,10 @@ class GridStatConfInfo { //////////////////////////////////////////////////////////////////////// -inline int GridStatConfInfo::get_n_vx() const { return(n_vx); } -inline int GridStatConfInfo::get_compression_level() { return(conf.nc_compression()); } -inline bool GridStatConfInfo::get_output_ascii_flag() const { return(output_ascii_flag); } -inline bool GridStatConfInfo::get_output_nc_flag() const { return(output_nc_flag); } +inline int GridStatConfInfo::get_n_vx() const { return n_vx; } +inline int GridStatConfInfo::get_compression_level() { return conf.nc_compression(); } +inline bool GridStatConfInfo::get_output_ascii_flag() const { return output_ascii_flag; } +inline bool GridStatConfInfo::get_output_nc_flag() const { return output_nc_flag; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index bbfb8774d5..edb59d8814 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -367,7 +367,7 @@ void setup_first_pass(const DataPlane &dp, const Grid &data_grid) { // Determine the verification grid grid = parse_vx_grid(conf_info.vx_opt[0].vx_pd.fcst_info->regrid(), - &(data_grid), &(data_grid)); + &data_grid, &data_grid); // Process the masks conf_info.process_masks(grid); @@ -464,31 +464,31 @@ void setup_txt_files() { // Get the maximum number of columns for this line type switch(i) { - case(i_mctc): + case i_mctc: max_col = get_n_mctc_columns(n_cat) + n_header_columns + 1; break; - case(i_pct): + case i_pct: max_col = get_n_pct_columns(n_prob) + n_header_columns + 1; break; - case(i_pstd): + case i_pstd: max_col = get_n_pstd_columns(n_prob) + n_header_columns + 1; break; - case(i_pjc): + case i_pjc: max_col = get_n_pjc_columns(n_prob) + n_header_columns + 1; break; - case(i_prc): + case i_prc: max_col = get_n_prc_columns(n_prob) + n_header_columns + 1; break; - case(i_eclv): + case i_eclv: max_col = get_n_eclv_columns(n_eclv) + n_header_columns + 1; break; - case(i_orank): + case i_orank: max_col = get_n_orank_columns(n_ens) + n_header_columns + 1; break; @@ -504,31 +504,31 @@ void setup_txt_files() { // Write the text header row switch(i) { - case(i_mctc): + case i_mctc: write_mctc_header_row(1, n_cat, txt_at[i], 0, 0); break; - case(i_pct): + case i_pct: write_pct_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pstd): + case i_pstd: write_pstd_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pjc): + case i_pjc: write_pjc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_prc): + case i_prc: write_prc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_eclv): + case i_eclv: write_eclv_header_row(1, n_eclv, txt_at[i], 0, 0); break; - case(i_orank): + case i_orank: write_orank_header_row(1, n_ens, txt_at[i], 0, 0); break; @@ -810,7 +810,7 @@ void process_obs_file(int i_nc) { StringArray obs_qty_array = met_point_obs->get_qty_data(); if(use_var_id) var_names = met_point_obs->get_var_names(); - const int buf_size = ((obs_count > BUFFER_SIZE) ? BUFFER_SIZE : (obs_count)); + const int buf_size = (obs_count > BUFFER_SIZE) ? BUFFER_SIZE : obs_count; int obs_qty_idx_block[buf_size]; float obs_arr_block[buf_size][OBS_ARRAY_LEN]; diff --git a/src/tools/core/point_stat/point_stat_conf_info.cc b/src/tools/core/point_stat/point_stat_conf_info.cc index 1a416fbd5a..1f28857cdc 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -80,6 +80,9 @@ void PointStatConfInfo::clear() { ugrid_map_config.clear(); ugrid_max_distance_km = bad_data_double; #endif + seeps_climo_name.clear(); + seeps_p1_thresh.clear(); + // Deallocate memory if(vx_opt) { delete [] vx_opt; vx_opt = (PointStatVxOpt *) nullptr; } @@ -196,6 +199,12 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { // Check for consistent number of climatology fields check_climo_n_vx(&conf, n_vx); + // Conf: threshold for SEEPS p1 + seeps_p1_thresh = conf.lookup_thresh(conf_key_seeps_p1_thresh); + + // Conf: SEEPS climo filename + seeps_climo_name = conf.lookup_string(conf_key_seeps_point_climo_name, false); + // Parse settings for each verification task for(i=0; iseeps_climo_name); + vx_pd.set_seeps_thresh(conf_info->seeps_p1_thresh); } return; } @@ -1234,14 +1238,14 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { // Switch on the index of the line type switch(i_txt_row) { - case(i_fho): - case(i_ctc): + case i_fho: + case i_ctc: // Number of FHO or CTC lines = // Message Types * Masks * Interpolations * Thresholds n = (prob_flag ? 0 : n_pd * get_n_cat_thresh()); break; - case(i_cts): + case i_cts: // Number of CTS lines = // Message Types * Masks * Interpolations * Thresholds * // Alphas @@ -1249,19 +1253,19 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { get_n_ci_alpha()); break; - case(i_mctc): + case i_mctc: // Number of MCTC lines = // Message Types * Masks * Interpolations n = (prob_flag ? 0 : n_pd); break; - case(i_mcts): + case i_mcts: // Number of MCTS lines = // Message Types * Masks * Interpolations * Alphas n = (prob_flag ? 0 : n_pd * get_n_ci_alpha()); break; - case(i_cnt): + case i_cnt: // Number of CNT lines = // Message Types * Masks * Interpolations * Thresholds * // Climo Bins * Alphas @@ -1269,23 +1273,23 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { get_n_ci_alpha()); break; - case(i_sl1l2): - case(i_sal1l2): + case i_sl1l2: + case i_sal1l2: // Number of SL1L2 and SAL1L2 lines = // Message Types * Masks * Interpolations * Thresholds * // Climo Bins n = (prob_flag ? 0 : n_pd * get_n_cnt_thresh() * n_bin); break; - case(i_vl1l2): - case(i_val1l2): + case i_vl1l2: + case i_val1l2: // Number of VL1L2 or VAL1L2 lines = // Message Types * Masks * Interpolations * Thresholds n = (!vect_flag ? 0 : n_pd * get_n_wind_thresh()); break; - case(i_vcnt): + case i_vcnt: // Number of VCNT lines = // Message Types * Masks * Interpolations * Thresholds * // Alphas @@ -1293,9 +1297,9 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { get_n_wind_thresh() * get_n_ci_alpha()); break; - case(i_pct): - case(i_pjc): - case(i_prc): + case i_pct: + case i_pjc: + case i_prc: // Number of PCT, PJC, or PRC lines possible = // Message Types * Masks * Interpolations * Thresholds * // Climo Bins @@ -1310,7 +1314,7 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_pstd): + case i_pstd: // Number of PSTD lines = // Message Types * Masks * Interpolations * Thresholds * // Alphas * Climo Bins @@ -1328,8 +1332,8 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_ecnt): - case(i_rps): + case i_ecnt: + case i_rps: // Number of HiRA ECNT and RPS lines = // Message Types * Masks * HiRA widths * // Alphas @@ -1342,7 +1346,7 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_orank): + case i_orank: // Number of HiRA ORANK lines possible = // Number of pairs * Categorical Thresholds * // HiRA widths @@ -1356,7 +1360,7 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_eclv): + case i_eclv: // Number of CTC -> ECLV lines = // Message Types * Masks * Interpolations * Thresholds * // Climo Bins @@ -1371,7 +1375,7 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_mpr): + case i_mpr: // Compute the number of matched pairs to be written n = vx_pd.get_n_pair(); @@ -1386,13 +1390,13 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { break; - case(i_seeps_mpr): + case i_seeps_mpr: // Compute the number of matched pairs to be written n = vx_pd.get_n_pair(); break; - case(i_seeps): + case i_seeps: // Compute the number of matched pairs to be written n = vx_pd.get_n_pair(); diff --git a/src/tools/core/point_stat/point_stat_conf_info.h b/src/tools/core/point_stat/point_stat_conf_info.h index befde20349..95bf59a7a7 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -131,7 +131,6 @@ class PointStatVxOpt { StringArray mpr_sa; // MPR column names ThreshArray mpr_ta; // MPR column thresholds - SingleThresh seeps_p1_thresh; // SEESP p1 threshold // Vector of MaskLatLon objects defining Lat/Lon Point masks std::vector mask_llpnt; @@ -193,13 +192,13 @@ class PointStatVxOpt { //////////////////////////////////////////////////////////////////////// -inline int PointStatVxOpt::get_n_msg_typ() const { return(msg_typ.n()); } -inline int PointStatVxOpt::get_n_mask() const { return(mask_name.n()); } -inline int PointStatVxOpt::get_n_interp() const { return(interp_info.n_interp); } +inline int PointStatVxOpt::get_n_msg_typ() const { return msg_typ.n(); } +inline int PointStatVxOpt::get_n_mask() const { return mask_name.n(); } +inline int PointStatVxOpt::get_n_interp() const { return interp_info.n_interp; } -inline int PointStatVxOpt::get_n_eclv_points() const { return(eclv_points.n()); } -inline int PointStatVxOpt::get_n_cdf_bin() const { return(cdf_info.n_bin); } -inline int PointStatVxOpt::get_n_ci_alpha() const { return(ci_alpha.n()); } +inline int PointStatVxOpt::get_n_eclv_points() const { return eclv_points.n(); } +inline int PointStatVxOpt::get_n_cdf_bin() const { return cdf_info.n_bin; } +inline int PointStatVxOpt::get_n_ci_alpha() const { return ci_alpha.n(); } //////////////////////////////////////////////////////////////////////// @@ -246,6 +245,10 @@ class PointStatConfInfo { ConcatString tmp_dir; // Directory for temporary files ConcatString output_prefix; // String to customize output file name ConcatString version; // Config file version + + ConcatString seeps_climo_name; // SEESP climo filename + SingleThresh seeps_p1_thresh; // SEESP p1 threshold + #ifdef WITH_UGRID bool ignore_ugrid_dataset; ConcatString ugrid_nc; // NetCDF for coordinate variables of unstructured grid diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.h b/src/tools/core/series_analysis/series_analysis_conf_info.h index 76f7041472..01aff16098 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.h +++ b/src/tools/core/series_analysis/series_analysis_conf_info.h @@ -100,8 +100,8 @@ class SeriesAnalysisConfInfo { //////////////////////////////////////////////////////////////////////// -inline int SeriesAnalysisConfInfo::get_n_fcst() const { return(n_fcst); } -inline int SeriesAnalysisConfInfo::get_n_obs() const { return(n_obs); } +inline int SeriesAnalysisConfInfo::get_n_fcst() const { return n_fcst; } +inline int SeriesAnalysisConfInfo::get_n_obs() const { return n_obs; } inline int SeriesAnalysisConfInfo::get_compression_level() { return conf.nc_compression(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index c40fb0eb64..eb7caeedf6 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -630,7 +630,7 @@ void aggr_summary_lines(LineDataFile &f, STATAnalysisJob &job, << "trouble parsing \"-column " << job.column[i] << "\" option. Either use \"-line_type\" exactly once " << "or use format \"-column LINE_TYPE:COLUMN\".\n\n"; - throw(1); + throw 1; } } @@ -854,7 +854,7 @@ void aggr_ctc_lines(LineDataFile &f, STATAnalysisJob &job, << "line type value of " << statlinetype_to_string(line.type()) << " not currently supported for the aggregation job.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // end switch // @@ -976,7 +976,7 @@ void aggr_ctc_lines(LineDataFile &f, STATAnalysisJob &job, if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_ctc_lines() -> " << "should be no ties in the valid time array.\n\n"; - throw(1); + throw 1; } // @@ -1045,7 +1045,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter multi-category contingency table count " << "(MCTC) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -1087,7 +1087,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, << "lines. Try setting \"-column_eq N_CAT n\", " << m[key].mcts_info.cts.nrows() << " != " << cur.cts.nrows() << "\n\n"; - throw(1); + throw 1; } // @@ -1172,7 +1172,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_mctc_lines() -> " << "should be no ties in the valid time array.\n\n"; - throw(1); + throw 1; } // @@ -1225,7 +1225,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter probability contingency table (PCT) " << "line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -1266,7 +1266,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, << "thresholds must remain the same for all lines, " << m[key].pct_info.pct.nrows() << " != " << cur.pct.nrows() << "\n\n"; - throw(1); + throw 1; } // @@ -1283,7 +1283,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, << "values must remain the same for all lines, " << m[key].pct_info.pct.threshold(i) << " != " << cur.pct.threshold(i) << "\n\n"; - throw(1); + throw 1; } oy = m[key].pct_info.pct.event_count_by_row(i); @@ -1367,7 +1367,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_pct_lines() -> " << "should be no ties in the valid time array.\n\n"; - throw(1); + throw 1; } // @@ -1461,7 +1461,7 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_psum_lines() -> " << "should only encounter partial sum line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // end switch // @@ -1568,7 +1568,7 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, if(n_ties > 0 || n != it->second.valid_ts.n()) { mlog << Error << "\naggr_psum_lines() -> " << "should be no ties in the valid time array.\n\n"; - throw(1); + throw 1; } // @@ -1619,7 +1619,7 @@ void aggr_grad_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_grad_lines() -> " << "should only encounter gradient (GRAD) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -1659,7 +1659,7 @@ void aggr_grad_lines(LineDataFile &f, STATAnalysisJob &job, << " != " << cur.dx << " and " << cur.dy << "). Try setting \"-column_eq DX n -column_eq DY n\"" << " or \"-by DX,DY\".\n\n"; - throw(1); + throw 1; } // @@ -1739,7 +1739,7 @@ void aggr_wind_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_wind_lines() -> " << "should only encounter vector partial sum line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // end switch // @@ -2126,7 +2126,7 @@ void aggr_mpr_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_mpr_lines() -> " << "should only encounter matched pair (MPR) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2203,7 +2203,7 @@ void aggr_mpr_lines(LineDataFile &f, STATAnalysisJob &job, << "remain constant. Try setting \"-fcst_var\" and/or " << "\"-obs_var\".\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } } @@ -2250,7 +2250,7 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, << "should only encounter intensity-scale " << "(ISC) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2325,7 +2325,7 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, << "filter out only those lines you'd like " << "to aggregate.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2508,7 +2508,7 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter ensemble continuous statistics " << "(ECNT) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2569,14 +2569,14 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, // m[key].me_na.add(cur.me); m[key].mae_na.add(cur.mae); - m[key].mse_na.add((is_bad_data(cur.rmse) ? - bad_data_double : - cur.rmse * cur.rmse)); + m[key].mse_na.add(is_bad_data(cur.rmse) ? + bad_data_double : + cur.rmse * cur.rmse); m[key].me_oerr_na.add(cur.me_oerr); m[key].mae_oerr_na.add(cur.mae_oerr); - m[key].mse_oerr_na.add((is_bad_data(cur.rmse_oerr) ? - bad_data_double : - cur.rmse_oerr * cur.rmse_oerr)); + m[key].mse_oerr_na.add(is_bad_data(cur.rmse_oerr) ? + bad_data_double : + cur.rmse_oerr * cur.rmse_oerr); // // Keep track of the unique header column entries @@ -2659,7 +2659,7 @@ void aggr_rps_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter ranked probability score " << "(RPS) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2699,7 +2699,7 @@ void aggr_rps_lines(LineDataFile &f, STATAnalysisJob &job, << "the \"N_PROB\" column must remain constant (" << m[key].rps_info.n_prob << " != " << cur.n_prob << "). Try setting \"-column_eq N_PROB n\".\n\n"; - throw(1); + throw 1; } // @@ -2751,7 +2751,7 @@ void aggr_rhist_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter ranked histogram " << "(RHIST) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2784,7 +2784,7 @@ void aggr_rhist_lines(LineDataFile &f, STATAnalysisJob &job, << "the \"N_RANK\" column must remain constant (" << m[key].ens_pd.rhist_na.n() << " != " << cur.n_rank << "). Try setting \"-column_eq N_RANK n\".\n\n"; - throw(1); + throw 1; } // @@ -2841,7 +2841,7 @@ void aggr_phist_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter probability integral " << "transform histogram (PHIST) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2879,7 +2879,7 @@ void aggr_phist_lines(LineDataFile &f, STATAnalysisJob &job, << "the \"BIN_SIZE\" column must remain constant (" << m[key].ens_pd.phist_bin_size << " != " << cur.bin_size << "). Try setting \"-column_eq BIN_SIZE n\".\n\n"; - throw(1); + throw 1; } // @@ -2932,7 +2932,7 @@ void aggr_relp_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter relative position (RELP) " << "line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -2969,7 +2969,7 @@ void aggr_relp_lines(LineDataFile &f, STATAnalysisJob &job, << "the \"N_ENS\" column must remain constant (" << m[key].ens_pd.relp_na.n() << " != " << cur.n_ens << "). Try setting \"-column_eq N_ENS n\".\n\n"; - throw(1); + throw 1; } // @@ -3024,7 +3024,7 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter observation rank " << "(ORANK) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3078,7 +3078,7 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_orank_lines() -> " << "the \"N_ENS\" column must remain constant. " << "Try setting \"-column_eq N_ENS n\".\n\n"; - throw(1); + throw 1; } // @@ -3213,7 +3213,7 @@ void aggr_ssvar_lines(LineDataFile &f, STATAnalysisJob &job, << "should only encounter spread-skill variance " << "(SSVAR) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3229,7 +3229,7 @@ void aggr_ssvar_lines(LineDataFile &f, STATAnalysisJob &job, << "remain constant. Try setting \"-fcst_var\" and/or " << "\"-obs_var\".\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3317,7 +3317,7 @@ void aggr_seeps_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_seeps_lines() -> " << "should only encounter SEEPS line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3333,7 +3333,7 @@ void aggr_seeps_lines(LineDataFile &f, STATAnalysisJob &job, << "remain constant. Try setting \"-fcst_var\" and/or " << "\"-obs_var\".\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3401,7 +3401,7 @@ void aggr_seeps_mpr_lines(LineDataFile &f, STATAnalysisJob &job, mlog << Error << "\naggr_seeps_mpr_lines() -> " << "should only encounter SEEPS_MPR line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3417,7 +3417,7 @@ void aggr_seeps_mpr_lines(LineDataFile &f, STATAnalysisJob &job, << "remain constant. Try setting \"-fcst_var\" and/or " << "\"-obs_var\".\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3520,7 +3520,7 @@ void aggr_time_series_lines(LineDataFile &f, STATAnalysisJob &job, << "remain constant for case \"" << key << "\". Try setting \"-fcst_var\" and/or \"-obs_var\".\n" << line << "\n\n"; - throw(1); + throw 1; } // @@ -3598,7 +3598,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, << "this job may only be called when the \"-model\" option " << "has been used exactly twice to specify the forecast " << "model followed by the reference model.\n\n"; - throw(1); + throw 1; } else { cur.job_info.fcst_model = job.model[0]; @@ -3628,7 +3628,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, << "you must define the skill score index to be computed " << "using the \"-fcst_var\", \"-fcst_lev\", \"-fcst_lead\", " << "\"-line_type\", \"-column\", and \"-weight\" options.\n\n"; - throw(1); + throw 1; } // @@ -3644,7 +3644,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, << n_term << ") or have length 1!\n" << "Check the \"-fcst_var\", \"-fcst_lev\", \"-fcst_lead\", " << "\"-line_type\", \"-column\", and \"-weight\" options.\n\n"; - throw(1); + throw 1; } // @@ -3677,7 +3677,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, << "a skill score index can only be computed using " << "statistics derived from SL1L2 or CTC line types." << "\n\n"; - throw(1); + throw 1; } } diff --git a/src/tools/core/stat_analysis/aggr_stat_line.h b/src/tools/core/stat_analysis/aggr_stat_line.h index e79c0155eb..d0ec0d9c7b 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.h +++ b/src/tools/core/stat_analysis/aggr_stat_line.h @@ -169,7 +169,7 @@ struct ssvar_bin_cmp { bool operator()(const ConcatString & cs1, const ConcatString & cs2) const { // Check for string equality - if( cs1 == cs2) return(0); + if( cs1 == cs2) return 0; // Otherwise, parse list of numbers and compare each element StringArray sa1 = cs1.split(":"); @@ -179,7 +179,7 @@ struct ssvar_bin_cmp { return(atof(sa1[i].c_str()) < atof(sa2[i].c_str())); } } - return(-1); + return -1; } }; diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index d957137d28..a4a803a9b0 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -208,7 +208,7 @@ int met_main(int argc, char * argv []) { if(jobs_sa.n() == 0) { mlog << Error << "\nmain() -> " << "no jobs defined in \"" << config_file << "\"!\n\n"; - throw(1); + throw 1; } for(i=0; i " << "at least one job must be specified on the command line " << "with \"-job\" or in a configuration file with \"-config\"!\n\n"; - throw(1); + throw 1; } } catch(int j) { // Catch errors @@ -464,7 +464,7 @@ void process_search_dirs() { mlog << Error << "\nprocess_search_dirs() -> " << "no STAT files found in the directories specified!\n\n"; - throw(1); + throw 1; } // @@ -556,7 +556,7 @@ void process_stat_file(const char *filename, const STATAnalysisJob &job, int &n_ << "unable to open input stat file \"" << filename << "\"\n\n"; - throw(1); + throw 1; } @@ -606,7 +606,7 @@ if ( ! pldf->open(user_script_path.c_str(), user_script_args) ) { << "unable to open user script file \"" << user_script_path << "\"\n\n"; - throw(1); + throw 1; } @@ -887,7 +887,7 @@ void open_temps() << "can't open the temporary file \"" << tmp_path << "\" for writing!\n\n"; - throw(1); + throw 1; } diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index 5c22c39d5a..6271114602 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -132,7 +132,7 @@ void set_job_from_config(MetConfig &c, STATAnalysisJob &job) { mlog << Error << "\nset_job_from_config() -> " << "\"" << conf_key_ss_index_vld_thresh << "\" (" << job.ss_index_vld_thresh << ") must be set between 0 and 1.\n\n"; - throw(1); + throw 1; } job.hss_ec_value = c.lookup_double(conf_key_hss_ec_value); @@ -167,7 +167,7 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, mlog << Error << "\ndo_job() -> " << "can't open the temporary file \"" << tmp_path << "\" for reading!\n\n"; - throw(1); + throw 1; } // @@ -255,7 +255,7 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, default: mlog << Error << "\ndo_job() -> " << "Invalid -job type requested!\n\n"; - throw(1); + throw 1; } mlog << Debug(2) << "Job " << n_job << " used " << n_out << " out of " @@ -305,7 +305,7 @@ void do_job_filter(const ConcatString &jobstring, LineDataFile &f, << "this function may only be called when using the " << "-dump_row option in the job command line: " << jobstring << "\n\n"; - throw(1); + throw 1; } mlog << Debug(3) << "Filter Test jobstring:\n" << jobstring << "\n"; @@ -362,7 +362,7 @@ void do_job_summary(const ConcatString &jobstring, LineDataFile &f, mlog << Error << "\ndo_job_summary() -> " << "the \"-column\" option must be used at least once: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -433,7 +433,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, << "this function may only be called when the \"-line_type\" " << "option has been used exactly once to specify the line " << "type for aggregation: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -460,7 +460,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, << "\tSL1L2, SAL1L2, VL1L2, VAL1L2,\n" << "\tPCT, NBRCTC, NBRCNT, GRAD, ISC,\n" << "\tECNT, RPS, RHIST, PHIST, RELP, SSVAR, SEEPS\n\n"; - throw(1); + throw 1; } // @@ -640,7 +640,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, << "the \"-line_type\" option must be used exactly once and " << "the \"-out_line_type\" option must be used at least once: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -813,7 +813,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, << "when \"-out_line_type\" is set to RPS, the " << "\"-out_fcst_thresh\" option must be used to specify " << "monotonically increasing thresholds of interet.\n\n"; - throw(1); + throw 1; } } @@ -872,7 +872,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, << "or SAL1L2, the \"-out_fcst_thresh\" and " << "\"-out_obs_thresh\" options must specify the " << "same number of thresholds.\n\n"; - throw(1); + throw 1; } // Store a single NA threshold @@ -899,7 +899,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, << "\"-out_fcst_thresh\" and \"-out_obs_thresh\" " << "options must specify the same number of thresholds " << "and at least one.\n\n"; - throw(1); + throw 1; } } @@ -916,7 +916,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, << "the \"-out_thresh\" option or \"-out_fcst_thresh\" and " << "\"-out_obs_thresh\" options must specify " << "the same number of thresholds and at least two.\n\n"; - throw(1); + throw 1; } for(i=0; i " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -1554,7 +1554,7 @@ void write_job_aggr_mctc(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_mctc() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -1732,7 +1732,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_pct() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -1932,7 +1932,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_psum() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -2045,7 +2045,7 @@ void write_job_aggr_wind(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_wind() -> " << "the number of U and V forecast and observation points " << "must be the same.\n\n"; - throw(1); + throw 1; } // @@ -3062,7 +3062,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_orank() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -3515,7 +3515,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_mpr() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -3615,7 +3615,7 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, mlog << Error << "\nwrite_job_aggr_mpr_wind() -> " << "unsupported output line type \"" << statlinetype_to_string(lt) << "\" requested.\n\n"; - throw(1); + throw 1; } } // end for it @@ -4292,7 +4292,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, mlog << Error << "\ndo_job_ramp() -> " << "the \"-line_type\" option may be used at most once to " << "specify the input line type: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4307,7 +4307,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, mlog << Error << "\ndo_job_ramp() -> " << "the \"-out_line_type\" option must be set to CTC, CTS, and/or MPR: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4323,7 +4323,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, << "specify the forecast and observation values for the " << "ramp job: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4334,7 +4334,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, mlog << Error << "\ndo_job_ramp() -> " << "unsupported \"-ramp_type\" option: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4345,7 +4345,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, mlog << Error << "\ndo_job_ramp() -> " << "the \"-swing_width\" option is required for \"-ramp_type SWING\": " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4357,7 +4357,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, << "the \"-ramp_thresh\" or \"-ramp_thresh_fcst\" and " << "\"-ramp_thresh_obs\" options must be used to define the " << "ramp events: " << jobstring << "\n\n"; - throw(1); + throw 1; } // @@ -4423,8 +4423,8 @@ void write_table(AsciiTable &at, ofstream *sa_out) { // if(at.nrows() == 0 && at.ncols() == 0) return; - if(sa_out) *(sa_out) << at << "\n" << flush; - else cout << at << "\n" << flush; + if(sa_out) *sa_out << at << "\n" << flush; + else cout << at << "\n" << flush; return; } @@ -4445,8 +4445,8 @@ void write_jobstring(const ConcatString &jobstring, ofstream *sa_out) { void write_line(const ConcatString &str, ofstream *sa_out) { - if(sa_out) *(sa_out) << str << "\n" << flush; - else cout << str << "\n" << flush; + if(sa_out) *sa_out << str << "\n" << flush; + else cout << str << "\n" << flush; return; } diff --git a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc index 68b2c670d7..e2dc49fb9f 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -332,13 +332,13 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, // Process the wavelet type switch(wvlt_type) { - case(WaveletType::Haar): type = *(gsl_wavelet_haar); break; - case(WaveletType::Haar_Cntr): type = *(gsl_wavelet_haar_centered); break; - case(WaveletType::Daub): type = *(gsl_wavelet_daubechies); break; - case(WaveletType::Daub_Cntr): type = *(gsl_wavelet_daubechies_centered); break; - case(WaveletType::BSpline): type = *(gsl_wavelet_bspline); break; - case(WaveletType::BSpline_Cntr): type = *(gsl_wavelet_bspline_centered); break; - case(WaveletType::None): + case WaveletType::Haar: type = *gsl_wavelet_haar; break; + case WaveletType::Haar_Cntr: type = *gsl_wavelet_haar_centered; break; + case WaveletType::Daub: type = *gsl_wavelet_daubechies; break; + case WaveletType::Daub_Cntr: type = *gsl_wavelet_daubechies_centered; break; + case WaveletType::BSpline: type = *gsl_wavelet_bspline; break; + case WaveletType::BSpline_Cntr: type = *gsl_wavelet_bspline_centered; break; + case WaveletType::None: default: mlog << Error << "\nWaveletStatConfInfo::process_config() -> " << "Unsupported wavelet type value of " << enum_class_as_int(wvlt_type) << ".\n\n"; @@ -350,8 +350,8 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, // Check for valid member number switch(wvlt_type) { - case(WaveletType::Haar): - case(WaveletType::Haar_Cntr): + case WaveletType::Haar: + case WaveletType::Haar_Cntr: if(wvlt_member != 2) { mlog << Error << "\nWaveletStatConfInfo::process_config() -> " << "For Haar wavelets, \"" << conf_key_wavelet_member @@ -360,8 +360,8 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, } break; - case(WaveletType::Daub): - case(WaveletType::Daub_Cntr): + case WaveletType::Daub: + case WaveletType::Daub_Cntr: if(wvlt_member < 4 || wvlt_member > 20 || wvlt_member%2 == 1) { mlog << Error << "\nWaveletStatConfInfo::process_config() -> " << "For Daubechies wavelets, \"" << conf_key_wavelet_member @@ -370,8 +370,8 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, } break; - case(WaveletType::BSpline): - case(WaveletType::BSpline_Cntr): + case WaveletType::BSpline: + case WaveletType::BSpline_Cntr: if(wvlt_member != 103 && wvlt_member != 105 && wvlt_member != 202 && wvlt_member != 204 && wvlt_member != 206 && wvlt_member != 208 && wvlt_member != 301 && wvlt_member != 303 && wvlt_member != 305 && @@ -384,7 +384,7 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, } break; - case(WaveletType::None): + case WaveletType::None: default: mlog << Error << "\nWaveletStatConfInfo::process_config() -> " << "Unsupported wavelet type value of " << enum_class_as_int(wvlt_type) << ".\n\n"; @@ -511,7 +511,7 @@ void WaveletStatConfInfo::process_tiles(const Grid &grid) { // Tile the input data using tiles of dimension n by n where n // is the largest integer power of 2 less than the smallest // dimension of the input data and allowing no overlap. - case(GridDecompType::Auto): + case GridDecompType::Auto: center_tiles(grid.nx(), grid.ny()); @@ -528,7 +528,7 @@ void WaveletStatConfInfo::process_tiles(const Grid &grid) { break; // Apply the tiles specified in the configuration file - case(GridDecompType::Tile): + case GridDecompType::Tile: // Number of tiles based on the user-specified locations n_tile = tile_xll.n(); @@ -547,7 +547,7 @@ void WaveletStatConfInfo::process_tiles(const Grid &grid) { // Setup tiles for padding the input fields out to the nearest // integer power of two - case(GridDecompType::Pad): + case GridDecompType::Pad: pad_tiles(grid.nx(), grid.ny()); @@ -562,7 +562,7 @@ void WaveletStatConfInfo::process_tiles(const Grid &grid) { break; - case(GridDecompType::None): + case GridDecompType::None: default: mlog << Error << "\nWaveletStatConfInfo::process_tiles() -> " << "Unsupported grid decomposition type of " diff --git a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h index 1380ecc6b3..11bdf93f90 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h @@ -146,11 +146,11 @@ class WaveletStatConfInfo { //////////////////////////////////////////////////////////////////////// -inline int WaveletStatConfInfo::get_n_vx() const { return(n_vx); } -inline int WaveletStatConfInfo::get_max_n_thresh() const { return(max_n_thresh); } -inline int WaveletStatConfInfo::get_n_tile() const { return(n_tile); } -inline int WaveletStatConfInfo::get_tile_dim() const { return(tile_dim); } -inline int WaveletStatConfInfo::get_n_scale() const { return(n_scale); } +inline int WaveletStatConfInfo::get_n_vx() const { return n_vx; } +inline int WaveletStatConfInfo::get_max_n_thresh() const { return max_n_thresh; } +inline int WaveletStatConfInfo::get_n_tile() const { return n_tile; } +inline int WaveletStatConfInfo::get_tile_dim() const { return tile_dim; } +inline int WaveletStatConfInfo::get_n_scale() const { return n_scale; } inline int WaveletStatConfInfo::get_compression_level() { return conf.nc_compression(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index 4551342192..e24265ef0d 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -196,7 +196,7 @@ void process_binary() { // Loop over climo bins, skipping the first and last points for(j=0; j<(n_bin-1); j++) { - int byte_offset = (j+1)*((n_read_bin - 1)/(n_bin))*4; + int byte_offset = (j+1)*((n_read_bin - 1)/n_bin)*4; unsigned char * b = buf + byte_offset; my_memcpy(&v, b, 4); shuffle_4(&v); diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 50e1151c51..3579c52f8e 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -156,8 +156,8 @@ bool MetNcFile::readFile(const int desired_grib_code, float *obs_arr = new float[obs_arr_len]; float *hdr_arr = new float[hdr_arr_len]; - mlog << Debug(2) << "Processing " << (obs_count) << " observations at " - << (hdr_count) << " locations.\n"; + mlog << Debug(2) << "Processing " << obs_count << " observations at " + << hdr_count << " locations.\n"; // Loop through the observations, saving the ones that we are // interested in diff --git a/src/tools/other/ascii2nc/aeronet_handler.cc b/src/tools/other/ascii2nc/aeronet_handler.cc index bf6ed08d12..440622938c 100644 --- a/src/tools/other/ascii2nc/aeronet_handler.cc +++ b/src/tools/other/ascii2nc/aeronet_handler.cc @@ -794,7 +794,7 @@ string AeronetHandler::make_var_name_from_header(string hdr_field) { else if ((int) string::npos != hdr_field.find(WAVELENGTHS_PW_NAME)) { var_name = WAVELENGTHS_PW_NAME; } - else if ((hdr_field == OPTICAL_AIR_MASS_NAME)) { + else if (hdr_field == OPTICAL_AIR_MASS_NAME) { var_name = hdr_field; } else { diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 5495c8b6dc..78fd4bc2e0 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -380,6 +380,6 @@ bool FileHandler::_keep_valid_time(const time_t &valid_time) const else if (valid_beg_ut == (time_t) 0 && valid_end_ut != (time_t) 0) { if (valid_time > valid_end_ut) keep = false; } - return(keep); + return keep; } diff --git a/src/tools/other/ascii2nc/iabp_handler.cc b/src/tools/other/ascii2nc/iabp_handler.cc index 71ce27f10c..fd384cbf2e 100644 --- a/src/tools/other/ascii2nc/iabp_handler.cc +++ b/src/tools/other/ascii2nc/iabp_handler.cc @@ -82,7 +82,7 @@ bool IabpHandler::isFileType(LineDataFile &ascii_file) const { if (tokens[6] != "Lat") is_file_type = false; if (tokens[7] != "Lon") is_file_type = false; - return(is_file_type); + return is_file_type; } //////////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ bool IabpHandler::isFileType(LineDataFile &ascii_file) const { bool IabpHandler::_readObservations(LineDataFile &ascii_file) { // Read and save the header information - if(!_readHeaderInfo(ascii_file)) return(false); + if(!_readHeaderInfo(ascii_file)) return false; string header_type = "IABP_STANDARD"; @@ -107,7 +107,7 @@ bool IabpHandler::_readObservations(LineDataFile &ascii_file) << " != " << _numColumns << ") on line number " << dl.line_number() << " of IABP file \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Extract the valid time from the data line, using POS_DOY (scientist is most @@ -119,7 +119,7 @@ bool IabpHandler::_readObservations(LineDataFile &ascii_file) << "No valid time computed in file, line number " << dl.line_number() << " of IABP file \"" << ascii_file.filename() << "\". Ignore this line\n\n"; - return(false); + return false; } double lat = stod(dl[_latPtr]); @@ -139,7 +139,7 @@ bool IabpHandler::_readObservations(LineDataFile &ascii_file) << "Latitude/longitude has missing value " << IABP_MISSING_VALUE << ", line number " << dl.line_number() << " of IABP file \"" << ascii_file.filename() << "\". Ignore this line\n\n"; - return(false); + return false; } if (_bpPtr >= 0) { @@ -184,7 +184,7 @@ bool IabpHandler::_readObservations(LineDataFile &ascii_file) } // end while - return(true); + return true; } // //////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ bool IabpHandler::_readHeaderInfo(LineDataFile &ascii_file) { << dl.n_items() << " < " << MIN_NUM_HDR_COLS << ") in IABP file \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Map the header information to column numbers diff --git a/src/tools/other/ascii2nc/met_handler.cc b/src/tools/other/ascii2nc/met_handler.cc index dd868d8029..5d68e69942 100644 --- a/src/tools/other/ascii2nc/met_handler.cc +++ b/src/tools/other/ascii2nc/met_handler.cc @@ -186,7 +186,7 @@ bool MetHandler::_readObservations(LineDataFile &ascii_file) double parse_num(const char *s) { if(!s) return bad_data_double; - return( (strcasecmp(s, na_str) == 0 ? bad_data_double : atof(s)) ); + return( strcasecmp(s, na_str) == 0 ? bad_data_double : atof(s) ); } 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 ba23574c30..bb76ce0c63 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 @@ -112,10 +112,10 @@ class GenEnsProdConfInfo { //////////////////////////////////////////////////////////////////////// -inline int GenEnsProdConfInfo::get_n_var() const { return(n_var); } -inline int GenEnsProdConfInfo::get_max_n_cat() const { return(max_n_cat); } -inline int GenEnsProdConfInfo::get_n_nbrhd() const { return(nbrhd_prob.width.n()); } -inline int GenEnsProdConfInfo::get_compression_level() { return(conf.nc_compression()); } +inline int GenEnsProdConfInfo::get_n_var() const { return n_var; } +inline int GenEnsProdConfInfo::get_max_n_cat() const { return max_n_cat; } +inline int GenEnsProdConfInfo::get_n_nbrhd() const { return nbrhd_prob.width.n(); } +inline int GenEnsProdConfInfo::get_compression_level() { return conf.nc_compression(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/conv_record.h b/src/tools/other/gsi_tools/conv_record.h index f482c6fd0b..658db1cec8 100644 --- a/src/tools/other/gsi_tools/conv_record.h +++ b/src/tools/other/gsi_tools/conv_record.h @@ -89,15 +89,15 @@ class ConvFile { //////////////////////////////////////////////////////////////////////// -inline bool ConvFile::get_swap_endian() const { return ( SwapEndian ); } +inline bool ConvFile::get_swap_endian() const { return SwapEndian; } -inline int ConvFile::get_rec_pad_size() const { return ( RecPadSize ); } +inline int ConvFile::get_rec_pad_size() const { return RecPadSize; } -inline unixtime ConvFile::date() const { return ( Date ); } +inline unixtime ConvFile::date() const { return Date; } -inline int ConvFile::n_rec() const { return ( Nrec ); } +inline int ConvFile::n_rec() const { return Nrec; } -inline int ConvFile::n_pair() const { return ( Npair ); } +inline int ConvFile::n_pair() const { return Npair; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsi_record.h b/src/tools/other/gsi_tools/gsi_record.h index 29392c49eb..2c6c3c3206 100644 --- a/src/tools/other/gsi_tools/gsi_record.h +++ b/src/tools/other/gsi_tools/gsi_record.h @@ -75,8 +75,8 @@ class GsiRecord { //////////////////////////////////////////////////////////////////////// -inline bool GsiRecord::shuffle () const { return ( Shuffle ); } -inline int GsiRecord::rec_pad_length () const { return ( RecPadLength ); } +inline bool GsiRecord::shuffle () const { return Shuffle; } +inline int GsiRecord::rec_pad_length () const { return RecPadLength; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/rad_record.h b/src/tools/other/gsi_tools/rad_record.h index 9f7f11f1ea..9159946d08 100644 --- a/src/tools/other/gsi_tools/rad_record.h +++ b/src/tools/other/gsi_tools/rad_record.h @@ -180,25 +180,25 @@ class RadFile { //////////////////////////////////////////////////////////////////////// -inline bool RadFile::get_swap_endian() const { return ( SwapEndian ); } +inline bool RadFile::get_swap_endian() const { return SwapEndian; } -inline int RadFile::get_rec_pad_size() const { return ( RecPadSize ); } +inline int RadFile::get_rec_pad_size() const { return RecPadSize; } -inline unixtime RadFile::date() const { return ( Date ); } +inline unixtime RadFile::date() const { return Date; } -inline int RadFile::n_channels() const { return ( Nchannels ); } +inline int RadFile::n_channels() const { return Nchannels; } -inline int RadFile::n_diag() const { return ( Ndiag ); } -inline int RadFile::n_rec() const { return ( Nrec ); } -inline int RadFile::n_pair() const { return ( Npair ); } +inline int RadFile::n_diag() const { return Ndiag; } +inline int RadFile::n_rec() const { return Nrec ; } +inline int RadFile::n_pair() const { return Npair; } -inline int RadFile::n1() const { return ( N1 ); } -inline int RadFile::n2() const { return ( N2 ); } +inline int RadFile::n1() const { return N1; } +inline int RadFile::n2() const { return N2; } -inline int RadFile::n12() const { return ( N1*N2 ); } +inline int RadFile::n12() const { return N1*N2; } -inline int RadFile::iextra() const { return ( R_params.iextra ); } -inline int RadFile::jextra() const { return ( R_params.jextra ); } +inline int RadFile::iextra() const { return R_params.iextra; } +inline int RadFile::jextra() const { return R_params.jextra; } inline bool RadFile::has_extra() const { return ( (R_params.iextra != 0) && (R_params.jextra != 0) ); } @@ -271,12 +271,12 @@ class RadRecord : public GsiRecord { //////////////////////////////////////////////////////////////////////// -inline int RadRecord::n1() const { return ( N1 ); } -inline int RadRecord::n2() const { return ( N2 ); } +inline int RadRecord::n1() const { return N1; } +inline int RadRecord::n2() const { return N2; } inline bool RadRecord::has_extra() const { return ( extra != 0 ); } -inline unixtime RadRecord::date() const { return ( Date ); } +inline unixtime RadRecord::date() const { return Date; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index 2c2c4f3853..63626c6908 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -305,38 +305,38 @@ void process_madis_file(const char *madis_file) { // Switch on the MADIS type and process accordingly. switch(my_mtype) { - case(MadisType::metar): + case MadisType::metar: process_madis_metar(f_in); break; - case(MadisType::raob): + case MadisType::raob: process_madis_raob(f_in); break; - case (MadisType::profiler): + case MadisType::profiler: process_madis_profiler(f_in); break; - case(MadisType::maritime): + case MadisType::maritime: process_madis_maritime(f_in); break; - case(MadisType::mesonet): + case MadisType::mesonet: process_madis_mesonet(f_in); break; - case(MadisType::acarsProfiles): + case MadisType::acarsProfiles: process_madis_acarsProfiles(f_in); break; - case(MadisType::coop): - case(MadisType::HDW): - case(MadisType::HDW1h): - case(MadisType::hydro): - case(MadisType::POES): - case(MadisType::acars): - case(MadisType::radiometer): - case(MadisType::sao): - case(MadisType::satrad): - case(MadisType::snow): - case(MadisType::none): + case MadisType::coop: + case MadisType::HDW: + case MadisType::HDW1h: + case MadisType::hydro: + case MadisType::POES: + case MadisType::acars: + case MadisType::radiometer: + case MadisType::sao: + case MadisType::satrad: + case MadisType::snow: + case MadisType::none: default: mlog << Error << "\nprocess_madis_file() -> " << "MADIS type (" << enum_class_as_int(my_mtype) diff --git a/src/tools/other/mode_graphics/cgraph_font.h b/src/tools/other/mode_graphics/cgraph_font.h index f8dc85b537..f6970fbcbd 100644 --- a/src/tools/other/mode_graphics/cgraph_font.h +++ b/src/tools/other/mode_graphics/cgraph_font.h @@ -130,7 +130,7 @@ class CgFontCollection { //////////////////////////////////////////////////////////////////////// -inline int CgFontCollection::n_fonts() const { return ( Nelements ); } +inline int CgFontCollection::n_fonts() const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/cgraph_main.h b/src/tools/other/mode_graphics/cgraph_main.h index 6352ee23eb..f7f6ce148b 100644 --- a/src/tools/other/mode_graphics/cgraph_main.h +++ b/src/tools/other/mode_graphics/cgraph_main.h @@ -265,7 +265,7 @@ inline void CgraphBase::stroke() { cairo_stroke (Cr); return; } inline void CgraphBase::fill() { cairo_fill (Cr); return; } inline void CgraphBase::clip() { cairo_clip (Cr); return; } -inline const Box & CgraphBase::page() const { return ( PageBox ); } +inline const Box & CgraphBase::page() const { return PageBox; } inline void CgraphBase::setlinecap_butt() { cairo_set_line_cap (Cr, CAIRO_LINE_CAP_BUTT); return; } inline void CgraphBase::setlinecap_round() { cairo_set_line_cap (Cr, CAIRO_LINE_CAP_ROUND); return; } @@ -275,7 +275,7 @@ inline void CgraphBase::setlinejoin_miter() { cairo_set_line_join (Cr, CAIRO_LIN inline void CgraphBase::setlinejoin_round() { cairo_set_line_join (Cr, CAIRO_LINE_JOIN_ROUND); return; } inline void CgraphBase::setlinejoin_bevel() { cairo_set_line_join (Cr, CAIRO_LINE_JOIN_BEVEL); return; } -inline double CgraphBase::c_fudge_y(double __Y__) const { return ( __Y__ ); } +inline double CgraphBase::c_fudge_y(double __Y__) const { return __Y__; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/color_stack.h b/src/tools/other/mode_graphics/color_stack.h index f225905cd2..4bc5b543d2 100644 --- a/src/tools/other/mode_graphics/color_stack.h +++ b/src/tools/other/mode_graphics/color_stack.h @@ -72,7 +72,7 @@ class ColorStack { //////////////////////////////////////////////////////////////////////// -inline int ColorStack::depth() const { return ( Nelements ); } +inline int ColorStack::depth() const { return Nelements; } //////////////////////////////////////////////////////////////////////// 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 177c059905..0187f6a169 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.h +++ b/src/tools/other/mode_graphics/mode_nc_output_file.h @@ -161,23 +161,23 @@ class ModeNcOutputFile { //////////////////////////////////////////////////////////////////////// -inline int ModeNcOutputFile::nx() const { return ( Nx ); } -inline int ModeNcOutputFile::ny() const { return ( Ny ); } +inline int ModeNcOutputFile::nx() const { return Nx; } +inline int ModeNcOutputFile::ny() const { return Ny; } -inline const Grid & ModeNcOutputFile::grid() const { return ( *_Grid ); } +inline const Grid & ModeNcOutputFile::grid() const { return *_Grid; } -inline ConcatString ModeNcOutputFile::filename() const { return ( Filename ); } +inline ConcatString ModeNcOutputFile::filename() const { return Filename; } -inline unixtime ModeNcOutputFile::valid_time() const { return ( ValidTime ); } -inline unixtime ModeNcOutputFile::init_time () const { return ( InitTime ); } +inline unixtime ModeNcOutputFile::valid_time() const { return ValidTime; } +inline unixtime ModeNcOutputFile::init_time () const { return InitTime; } -inline int ModeNcOutputFile::accum_time () const { return ( AccumTime ); } +inline int ModeNcOutputFile::accum_time () const { return AccumTime; } -// inline int ModeNcOutputFile::n_fcst_objs () const { return ( NFcstObjs ); } -// inline int ModeNcOutputFile::n_obs_objs () const { return ( NObsObjs ); } +// inline int ModeNcOutputFile::n_fcst_objs () const { return NFcstObjs; } +// inline int ModeNcOutputFile::n_obs_objs () const { return NObsObjs ; } // -// inline int ModeNcOutputFile::n_fcst_clus () const { return ( NFcstClus ); } -// inline int ModeNcOutputFile::n_obs_clus () const { return ( NObsClus ); } +// inline int ModeNcOutputFile::n_fcst_clus () const { return NFcstClus; } +// inline int ModeNcOutputFile::n_obs_clus () const { return NObsClus ; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 6f5e7fe26c..bf37364728 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -920,16 +920,16 @@ void draw_map(Cgraph & plot, const Box & map_box, const Grid & grid) { int j; -Dictionary & s = *(sources); -const DictionaryEntry * e = 0; -Dictionary * dict = 0; +Dictionary & s = *sources; +const DictionaryEntry * e = nullptr; +Dictionary * dict = nullptr; for (j=0; jis_dictionary()) ) { + if ( ! e->is_dictionary() ) { mlog << Error << "\n\n " << program_name << ": draw_map() -> non-dictionary found " diff --git a/src/tools/other/mode_time_domain/2d_att.h b/src/tools/other/mode_time_domain/2d_att.h index 6975969278..75f6260ea1 100644 --- a/src/tools/other/mode_time_domain/2d_att.h +++ b/src/tools/other/mode_time_domain/2d_att.h @@ -162,48 +162,48 @@ class SingleAtt2D { //////////////////////////////////////////////////////////////////////// -inline int SingleAtt2D::object_number() const { return ( ObjectNumber ); } +inline int SingleAtt2D::object_number() const { return ObjectNumber; } -inline int SingleAtt2D::cluster_number() const { return ( ClusterNumber ); } +inline int SingleAtt2D::cluster_number() const { return ClusterNumber; } -inline int SingleAtt2D::time_index() const { return ( TimeIndex ); } +inline int SingleAtt2D::time_index() const { return TimeIndex; } inline void SingleAtt2D::set_object_number (int _n) { ObjectNumber = _n; return; } inline void SingleAtt2D::set_cluster_number (int _n) { ClusterNumber = _n; return; } -inline int SingleAtt2D::area() const { return ( Area ); } +inline int SingleAtt2D::area() const { return Area; } inline void SingleAtt2D::set_area(int _A) { Area = _A; return; } inline void SingleAtt2D::set_time_index(int _t) { TimeIndex = _t; return; } -inline double SingleAtt2D::xbar() const { return ( Xbar ); } -inline double SingleAtt2D::ybar() const { return ( Ybar ); } +inline double SingleAtt2D::xbar() const { return Xbar; } +inline double SingleAtt2D::ybar() const { return Ybar; } -inline double SingleAtt2D::centroid_lat() const { return ( CentroidLat ); } -inline double SingleAtt2D::centroid_lon() const { return ( CentroidLon ); } +inline double SingleAtt2D::centroid_lat() const { return CentroidLat; } +inline double SingleAtt2D::centroid_lon() const { return CentroidLon; } -inline double SingleAtt2D::axis() const { return ( AxisAngle ); } +inline double SingleAtt2D::axis() const { return AxisAngle; } -inline double SingleAtt2D::ptile_10() const { return ( Ptile_10 ); } -inline double SingleAtt2D::ptile_25() const { return ( Ptile_25 ); } -inline double SingleAtt2D::ptile_50() const { return ( Ptile_50 ); } -inline double SingleAtt2D::ptile_75() const { return ( Ptile_75 ); } -inline double SingleAtt2D::ptile_90() const { return ( Ptile_90 ); } +inline double SingleAtt2D::ptile_10() const { return Ptile_10; } +inline double SingleAtt2D::ptile_25() const { return Ptile_25; } +inline double SingleAtt2D::ptile_50() const { return Ptile_50; } +inline double SingleAtt2D::ptile_75() const { return Ptile_75; } +inline double SingleAtt2D::ptile_90() const { return Ptile_90; } -inline int SingleAtt2D::ptile_value() const { return ( Ptile_Value ); } -inline double SingleAtt2D::ptile_user() const { return ( Ptile_User ); } +inline int SingleAtt2D::ptile_value() const { return Ptile_Value; } +inline double SingleAtt2D::ptile_user() const { return Ptile_User ; } -inline bool SingleAtt2D::is_fcst() const { return ( IsFcst ); } -inline bool SingleAtt2D::is_obs () const { return ( ! IsFcst ); } +inline bool SingleAtt2D::is_fcst() const { return IsFcst; } +inline bool SingleAtt2D::is_obs () const { return !IsFcst; } -inline bool SingleAtt2D::is_cluster () const { return ( Is_Cluster ); } -inline bool SingleAtt2D::is_simple () const { return ( ! Is_Cluster ); } +inline bool SingleAtt2D::is_cluster () const { return Is_Cluster; } +inline bool SingleAtt2D::is_simple () const { return !Is_Cluster; } -inline unixtime SingleAtt2D::valid_time () const { return ( ValidTime ); } +inline unixtime SingleAtt2D::valid_time () const { return ValidTime; } -inline int SingleAtt2D::lead_time () const { return ( Lead_Time ); } +inline int SingleAtt2D::lead_time () const { return Lead_Time; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/2d_att_array.h b/src/tools/other/mode_time_domain/2d_att_array.h index 6963664805..968b917211 100644 --- a/src/tools/other/mode_time_domain/2d_att_array.h +++ b/src/tools/other/mode_time_domain/2d_att_array.h @@ -84,8 +84,8 @@ class SingleAtt2DArray { //////////////////////////////////////////////////////////////////////// -inline int SingleAtt2DArray::n_elements() const { return ( Nelements ); } -inline int SingleAtt2DArray::n () const { return ( Nelements ); } +inline int SingleAtt2DArray::n_elements() const { return Nelements; } +inline int SingleAtt2DArray::n () const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/2d_moments.h b/src/tools/other/mode_time_domain/2d_moments.h index 1f379a79f5..2052561687 100644 --- a/src/tools/other/mode_time_domain/2d_moments.h +++ b/src/tools/other/mode_time_domain/2d_moments.h @@ -77,7 +77,7 @@ class Mtd_2D_Moments { //////////////////////////////////////////////////////////////////////// -inline int Mtd_2D_Moments::area() const { return ( N ); } +inline int Mtd_2D_Moments::area() const { return N; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_att.h b/src/tools/other/mode_time_domain/3d_att.h index 8d1db58227..91ad4901c3 100644 --- a/src/tools/other/mode_time_domain/3d_att.h +++ b/src/tools/other/mode_time_domain/3d_att.h @@ -196,58 +196,58 @@ class SingleAtt3D { //////////////////////////////////////////////////////////////////////// -inline int SingleAtt3D::object_number () const { return ( ObjectNumber ); } -inline int SingleAtt3D::cluster_number () const { return ( ClusterNumber ); } +inline int SingleAtt3D::object_number () const { return ObjectNumber ; } +inline int SingleAtt3D::cluster_number () const { return ClusterNumber; } -inline bool SingleAtt3D::is_fcst () const { return ( IsFcst ); } -inline bool SingleAtt3D::is_obs () const { return ( ! IsFcst ); } +inline bool SingleAtt3D::is_fcst () const { return IsFcst; } +inline bool SingleAtt3D::is_obs () const { return !IsFcst; } -inline bool SingleAtt3D::is_simple () const { return ( IsSimple ); } -inline bool SingleAtt3D::is_cluster () const { return ( ! IsSimple ); } +inline bool SingleAtt3D::is_simple () const { return IsSimple; } +inline bool SingleAtt3D::is_cluster () const { return !IsSimple; } inline void SingleAtt3D::set_object_number (int _n) { ObjectNumber = _n; return; } inline void SingleAtt3D::set_cluster_number (int _n) { ClusterNumber = _n; return; } -inline int SingleAtt3D::volume() const { return ( Volume ); } +inline int SingleAtt3D::volume() const { return Volume; } inline void SingleAtt3D::set_volume(int _v) { Volume = _v; return; } -inline double SingleAtt3D::complexity() const { return ( Complexity ); } +inline double SingleAtt3D::complexity() const { return Complexity; } inline void SingleAtt3D::set_complexity(double _v) { Complexity = _v; return; } -inline double SingleAtt3D::xbar() const { return ( Xbar ); } -inline double SingleAtt3D::ybar() const { return ( Ybar ); } -inline double SingleAtt3D::tbar() const { return ( Tbar ); } +inline double SingleAtt3D::xbar() const { return Xbar; } +inline double SingleAtt3D::ybar() const { return Ybar; } +inline double SingleAtt3D::tbar() const { return Tbar; } -inline double SingleAtt3D::centroid_lat() const { return ( Centroid_Lat ); } -inline double SingleAtt3D::centroid_lon() const { return ( Centroid_Lon ); } +inline double SingleAtt3D::centroid_lat() const { return Centroid_Lat; } +inline double SingleAtt3D::centroid_lon() const { return Centroid_Lon; } -inline int SingleAtt3D::xmin() const { return ( Xmin ); } -inline int SingleAtt3D::xmax() const { return ( Xmax ); } +inline int SingleAtt3D::xmin() const { return Xmin; } +inline int SingleAtt3D::xmax() const { return Xmax; } -inline int SingleAtt3D::ymin() const { return ( Ymin ); } -inline int SingleAtt3D::ymax() const { return ( Ymax ); } +inline int SingleAtt3D::ymin() const { return Ymin; } +inline int SingleAtt3D::ymax() const { return Ymax; } -inline int SingleAtt3D::tmin() const { return ( Tmin ); } -inline int SingleAtt3D::tmax() const { return ( Tmax ); } +inline int SingleAtt3D::tmin() const { return Tmin; } +inline int SingleAtt3D::tmax() const { return Tmax; } -inline double SingleAtt3D::xdot() const { return ( Xvelocity ); } -inline double SingleAtt3D::ydot() const { return ( Yvelocity ); } +inline double SingleAtt3D::xdot() const { return Xvelocity; } +inline double SingleAtt3D::ydot() const { return Yvelocity; } -inline double SingleAtt3D::spatial_axis() const { return ( SpatialAxisAngle ); } +inline double SingleAtt3D::spatial_axis() const { return SpatialAxisAngle; } -inline double SingleAtt3D::cdist_travelled() const { return ( CdistTravelled ); } +inline double SingleAtt3D::cdist_travelled() const { return CdistTravelled; } -inline double SingleAtt3D::ptile_10() const { return ( Ptile_10 ); } -inline double SingleAtt3D::ptile_25() const { return ( Ptile_25 ); } -inline double SingleAtt3D::ptile_50() const { return ( Ptile_50 ); } -inline double SingleAtt3D::ptile_75() const { return ( Ptile_75 ); } -inline double SingleAtt3D::ptile_90() const { return ( Ptile_90 ); } +inline double SingleAtt3D::ptile_10() const { return Ptile_10; } +inline double SingleAtt3D::ptile_25() const { return Ptile_25; } +inline double SingleAtt3D::ptile_50() const { return Ptile_50; } +inline double SingleAtt3D::ptile_75() const { return Ptile_75; } +inline double SingleAtt3D::ptile_90() const { return Ptile_90; } -inline int SingleAtt3D::ptile_value() const { return ( Ptile_Value ); } -inline double SingleAtt3D::ptile_user() const { return ( Ptile_User ); } +inline int SingleAtt3D::ptile_value() const { return Ptile_Value; } +inline double SingleAtt3D::ptile_user() const { return Ptile_User ; } //////////////////////////////////////////////////////////////////////// @@ -388,33 +388,33 @@ class PairAtt3D { //////////////////////////////////////////////////////////////////////// -inline int PairAtt3D::fcst_obj_number() const { return ( FcstObjectNumber ); } -inline int PairAtt3D::obs_obj_number() const { return ( ObsObjectNumber ); } +inline int PairAtt3D::fcst_obj_number() const { return FcstObjectNumber; } +inline int PairAtt3D::obs_obj_number() const { return ObsObjectNumber; } -inline int PairAtt3D::fcst_cluster_number() const { return ( FcstClusterNumber ); } -inline int PairAtt3D::obs_cluster_number() const { return ( ObsClusterNumber ); } +inline int PairAtt3D::fcst_cluster_number() const { return FcstClusterNumber; } +inline int PairAtt3D::obs_cluster_number() const { return ObsClusterNumber; } -inline int PairAtt3D::intersection_vol () const { return ( IntersectionVol ); } -// inline int PairAtt3D::union_vol () const { return ( UnionVol ); } +inline int PairAtt3D::intersection_vol () const { return IntersectionVol; } +// inline int PairAtt3D::union_vol () const { return UnionVol; } -inline double PairAtt3D::time_centroid_delta () const { return ( TimeCentroidDelta ); } -inline double PairAtt3D::space_centroid_dist () const { return ( SpaceCentroidDist ); } +inline double PairAtt3D::time_centroid_delta () const { return TimeCentroidDelta; } +inline double PairAtt3D::space_centroid_dist () const { return SpaceCentroidDist; } -inline double PairAtt3D::direction_difference () const { return ( DirectionDifference ); } -inline double PairAtt3D::speed_delta () const { return ( SpeedDelta ); } +inline double PairAtt3D::direction_difference () const { return DirectionDifference; } +inline double PairAtt3D::speed_delta () const { return SpeedDelta; } -inline double PairAtt3D::volume_ratio () const { return ( VolumeRatio ); } -inline double PairAtt3D::axis_angle_diff () const { return ( AxisDiff ); } +inline double PairAtt3D::volume_ratio () const { return VolumeRatio; } +inline double PairAtt3D::axis_angle_diff () const { return AxisDiff; } -inline int PairAtt3D::start_time_delta () const { return ( StartTimeDelta ); } -inline int PairAtt3D::end_time_delta () const { return ( EndTimeDelta ); } +inline int PairAtt3D::start_time_delta () const { return StartTimeDelta; } +inline int PairAtt3D::end_time_delta () const { return EndTimeDelta; } -inline int PairAtt3D::duration_difference () const { return ( DurationDifference ); } +inline int PairAtt3D::duration_difference () const { return DurationDifference; } -inline double PairAtt3D::total_interest () const { return ( TotalInterest ); } +inline double PairAtt3D::total_interest () const { return TotalInterest; } -inline bool PairAtt3D::is_simple () const { return ( IsSimple ); } -inline bool PairAtt3D::is_cluster () const { return ( ! IsSimple ); } +inline bool PairAtt3D::is_simple () const { return IsSimple; } +inline bool PairAtt3D::is_cluster () const { return !IsSimple; } inline void PairAtt3D::set_simple () { IsSimple = true; return; } inline void PairAtt3D::set_cluster () { IsSimple = false; return; } diff --git a/src/tools/other/mode_time_domain/3d_att_pair_array.h b/src/tools/other/mode_time_domain/3d_att_pair_array.h index e933bbd6a9..f3cdf13674 100644 --- a/src/tools/other/mode_time_domain/3d_att_pair_array.h +++ b/src/tools/other/mode_time_domain/3d_att_pair_array.h @@ -99,8 +99,8 @@ class PairAtt3DArray { //////////////////////////////////////////////////////////////////////// -inline int PairAtt3DArray::n_elements() const { return ( Nelements ); } -inline int PairAtt3DArray::n () const { return ( Nelements ); } +inline int PairAtt3DArray::n_elements() const { return Nelements; } +inline int PairAtt3DArray::n () const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_att_single_array.h b/src/tools/other/mode_time_domain/3d_att_single_array.h index efe0afd6c1..d501de1d05 100644 --- a/src/tools/other/mode_time_domain/3d_att_single_array.h +++ b/src/tools/other/mode_time_domain/3d_att_single_array.h @@ -77,8 +77,8 @@ class SingleAtt3DArray { //////////////////////////////////////////////////////////////////////// -inline int SingleAtt3DArray::n_elements() const { return ( Nelements ); } -inline int SingleAtt3DArray::n () const { return ( Nelements ); } +inline int SingleAtt3DArray::n_elements() const { return Nelements; } +inline int SingleAtt3DArray::n () const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_moments.h b/src/tools/other/mode_time_domain/3d_moments.h index 603548be44..933fa4e7ad 100644 --- a/src/tools/other/mode_time_domain/3d_moments.h +++ b/src/tools/other/mode_time_domain/3d_moments.h @@ -83,7 +83,7 @@ class Mtd_3D_Moments { //////////////////////////////////////////////////////////////////////// -inline int Mtd_3D_Moments::volume() const { return ( N ); } +inline int Mtd_3D_Moments::volume() const { return N; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/fo_graph.h b/src/tools/other/mode_time_domain/fo_graph.h index 5d0ba7cd7a..ad8b5043d0 100644 --- a/src/tools/other/mode_time_domain/fo_graph.h +++ b/src/tools/other/mode_time_domain/fo_graph.h @@ -107,10 +107,10 @@ class FO_Graph { //////////////////////////////////////////////////////////////////////// -inline int FO_Graph::n_fcst () const { return ( N_fcst ); } -inline int FO_Graph::n_obs () const { return ( N_obs ); } +inline int FO_Graph::n_fcst () const { return N_fcst; } +inline int FO_Graph::n_obs () const { return N_obs ; } -inline int FO_Graph::n_nodes () const { return ( N_nodes ); } +inline int FO_Graph::n_nodes () const { return N_nodes; } inline int FO_Graph::n_total () const { return ( N_fcst + N_obs ); } diff --git a/src/tools/other/mode_time_domain/fo_node.h b/src/tools/other/mode_time_domain/fo_node.h index 5903c8be58..89eec989fb 100644 --- a/src/tools/other/mode_time_domain/fo_node.h +++ b/src/tools/other/mode_time_domain/fo_node.h @@ -90,14 +90,14 @@ class FO_Node { //////////////////////////////////////////////////////////////////////// -inline bool FO_Node::is_fcst() const { return ( IsFcst ); } -inline bool FO_Node::is_obs() const { return ( ! IsFcst ); } +inline bool FO_Node::is_fcst() const { return IsFcst; } +inline bool FO_Node::is_obs() const { return !IsFcst; } -inline bool FO_Node::is_visited() const { return ( IsVisited ); } +inline bool FO_Node::is_visited() const { return IsVisited; } -inline bool FO_Node::has_edge() const { return ( HasEdge ); } +inline bool FO_Node::has_edge() const { return HasEdge; } -inline int FO_Node::number() const { return ( Number ); } +inline int FO_Node::number() const { return Number; } inline void FO_Node::set_fcst() { IsFcst = true; } inline void FO_Node::set_obs() { IsFcst = false; } diff --git a/src/tools/other/mode_time_domain/fo_node_array.h b/src/tools/other/mode_time_domain/fo_node_array.h index d778a78e5e..72928b5046 100644 --- a/src/tools/other/mode_time_domain/fo_node_array.h +++ b/src/tools/other/mode_time_domain/fo_node_array.h @@ -74,8 +74,8 @@ class FO_Node_Array { //////////////////////////////////////////////////////////////////////// -inline int FO_Node_Array::n_elements() const { return ( Nelements ); } -inline int FO_Node_Array::n () const { return ( Nelements ); } +inline int FO_Node_Array::n_elements() const { return Nelements; } +inline int FO_Node_Array::n () const { return Nelements; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mm_engine.h b/src/tools/other/mode_time_domain/mm_engine.h index c36850fd91..628089f281 100644 --- a/src/tools/other/mode_time_domain/mm_engine.h +++ b/src/tools/other/mode_time_domain/mm_engine.h @@ -103,10 +103,10 @@ class MM_Engine { //////////////////////////////////////////////////////////////////////// -inline int MM_Engine::n_fcst_simples () const { return ( graph.n_fcst () ); } -inline int MM_Engine::n_obs_simples () const { return ( graph.n_obs () ); } +inline int MM_Engine::n_fcst_simples () const { return graph.n_fcst(); } +inline int MM_Engine::n_obs_simples () const { return graph.n_obs (); } -inline int MM_Engine::n_composites () const { return ( N_Composites ); } +inline int MM_Engine::n_composites () const { return N_Composites; } //////////////////////////////////////////////////////////////////////// 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 92bc827f82..52407160de 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.h +++ b/src/tools/other/mode_time_domain/mtd_file_base.h @@ -164,18 +164,18 @@ class MtdFileBase { //////////////////////////////////////////////////////////////////////// -inline int MtdFileBase::nx() const { return ( Nx ); } -inline int MtdFileBase::ny() const { return ( Ny ); } -inline int MtdFileBase::nt() const { return ( Nt ); } +inline int MtdFileBase::nx() const { return Nx; } +inline int MtdFileBase::ny() const { return Ny; } +inline int MtdFileBase::nt() const { return Nt; } -inline int MtdFileBase::nxy () const { return ( Nx*Ny ); } -inline int MtdFileBase::nxyt () const { return ( Nx*Ny*Nt ); } +inline int MtdFileBase::nxy () const { return Nx*Ny ; } +inline int MtdFileBase::nxyt () const { return Nx*Ny*Nt; } -inline unixtime MtdFileBase::start_valid_time() const { return ( StartValidTime ); } +inline unixtime MtdFileBase::start_valid_time() const { return StartValidTime; } -inline int MtdFileBase::delta_t() const { return ( DeltaT ); } +inline int MtdFileBase::delta_t() const { return DeltaT; } -inline MtdFileType MtdFileBase::filetype() const { return ( FileType ); } +inline MtdFileType MtdFileBase::filetype() const { return FileType; } //////////////////////////////////////////////////////////////////////// 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 a9935531cf..cfa75b2b8d 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.h +++ b/src/tools/other/mode_time_domain/mtd_file_float.h @@ -137,21 +137,21 @@ class MtdFloatFile : public MtdFileBase { //////////////////////////////////////////////////////////////////////// -inline int MtdFloatFile::spatial_radius() const { return ( Spatial_Radius ); } +inline int MtdFloatFile::spatial_radius() const { return Spatial_Radius; } -inline int MtdFloatFile::time_beg() const { return ( TimeBeg ); } -inline int MtdFloatFile::time_end() const { return ( TimeEnd ); } +inline int MtdFloatFile::time_beg() const { return TimeBeg; } +inline int MtdFloatFile::time_end() const { return TimeEnd; } -inline float MtdFloatFile::data_min() const { return ( DataMin ); } -inline float MtdFloatFile::data_max() const { return ( DataMax ); } +inline float MtdFloatFile::data_min() const { return DataMin; } +inline float MtdFloatFile::data_max() const { return DataMax; } -inline const float * MtdFloatFile::data() const { return ( Data ); } +inline const float * MtdFloatFile::data() const { return Data; } inline float MtdFloatFile::operator()(int _x, int _y, int _t) const { -return ( Data[mtd_three_to_one(Nx, Ny, Nt, _x, _y, _t)] ); +return Data[mtd_three_to_one(Nx, Ny, Nt, _x, _y, _t)]; } 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 3ab39dbaa1..f40d92fe91 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.h +++ b/src/tools/other/mode_time_domain/mtd_file_int.h @@ -164,25 +164,25 @@ class MtdIntFile : public MtdFileBase { //////////////////////////////////////////////////////////////////////// -inline int MtdIntFile::radius() const { return ( Radius ); } +inline int MtdIntFile::radius() const { return Radius; } -inline int MtdIntFile::time_beg() const { return ( TimeBeg ); } -inline int MtdIntFile::time_end() const { return ( TimeEnd ); } +inline int MtdIntFile::time_beg() const { return TimeBeg; } +inline int MtdIntFile::time_end() const { return TimeEnd; } -inline double MtdIntFile::threshold() const { return ( Threshold ); } +inline double MtdIntFile::threshold() const { return Threshold; } -inline int MtdIntFile::data_min() const { return ( DataMin ); } -inline int MtdIntFile::data_max() const { return ( DataMax ); } +inline int MtdIntFile::data_min() const { return DataMin; } +inline int MtdIntFile::data_max() const { return DataMax; } -inline int MtdIntFile::n_objects() const { return ( Nobjects ); } +inline int MtdIntFile::n_objects() const { return Nobjects; } -inline const int * MtdIntFile::data() const { return ( Data ); } +inline const int * MtdIntFile::data() const { return Data; } inline int MtdIntFile::operator()(int _x, int _y, int _t) const { -return ( Data[mtd_three_to_one(Nx, Ny, Nt, _x, _y, _t)] ); +return Data[mtd_three_to_one(Nx, Ny, Nt, _x, _y, _t)]; } diff --git a/src/tools/other/mode_time_domain/mtd_partition.h b/src/tools/other/mode_time_domain/mtd_partition.h index caf63598cf..ce8277eca4 100644 --- a/src/tools/other/mode_time_domain/mtd_partition.h +++ b/src/tools/other/mode_time_domain/mtd_partition.h @@ -92,7 +92,7 @@ class EquivalenceClass { //////////////////////////////////////////////////////////////////////// -inline int EquivalenceClass::n_elements() const { return ( Nelements ); } +inline int EquivalenceClass::n_elements() const { return Nelements; } //////////////////////////////////////////////////////////////////////// @@ -107,12 +107,12 @@ int * e = E; for (j=0; jhas(k) ) return ( true ); + if ( (*c)->has(k) ) return true; } -return ( false ); +return false; } diff --git a/src/tools/other/modis_regrid/cloudsat_swath_file.h b/src/tools/other/modis_regrid/cloudsat_swath_file.h index 9853b7c75b..b6be77c59a 100644 --- a/src/tools/other/modis_regrid/cloudsat_swath_file.h +++ b/src/tools/other/modis_regrid/cloudsat_swath_file.h @@ -81,9 +81,9 @@ class SatDimension { //////////////////////////////////////////////////////////////////////// -inline ConcatString SatDimension::name() const { return ( Name ); } +inline ConcatString SatDimension::name() const { return Name; } -inline int SatDimension::size() const { return ( Size ); } +inline int SatDimension::size() const { return Size; } //////////////////////////////////////////////////////////////////////// @@ -167,18 +167,18 @@ class SatAttribute { //////////////////////////////////////////////////////////////////////// -inline ConcatString SatAttribute::name() const { return ( Name ); } +inline ConcatString SatAttribute::name() const { return Name; } -inline int SatAttribute::number_type() const { return ( Numbertype ); } +inline int SatAttribute::number_type() const { return Numbertype; } -inline int SatAttribute::bytes() const { return ( Bytes ); } +inline int SatAttribute::bytes() const { return Bytes; } -inline int SatAttribute::n_values() const { return ( Nvalues ); } +inline int SatAttribute::n_values() const { return Nvalues; } -inline int SatAttribute::ival(int n) const { return ( Ival[n] ); } -inline double SatAttribute::dval(int n) const { return ( Dval[n] ); } +inline int SatAttribute::ival(int n) const { return Ival[n]; } +inline double SatAttribute::dval(int n) const { return Dval[n]; } -inline ConcatString SatAttribute::sval() const { return ( Sval ); } +inline ConcatString SatAttribute::sval() const { return Sval; } //////////////////////////////////////////////////////////////////////// @@ -253,12 +253,12 @@ class SwathDataField { //////////////////////////////////////////////////////////////////////// -inline ConcatString SwathDataField::name() const { return ( Name ); } +inline ConcatString SwathDataField::name() const { return Name; } -inline int SwathDataField::get_rank () const { return ( Rank ); } -inline int SwathDataField::numbertype () const { return ( Numbertype ); } +inline int SwathDataField::get_rank () const { return Rank ; } +inline int SwathDataField::numbertype () const { return Numbertype ; } -inline int SwathDataField::n_dimensions () const { return ( Ndimensions ); } +inline int SwathDataField::n_dimensions () const { return Ndimensions; } //////////////////////////////////////////////////////////////////////// @@ -374,15 +374,15 @@ class CloudsatSwath { //////////////////////////////////////////////////////////////////////// -inline ConcatString CloudsatSwath::name() const { return ( Name ); } +inline ConcatString CloudsatSwath::name() const { return Name; } -inline int CloudsatSwath::swath_id() const { return ( SwathId ); } +inline int CloudsatSwath::swath_id() const { return SwathId; } -inline int CloudsatSwath::n_data_fields() const { return ( Ndatafields ); } +inline int CloudsatSwath::n_data_fields() const { return Ndatafields; } -inline int CloudsatSwath::n_attributes () const { return ( Nattributes ); } +inline int CloudsatSwath::n_attributes () const { return Nattributes; } -inline int CloudsatSwath::n_geo_fields () const { return ( Ngeofields ); } +inline int CloudsatSwath::n_geo_fields () const { return Ngeofields; } //////////////////////////////////////////////////////////////////////// @@ -448,11 +448,11 @@ class CloudsatSwathFile { //////////////////////////////////////////////////////////////////////// -inline ConcatString CloudsatSwathFile::filename() const { return ( Filename ); } +inline ConcatString CloudsatSwathFile::filename() const { return Filename; } -inline int CloudsatSwathFile::file_id() const { return ( FileId ); } +inline int CloudsatSwathFile::file_id() const { return FileId; } -inline int CloudsatSwathFile::n_swaths() const { return ( Nswaths ); } +inline int CloudsatSwathFile::n_swaths() const { return Nswaths; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/modis_file.h b/src/tools/other/modis_regrid/modis_file.h index 9ef823dfed..245ea3347f 100644 --- a/src/tools/other/modis_regrid/modis_file.h +++ b/src/tools/other/modis_regrid/modis_file.h @@ -137,12 +137,12 @@ class ModisFile { //////////////////////////////////////////////////////////////////////// -inline ConcatString ModisFile::filename() const { return ( Filename ); } +inline ConcatString ModisFile::filename() const { return Filename; } -inline int ModisFile::file_id() const { return ( FileId ); } +inline int ModisFile::file_id() const { return FileId; } -inline int ModisFile::dim0() const { return ( Dim0 ); } -inline int ModisFile::dim1() const { return ( Dim1 ); } +inline int ModisFile::dim0() const { return Dim0; } +inline int ModisFile::dim1() const { return Dim1; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index e393a17f57..a9abdf1be9 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -2032,7 +2032,7 @@ void process_pbfile(int i_pb) { if (cal_cape) { mlog << Debug(3) << "\nDerived CAPE = " << cape_count << "\tZero = " << cape_cnt_zero_values - << "\n\tnot derived: No cape inputs = " << (cape_cnt_no_levels) + << "\n\tnot derived: No cape inputs = " << cape_cnt_no_levels << "\tNo vertical levels = " << cape_cnt_surface_msgs << "\n\tfiltered: " << cape_cnt_missing_values << ", " << cape_cnt_too_big @@ -2811,7 +2811,7 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, switch(gc) { // Pressure Reduced to Mean Sea Level - case(prmsl_grib_code): + case prmsl_grib_code: p = (double) pqtzuv[0]; t = (double) pqtzuv[2]; z = (double) pqtzuv[3]; @@ -2822,14 +2822,14 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, break; // Humidity mixing ratio - case(mixr_grib_code): + case mixr_grib_code: q = (double) pqtzuv[1]; qty = pqtzuv_qty[1]; result = (float) convert_q_to_w(q); break; // Dewpoint temperature: derived from p and q - case(dpt_grib_code): + case dpt_grib_code: p = (double) pqtzuv[0]; q = (double) pqtzuv[1]; qty = pqtzuv_qty[0]; @@ -2840,7 +2840,7 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, break; // Relative humidity - case(rh_grib_code): + case rh_grib_code: p = (double) pqtzuv[0]; q = (double) pqtzuv[1]; t = (double) pqtzuv[2]; @@ -2851,7 +2851,7 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, break; // Wind direction (direction wind is coming from): derived from u and v - case(wdir_grib_code): + case wdir_grib_code: u = (double) pqtzuv[4]; v = (double) pqtzuv[5]; qty = pqtzuv_qty[4]; @@ -2860,7 +2860,7 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, break; // Wind speed: derived from u and v - case(wind_grib_code): + case wind_grib_code: u = (double) pqtzuv[4]; v = (double) pqtzuv[5]; qty = pqtzuv_qty[4]; diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 2b067ffdf4..de7d284fc1 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -41,6 +41,7 @@ #include "vx_regrid.h" #include "vx_util.h" #include "vx_statistics.h" +#include "var_info_nc_cf.h" #include "nc_obs_util.h" #include "nc_point_obs_in.h" @@ -170,6 +171,7 @@ static void set_gaussian_dx(const StringArray &); static void set_gaussian_radius(const StringArray &); static unixtime compute_unixtime(NcVar *time_var, unixtime var_value); +void clear_cell_mapping(IntArray *cell_mapping); static bool get_grid_mapping(const Grid &fr_grid, const Grid &to_grid, IntArray *cellMapping, NcVar var_lat, NcVar var_lon, bool *skip_times); static bool get_grid_mapping(const Grid &to_grid, IntArray *cellMapping, @@ -390,7 +392,7 @@ static void process_data_file() { if (compress_level < 0) compress_level = config.nc_compression(); // Get the gridded file type from config string, if present - ftype = parse_conf_file_type(&config); + ftype = parse_conf_file_type(&conf_info.conf); // Open the input file mlog << Debug(1) << "Reading data file: " << InputFilename << "\n"; @@ -422,7 +424,6 @@ static void process_data_file() { // Get the obs type before opening NetCDF obs_type = get_obs_type(nc_in); goes_data = (obs_type == TYPE_GOES || obs_type == TYPE_GOES_ADP); - if (obs_type == TYPE_NCCF) setenv(nc_att_met_point_nccf, "yes", 1); // Read the input data file @@ -943,8 +944,9 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI } if (cellMapping) { - for (idx=0; idx<(nx*ny); idx++) cellMapping[idx].clear(); + clear_cell_mapping(cellMapping); delete [] cellMapping; + cellMapping = (IntArray *) nullptr; } cellMapping = new IntArray[nx * ny]; if( get_grid_mapping(to_grid, cellMapping, var_index_array, @@ -1139,6 +1141,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI } // end for i if (cellMapping) { + clear_cell_mapping(cellMapping); delete [] cellMapping; cellMapping = (IntArray *) nullptr; } @@ -1237,8 +1240,58 @@ static void process_point_nccf_file(NcFile *nc_in, MetConfig &config, int from_size = fr_grid.nx() * fr_grid.ny(); static const char *method_name = "process_point_nccf_file() -> "; - NcVar var_lat = get_nc_var_lat(nc_in); - NcVar var_lon = get_nc_var_lon(nc_in); + NcVar var_lat; + NcVar var_lon; + bool user_defined_latlon = false; + ConcatString lat_vname = conf_info.get_var_name(conf_key_lat_vname); + ConcatString lon_vname = conf_info.get_var_name(conf_key_lon_vname); + + if (lat_vname != conf_key_lat_vname && lon_vname != conf_key_lon_vname) { + if (lat_vname != conf_key_lat_vname && has_var(nc_in, lat_vname.c_str())) { + var_lat = get_nc_var(nc_in, lat_vname.c_str()); + } + if (lon_vname != conf_key_lon_vname && has_var(nc_in, lon_vname.c_str())) { + var_lon = get_nc_var(nc_in, lon_vname.c_str()); + } + if (IS_INVALID_NC(var_lat)) { + mlog << Error << "\n" << method_name + << "can not find the latitude variable (" << lat_vname + << ") from the config file (" << config_filename << ").\n\n"; + exit(1); + } + else if (IS_INVALID_NC(var_lon)) { + mlog << Error << "\n" << method_name + << "can not find the longitude variable (" << lon_vname + << ") from the config file (" << config_filename << ").\n\n"; + exit(1); + } + else user_defined_latlon = true; + } + // Find lat/lon variables from the coordinates attribue + if (0 < FieldSA.n() && !user_defined_latlon) { + ConcatString coordinates_value; + VarInfoNcCF var_info = VarInfoNcCF(*(VarInfoNcCF *)vinfo); + // Initialize + var_info.clear(); + // Populate the VarInfo object using the config string + config.read_string(FieldSA[0].c_str()); + var_info.set_dict(config); + NcVar var_data = get_nc_var(nc_in, var_info.name().c_str()); + if (get_nc_att_value(&var_data, coordinates_att_name, coordinates_value)) { + StringArray sa = coordinates_value.split(" "); + ConcatString units; + for (int idx=0; idxset_dict(config); + NcVar var_data = get_nc_var(nc_in, vinfo->name().c_str()); + ConcatString coordinates_value; + if (!user_defined_latlon && get_nc_att_value(&var_data, coordinates_att_name, coordinates_value)) { + StringArray sa = coordinates_value.split(" "); + int count = sa.n_elements(); + if (count >= 2) { + bool match_lat = false; + bool match_lon = false; + for (int idx=0; idx= 2) { @@ -1334,7 +1425,6 @@ static void process_point_nccf_file(NcFile *nc_in, MetConfig &config, write_nc(to_dp, to_grid, vinfo, vname.c_str()); NcVar to_var = get_nc_var(nc_out, vname.c_str()); - NcVar var_data = get_nc_var(nc_in, vinfo->name().c_str()); bool has_prob_thresh = !prob_cat_thresh.check(bad_data_double); if (has_prob_thresh || do_gaussian_filter) { @@ -1374,8 +1464,15 @@ static void process_point_nccf_file(NcFile *nc_in, MetConfig &config, } } + if (nullptr != var_cell_mapping) { + clear_cell_mapping(var_cell_mapping); + delete [] var_cell_mapping; + var_cell_mapping = nullptr; + } + } // end for i + clear_cell_mapping(cellMapping); delete [] cellMapping; cellMapping = (IntArray *) nullptr; if( 0 < filtered_by_time ) { @@ -1397,7 +1494,7 @@ static void regrid_nc_variable(NcFile *nc_in, Met2dDataFile *fr_mtddf, Grid to_grid, IntArray *cellMapping) { int to_cell_cnt = 0; - clock_t start_clock = clock(); + clock_t start_clock = clock(); Grid fr_grid = fr_mtddf->grid(); static const char *method_name = "regrid_nc_variable() -> "; @@ -1801,6 +1898,7 @@ static void process_goes_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo, } delete nc_adp; nc_adp = nullptr; + clear_cell_mapping(cellMapping); delete [] cellMapping; cellMapping = (IntArray *) nullptr; mlog << Debug(LEVEL_FOR_PERFORMANCE) << method_name << "took " << (clock()-start_clock)/double(CLOCKS_PER_SEC) << " seconds\n"; @@ -1866,6 +1964,14 @@ GOES_QC compute_adp_qc_flag(int adp_qc, int shift_bits) { } +//////////////////////////////////////////////////////////////////////// + +void clear_cell_mapping(IntArray *cell_mapping) { + if (nullptr != cell_mapping) { + for (int idx=0; idxn(); idx++) cell_mapping[idx].clear(); + } +} + //////////////////////////////////////////////////////////////////////// static unixtime compute_unixtime(NcVar *time_var, unixtime var_value) { @@ -2838,7 +2944,7 @@ static bool has_lat_lon_vars(const NcFile *nc) { << " has_lat_var: " << has_lat_var << ", has_lon_var: " << has_lon_var << ", has_time_var: " << has_time_var << "\n"; - return (has_lat_var && has_lon_var && has_time_var); + return (has_lat_var && has_lon_var); } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/af_file.h b/src/tools/other/wwmca_tool/af_file.h index dbcbc0bdf3..eba9dfff68 100644 --- a/src/tools/other/wwmca_tool/af_file.h +++ b/src/tools/other/wwmca_tool/af_file.h @@ -93,12 +93,12 @@ class AFDataFile { //////////////////////////////////////////////////////////////////////// -inline int AFDataFile::nx() const { return ( af_nx ); } -inline int AFDataFile::ny() const { return ( af_ny ); } +inline int AFDataFile::nx() const { return af_nx; } +inline int AFDataFile::ny() const { return af_ny; } -inline unixtime AFDataFile::init () const { return ( Init ); } -inline unixtime AFDataFile::valid () const { return ( Valid ); } -inline char AFDataFile::hemisphere () const { return ( Hemisphere ); } +inline unixtime AFDataFile::init () const { return Init; } +inline unixtime AFDataFile::valid () const { return Valid; } +inline char AFDataFile::hemisphere () const { return Hemisphere; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/interp_base.h b/src/tools/other/wwmca_tool/interp_base.h index 885623521d..52f7015efe 100644 --- a/src/tools/other/wwmca_tool/interp_base.h +++ b/src/tools/other/wwmca_tool/interp_base.h @@ -119,9 +119,9 @@ class Interpolator { //////////////////////////////////////////////////////////////////////// -inline int Interpolator::width() const { return ( Width ); } +inline int Interpolator::width() const { return Width; } -inline int Interpolator::wm1o2() const { return ( Wm1o2 ); } +inline int Interpolator::wm1o2() const { return Wm1o2; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/wwmca_ref.h b/src/tools/other/wwmca_tool/wwmca_ref.h index 9cbee01559..3006612804 100644 --- a/src/tools/other/wwmca_tool/wwmca_ref.h +++ b/src/tools/other/wwmca_tool/wwmca_ref.h @@ -134,7 +134,7 @@ class WwmcaRegridder { //////////////////////////////////////////////////////////////////////// -inline GridHemisphere WwmcaRegridder::hemi() const { return ( Hemi ); } +inline GridHemisphere WwmcaRegridder::hemi() const { return Hemi; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_dland/tc_poly.h b/src/tools/tc_utils/tc_dland/tc_poly.h index 55cb053e16..db7d654eb8 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.h +++ b/src/tools/tc_utils/tc_dland/tc_poly.h @@ -65,7 +65,7 @@ class TCPoly { //////////////////////////////////////////////////////////////////////// -inline ConcatString TCPoly::name() const { return(Name); } +inline ConcatString TCPoly::name() const { return Name; } //////////////////////////////////////////////////////////////////////// @@ -110,7 +110,7 @@ class TCPolyArray { //////////////////////////////////////////////////////////////////////// -inline int TCPolyArray::n_polys() const { return(NPolys); } +inline int TCPolyArray::n_polys() const { return NPolys; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index 04e0b0c408..7c6a44c16e 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -1750,18 +1750,18 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) { // 2x2 contingency table output: // 1 header + 2 vx methods * # models * # filters - case(i_fho): - case(i_ctc): - case(i_cts): + case i_fho: + case i_ctc: + case i_cts: n_rows = 1 + 2 * n_model * conf_info.n_vx(); break; // Nx2 probabilistic contingency table output: // 1 header + 1 vx method * # models * # probs * # filters - case(i_pct): - case(i_pstd): - case(i_pjc): - case(i_prc): + case i_pct: + case i_pstd: + case i_pjc: + case i_prc: n_rows = 1 + n_model * max_n_prob * conf_info.n_vx(); break; @@ -1775,19 +1775,19 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) { // Compute the number of columns for this line type switch(i) { - case(i_pct): + case i_pct: n_cols = get_n_pct_columns(n_prob) + n_header_columns + 1; break; - case(i_pstd): + case i_pstd: n_cols = get_n_pstd_columns(n_prob) + n_header_columns + 1; break; - case(i_pjc): + case i_pjc: n_cols = get_n_pjc_columns(n_prob) + n_header_columns + 1; break; - case(i_prc): + case i_prc: n_cols = get_n_prc_columns(n_prob) + n_header_columns + 1; break; @@ -1823,19 +1823,19 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) { // Write header row switch(i) { - case(i_pct): + case i_pct: write_pct_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pstd): + case i_pstd: write_pstd_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_pjc): + case i_pjc: write_pjc_header_row(1, n_prob, txt_at[i], 0, 0); break; - case(i_prc): + case i_prc: write_prc_header_row(1, n_prob, txt_at[i], 0, 0); break; 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 ba93072c16..8fa68cad5d 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.h +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.h @@ -381,7 +381,7 @@ class TCStatJob { //////////////////////////////////////////////////////////////////////// inline void TCStatJob::set_precision (int p) { Precision = p; return; } -inline int TCStatJob::get_precision () const { return(Precision); } +inline int TCStatJob::get_precision () const { return Precision; } ////////////////////////////////////////////////////////////////////////