From d8572b9aac058efb5fa602d82b9bfd551b6943d9 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 2 Feb 2024 16:58:42 +0000 Subject: [PATCH 01/72] 2673 Moved dvariable declaration after include --- src/basic/enum_to_string/enum_to_string.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/basic/enum_to_string/enum_to_string.cc b/src/basic/enum_to_string/enum_to_string.cc index 0045f23735..1e7a1f31d7 100644 --- a/src/basic/enum_to_string/enum_to_string.cc +++ b/src/basic/enum_to_string/enum_to_string.cc @@ -10,12 +10,6 @@ //////////////////////////////////////////////////////////////////////// -static const int debug = 0; - - -//////////////////////////////////////////////////////////////////////// - - #include #include @@ -36,6 +30,12 @@ static const int debug = 0; using namespace std; +//////////////////////////////////////////////////////////////////////// + + +static const int debug = 0; + + //////////////////////////////////////////////////////////////////////// From 6ebfdac2b17fbe842e51e52bd27ea04a42ee5658 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 2 Feb 2024 17:41:26 +0000 Subject: [PATCH 02/72] #2673 Move down namespace below include --- src/basic/enum_to_string/info.cc | 4 ++-- src/basic/vx_config/grdfiletype_to_string.cc | 8 ++++---- src/basic/vx_log/concat_string.cc | 4 ++-- src/basic/vx_log/file_fxns.cc | 5 +++-- src/basic/vx_log/indent.cc | 4 ++-- src/basic/vx_log/str_wrappers.cc | 4 ++-- src/basic/vx_log/string_array.cc | 6 +++--- src/basic/vx_math/affine.cc | 6 +++--- src/basic/vx_math/hist.cc | 7 +++---- src/basic/vx_math/legendre.cc | 8 ++------ src/basic/vx_math/nint.cc | 7 +++---- src/basic/vx_math/nti.cc | 5 ++--- src/basic/vx_math/ptile.cc | 7 +++---- src/basic/vx_math/pwl.cc | 6 +++--- src/basic/vx_math/viewgravity_to_string.cc | 6 +++--- src/basic/vx_math/vx_vector.cc | 8 ++------ src/basic/vx_util/ascii_header.cc | 4 ++-- src/basic/vx_util/ascii_table.cc | 4 ++-- src/basic/vx_util/asciitablejust_to_string.cc | 7 +++---- src/basic/vx_util/check_endian.cc | 5 ++--- src/basic/vx_util/comma_string.cc | 7 +++---- src/basic/vx_util/command_line.cc | 4 ++-- src/basic/vx_util/conversions.cc | 4 ++-- src/basic/vx_util/data_cube.cc | 4 ++-- src/basic/vx_util/data_line.cc | 5 ++--- src/basic/vx_util/data_plane.cc | 4 ++-- src/basic/vx_util/data_plane_util.cc | 4 ++-- src/basic/vx_util/file_exists.cc | 6 ++---- src/basic/vx_util/file_linecount.cc | 8 ++------ src/basic/vx_util/file_size.cc | 8 ++------ src/basic/vx_util/filename_suffix.cc | 4 ++-- src/basic/vx_util/fix_float.cc | 5 ++--- src/basic/vx_util/get_filenames.cc | 5 ++--- src/basic/vx_util/grib_constants.cc | 4 ++-- src/basic/vx_util/interp_mthd.cc | 4 ++-- src/basic/vx_util/interp_util.cc | 4 ++-- src/basic/vx_util/is_number.cc | 7 +++---- src/basic/vx_util/long_array.cc | 10 +++------- src/basic/vx_util/main.cc | 4 ++-- src/basic/vx_util/make_path.cc | 5 ++--- src/basic/vx_util/mask_poly.cc | 4 ++-- src/basic/vx_util/memory.cc | 4 ++-- src/basic/vx_util/met_buffer.cc | 5 ++--- src/basic/vx_util/normalize.cc | 4 ++-- src/basic/vx_util/num_array.cc | 6 ++---- src/basic/vx_util/observation.cc | 4 ++-- src/basic/vx_util/ordinal.cc | 7 +++---- src/basic/vx_util/polyline.cc | 4 ++-- src/basic/vx_util/python_line.cc | 6 +++--- src/basic/vx_util/read_fortran_binary.cc | 5 ++--- src/basic/vx_util/roman_numeral.cc | 5 ++--- src/basic/vx_util/smart_buffer.cc | 8 ++------ src/basic/vx_util/string_fxns.cc | 7 +++---- src/basic/vx_util/substring.cc | 7 +++---- src/basic/vx_util/thresh_array.cc | 4 ++-- src/basic/vx_util/two_to_one.cc | 4 ++-- src/basic/vx_util_math/so3.cc | 6 ++---- 57 files changed, 132 insertions(+), 179 deletions(-) diff --git a/src/basic/enum_to_string/info.cc b/src/basic/enum_to_string/info.cc index 224ea9df07..48aa93e67e 100644 --- a/src/basic/enum_to_string/info.cc +++ b/src/basic/enum_to_string/info.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "info.h" #include "str_wrappers.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/grdfiletype_to_string.cc b/src/basic/vx_config/grdfiletype_to_string.cc index e82450caf8..6a2140927e 100644 --- a/src/basic/vx_config/grdfiletype_to_string.cc +++ b/src/basic/vx_config/grdfiletype_to_string.cc @@ -24,14 +24,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "grdfiletype_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ ConcatString grdfiletype_to_string(const GrdFileType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_log/concat_string.cc b/src/basic/vx_log/concat_string.cc index ff9e9c1701..5208644928 100644 --- a/src/basic/vx_log/concat_string.cc +++ b/src/basic/vx_log/concat_string.cc @@ -18,12 +18,12 @@ #include #include -using namespace std; - #include "concat_string.h" #include "logger.h" #include "str_wrappers.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/file_fxns.cc b/src/basic/vx_log/file_fxns.cc index e3ac30e48f..c3bc9452ab 100644 --- a/src/basic/vx_log/file_fxns.cc +++ b/src/basic/vx_log/file_fxns.cc @@ -7,8 +7,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,9 @@ using namespace std; #include "file_fxns.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// bool is_regular_file(const char *path) { diff --git a/src/basic/vx_log/indent.cc b/src/basic/vx_log/indent.cc index 918fca7020..4c1427b083 100644 --- a/src/basic/vx_log/indent.cc +++ b/src/basic/vx_log/indent.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "indent.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/str_wrappers.cc b/src/basic/vx_log/str_wrappers.cc index 4361388d71..dfe67d6b57 100644 --- a/src/basic/vx_log/str_wrappers.cc +++ b/src/basic/vx_log/str_wrappers.cc @@ -11,11 +11,11 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "logger.h" #include "str_wrappers.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/string_array.cc b/src/basic/vx_log/string_array.cc index 03116b5e3d..1a3f106800 100644 --- a/src/basic/vx_log/string_array.cc +++ b/src/basic/vx_log/string_array.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "indent.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/affine.cc b/src/basic/vx_math/affine.cc index f4899de86d..427755da1f 100644 --- a/src/basic/vx_math/affine.cc +++ b/src/basic/vx_math/affine.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/hist.cc b/src/basic/vx_math/hist.cc index d1eb05750c..90b28ea623 100644 --- a/src/basic/vx_math/hist.cc +++ b/src/basic/vx_math/hist.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +21,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/legendre.cc b/src/basic/vx_math/legendre.cc index 682ba30027..605378f10a 100644 --- a/src/basic/vx_math/legendre.cc +++ b/src/basic/vx_math/legendre.cc @@ -1,8 +1,5 @@ - - //////////////////////////////////////////////////////////////////////// - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -11,12 +8,9 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +19,8 @@ using namespace std; #include "legendre.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/nint.cc b/src/basic/vx_math/nint.cc index 76e4cb6780..a512a36668 100644 --- a/src/basic/vx_math/nint.cc +++ b/src/basic/vx_math/nint.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -22,6 +18,9 @@ using namespace std; #include "nint.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/nti.cc b/src/basic/vx_math/nti.cc index 5c4c9b6003..e020832d93 100644 --- a/src/basic/vx_math/nti.cc +++ b/src/basic/vx_math/nti.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +18,8 @@ using namespace std; #include "nti.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 9812403a84..0ed5d97863 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - /////////////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +22,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/pwl.cc b/src/basic/vx_math/pwl.cc index 5e8fc7cb7f..c505db383a 100644 --- a/src/basic/vx_math/pwl.cc +++ b/src/basic/vx_math/pwl.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,9 @@ using namespace std; #include "is_bad_data.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc index ed8dbefb66..b1bc46c2a1 100644 --- a/src/basic/vx_math/viewgravity_to_string.cc +++ b/src/basic/vx_math/viewgravity_to_string.cc @@ -24,14 +24,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "viewgravity_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/vx_vector.cc b/src/basic/vx_math/vx_vector.cc index fd6c7f0645..7833be1fe1 100644 --- a/src/basic/vx_math/vx_vector.cc +++ b/src/basic/vx_math/vx_vector.cc @@ -1,8 +1,5 @@ - - //////////////////////////////////////////////////////////////////////// - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -11,12 +8,9 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +21,8 @@ using namespace std; #include "trig.h" #include "vx_vector.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ascii_header.cc b/src/basic/vx_util/ascii_header.cc index 27c1d69a1a..e7898b65cc 100644 --- a/src/basic/vx_util/ascii_header.cc +++ b/src/basic/vx_util/ascii_header.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "ascii_header.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // diff --git a/src/basic/vx_util/ascii_table.cc b/src/basic/vx_util/ascii_table.cc index d7e2640fa4..0725cde4e4 100644 --- a/src/basic/vx_util/ascii_table.cc +++ b/src/basic/vx_util/ascii_table.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +27,8 @@ using namespace std; #include "fix_float.h" #include "util_constants.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc index 3415941569..f5a42fde27 100644 --- a/src/basic/vx_util/asciitablejust_to_string.cc +++ b/src/basic/vx_util/asciitablejust_to_string.cc @@ -6,7 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// @@ -24,14 +23,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "asciitablejust_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/check_endian.cc b/src/basic/vx_util/check_endian.cc index 30c236f9c5..f0aa3d13c9 100644 --- a/src/basic/vx_util/check_endian.cc +++ b/src/basic/vx_util/check_endian.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +17,8 @@ using namespace std; #include "check_endian.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/comma_string.cc b/src/basic/vx_util/comma_string.cc index 4c27d13f23..c2e5d41516 100644 --- a/src/basic/vx_util/comma_string.cc +++ b/src/basic/vx_util/comma_string.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -23,6 +19,9 @@ using namespace std; #include "comma_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/command_line.cc b/src/basic/vx_util/command_line.cc index 73aab12b2b..81c12dd185 100644 --- a/src/basic/vx_util/command_line.cc +++ b/src/basic/vx_util/command_line.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "util_constants.h" #include "file_exists.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/conversions.cc b/src/basic/vx_util/conversions.cc index 4d77ea5427..e13a64eb95 100644 --- a/src/basic/vx_util/conversions.cc +++ b/src/basic/vx_util/conversions.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "util_constants.h" #include "is_bad_data.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// double convert_gpm_to_msl(double gpm, double lat) { diff --git a/src/basic/vx_util/data_cube.cc b/src/basic/vx_util/data_cube.cc index 646f477151..dcd295f70f 100644 --- a/src/basic/vx_util/data_cube.cc +++ b/src/basic/vx_util/data_cube.cc @@ -19,13 +19,13 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "data_cube.h" #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// DataCube::DataCube() { diff --git a/src/basic/vx_util/data_line.cc b/src/basic/vx_util/data_line.cc index 2246dfbba4..43814d39b5 100644 --- a/src/basic/vx_util/data_line.cc +++ b/src/basic/vx_util/data_line.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -34,6 +31,8 @@ using namespace std; #include "python_line.h" #endif /* WITH_PYTHON */ +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index a6d702f0b6..20ea713e42 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -20,8 +20,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -32,6 +30,8 @@ using namespace std; #include "vx_cal.h" #include "math_constants.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Begin Code for class DataPlane diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc index e20c49712d..044c07dd11 100644 --- a/src/basic/vx_util/data_plane_util.cc +++ b/src/basic/vx_util/data_plane_util.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "GridTemplate.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Utility functions operating on a DataPlane diff --git a/src/basic/vx_util/file_exists.cc b/src/basic/vx_util/file_exists.cc index a51db6f164..59751bfd7c 100644 --- a/src/basic/vx_util/file_exists.cc +++ b/src/basic/vx_util/file_exists.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +22,8 @@ using namespace std; #include "file_exists.h" #include "empty_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/file_linecount.cc b/src/basic/vx_util/file_linecount.cc index 8ea6cd2637..a7a73b3a94 100644 --- a/src/basic/vx_util/file_linecount.cc +++ b/src/basic/vx_util/file_linecount.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -9,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +20,8 @@ using namespace std; #include "empty_string.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/file_size.cc b/src/basic/vx_util/file_size.cc index 485b1b1b52..60852927e7 100644 --- a/src/basic/vx_util/file_size.cc +++ b/src/basic/vx_util/file_size.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -9,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +22,8 @@ using namespace std; #include "file_size.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/filename_suffix.cc b/src/basic/vx_util/filename_suffix.cc index ebcf211bd9..cb7b916098 100644 --- a/src/basic/vx_util/filename_suffix.cc +++ b/src/basic/vx_util/filename_suffix.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "filename_suffix.h" #include "concat_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/fix_float.cc b/src/basic/vx_util/fix_float.cc index 1e39aaf7e3..0339cdcbe5 100644 --- a/src/basic/vx_util/fix_float.cc +++ b/src/basic/vx_util/fix_float.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +18,8 @@ using namespace std; #include "fix_float.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/get_filenames.cc b/src/basic/vx_util/get_filenames.cc index f8d1bb5d3f..df81b25d50 100644 --- a/src/basic/vx_util/get_filenames.cc +++ b/src/basic/vx_util/get_filenames.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +27,8 @@ using namespace std; #include "get_filenames.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/grib_constants.cc b/src/basic/vx_util/grib_constants.cc index 612db90eeb..f3fa9215e7 100644 --- a/src/basic/vx_util/grib_constants.cc +++ b/src/basic/vx_util/grib_constants.cc @@ -6,8 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; - /////////////////////////////////////////////////////////////////////////////// #include @@ -24,6 +22,8 @@ using namespace std; #include "grib_constants.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// bool is_precip_grib_code(int gc) { diff --git a/src/basic/vx_util/interp_mthd.cc b/src/basic/vx_util/interp_mthd.cc index 73a3dbc054..856627db95 100644 --- a/src/basic/vx_util/interp_mthd.cc +++ b/src/basic/vx_util/interp_mthd.cc @@ -8,8 +8,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -18,6 +16,8 @@ using namespace std; #include "interp_mthd.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// ConcatString interpmthd_to_string(const InterpMthd m) { diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc index b28ecc40dd..dfad729e29 100644 --- a/src/basic/vx_util/interp_util.cc +++ b/src/basic/vx_util/interp_util.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // diff --git a/src/basic/vx_util/is_number.cc b/src/basic/vx_util/is_number.cc index 7daec912ee..0c9ad401d1 100644 --- a/src/basic/vx_util/is_number.cc +++ b/src/basic/vx_util/is_number.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +21,9 @@ using namespace std; #include "substring.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/long_array.cc b/src/basic/vx_util/long_array.cc index c0e493628c..330fd6a2e2 100644 --- a/src/basic/vx_util/long_array.cc +++ b/src/basic/vx_util/long_array.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -9,14 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -27,6 +20,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/main.cc b/src/basic/vx_util/main.cc index 5144ab5643..f75b648e3f 100644 --- a/src/basic/vx_util/main.cc +++ b/src/basic/vx_util/main.cc @@ -33,8 +33,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -43,6 +41,8 @@ using namespace std; #include "memory.h" #include "logger.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/make_path.cc b/src/basic/vx_util/make_path.cc index c6f207183a..badeed3d59 100644 --- a/src/basic/vx_util/make_path.cc +++ b/src/basic/vx_util/make_path.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +24,8 @@ using namespace std; #include "make_path.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/mask_poly.cc b/src/basic/vx_util/mask_poly.cc index 6a8f176c9f..8e0166d9ac 100644 --- a/src/basic/vx_util/mask_poly.cc +++ b/src/basic/vx_util/mask_poly.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/memory.cc b/src/basic/vx_util/memory.cc index a832b79840..26bcbf9b6c 100644 --- a/src/basic/vx_util/memory.cc +++ b/src/basic/vx_util/memory.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -18,6 +16,8 @@ using namespace std; #include "memory.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/met_buffer.cc b/src/basic/vx_util/met_buffer.cc index ef1e8c481c..5af20835a6 100644 --- a/src/basic/vx_util/met_buffer.cc +++ b/src/basic/vx_util/met_buffer.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +20,8 @@ using namespace std; #include "read_fortran_binary.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/normalize.cc b/src/basic/vx_util/normalize.cc index 831af6c6a1..1c17f0474f 100644 --- a/src/basic/vx_util/normalize.cc +++ b/src/basic/vx_util/normalize.cc @@ -8,8 +8,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -18,6 +16,8 @@ using namespace std; #include "normalize.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// ConcatString normalizetype_to_string(const NormalizeType type) { diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index 3b68d21978..d25e8bb034 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; -using namespace std; - #include #include #include @@ -28,6 +24,8 @@ using namespace std; #include "nint.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/observation.cc b/src/basic/vx_util/observation.cc index 1fe4ea7ede..b469a00fba 100644 --- a/src/basic/vx_util/observation.cc +++ b/src/basic/vx_util/observation.cc @@ -10,14 +10,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_log.h" #include "vx_math.h" #include "vx_util.h" #include "observation.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ordinal.cc b/src/basic/vx_util/ordinal.cc index 7d8c98e4f4..57c917e507 100644 --- a/src/basic/vx_util/ordinal.cc +++ b/src/basic/vx_util/ordinal.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +20,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/polyline.cc b/src/basic/vx_util/polyline.cc index 88570f369d..9ffdc6bb3d 100644 --- a/src/basic/vx_util/polyline.cc +++ b/src/basic/vx_util/polyline.cc @@ -19,8 +19,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -33,6 +31,8 @@ using namespace std; #include "vx_math.h" #include "vx_util.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class Polyline diff --git a/src/basic/vx_util/python_line.cc b/src/basic/vx_util/python_line.cc index 0fd205825c..36d0c2fc67 100644 --- a/src/basic/vx_util/python_line.cc +++ b/src/basic/vx_util/python_line.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -29,6 +26,9 @@ using namespace std; #include "python_line.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/read_fortran_binary.cc b/src/basic/vx_util/read_fortran_binary.cc index 78680f707e..843f8031eb 100644 --- a/src/basic/vx_util/read_fortran_binary.cc +++ b/src/basic/vx_util/read_fortran_binary.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +23,8 @@ using namespace std; #include "check_endian.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/roman_numeral.cc b/src/basic/vx_util/roman_numeral.cc index c278179994..afa89e8891 100644 --- a/src/basic/vx_util/roman_numeral.cc +++ b/src/basic/vx_util/roman_numeral.cc @@ -7,12 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +20,8 @@ using namespace std; #include "roman_numeral.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/smart_buffer.cc b/src/basic/vx_util/smart_buffer.cc index 9645b6d773..0bd09c8029 100644 --- a/src/basic/vx_util/smart_buffer.cc +++ b/src/basic/vx_util/smart_buffer.cc @@ -1,8 +1,5 @@ - - //////////////////////////////////////////////////////////////////////// - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -11,12 +8,9 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +24,8 @@ using namespace std; #include "smart_buffer.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/string_fxns.cc b/src/basic/vx_util/string_fxns.cc index 3d17832de5..ab84446789 100644 --- a/src/basic/vx_util/string_fxns.cc +++ b/src/basic/vx_util/string_fxns.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -31,6 +27,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/substring.cc b/src/basic/vx_util/substring.cc index 8fdec968b9..b6ee3ab23d 100644 --- a/src/basic/vx_util/substring.cc +++ b/src/basic/vx_util/substring.cc @@ -7,13 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -23,6 +19,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index a5063de78f..ad35ecac09 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -7,8 +7,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static const int thresharray_alloc_inc = 10; diff --git a/src/basic/vx_util/two_to_one.cc b/src/basic/vx_util/two_to_one.cc index cb0229a350..c29aa3b741 100644 --- a/src/basic/vx_util/two_to_one.cc +++ b/src/basic/vx_util/two_to_one.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util_math/so3.cc b/src/basic/vx_util_math/so3.cc index 5e6266801d..6797d76f04 100644 --- a/src/basic/vx_util_math/so3.cc +++ b/src/basic/vx_util_math/so3.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2023 // ** University Corporation for Atmospheric Research (UCAR) @@ -11,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +21,8 @@ using namespace std; #include "fix_float.h" #include "trig.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// From b558794ac458c3e90922b3896305d62a82529064 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 22 Feb 2024 13:58:30 -0700 Subject: [PATCH 03/72] Feature #2280 ens_prob (#2823) * Per #2280, update to support probability threshold strings like ==8, where 8 is the number of ensemble members, to create probability bins centered on the n/8 for n = 0 ... 8. * Per #2280, update docs about probability threshold settings. * Per #2280, use a loose tolerance when checking for consistent bin widths. * Per #2280, add a new unit test for grid_stat to demonstrate processing the output from gen_ens_prod. * Per #2280, when verifying NMEP probability forecasts, smooth the obs data first. * Per #2280, only request STAT output for the PCT line type to match unit_grid_stat.xml and minimize the new output files. * Per #2280, update config option docs. * Per #2280, update config option docs. --- .github/workflows/testing.yml | 4 +- docs/Users_Guide/config_options.rst | 70 +++-- .../config/GridStatConfig_gen_ens_prod | 285 ++++++++++++++++++ internal/test_unit/xml/unit_grid_stat.xml | 20 +- src/basic/vx_util/thresh_array.cc | 180 +++++++---- src/basic/vx_util/thresh_array.h | 5 +- 6 files changed, 484 insertions(+), 80 deletions(-) create mode 100644 internal/test_unit/config/GridStatConfig_gen_ens_prod diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b667511b92..1fccc357fa 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -136,7 +136,7 @@ jobs: - jobid: 'job1' tests: 'ascii2nc' - jobid: 'job2' - tests: 'pb2nc madis2nc pcp_combine' + tests: 'pb2nc madis2nc pcp_combine gen_ens_prod' fail-fast: false steps: - uses: actions/checkout@v4 @@ -176,7 +176,7 @@ jobs: - jobid: 'job1' tests: 'ascii2nc_indy pb2nc_indy tc_dland tc_pairs tc_stat plot_tc tc_rmw rmw_analysis tc_diag tc_gen' - jobid: 'job2' - tests: 'met_test_scripts mode_multivar mode_graphics mtd regrid airnow gsi_tools netcdf modis series_analysis gen_ens_prod wwmca_regrid gen_vx_mask grid_weight interp_shape grid_diag grib_tables lidar2nc shift_data_plane trmm2nc aeronet wwmca_plot ioda2nc gaussian' + tests: 'met_test_scripts mode_multivar mode_graphics mtd regrid airnow gsi_tools netcdf modis series_analysis wwmca_regrid gen_vx_mask grid_weight interp_shape grid_diag grib_tables lidar2nc shift_data_plane trmm2nc aeronet wwmca_plot ioda2nc gaussian' fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index 60f81e5ef1..ec76ecf7d5 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -101,13 +101,13 @@ The configuration file language supports the following data types: the user has already determined to be 2.5 outside of MET. * "==FBIAS" for a user-specified frequency bias value. - e.g. "==FBIAS1" to automatically de-bias the data, "==FBIAS0.9" to select a low-bias threshold, or "==FBIAS1.1" to select a high-bias threshold. - This option must be used in - conjunction with a simple threshold in the other field. For example, - when "obs.cat_thresh = >5.0" and "fcst.cat_thresh = ==FBIAS1;", - MET applies the >5.0 threshold to the observations and then chooses a - forecast threshold which results in a frequency bias of 1. - The frequency bias can be any float value > 0.0. + e.g. "==FBIAS1" to automatically de-bias the data, "==FBIAS0.9" to + select a low-bias threshold, or "==FBIAS1.1" to select a high-bias + threshold. This option must be used in conjunction with a simple + threshold in the other field. For example, when "obs.cat_thresh = >5.0" + and "fcst.cat_thresh = ==FBIAS1;", MET applies the >5.0 threshold to + the observations and then chooses a forecast threshold which results in + a frequency bias of 1. The frequency bias can be any float value > 0.0. * "CDP" for climatological distribution percentile thresholds. These thresholds require that the climatological mean and standard @@ -842,32 +842,37 @@ to be verified. This dictionary may include the following entries: When set as a boolean to TRUE, it indicates that the "fcst.field" data should be treated as probabilities. For example, when verifying the - probabilistic NetCDF output of Ensemble-Stat, one could configure the - Grid-Stat or Point-Stat tools as follows: + probabilistic NetCDF output of Gen-Ens-Prod for an ensemble of size 10, + one could configure the Grid-Stat or Point-Stat tools as follows: .. code-block:: none fcst = { - field = [ { name = "APCP_24_A24_ENS_FREQ_gt0.0"; - level = "(*,*)"; - prob = TRUE; } ]; + field = [ { name = "APCP_24_A24_ENS_FREQ_gt0.0"; + level = "(*,*)"; + cat_thresh = ==10; + prob = TRUE; } ]; } Setting "prob = TRUE" indicates that the "APCP_24_A24_ENS_FREQ_gt0.0" - data should be processed as probabilities. + data should be processed as probabilities. Setting "cat_thresh = ==10" + indicates that these probabilities are derived from an ensemble with 10 + members and 11 probability bins should be defined, each centered on the + value n/10 for n = 0, 1, ... 10. When set as a dictionary, it defines the probabilistic field to be used. For example, when verifying GRIB files containing probabilistic - data, one could configure the Grid-Stat or Point-Stat tools as - follows: + data, one could configure the Grid-Stat or Point-Stat tools as follows: .. code-block:: none fcst = { - field = [ { name = "PROB"; level = "A24"; - prob = { name = "APCP"; thresh_lo = 2.54; } }, - { name = "PROB"; level = "P850"; - prob = { name = "TMP"; thresh_hi = 273; } } ]; + field = [ { name = "PROB"; level = "A24"; + prob = { name = "APCP"; thresh_lo = 2.54; } + cat_thresh = ==0.25; }, + { name = "PROB"; level = "P850"; + prob = { name = "TMP"; thresh_hi = 273; } + cat_thresh = ==0.1; } ]; } The example above selects two probabilistic fields. In both, "name" @@ -883,6 +888,31 @@ to be verified. This dictionary may include the following entries: with a range [0, 100], it will automatically rescale it to be [0, 1] before applying the probabilistic verification methods. + Probabilistic statistics in MET are derived from an Nx2 probabilistic + contingency table. The N-dimension is determined by the number of + probability bins requested. The "cat_thresh" configuration option + defines the number of and size of these probabibility bins. The bins + must include the full range of possible probability values, [0, 1]. + Since selecting bins of equal width is common, shorthand notation is + provided to do so. The following options are supported. + + * :code:`cat_thresh = [ ==0.25 ];` specifies an equal probability bin + width of 0.25 and defines 4 bins between the values 0, 0.25, 0.5, 0.75, + and 1.0. The :code:`==p` threshold may be set to any probability bin + width greater than 0 and less than 1. + + * :code:`cat_thresh = [ ==10 ];` specifies probability bins for an + ensemble of size 10 and defines 11 bins between the values -0.05, 0.05, + 0.15, ..., 0.95, and 1.05. Note that each bin is centered on the + probability value n/10, for n = 0 to 10. The :code:`==n` threshold may + be set to any integer number of ensemble members greater than 1 to + define n+1 probability bins. + + * :code:`cat_thresh = [ >=0, >=0.5, >=0.75, >=1.0 ];` explicitly + specifies the probability thresholds and defines 3 bins of unequal + width between the values 0, 0.5, 0.75, and 1.0. By convention, the + greater-than-or-equal-to (">=" or "ge") inequality type is required. + * Set "prob_as_scalar = TRUE" to override the processing of probability data. When the "prob" entry is set as a dictionary to define the field of interest, setting "prob_as_scalar = TRUE" indicates that this @@ -2047,7 +2077,7 @@ This dictionary may include the following entries: .. code-block:: none hira = { - flag = FALSE; + flag = FALSE; width = [ 2, 3, 4, 5 ]; vld_thresh = 1.0; cov_thresh = [ ==0.25 ]; diff --git a/internal/test_unit/config/GridStatConfig_gen_ens_prod b/internal/test_unit/config/GridStatConfig_gen_ens_prod new file mode 100644 index 0000000000..8893c2d5ff --- /dev/null +++ b/internal/test_unit/config/GridStatConfig_gen_ens_prod @@ -0,0 +1,285 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Grid-Stat configuration file. +// +// For additional information, please see the MET User's Guide. +// +//////////////////////////////////////////////////////////////////////////////// + +// +// Output model name to be written +// +model = "FCST"; + +// +// Output description to be written +// May be set separately in each "obs.field" entry +// +desc = "NA"; + +// +// Output observation type to be written +// +obtype = "ANALYS"; + +//////////////////////////////////////////////////////////////////////////////// + +// +// Verification grid +// May be set separately in each "field" entry +// +regrid = { + to_grid = NONE; + method = NEAREST; + width = 1; + vld_thresh = 0.5; + shape = SQUARE; +} + +//////////////////////////////////////////////////////////////////////////////// + +// +// May be set separately in each "field" entry +// +censor_thresh = []; +censor_val = []; +mpr_column = []; +mpr_thresh = []; +cat_thresh = []; +cnt_thresh = [ NA ]; +cnt_logic = UNION; +wind_thresh = [ NA ]; +wind_logic = UNION; +eclv_points = 0.05; +nc_pairs_var_name = ""; +nc_pairs_var_suffix = ""; +hss_ec_value = NA; +rank_corr_flag = FALSE; + +// +// Forecast and observation fields to be verified +// +fcst = { + + level = "(*,*)"; + cat_thresh = ==7; + prob = TRUE; + + field = [ + { name = "UGRD_Z10_ENS_FREQ_ltCDP25"; }, + { name = "UGRD_Z10_ENS_NEP_ltCDP25_NBRHD25"; }, + { name = "UGRD_Z10_ENS_NMEP_ltCDP25_NBRHD25_GAUSSIAN1"; } + ]; + +} +obs = { + + name = "UGRD"; + level = "Z10"; + cat_thresh = =0.5 ]; +} + +//////////////////////////////////////////////////////////////////////////////// + +// +// Fourier decomposition +// May be set separately in each "obs.field" entry +// +fourier = { + wave_1d_beg = []; + wave_1d_end = []; +} + +//////////////////////////////////////////////////////////////////////////////// + +// +// Gradient statistics +// May be set separately in each "obs.field" entry +// +gradient = { + dx = [ 1 ]; + dy = [ 1 ]; +} + +//////////////////////////////////////////////////////////////////////////////// + +// +// Distance Map statistics +// May be set separately in each "obs.field" entry +// +distance_map = { + baddeley_p = 2; + baddeley_max_dist = NA; + fom_alpha = 0.1; + zhu_weight = 0.5; + beta_value(n) = n * n / 2.0; +} + +//////////////////////////////////////////////////////////////////////////////// + +// +// Threshold for SEEPS p1 (Probability of being dry) +// +seeps_p1_thresh = >=0.1&&<=0.85; + +//////////////////////////////////////////////////////////////////////////////// + +// +// Statistical output types +// May be set separately in each "obs.field" entry +// +output_flag = { + fho = NONE; + ctc = NONE; + cts = NONE; + mctc = NONE; + mcts = NONE; + cnt = NONE; + sl1l2 = NONE; + sal1l2 = NONE; + vl1l2 = NONE; + val1l2 = NONE; + vcnt = NONE; + pct = STAT; + pstd = NONE; + pjc = NONE; + prc = NONE; + eclv = NONE; + nbrctc = NONE; + nbrcts = NONE; + nbrcnt = NONE; + grad = NONE; + dmap = NONE; + seeps = NONE; +} + +// +// NetCDF matched pairs output file +// May be set separately in each "obs.field" entry +// +nc_pairs_flag = FALSE; + +//////////////////////////////////////////////////////////////////////////////// + +ugrid_dataset = ""; +ugrid_max_distance_km = 30; +ugrid_coordinates_file = ""; + +//////////////////////////////////////////////////////////////////////////////// + +grid_weight_flag = NONE; +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 f70f53ad22..cc24ad21d3 100644 --- a/internal/test_unit/xml/unit_grid_stat.xml +++ b/internal/test_unit/xml/unit_grid_stat.xml @@ -11,7 +11,7 @@ ]> - + @@ -328,4 +328,22 @@ + + &MET_BIN;/grid_stat + + OUTPUT_PREFIX GEN_ENS_PROD + CLIMO_MEAN_FILE &DATA_DIR_CLIMO;/NCEP_1.0deg/cmean_1d.19790410 + CLIMO_STDEV_FILE &DATA_DIR_CLIMO;/NCEP_1.0deg/cstdv_1d.19790410 + + \ + &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_NO_CTRL_20120410_120000V.nc \ + &DATA_DIR_MODEL;/grib1/arw-tom-gep0/arw-tom-gep0_2012040912_F024.grib \ + &CONFIG_DIR;/GridStatConfig_gen_ens_prod \ + -outdir &OUTPUT_DIR;/grid_stat -v 1 + + + &OUTPUT_DIR;/grid_stat/grid_stat_GEN_ENS_PROD_240000L_20120410_120000V.stat + + + diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index 8d1fda8312..eae780063f 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -527,6 +527,33 @@ void ThreshArray::get_simple_nodes(vector &v) { } +//////////////////////////////////////////////////////////////////////// + +bool ThreshArray::equal_bin_width(double &width) const { + + // Check number of elements + if(Nelements < 2) { + width = bad_data_double; + return(false); + } + + // Initialize return values + width = t[1].get_value() - t[0].get_value(); + bool is_equal = true; + + // Check for consistent widths, ignoring the last bin + for(int i=0; i<(Nelements-2); i++) { + double cur_width = t[i+1].get_value() - t[i].get_value(); + if(!is_eq(width, cur_width, loose_tol)) { + width = bad_data_double; + is_equal = false; + break; + } + } // end for i + + return(is_equal); +} + //////////////////////////////////////////////////////////////////////// // // External utility for parsing probability thresholds. @@ -535,8 +562,6 @@ void ThreshArray::get_simple_nodes(vector &v) { ThreshArray string_to_prob_thresh(const char *s) { ThreshArray ta; - double v; - int i; // Parse the input string as a comma-separated list ta.add_css(s); @@ -545,30 +570,29 @@ ThreshArray string_to_prob_thresh(const char *s) { if(ta.n() == 1 && ta[0].get_type() == thresh_eq) { // Store the threshold value - v = ta[0].get_value(); + double v = ta[0].get_value(); // Threshold value must be between 0 and 1 - if(v <= 0 || v >=1) { + // or be an integer greater than 1 + if(v <= 0 || (v >=1 && !is_eq(nint(v), v))) { mlog << Error << "\nstring_to_prob_thresh() -> " - << "threshold value (" << v - << ") must be between 0 and 1.\n\n"; + << "the threshold string (" << s + << ") must specify a probability bin width between 0 and 1 " + << "or an integer number of ensemble members.\n\n"; exit(1); } - // Determine input precision - ConcatString cs; - const char *ptr = strchr(s, '.'); - int prec = ( ptr ? m_strlen(++ptr) : 0 ); - cs.set_precision(prec); - - // Construct list of probability thresholds using the input precision - ta.clear(); - for(i=0; i*v<1.0; i++) { - cs << cs_erase << ">=" << i*v; - ta.add(cs.c_str()); + // Define probability bins from [0, 1] with equal width + if(v > 0 && v < 1) { + const char *ptr = strchr(s, '.'); + double prec = (ptr ? m_strlen(++ptr) : 0); + ta = define_prob_bins(0.0, 1.0, v, prec); + } + // Define ensemble probability bins + else { + double inc = 1.0/nint(v); + ta = define_prob_bins(-inc/2.0, 1.0+inc/2.0, inc, bad_data_int); } - cs << cs_erase << ">=" << 1.0; - ta.add(cs.c_str()); } // Check probability thresholds @@ -577,6 +601,39 @@ ThreshArray string_to_prob_thresh(const char *s) { return(ta); } +//////////////////////////////////////////////////////////////////////// + +ThreshArray define_prob_bins(double beg, double end, double inc, int prec) { + ThreshArray ta; + double v; + + // Check inputs + if(beg > 0 || end < 1 || inc <= 0 || + (!is_bad_data(prec) && prec < 0)) { + mlog << Error << "\nget_prob_bins() -> " + << "the probability thresholds must begin (" + << beg << ") <= 0 and end (" + << end << ") >= 1 with an increment (" + << inc << ") between 0 and 1 and precision (" + << prec << ") >= 0.\n\n"; + exit(1); + } + + // Set the specified precision + ConcatString cs; + if(!is_bad_data(prec)) cs.set_precision(prec); + + // Construct a list of probability thresholds + v = beg; + while(v <= end) { + cs << cs_erase << ">=" << v; + ta.add(cs.c_str()); + v += inc; + } + + return(ta); +} + //////////////////////////////////////////////////////////////////////// // // Convert array of probability thresholds to a string. @@ -584,47 +641,51 @@ ThreshArray string_to_prob_thresh(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString prob_thresh_to_string(const ThreshArray &ta) { - ConcatString s; + ConcatString cs; ThreshArray prob_ta; - bool status = true; + double w; // Check for probability thresholds - if(!check_prob_thresh(ta, false)) status = false; + if(check_prob_thresh(ta, false)) { - // Use the second threshold to construct a probability threshold array - // and check for equality - if(status) { - s << "==" << ta[1].get_value(); - prob_ta = string_to_prob_thresh(s.c_str()); - status = (ta == prob_ta); + // Check for equal bin widths + if(ta.equal_bin_width(w)) { + if(is_eq(ta[0].get_value(), 0.0) && + is_eq(ta[(ta.n() - 1)].get_value(), 1.0)) { + cs << "==" << w; + } + else { + cs << "==" << nint(1/w); + } + prob_ta = string_to_prob_thresh(cs.c_str()); + if(!(ta == prob_ta)) cs.clear(); + } } - // If not an array of probabilities, return comma-separated string - if(!status) s = ta.get_str(); + // Return comma-separated list of thresholds + if(cs.length() == 0) cs = ta.get_str(); - return(s); + return(cs); } //////////////////////////////////////////////////////////////////////// bool check_prob_thresh(const ThreshArray &ta, bool error_out) { - int i, n; - n = ta.n(); + const char * method_name = "check_prob_thresh() -> "; - // Check for at least 3 thresholds beginning with 0 and ending with 1. - if(n < 3 || - !is_eq(ta[0].get_value(), 0.0) || - !is_eq(ta[n-1].get_value(), 1.0)) { + int n = ta.n(); + // Check for at least 3 thresholds that include the range [0, 1] + if(n < 3 || ta[0].get_value() > 0 || ta[n-1].get_value() < 1) { if(error_out) { - mlog << Error << "\ncheck_prob_thresh() -> " - << "When verifying a probability field, you must " - << "select at least 3 thresholds beginning with 0.0 " - << "and ending with 1.0 (current setting: " - << ta.get_str() << ").\n" - << "Consider using the ==p shorthand notation for bins " - << "of equal width.\n\n"; + mlog << Error << "\n" << method_name + << "when verifying a probability field, you must " + << "select at least 3 thresholds which include the range [0, 1] " + << "(current setting: " << ta.get_str() << ").\n" + << "Consider using the \"==n\" shorthand notation to specify " + << "probability bins of equal width, for n < 1, or the integer " + << "number of ensemble members, for n > 1.\n\n"; exit(1); } else { @@ -632,18 +693,20 @@ bool check_prob_thresh(const ThreshArray &ta, bool error_out) { } } - for(i=0; i " - << "When verifying a probability field, all " + mlog << Error << "\n" << method_name + << "when verifying a probability field, all " << "thresholds must be greater than or equal to, " << "using \"ge\" or \">=\" (current setting: " << ta.get_str() << ").\n" - << "Consider using the ==p shorthand notation for bins " - << "of equal width.\n\n"; + << "Consider using the \"==n\" shorthand notation to specify " + << "probability bins of equal width, for n < 1, or the integer " + << "number of ensemble members, for n > 1.\n\n"; exit(1); } else { @@ -651,15 +714,20 @@ bool check_prob_thresh(const ThreshArray &ta, bool error_out) { } } - // Check that all thresholds are in [0, 1]. - if(ta[i].get_value() < 0.0 || ta[i].get_value() > 1.0) { + // Break out of the last loop + if(i+1 == n) break; + + // Check that all probability bins overlap with [0, 1] + if((ta[i].get_value() < 0 && ta[i+1].get_value() < 0) || + (ta[i].get_value() > 1 && ta[i+1].get_value() > 1)) { if(error_out) { - mlog << Error << "\ncheck_prob_thresh() -> " - << "When verifying a probability field, all thresholds " - << "must be between 0 and 1 (current setting: " + mlog << Error << "\n" << method_name + << "when verifying a probability field, each probability bin " + << "must overlap the range [0, 1] (current setting: " << ta.get_str() << ").\n" - << "Consider using the ==p shorthand notation for bins " - << "of equal width.\n\n"; + << "Consider using the \"==n\" shorthand notation to specify " + << "probability bins of equal width, for n < 1, or the integer " + << "number of ensemble members, for n > 1.\n\n"; exit(1); } else { diff --git a/src/basic/vx_util/thresh_array.h b/src/basic/vx_util/thresh_array.h index f4fe0c4336..4ad5cf5146 100644 --- a/src/basic/vx_util/thresh_array.h +++ b/src/basic/vx_util/thresh_array.h @@ -87,6 +87,8 @@ class ThreshArray { bool check_dbl(double) const; bool check_dbl(double, double, double) const; + + bool equal_bin_width(double &) const; }; //////////////////////////////////////////////////////////////////////// @@ -99,7 +101,8 @@ inline SingleThresh * ThreshArray::buf() const { return ( t ); //////////////////////////////////////////////////////////////////////// extern ThreshArray string_to_prob_thresh (const char *); -extern ConcatString prob_thresh_to_string (const ThreshArray &); +extern ConcatString prob_thresh_to_string (const ThreshArray &); +extern ThreshArray define_prob_bins (double, double, double, int); extern bool check_prob_thresh (const ThreshArray &, bool error_out = true); extern ThreshArray process_perc_thresh_bins (const ThreshArray &); extern ThreshArray process_rps_cdp_thresh (const ThreshArray &); From 7f513ebb270578e3958f61c2a3c9113161360bce Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 27 Feb 2024 15:58:51 +0000 Subject: [PATCH 04/72] #2673 Change 0 to nullptr --- src/basic/enum_to_string/enum_to_string.cc | 6 ++-- src/basic/enum_to_string/scope.cc | 12 ++++---- src/basic/vx_config/celltype_to_string.cc | 2 +- src/basic/vx_config/grdfiletype_to_string.cc | 2 +- src/basic/vx_config/icode.cc | 14 ++++----- src/basic/vx_config/idstack.cc | 12 ++++---- src/basic/vx_config/number_stack.cc | 6 ++-- src/basic/vx_config/threshold.cc | 28 ++++++++--------- src/basic/vx_log/logger.cc | 4 +-- src/basic/vx_log/str_wrappers.cc | 2 +- src/basic/vx_math/hist.cc | 6 ++-- src/basic/vx_math/legendre.cc | 4 +-- src/basic/vx_math/ptile.cc | 8 ++--- src/basic/vx_math/viewgravity_to_string.cc | 2 +- src/basic/vx_util/ascii_table.cc | 4 +-- src/basic/vx_util/asciitablejust_to_string.cc | 2 +- src/basic/vx_util/command_line.cc | 10 +++---- src/basic/vx_util/crr_array.h | 8 ++--- src/basic/vx_util/data_line.cc | 10 +++---- src/basic/vx_util/data_plane.cc | 30 +++++++++---------- src/basic/vx_util/get_filenames.cc | 6 ++-- src/basic/vx_util/interp_util.cc | 10 +++---- src/basic/vx_util/is_number.cc | 4 +-- src/basic/vx_util/long_array.cc | 10 +++---- src/basic/vx_util/make_path.cc | 4 +-- src/basic/vx_util/ncrr_array.h | 14 ++++----- src/basic/vx_util/num_array.cc | 12 ++++---- src/basic/vx_util/ordinal.cc | 2 +- src/basic/vx_util/polyline.cc | 18 +++++------ src/basic/vx_util/thresh_array.cc | 10 +++---- src/basic/vx_util/two_d_array.h | 4 +-- 31 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/basic/enum_to_string/enum_to_string.cc b/src/basic/enum_to_string/enum_to_string.cc index 7760d47c26..1eb8fb1ae6 100644 --- a/src/basic/enum_to_string/enum_to_string.cc +++ b/src/basic/enum_to_string/enum_to_string.cc @@ -47,10 +47,10 @@ using namespace std; extern int yyparse(); // extern FILE * yyin; -FILE * yyin = 0; +FILE * yyin = nullptr; // extern char * yytext; -char * yytext = 0; +char * yytext = nullptr; extern int yydebug; @@ -90,7 +90,7 @@ bool do_reverse = false; bool verbose = true; -const char * program_name = (const char *) 0; +const char * program_name = (const char *) nullptr; //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/enum_to_string/scope.cc b/src/basic/enum_to_string/scope.cc index fc69bddf92..0d3f4ad5dd 100644 --- a/src/basic/enum_to_string/scope.cc +++ b/src/basic/enum_to_string/scope.cc @@ -38,7 +38,7 @@ ScopeStackElement::ScopeStackElement() { -Name = (const char *) 0; +Name = (const char *) nullptr; clear(); @@ -64,7 +64,7 @@ ScopeStackElement::ScopeStackElement(const ScopeStackElement & e) { -Name = (const char *) 0; +Name = (const char *) nullptr; assign(e); @@ -116,7 +116,7 @@ void ScopeStackElement::clear() Level = 0; -if ( Name ) { delete [] Name; Name = (const char *) 0; } +if ( Name ) { delete [] Name; Name = (const char *) nullptr; } return; @@ -131,12 +131,12 @@ void ScopeStackElement::set_name(const char * text) { const char *method_name = "void ScopeStackElement::set_name(const char *) -> "; -if ( Name ) { delete [] Name; Name = (const char *) 0; } +if ( Name ) { delete [] Name; Name = (const char *) nullptr; } if ( !text ) return; int k; -char * c = (char *) 0; +char * c = (char *) nullptr; k = m_strlen(text); @@ -154,7 +154,7 @@ m_strncpy(c, text, k, method_name); c[k] = (char) 0; // just to make sure -Name = (const char *) c; c = (char *) 0; +Name = (const char *) c; c = (char *) nullptr; return; diff --git a/src/basic/vx_config/celltype_to_string.cc b/src/basic/vx_config/celltype_to_string.cc index 226f8c50c7..32476474c2 100644 --- a/src/basic/vx_config/celltype_to_string.cc +++ b/src/basic/vx_config/celltype_to_string.cc @@ -39,7 +39,7 @@ ConcatString celltype_to_string(const CellType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_config/grdfiletype_to_string.cc b/src/basic/vx_config/grdfiletype_to_string.cc index e6f5b11b89..3a95b3eb1b 100644 --- a/src/basic/vx_config/grdfiletype_to_string.cc +++ b/src/basic/vx_config/grdfiletype_to_string.cc @@ -39,7 +39,7 @@ ConcatString grdfiletype_to_string(const GrdFileType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_config/icode.cc b/src/basic/vx_config/icode.cc index 0b5dfa631d..26aa274458 100644 --- a/src/basic/vx_config/icode.cc +++ b/src/basic/vx_config/icode.cc @@ -114,9 +114,9 @@ d = 0.0; type = no_cell_type; -name = (char *) 0; +name = (char *) nullptr; -text = (char *) 0; +text = (char *) nullptr; e = 0; @@ -596,7 +596,7 @@ void IcodeVector::init_from_scratch() { -Cell = (IcodeCell *) 0; +Cell = (IcodeCell *) nullptr; Ncells = Nalloc = 0; @@ -1155,7 +1155,7 @@ ICVStack::ICVStack() { -for (int j=0; j n ) return; int k; -Identifier * inew = (Identifier *) 0; +Identifier * inew = (Identifier *) nullptr; k = n/id_array_jump; @@ -507,9 +507,9 @@ if ( !inew ) { for (int j=0; jabbr_s << thresh_abbr_str[ind] << t; node = a; -a = 0; +a = nullptr; return; @@ -1527,7 +1527,7 @@ a->abbr_s << thresh_abbr_str[ind] << cs; node = a; -a = 0; +a = nullptr; return; @@ -1565,7 +1565,7 @@ a->set_na(); node = a; -a = 0; +a = nullptr; return; diff --git a/src/basic/vx_log/logger.cc b/src/basic/vx_log/logger.cc index 50199434c6..281d13cb47 100644 --- a/src/basic/vx_log/logger.cc +++ b/src/basic/vx_log/logger.cc @@ -438,7 +438,7 @@ Logger & Logger::operator=(const Logger & l) void Logger::init_from_scratch() { - out = (ofstream *) 0; + out = (ofstream *) nullptr; clear(); @@ -458,7 +458,7 @@ void Logger::clear() delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } diff --git a/src/basic/vx_log/str_wrappers.cc b/src/basic/vx_log/str_wrappers.cc index 0f58d0ab86..d0eb8b5922 100644 --- a/src/basic/vx_log/str_wrappers.cc +++ b/src/basic/vx_log/str_wrappers.cc @@ -49,7 +49,7 @@ void m_strcpy(char *to_str, const char *from_str, const char *method_name, // to_string should not allocated. This allocates and return to_str after copying char *m_strcpy2(const char *from_str, const char *method_name, const char *extra_msg) { - char *to_str = (char *) 0; + char *to_str = (char *) nullptr; if (from_str) { int str_len = m_strlen(from_str); diff --git a/src/basic/vx_math/hist.cc b/src/basic/vx_math/hist.cc index fb3cfa52c6..067a848013 100644 --- a/src/basic/vx_math/hist.cc +++ b/src/basic/vx_math/hist.cc @@ -52,7 +52,7 @@ Histogram::~Histogram() { -if ( Count ) { delete [] Count; Count = (int *) 0; } +if ( Count ) { delete [] Count; Count = (int *) nullptr; } } @@ -94,7 +94,7 @@ void Histogram::init_from_scratch() { -Count = (int *) 0; +Count = (int *) nullptr; Nbins = 0; @@ -143,7 +143,7 @@ void Histogram::set_nbd(int n, double b, double d) { -if ( Count ) { delete [] Count; Count = (int *) 0; } +if ( Count ) { delete [] Count; Count = (int *) nullptr; } Nbins = n; diff --git a/src/basic/vx_math/legendre.cc b/src/basic/vx_math/legendre.cc index 6d1b87317c..7ba2c696e6 100644 --- a/src/basic/vx_math/legendre.cc +++ b/src/basic/vx_math/legendre.cc @@ -139,9 +139,9 @@ void Legendre::clear() { -if ( P ) { delete [] P; P = 0; } +if ( P ) { delete [] P; P = nullptr; } -if ( PP ) { delete [] PP; PP = 0; } +if ( PP ) { delete [] PP; PP = nullptr; } X = 0.0; diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 31d3152284..c80051ac79 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -215,8 +215,8 @@ if ( n <= 1 ) return(0); int i, j, ties_current, ties_total, tie_rank_start = 0, tie_rank_end; double tie_rank_mean; -RankInfo *rank_info = (RankInfo *) 0; -double *ordered_array = (double *) 0; +RankInfo *rank_info = (RankInfo *) nullptr; +double *ordered_array = (double *) nullptr; double prev_v, v; rank_info = new RankInfo [n]; @@ -296,8 +296,8 @@ if(ties_current != 0) { } } -if(rank_info) { delete [] rank_info; rank_info = (RankInfo *) 0; } -if(ordered_array) { delete [] ordered_array; ordered_array = (double *) 0; } +if(rank_info) { delete [] rank_info; rank_info = (RankInfo *) nullptr; } +if(ordered_array) { delete [] ordered_array; ordered_array = (double *) nullptr; } return(ties_total); diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc index 9a7034fbcf..1363a26679 100644 --- a/src/basic/vx_math/viewgravity_to_string.cc +++ b/src/basic/vx_math/viewgravity_to_string.cc @@ -39,7 +39,7 @@ ConcatString viewgravity_to_string(const ViewGravity t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_util/ascii_table.cc b/src/basic/vx_util/ascii_table.cc index ff70dff926..db58781ba1 100644 --- a/src/basic/vx_util/ascii_table.cc +++ b/src/basic/vx_util/ascii_table.cc @@ -1022,7 +1022,7 @@ fix_float(str); if ( DoCommaString ) { char junk[256]; m_strncpy(junk, str.c_str(), str.length(), method_name); - char * p = (char *) 0; + char * p = (char *) nullptr; long X; ConcatString s; ConcatString j2; @@ -1248,7 +1248,7 @@ s = out; // done // -if ( out ) { delete [] out; out = (char *) 0; } +if ( out ) { delete [] out; out = (char *) nullptr; } return ( s ); diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc index 50fbf4387e..6c378d863e 100644 --- a/src/basic/vx_util/asciitablejust_to_string.cc +++ b/src/basic/vx_util/asciitablejust_to_string.cc @@ -39,7 +39,7 @@ ConcatString asciitablejust_to_string(const AsciiTableJust t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/basic/vx_util/command_line.cc b/src/basic/vx_util/command_line.cc index 2063d37d51..7911439c79 100644 --- a/src/basic/vx_util/command_line.cc +++ b/src/basic/vx_util/command_line.cc @@ -234,7 +234,7 @@ void CLOptionInfoArray::init_from_scratch() { -e = (CLOptionInfo *) 0; +e = (CLOptionInfo *) nullptr; AllocInc = 16; // default value @@ -252,7 +252,7 @@ void CLOptionInfoArray::clear() { -if ( e ) { delete [] e; e = (CLOptionInfo *) 0; } +if ( e ) { delete [] e; e = (CLOptionInfo *) nullptr; } @@ -298,7 +298,7 @@ if ( n <= Nalloc ) return; n = AllocInc*( (n + AllocInc - 1)/AllocInc ); int j; -CLOptionInfo * u = (CLOptionInfo *) 0; +CLOptionInfo * u = (CLOptionInfo *) nullptr; u = new CLOptionInfo [n]; @@ -317,11 +317,11 @@ for(j=0; j::init_from_scratch() { -e = (T *) 0; +e = (T *) nullptr; AllocInc = 25; // default value @@ -130,7 +130,7 @@ void CRR_Array::clear() { -if ( e ) { delete [] e; e = (T *) 0; } +if ( e ) { delete [] e; e = (T *) nullptr; } @@ -201,11 +201,11 @@ for(j=0; jclose(); - delete in; in = (ifstream *) 0; + delete in; in = (ifstream *) nullptr; } diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index a46cb4664d..d9977f7a92 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -1303,10 +1303,10 @@ void DataPlaneArray::init_from_scratch() { -Lower = (double *) 0; -Upper = (double *) 0; +Lower = (double *) nullptr; +Upper = (double *) nullptr; -Plane = (DataPlane **) 0; +Plane = (DataPlane **) nullptr; Nplanes = 0; @@ -1330,11 +1330,11 @@ if ( Nplanes > 0 ) { for (j=0; j= n ) return; int j, k; -DataPlane ** p = (DataPlane **) 0; -double * b = (double *) 0; -double * t = (double *) 0; +DataPlane ** p = (DataPlane **) nullptr; +double * b = (double *) nullptr; +double * t = (double *) nullptr; if ( ! exact ) { @@ -1411,7 +1411,7 @@ t = new double [n]; for (j=0; j::init_from_scratch() { -e = (T **) 0; +e = (T **) nullptr; AllocInc = ncrr_default_alloc_inc; @@ -158,11 +158,11 @@ if ( e ) { for (j=0; j::bubble_sort_decreasing(ncrr_cmp_func _cmp) if ( Nelements < 2 ) return; int j, k; -T * temp = 0; +T * temp = nullptr; for (j=0; j<(Nelements - 1); ++j) { diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index 20632a8978..c4d16f078a 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -642,9 +642,9 @@ int NumArray::rank_array(int &ties) int n_vld, i; - double *data = (double *) 0; - int *data_loc = (int *) 0; - double *data_rank = (double *) 0; + double *data = (double *) nullptr; + int *data_loc = (int *) nullptr; + double *data_rank = (double *) nullptr; // // Arrays to store the raw data values to be ranked, their locations, @@ -690,9 +690,9 @@ int NumArray::rank_array(int &ties) // // Deallocate memory // - if(data) { delete [] data; data = (double *) 0; } - if(data_loc) { delete [] data_loc; data_loc = (int *) 0; } - if(data_rank) { delete [] data_rank; data_rank = (double *) 0; } + if(data) { delete [] data; data = (double *) nullptr; } + if(data_loc) { delete [] data_loc; data_loc = (int *) nullptr; } + if(data_rank) { delete [] data_rank; data_rank = (double *) nullptr; } Sorted = false; diff --git a/src/basic/vx_util/ordinal.cc b/src/basic/vx_util/ordinal.cc index ef8bf4ab1e..66d8417952 100644 --- a/src/basic/vx_util/ordinal.cc +++ b/src/basic/vx_util/ordinal.cc @@ -74,7 +74,7 @@ if ( (n >= 10) && (n <= 20) ) { m_strcpy(out, th, method_name, "out1"); retur n %= 10; -const char * ans = (const char *) 0; +const char * ans = (const char *) nullptr; switch ( n ) { diff --git a/src/basic/vx_util/polyline.cc b/src/basic/vx_util/polyline.cc index 3ae48006f8..aa75ecda94 100644 --- a/src/basic/vx_util/polyline.cc +++ b/src/basic/vx_util/polyline.cc @@ -40,7 +40,7 @@ using namespace std; /////////////////////////////////////////////////////////////////////////////// Polyline::Polyline() { - u = v = (double *) 0; + u = v = (double *) nullptr; clear(); } @@ -55,7 +55,7 @@ Polyline::~Polyline() { /////////////////////////////////////////////////////////////////////////////// Polyline::Polyline(const Polyline &c) { - u = v = (double *) 0; + u = v = (double *) nullptr; assign(c); } @@ -75,8 +75,8 @@ Polyline & Polyline::operator=(const Polyline &c) { void Polyline::clear() { - if(u) { delete [] u; u = (double *) 0; } - if(v) { delete [] v; v = (double *) 0; } + if(u) { delete [] u; u = (double *) nullptr; } + if(v) { delete [] v; v = (double *) nullptr; } n_points = n_alloc = 0; @@ -203,8 +203,8 @@ void Polyline::extend_points(int n) { } int i; - double *uu = (double *) 0; - double *vv = (double *) 0; + double *uu = (double *) nullptr; + double *vv = (double *) nullptr; uu = new double [n]; vv = new double [n]; @@ -222,13 +222,13 @@ void Polyline::extend_points(int n) { vv[i] = v[i]; } - delete [] u; u = (double *) 0; - delete [] v; v = (double *) 0; + delete [] u; u = (double *) nullptr; + delete [] v; v = (double *) nullptr; u = uu; v = vv; - uu = vv = (double *) 0; + uu = vv = (double *) nullptr; return; } diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index eae780063f..2eb7f07e67 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -65,7 +65,7 @@ ThreshArray & ThreshArray::operator=(const ThreshArray & a) { void ThreshArray::init_from_scratch() { - t = (SingleThresh *) 0; + t = (SingleThresh *) nullptr; clear(); @@ -76,7 +76,7 @@ void ThreshArray::init_from_scratch() { void ThreshArray::clear() { - if(t) { delete [] t; t = (SingleThresh *) 0; } + if(t) { delete [] t; t = (SingleThresh *) nullptr; } Nelements = Nalloc = 0; @@ -134,17 +134,17 @@ void ThreshArray::extend(int n, bool exact) { n = k*thresharray_alloc_inc; } - SingleThresh *u = (SingleThresh *) 0; + SingleThresh *u = (SingleThresh *) nullptr; u = new SingleThresh [n]; if(t) { for(j=0; j::init_from_scratch() { -E = (T *) 0; +E = (T *) nullptr; clear(); @@ -133,7 +133,7 @@ void TwoD_Array::clear() { -if ( E ) { delete [] E; E = (T *) 0; } +if ( E ) { delete [] E; E = (T *) nullptr; } Nx = Ny = 0; From 7483636985decd60e028e9bd79d26da2710a6299 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 27 Feb 2024 16:52:00 +0000 Subject: [PATCH 05/72] #2673 Change 0 to nullptr --- src/libcode/vx_afm/afm.cc | 84 +++++++++---------- src/libcode/vx_afm/afmkeyword_to_string.cc | 2 +- src/libcode/vx_afm/afmtokentype_to_string.cc | 2 +- .../vx_analysis_util/analysis_utils.cc | 2 +- src/libcode/vx_analysis_util/mode_atts.cc | 8 +- src/libcode/vx_analysis_util/mode_job.cc | 20 ++--- src/libcode/vx_analysis_util/mode_line.cc | 8 +- src/libcode/vx_analysis_util/stat_job.cc | 42 +++++----- src/libcode/vx_analysis_util/stat_line.cc | 2 +- src/libcode/vx_analysis_util/time_series.cc | 4 +- src/libcode/vx_bool_calc/bool_calc.cc | 8 +- src/libcode/vx_bool_calc/token_stack.cc | 8 +- src/libcode/vx_bool_calc/tokenizer.cc | 4 +- src/libcode/vx_color/color_list.cc | 10 +-- src/libcode/vx_color/color_table.cc | 22 ++--- src/libcode/vx_data2d/data_class.cc | 12 +-- src/libcode/vx_data2d/leveltype_to_string.cc | 2 +- .../vx_data2d_factory/data2d_factory.cc | 8 +- src/libcode/vx_data2d_grib/data2d_grib.cc | 4 +- .../vx_data2d_grib/data2d_grib_utils.cc | 2 +- src/libcode/vx_data2d_grib/grib_classes.cc | 50 +++++------ src/libcode/vx_data2d_grib/grib_strings.cc | 4 +- src/libcode/vx_data2d_grib2/data2d_grib2.cc | 4 +- src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc | 4 +- src/libcode/vx_data2d_nc_met/data2d_nc_met.cc | 6 +- src/libcode/vx_data2d_nc_met/get_met_grid.cc | 2 +- src/libcode/vx_data2d_nc_met/met_file.cc | 16 ++-- .../vx_data2d_nc_met/var_info_nc_met.cc | 5 +- src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc | 8 +- .../vx_data2d_nc_wrf/var_info_nc_wrf.cc | 5 +- src/libcode/vx_data2d_nc_wrf/wrf_file.cc | 22 ++--- src/libcode/vx_data2d_python/data2d_python.cc | 6 +- .../vx_data2d_python/grid_from_python_dict.cc | 14 ++-- src/libcode/vx_gis/shapetype_to_string.cc | 2 +- src/libcode/vx_gis/shp_array.h | 8 +- src/libcode/vx_grid/find_grid_by_name.cc | 28 +++---- src/libcode/vx_grid/lc_grid.cc | 8 +- src/libcode/vx_grid/merc_grid.cc | 8 +- src/libcode/vx_grid/semilatlon_grid.cc | 4 +- src/libcode/vx_grid/st_grid.cc | 8 +- src/libcode/vx_gsl_prob/gsl_randist.cc | 20 ++--- src/libcode/vx_gsl_prob/gsl_statistics.cc | 4 +- src/libcode/vx_gsl_prob/gsl_wavelet2d.cc | 8 +- 43 files changed, 252 insertions(+), 246 deletions(-) diff --git a/src/libcode/vx_afm/afm.cc b/src/libcode/vx_afm/afm.cc index e40ac65256..97ff1e20d9 100644 --- a/src/libcode/vx_afm/afm.cc +++ b/src/libcode/vx_afm/afm.cc @@ -253,9 +253,9 @@ void LigatureInfo::init_from_scratch() { -successor_name = (char *) 0; +successor_name = (char *) nullptr; -ligature_name = (char *) 0; +ligature_name = (char *) nullptr; clear(); @@ -273,9 +273,9 @@ void LigatureInfo::clear() { -if ( successor_name ) { delete [] successor_name; successor_name = (char *) 0; } +if ( successor_name ) { delete [] successor_name; successor_name = (char *) nullptr; } -if ( ligature_name ) { delete [] ligature_name; ligature_name = (char *) 0; } +if ( ligature_name ) { delete [] ligature_name; ligature_name = (char *) nullptr; } successor_index = ligature_index = -1; @@ -424,9 +424,9 @@ void AfmCharMetrics::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; -linfo = (LigatureInfo *) 0; +linfo = (LigatureInfo *) nullptr; clear(); @@ -443,9 +443,9 @@ void AfmCharMetrics::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( linfo ) { delete [] linfo; linfo = (LigatureInfo *) 0; } +if ( linfo ) { delete [] linfo; linfo = (LigatureInfo *) nullptr; } ascii_code = -1; @@ -622,7 +622,7 @@ void PCC::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; clear(); @@ -638,7 +638,7 @@ void PCC::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } delta_x = 0; @@ -762,9 +762,9 @@ void AfmCompositeInfo::init_from_scratch() { -name = (char *) 0; +name = (char *) nullptr; -pcc = (PCC *) 0; +pcc = (PCC *) nullptr; clear(); @@ -780,9 +780,9 @@ void AfmCompositeInfo::clear() { -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( pcc ) { delete [] pcc; pcc = (PCC *) 0; } +if ( pcc ) { delete [] pcc; pcc = (PCC *) nullptr; } n_parts = 0; @@ -926,9 +926,9 @@ void KPX::init_from_scratch() { -name1 = (char *) 0; +name1 = (char *) nullptr; -name2 = (char *) 0; +name2 = (char *) nullptr; clear(); @@ -946,8 +946,8 @@ void KPX::clear() { -if ( name1 ) { delete [] name1; name1 = (char *) 0; } -if ( name2 ) { delete [] name2; name2 = (char *) 0; } +if ( name1 ) { delete [] name1; name1 = (char *) nullptr; } +if ( name2 ) { delete [] name2; name2 = (char *) nullptr; } dx = 0.0; @@ -1069,22 +1069,22 @@ void Afm::init_from_scratch() { -in = (ifstream *) 0; +in = (ifstream *) nullptr; -cm = (AfmCharMetrics *) 0; +cm = (AfmCharMetrics *) nullptr; -FontName = (char *) 0; -FullName = (char *) 0; -FamilyName = (char *) 0; -Weight = (char *) 0; -Version = (char *) 0; -EncodingScheme = (char *) 0; +FontName = (char *) nullptr; +FullName = (char *) nullptr; +FamilyName = (char *) nullptr; +Weight = (char *) nullptr; +Version = (char *) nullptr; +EncodingScheme = (char *) nullptr; -compinfo = (AfmCompositeInfo *) 0; +compinfo = (AfmCompositeInfo *) nullptr; -kpx = (KPX *) 0; +kpx = (KPX *) nullptr; @@ -1104,28 +1104,28 @@ void Afm::clear() { -if ( in ) { delete in; in = (ifstream *) 0; } +if ( in ) { delete in; in = (ifstream *) nullptr; } line_number = 0; -if ( FontName ) { delete [] FontName; FontName = (char *) 0; } -if ( FullName ) { delete [] FullName; FullName = (char *) 0; } -if ( FamilyName ) { delete [] FamilyName; FamilyName = (char *) 0; } -if ( Weight ) { delete [] Weight; Weight = (char *) 0; } -if ( Version ) { delete [] Version; Version = (char *) 0; } -if ( EncodingScheme ) { delete [] EncodingScheme; EncodingScheme = (char *) 0; } +if ( FontName ) { delete [] FontName; FontName = (char *) nullptr; } +if ( FullName ) { delete [] FullName; FullName = (char *) nullptr; } +if ( FamilyName ) { delete [] FamilyName; FamilyName = (char *) nullptr; } +if ( Weight ) { delete [] Weight; Weight = (char *) nullptr; } +if ( Version ) { delete [] Version; Version = (char *) nullptr; } +if ( EncodingScheme ) { delete [] EncodingScheme; EncodingScheme = (char *) nullptr; } -if ( cm ) { delete [] cm; cm = (AfmCharMetrics *) 0; } +if ( cm ) { delete [] cm; cm = (AfmCharMetrics *) nullptr; } n_cms = 0; -if ( compinfo ) { delete [] compinfo; compinfo = (AfmCompositeInfo *) 0; } +if ( compinfo ) { delete [] compinfo; compinfo = (AfmCompositeInfo *) nullptr; } n_composites = 0; -if ( kpx ) { delete [] kpx; kpx = (KPX *) 0; } +if ( kpx ) { delete [] kpx; kpx = (KPX *) nullptr; } n_kern_pairs = 0; @@ -1443,7 +1443,7 @@ for (j=0; jclose(); -delete in; in = (ifstream *) 0; +delete in; in = (ifstream *) nullptr; line_number = 0; @@ -2231,8 +2231,8 @@ if ( ascii_code_2 < 0 ) ascii_code_2 += 256; int j; int cm_index_1, cm_index_2; -const char * n1 = (const char *) 0; -const char * n2 = (const char *) 0; +const char * n1 = (const char *) nullptr; +const char * n2 = (const char *) nullptr; cm_index_1 = lookup_cm(ascii_code_1); cm_index_2 = lookup_cm(ascii_code_2); @@ -2279,7 +2279,7 @@ void set_string(char * & s, const char * text) { -if ( s ) { delete [] s; s = (char *) 0; } +if ( s ) { delete [] s; s = (char *) nullptr; } if ( !text ) return; diff --git a/src/libcode/vx_afm/afmkeyword_to_string.cc b/src/libcode/vx_afm/afmkeyword_to_string.cc index 2f0bc4ebeb..f2e6d2be89 100644 --- a/src/libcode/vx_afm/afmkeyword_to_string.cc +++ b/src/libcode/vx_afm/afmkeyword_to_string.cc @@ -39,7 +39,7 @@ ConcatString afmkeyword_to_string(const AfmKeyword t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_afm/afmtokentype_to_string.cc b/src/libcode/vx_afm/afmtokentype_to_string.cc index c08fb62f19..02023ee560 100644 --- a/src/libcode/vx_afm/afmtokentype_to_string.cc +++ b/src/libcode/vx_afm/afmtokentype_to_string.cc @@ -39,7 +39,7 @@ ConcatString afmtokentype_to_string(const AfmTokenType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_analysis_util/analysis_utils.cc b/src/libcode/vx_analysis_util/analysis_utils.cc index c0c079cec3..be09c352c2 100644 --- a/src/libcode/vx_analysis_util/analysis_utils.cc +++ b/src/libcode/vx_analysis_util/analysis_utils.cc @@ -56,7 +56,7 @@ while((c = strtok_r(L, delim, &temp_ptr)) != nullptr) { // done // -if ( L ) { delete [] L; L = (char *) 0; } +if ( L ) { delete [] L; L = (char *) nullptr; } return ( a ); diff --git a/src/libcode/vx_analysis_util/mode_atts.cc b/src/libcode/vx_analysis_util/mode_atts.cc index e63d661549..622a167d37 100644 --- a/src/libcode/vx_analysis_util/mode_atts.cc +++ b/src/libcode/vx_analysis_util/mode_atts.cc @@ -97,7 +97,7 @@ void ModeAttributes::init_from_scratch() { -poly = (MaskPoly *) 0; +poly = (MaskPoly *) nullptr; clear(); @@ -408,7 +408,7 @@ interest_max_set = 0; interest_max = 0.0; -if ( poly ) { delete poly; poly =(MaskPoly *) 0; } +if ( poly ) { delete poly; poly =(MaskPoly *) nullptr; } return; @@ -1356,7 +1356,7 @@ int ModeAttributes::is_keeper(const ModeLine & L) const int i; double x; unixtime t; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; // @@ -1923,7 +1923,7 @@ void ModeAttributes::parse_command_line(StringArray & a) { int j; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; j = 0; diff --git a/src/libcode/vx_analysis_util/mode_job.cc b/src/libcode/vx_analysis_util/mode_job.cc index b2e0b1339f..736379d6c9 100644 --- a/src/libcode/vx_analysis_util/mode_job.cc +++ b/src/libcode/vx_analysis_util/mode_job.cc @@ -107,11 +107,11 @@ void BasicModeAnalysisJob::init_from_scratch() { -accums = (NumArray *) 0; +accums = (NumArray *) nullptr; -dumpfile = (ostream *) 0; // don't delete +dumpfile = (ostream *) nullptr; // don't delete -outfile = (ostream *) 0; // don't delete +outfile = (ostream *) nullptr; // don't delete clear(); @@ -133,16 +133,16 @@ atts.clear(); columns.clear(); -if ( accums ) { delete [] accums; accums = (NumArray *) 0; } +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; -dumpfile = (ostream *) 0; // don't delete +dumpfile = (ostream *) nullptr; // don't delete -outfile = (ostream *) 0; // don't delete +outfile = (ostream *) nullptr; // don't delete n_dump = 0; @@ -756,7 +756,7 @@ void ByCaseJob::init_from_scratch() { -info = (ByCaseInfo *) 0; +info = (ByCaseInfo *) nullptr; BasicModeAnalysisJob::init_from_scratch(); @@ -774,7 +774,7 @@ void ByCaseJob::clear() BasicModeAnalysisJob::clear(); -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } valid_times.clear(); @@ -995,7 +995,7 @@ valid_times.sort_increasing(); n_valid_times = valid_times.n_elements(); -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } info = new ByCaseInfo [n_valid_times + 1]; // in case n_valid_times is zero @@ -1030,7 +1030,7 @@ else do_output(cout); // done // -if ( info ) { delete [] info; info = (ByCaseInfo *) 0; } +if ( info ) { delete [] info; info = (ByCaseInfo *) nullptr; } return; diff --git a/src/libcode/vx_analysis_util/mode_line.cc b/src/libcode/vx_analysis_util/mode_line.cc index 5a7319565f..3d565c1f5d 100644 --- a/src/libcode/vx_analysis_util/mode_line.cc +++ b/src/libcode/vx_analysis_util/mode_line.cc @@ -139,7 +139,7 @@ void ModeLine::clear() DataLine::clear(); HdrFlag = false; -HdrLine = (AsciiHeaderLine *) 0; +HdrLine = (AsciiHeaderLine *) nullptr; return; @@ -426,7 +426,7 @@ unixtime ModeLine::fcst_init() const unixtime v, l; -const char * c = (char *) 0; +const char * c = (char *) nullptr; c = get_item("FCST_VALID"); @@ -528,7 +528,7 @@ unixtime ModeLine::obs_init() const unixtime v, l; -const char * c = (char *) 0; +const char * c = (char *) nullptr; c = get_item("OBS_VALID"); @@ -999,7 +999,7 @@ nfcst = nobs = -1; if ( is_single() ) return ( false ); const char * c = object_id(); -const char * u = (const char *) 0; +const char * u = (const char *) nullptr; // // skip leading F, O, CF or CO diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 963271d905..6f09f1779c 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -75,13 +75,13 @@ STATAnalysisJob & STATAnalysisJob::operator=( void STATAnalysisJob::init_from_scratch() { - dump_row = (char *) 0; - dr_out = (ofstream *) 0; + dump_row = (char *) nullptr; + dr_out = (ofstream *) nullptr; n_dump = 0; - stat_file = (char *) 0; - stat_out = (ofstream *) 0; - boot_rng = (char *) 0; - boot_seed = (char *) 0; + stat_file = (char *) nullptr; + stat_out = (ofstream *) nullptr; + boot_rng = (char *) nullptr; + boot_seed = (char *) nullptr; model.set_ignore_case(1); desc.set_ignore_case(1); @@ -183,8 +183,8 @@ void STATAnalysisJob::clear() { close_dump_row_file(); close_stat_file(); - if(dump_row) { delete [] dump_row; dump_row = (char *) 0; } - if(stat_file) { delete [] stat_file; stat_file = (char *) 0; } + if(dump_row) { delete [] dump_row; dump_row = (char *) nullptr; } + if(stat_file) { delete [] stat_file; stat_file = (char *) nullptr; } stat_row = 0; @@ -1102,7 +1102,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { jc_array.add(c); - lp = (char *) 0; + lp = (char *) nullptr; } // @@ -1210,11 +1210,11 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { if(jc_array[i] == "-job") { if(set_job_type(jc_array[i+1].c_str()) != 0) { - delete [] line; line = 0; lp = 0; + lp = nullptr; mlog << Error << "\nSTATAnalysisJob::STATAnalysisJob::parse_job_command() -> " << "unrecognized job type specified \"" << jc_array[i] << "\" in job command line: " << jobstring << "\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } i++; @@ -1636,7 +1636,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "unrecognized switch \"" << jc_array[i] << "\" in job command line: " << jobstring << "\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } // end if @@ -1658,7 +1658,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { << "no match found for " << (line_type.n() == 1 ? line_type[0] : "header") << " column named \"" << hdr_name[i] << "\"\n\n"; - if(line) { delete [] line; line = (char *) 0; } + if(line) { delete [] line; line = (char *) nullptr; } throw(1); } } // end for @@ -1672,8 +1672,8 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { // // Deallocate memory // - if(line) { delete [] line; line = (char *) 0; } - lp = (char *) 0; + if(line) { delete [] line; line = (char *) nullptr; } + lp = (char *) nullptr; return; } @@ -1712,7 +1712,7 @@ int STATAnalysisJob::set_job_type(const char *c) { void STATAnalysisJob::set_dump_row(const char *c) { - if(dump_row) { delete [] dump_row; dump_row = (char *) 0; } + if(dump_row) { delete [] dump_row; dump_row = (char *) nullptr; } if(!c) return; @@ -1727,7 +1727,7 @@ void STATAnalysisJob::set_dump_row(const char *c) { void STATAnalysisJob::set_stat_file(const char *c) { - if(stat_file) { delete [] stat_file; stat_file = (char *) 0; } + if(stat_file) { delete [] stat_file; stat_file = (char *) nullptr; } if(!c) return; @@ -1823,7 +1823,7 @@ void STATAnalysisJob::set_mask_sid(const char *c) { void STATAnalysisJob::set_boot_rng(const char *c) { - if(boot_rng) { delete [] boot_rng; boot_rng = (char *) 0; } + if(boot_rng) { delete [] boot_rng; boot_rng = (char *) nullptr; } if(!c) return; @@ -1838,7 +1838,7 @@ void STATAnalysisJob::set_boot_rng(const char *c) { void STATAnalysisJob::set_boot_seed(const char *c) { - if(boot_seed) { delete [] boot_seed; boot_seed = (char *) 0; } + if(boot_seed) { delete [] boot_seed; boot_seed = (char *) nullptr; } if(!c) return; @@ -1915,7 +1915,7 @@ void STATAnalysisJob::close_dump_row_file() { dr_out->close(); delete dr_out; - dr_out = (ofstream *) 0; + dr_out = (ofstream *) nullptr; n_dump = 0; } @@ -2136,7 +2136,7 @@ void STATAnalysisJob::close_stat_file() { stat_out->close(); delete stat_out; - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; } return; diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index faf5c409f3..d229712943 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -141,7 +141,7 @@ void STATLine::clear() DataLine::clear(); Type = no_stat_line_type; -HdrLine = (AsciiHeaderLine *) 0; +HdrLine = (AsciiHeaderLine *) nullptr; return; diff --git a/src/libcode/vx_analysis_util/time_series.cc b/src/libcode/vx_analysis_util/time_series.cc index a07c07debd..dd284f35ad 100644 --- a/src/libcode/vx_analysis_util/time_series.cc +++ b/src/libcode/vx_analysis_util/time_series.cc @@ -94,7 +94,7 @@ void TimeSeries::init_from_scratch() { -Value = (double *) 0; +Value = (double *) nullptr; clear(); @@ -110,7 +110,7 @@ void TimeSeries::clear() { -if ( Value ) { delete [] Value; Value = (double *) 0; } +if ( Value ) { delete [] Value; Value = (double *) nullptr; } Nelements = 0; diff --git a/src/libcode/vx_bool_calc/bool_calc.cc b/src/libcode/vx_bool_calc/bool_calc.cc index 21ccd83921..d0582e3478 100644 --- a/src/libcode/vx_bool_calc/bool_calc.cc +++ b/src/libcode/vx_bool_calc/bool_calc.cc @@ -53,9 +53,9 @@ void BoolCalc::init_from_scratch() { -s = 0; +s = nullptr; -program = 0; +program = nullptr; clear(); @@ -71,9 +71,9 @@ void BoolCalc::clear() { -if ( s ) { delete s; s = 0; } +if ( s ) { delete s; s = nullptr; } -if ( program ) { delete program; program = 0; } +if ( program ) { delete program; program = nullptr; } Max_depth = Max_local = 0; diff --git a/src/libcode/vx_bool_calc/token_stack.cc b/src/libcode/vx_bool_calc/token_stack.cc index cdcdb2f039..41e27122fa 100644 --- a/src/libcode/vx_bool_calc/token_stack.cc +++ b/src/libcode/vx_bool_calc/token_stack.cc @@ -99,7 +99,7 @@ void TokenStack::init_from_scratch() { -e = (Token *) 0; +e = (Token *) nullptr; AllocInc = 50; // default value @@ -117,7 +117,7 @@ void TokenStack::clear() { -if ( e ) { delete [] e; e = (Token *) 0; } +if ( e ) { delete [] e; e = (Token *) nullptr; } @@ -189,11 +189,11 @@ for(j=0; j= n ) return; int k; -ClistEntry * u = (ClistEntry *) 0; +ClistEntry * u = (ClistEntry *) nullptr; k = n/colorlist_alloc_inc; @@ -348,11 +348,11 @@ if ( e ) { for (k=0; k failed to read colortable file \"" << input_filename << "\"\n\n"; @@ -593,11 +593,11 @@ sort(); // done // -fclose(colorin); colorin = (FILE *) 0; +fclose(colorin); colorin = (FILE *) nullptr; -input_filename = (const char *) 0; +input_filename = (const char *) nullptr; -the_table = (ColorTable *) 0; +the_table = (ColorTable *) nullptr; clist.clear(); @@ -802,7 +802,7 @@ void ColorTable::extend(int n) if ( Nalloc >= n ) return; int j; -CtableEntry * u = (CtableEntry *) 0; +CtableEntry * u = (CtableEntry *) nullptr; j = n/ctable_alloc_inc; @@ -828,11 +828,11 @@ if ( Entry ) { } - delete [] Entry; Entry = (CtableEntry *) 0; + delete [] Entry; Entry = (CtableEntry *) nullptr; } -Entry = u; u = (CtableEntry *) 0; +Entry = u; u = (CtableEntry *) nullptr; // diff --git a/src/libcode/vx_data2d/data_class.cc b/src/libcode/vx_data2d/data_class.cc index 1d95284e38..8f6fb7cda3 100644 --- a/src/libcode/vx_data2d/data_class.cc +++ b/src/libcode/vx_data2d/data_class.cc @@ -106,8 +106,8 @@ void Met2dDataFile::mtddf_init_from_scratch() { -Raw_Grid = (Grid *) 0; -Dest_Grid = (Grid *) 0; +Raw_Grid = (Grid *) nullptr; +Dest_Grid = (Grid *) nullptr; ShiftRight = 0; @@ -123,8 +123,8 @@ void Met2dDataFile::mtddf_clear() { -if ( Raw_Grid ) { delete Raw_Grid; Raw_Grid = (Grid *) 0; } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = (Grid *) 0; } +if ( Raw_Grid ) { delete Raw_Grid; Raw_Grid = (Grid *) nullptr; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = (Grid *) nullptr; } Filename.clear(); @@ -268,7 +268,7 @@ mlog << Debug(3) << "Resetting grid definition from \"" } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = 0; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = nullptr; } Dest_Grid = new Grid; @@ -295,7 +295,7 @@ if ( ! Raw_Grid ) { } -if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = 0; } +if ( Dest_Grid ) { delete Dest_Grid; Dest_Grid = nullptr; } Dest_Grid = new Grid; diff --git a/src/libcode/vx_data2d/leveltype_to_string.cc b/src/libcode/vx_data2d/leveltype_to_string.cc index 1c7d52b24e..8c119b8b45 100644 --- a/src/libcode/vx_data2d/leveltype_to_string.cc +++ b/src/libcode/vx_data2d/leveltype_to_string.cc @@ -39,7 +39,7 @@ ConcatString leveltype_to_string(const LevelType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_data2d_factory/data2d_factory.cc b/src/libcode/vx_data2d_factory/data2d_factory.cc index 7d188c2080..39fcc7f786 100644 --- a/src/libcode/vx_data2d_factory/data2d_factory.cc +++ b/src/libcode/vx_data2d_factory/data2d_factory.cc @@ -161,7 +161,7 @@ MetPythonDataFile * p = nullptr; Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename) { GrdFileType type; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // // Determine the file type @@ -195,7 +195,7 @@ Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename, { - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // // Use the file type, if valid @@ -246,7 +246,7 @@ Met2dDataFile * Met2dDataFileFactory::new_met_2d_data_file(const char *filename, bool is_2d_data_file(const ConcatString &filename, const ConcatString &config_str) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; GrdFileType type = FileType_None; // Check for a requested file type @@ -260,7 +260,7 @@ bool is_2d_data_file(const ConcatString &filename, mtddf = mtddf_factory.new_met_2d_data_file(filename.c_str(), type); bool status = (mtddf != 0); - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(status); } diff --git a/src/libcode/vx_data2d_grib/data2d_grib.cc b/src/libcode/vx_data2d_grib/data2d_grib.cc index 09dc80815a..a436d725a4 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib.cc @@ -103,7 +103,7 @@ void MetGrib1DataFile::grib1_init_from_scratch() { -GF = (GribFile *) 0; +GF = (GribFile *) nullptr; Plane.clear(); @@ -121,7 +121,7 @@ void MetGrib1DataFile::close() { -if ( GF ) { delete GF; GF = (GribFile *) 0; } +if ( GF ) { delete GF; GF = (GribFile *) nullptr; } CurrentRecord.reset(); diff --git a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc index 2f1f66385b..2f8f61dfe0 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc @@ -577,7 +577,7 @@ void read_pds(const GribRecord &r, int &bms_flag, unixtime &init_ut, unixtime &valid_ut, int &accum) { double sec_per_fcst_unit = 0.0; unsigned char pp1[2]; - Section1_Header *pds = (Section1_Header *) 0; + Section1_Header *pds = (Section1_Header *) nullptr; pds = (Section1_Header *) r.pds; diff --git a/src/libcode/vx_data2d_grib/grib_classes.cc b/src/libcode/vx_data2d_grib/grib_classes.cc index 5954a6ed7d..03817a9790 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.cc +++ b/src/libcode/vx_data2d_grib/grib_classes.cc @@ -63,7 +63,7 @@ GribRecord::GribRecord() { is = new Section0_Header; -pds = (unsigned char *) 0; +pds = (unsigned char *) nullptr; gds = new Section2_Header; bms = new Section3_Header; bds = new Section4_Header; @@ -102,8 +102,8 @@ word_size = 0; data_lseek_offset = record_lseek_offset = (off_t) 0; -// data = (unsigned char *) 0; -// bitmap = (unsigned char *) 0; +// data = (unsigned char *) nullptr; +// bitmap = (unsigned char *) nullptr; // //data_size = data_alloc = 0; //bitmap_size = bitmap_alloc = 0; @@ -135,13 +135,13 @@ GribRecord::~GribRecord() { -if ( is ) { delete is; is = (Section0_Header *) 0; } -if ( pds ) { delete [] pds; pds = (unsigned char *) 0; } -if ( gds ) { delete gds; gds = (Section2_Header *) 0; } -if ( bms ) { delete bms; bms = (Section3_Header *) 0; } -if ( bds ) { delete bds; bds = (Section4_Header *) 0; } -//if ( data ) { delete data; data = (vector *) 0; } -//if ( bitmap ) { delete bitmap; bitmap = (vector *) 0; } +if ( is ) { delete is; is = (Section0_Header *) nullptr; } +if ( pds ) { delete [] pds; pds = (unsigned char *) nullptr; } +if ( gds ) { delete gds; gds = (Section2_Header *) nullptr; } +if ( bms ) { delete bms; bms = (Section3_Header *) nullptr; } +if ( bds ) { delete bds; bds = (Section4_Header *) nullptr; } +//if ( data ) { delete data; data = (vector *) nullptr; } +//if ( bitmap ) { delete bitmap; bitmap = (vector *) nullptr; } } @@ -316,8 +316,8 @@ uint4 GribRecord::long_data_value(int n) const int k, byte, shift; uint4 value, u; -unsigned char *c1 = (unsigned char *) 0; -const unsigned char *c2 = (unsigned char *) 0; +unsigned char *c1 = (unsigned char *) nullptr; +const unsigned char *c2 = (unsigned char *) nullptr; k = n*word_size; @@ -522,7 +522,7 @@ fd = -1; file_start = (long) -1; -name = (char *) 0; +name = (char *) nullptr; referenceCount = n_alloc = issue = lead = 0; @@ -530,9 +530,9 @@ buf_size = (size_t) 0; n_records = (unsigned int) 0; -buf = (unsigned char *) 0; +buf = (unsigned char *) nullptr; -record_info = (RecordInfo *) 0; +record_info = (RecordInfo *) nullptr; } @@ -546,11 +546,11 @@ GribFileRep::~GribFileRep() if ( fd >= 0 ) { ::close(fd); fd = -1; } -if ( buf ) { delete [] buf; buf = (unsigned char *) 0; } +if ( buf ) { delete [] buf; buf = (unsigned char *) nullptr; } -if ( name ) { delete [] name; name = (char *) 0; } +if ( name ) { delete [] name; name = (char *) nullptr; } -if ( n_alloc ) { delete [] record_info; record_info = (RecordInfo *) 0; } +if ( n_alloc ) { delete [] record_info; record_info = (RecordInfo *) nullptr; } } @@ -565,7 +565,7 @@ void GribFileRep::record_extend(int n) if ( n_alloc > n ) return; int j; -RecordInfo *r = (RecordInfo *) 0; +RecordInfo *r = (RecordInfo *) nullptr; ++n; @@ -600,9 +600,9 @@ for (j=n_records; jrecord_extend(1); diff --git a/src/libcode/vx_data2d_grib/grib_strings.cc b/src/libcode/vx_data2d_grib/grib_strings.cc index f9b3edcdac..31d5428c1e 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.cc +++ b/src/libcode/vx_data2d_grib/grib_strings.cc @@ -266,7 +266,7 @@ int str_to_grib_code(const char *c, int &pcode, int gc = bad_data_int; const int buf_len = 512; char tmp_str[buf_len + 1]; - char *ptr = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr, *save_ptr = (char *) nullptr; const char *method_name = "str_to_grib_code() -> "; // Parse out strings of the form: @@ -308,7 +308,7 @@ int str_to_prob_info(const char *c, double &pthresh_lo, double &pthresh_hi, int gc = bad_data_int, i, n_lt, n_gt; const int buf_len = 512; char tmp_str[buf_len + 1]; - char *ptr = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr, *save_ptr = (char *) nullptr; SingleThresh st; const char *method_name = "str_to_prob_info()"; diff --git a/src/libcode/vx_data2d_grib2/data2d_grib2.cc b/src/libcode/vx_data2d_grib2/data2d_grib2.cc index 5ea279fb96..401d226f8e 100644 --- a/src/libcode/vx_data2d_grib2/data2d_grib2.cc +++ b/src/libcode/vx_data2d_grib2/data2d_grib2.cc @@ -1583,7 +1583,7 @@ long MetGrib2DataFile::read_grib2_record(long offset, g2int unpack, fread(cgrib, sizeof(unsigned char), lgrib, FileGrib2); if(g2_info(cgrib, listsec0, listsec1, &numfields, &numlocal)) { - if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) 0; } + if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) nullptr; } return -1; } @@ -1591,7 +1591,7 @@ long MetGrib2DataFile::read_grib2_record(long offset, g2int unpack, g2_getfld(cgrib, ifld, unpack, 1, &gfld); // cleanup - if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) 0; } + if(cgrib) { delete [] cgrib; cgrib = (unsigned char *) nullptr; } // reset to default out of memory handler set_new_handler(oom); 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 72275ecd9f..fcece7b021 100644 --- a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc @@ -110,7 +110,7 @@ NcVarInfo *MetNcCFDataFile::find_first_data_var() { void MetNcCFDataFile::close() { - if(_file) { delete _file; _file = (NcCfFile *) 0; } + if(_file) { delete _file; _file = (NcCfFile *) nullptr; } return; } @@ -260,7 +260,7 @@ bool MetNcCFDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) } // Read the data - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; bool status = _file->getData(vinfo_nc->req_name().c_str(), dimension, diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc index 40caecba95..fa2dad9289 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc @@ -63,7 +63,7 @@ MetNcMetDataFile & MetNcMetDataFile::operator=(const MetNcMetDataFile &) { void MetNcMetDataFile::nc_met_init_from_scratch() { - MetNc = (MetNcFile *) 0; + MetNc = (MetNcFile *) nullptr; close(); @@ -74,7 +74,7 @@ void MetNcMetDataFile::nc_met_init_from_scratch() { void MetNcMetDataFile::close() { - if(MetNc) { delete MetNc; MetNc = (MetNcFile *) 0; } + if(MetNc) { delete MetNc; MetNc = (MetNcFile *) nullptr; } return; } @@ -123,7 +123,7 @@ bool MetNcMetDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { bool status = false; ConcatString req_time_str, data_time_str; VarInfoNcMet * vinfo_nc = (VarInfoNcMet *) &vinfo; - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; int i; // Initialize the data plane diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index 7ae924bd34..0f4331b811 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -700,7 +700,7 @@ void get_semilatlon_var(NcFile *ncfile, const char * var_name, NumArray &out_na) double * data_values = new double[ count ]; get_nc_data(&nc_var, data_values); for(int i=0; i= max_met_args ) { int j, count; bool found = false; -NcVarInfo * var = (NcVarInfo *) 0; +NcVarInfo * var = (NcVarInfo *) nullptr; const int Nx = grid.nx(); const int Ny = grid.ny(); LongArray b = a; diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc index 338d83e8f4..3512727c8d 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc @@ -148,7 +148,10 @@ void VarInfoNcMet::add_dimension(int dim) { void VarInfoNcMet::set_magic(const ConcatString &nstr, const ConcatString &lstr) { ConcatString tmp_str; - char *ptr = (char *) 0, *ptr2 = (char *) 0, *ptr3 = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr; + char *ptr2 = (char *) nullptr; + char *ptr3 = (char *) nullptr; + char *save_ptr = (char *) nullptr; // Store the magic string VarInfo::set_magic(nstr, lstr); diff --git a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc index e249856a7a..2ff9592e9a 100644 --- a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc @@ -64,7 +64,7 @@ MetNcWrfDataFile & MetNcWrfDataFile::operator=(const MetNcWrfDataFile &) { void MetNcWrfDataFile::nc_wrf_init_from_scratch() { - WrfNc = (WrfFile *) 0; + WrfNc = (WrfFile *) nullptr; close(); @@ -75,7 +75,7 @@ void MetNcWrfDataFile::nc_wrf_init_from_scratch() { void MetNcWrfDataFile::close() { - if(WrfNc) { delete WrfNc; WrfNc = (WrfFile *) 0; } + if(WrfNc) { delete WrfNc; WrfNc = (WrfFile *) nullptr; } return; } @@ -125,7 +125,7 @@ bool MetNcWrfDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { double pressure; ConcatString level_str; VarInfoNcWrf * vinfo_nc = (VarInfoNcWrf *) &vinfo; - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; // Initialize the data plane plane.clear(); @@ -204,7 +204,7 @@ int MetNcWrfDataFile::data_plane_array(VarInfo &vinfo, bool found = false; VarInfoNcWrf *vinfo_nc = (VarInfoNcWrf *) &vinfo; LongArray dim = vinfo_nc->dimension(); - NcVarInfo *info = (NcVarInfo *) 0; + NcVarInfo *info = (NcVarInfo *) nullptr; LongArray cur_dim; DataPlane cur_plane; diff --git a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc index 62c1d9c834..1edc5a102f 100644 --- a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc @@ -160,7 +160,10 @@ void VarInfoNcWrf::set_dimension(int i_dim, int dim) { void VarInfoNcWrf::set_magic(const ConcatString &nstr, const ConcatString &lstr) { ConcatString tmp_str; - char *ptr = (char *) 0, *ptr2 = (char *) 0, *ptr3 = (char *) 0, *save_ptr = (char *) 0; + char *ptr = (char *) nullptr; + char *ptr2 = (char *) nullptr; + char *ptr3 = (char *) nullptr; + char *save_ptr = (char *) nullptr; const char *method_name = "VarInfoNcWrf::set_magic() -> "; // Store the magic string diff --git a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc index 19c99b6de8..79e277bef6 100644 --- a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc +++ b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc @@ -124,13 +124,13 @@ void WrfFile::init_from_scratch() { -Nc = (NcFile *) 0; +Nc = (NcFile *) nullptr; -Dim = (NcDim **) 0; +Dim = (NcDim **) nullptr; -Var = (NcVarInfo *) 0; +Var = (NcVarInfo *) nullptr; -Time = (unixtime *) 0; +Time = (unixtime *) nullptr; close(); @@ -146,21 +146,21 @@ void WrfFile::close() { -if ( Nc ) { delete Nc; Nc = (NcFile *) 0; } +if ( Nc ) { delete Nc; Nc = (NcFile *) nullptr; } -if ( Dim ) { delete [] Dim; Dim = (NcDim **) 0; } +if ( Dim ) { delete [] Dim; Dim = (NcDim **) nullptr; } -if ( Time ) { delete [] Time; Time = (unixtime *) 0; } +if ( Time ) { delete [] Time; Time = (unixtime *) nullptr; } Ndims = 0; DimNames.clear(); -Tdim = (NcDim *) 0; +Tdim = (NcDim *) nullptr; Nvars = 0; -if ( Var ) { delete [] Var; Var = (NcVarInfo *) 0; } +if ( Var ) { delete [] Var; Var = (NcVarInfo *) nullptr; } InitTime = (unixtime) 0; @@ -605,8 +605,8 @@ int j, k, count; int x, y; double value; bool found = false; -NcVarInfo * var = (NcVarInfo *) 0; -NcVarInfo * P = (NcVarInfo *) 0; +NcVarInfo * var = (NcVarInfo *) nullptr; +NcVarInfo * P = (NcVarInfo *) nullptr; LongArray b = a; pressure = bad_data_double; diff --git a/src/libcode/vx_data2d_python/data2d_python.cc b/src/libcode/vx_data2d_python/data2d_python.cc index 3b146f45f7..546a68514d 100644 --- a/src/libcode/vx_data2d_python/data2d_python.cc +++ b/src/libcode/vx_data2d_python/data2d_python.cc @@ -153,7 +153,7 @@ close(); ConcatString full_path, file_name; int i, file_argc; -char **file_argv = (char **) 0; // allocated +char **file_argv = (char **) nullptr; // allocated StringArray sa; const char *method_name = "MetPythonDataFile::open() "; @@ -231,9 +231,9 @@ if ( ShiftRight != 0 ) Plane.shift_right(ShiftRight); if ( file_argv ) { for ( i=1; i::init_from_scratch() { -E = (T *) 0; +E = (T *) nullptr; AllocInc = 25; // default value @@ -143,7 +143,7 @@ void Shp_Array::clear() { -if ( E ) { delete [] E; E = (T *) 0; } +if ( E ) { delete [] E; E = (T *) nullptr; } @@ -214,11 +214,11 @@ for(j=0; j Date: Tue, 27 Feb 2024 16:52:10 +0000 Subject: [PATCH 06/72] #2673 Change 0 to nullptr --- src/libcode/vx_nc_obs/met_point_data.cc | 16 ++-- src/libcode/vx_nc_obs/nc_point_obs.cc | 4 +- src/libcode/vx_nc_util/grid_output.cc | 2 +- src/libcode/vx_nc_util/nc_utils.cc | 8 +- src/libcode/vx_nc_util/nc_var_info.cc | 6 +- src/libcode/vx_pb_util/do_blocking.cc | 2 +- src/libcode/vx_pb_util/do_unblocking.cc | 2 +- src/libcode/vx_plot_util/vx_plot_util.cc | 2 +- .../vx_pointdata_python/pointdata_python.cc | 2 +- src/libcode/vx_ps/documentmedia_to_string.cc | 2 +- .../vx_ps/documentorientation_to_string.cc | 2 +- src/libcode/vx_ps/fontfamily_to_string.cc | 2 +- src/libcode/vx_ps/ps_text.cc | 18 ++-- src/libcode/vx_ps/table_helper.cc | 10 +- src/libcode/vx_ps/vx_ps.cc | 8 +- src/libcode/vx_pxm/pcm.cc | 10 +- src/libcode/vx_pxm/pgm.cc | 2 +- src/libcode/vx_pxm/ppm.cc | 8 +- src/libcode/vx_pxm/pxm_base.cc | 10 +- src/libcode/vx_render/flate_filter.cc | 6 +- src/libcode/vx_render/ps_filter.cc | 4 +- src/libcode/vx_render/psout_filter.cc | 6 +- src/libcode/vx_render/render_pbm.cc | 6 +- src/libcode/vx_render/render_pcm.cc | 6 +- src/libcode/vx_render/render_pgm.cc | 6 +- src/libcode/vx_render/render_ppm.cc | 6 +- src/libcode/vx_series_data/series_data.cc | 8 +- src/libcode/vx_shapedata/engine.cc | 38 ++++---- src/libcode/vx_shapedata/interest.cc | 22 ++--- src/libcode/vx_shapedata/mode_conf_info.cc | 38 ++++---- src/libcode/vx_shapedata/node.cc | 37 +++---- src/libcode/vx_shapedata/shapedata.cc | 2 +- src/libcode/vx_stat_out/stat_columns.cc | 4 +- src/libcode/vx_statistics/apply_mask.cc | 22 ++--- src/libcode/vx_statistics/compute_ci.cc | 96 ++++++++++--------- src/libcode/vx_statistics/contable_nx2.cc | 6 +- src/libcode/vx_statistics/contable_stats.cc | 20 ++-- src/libcode/vx_statistics/met_stats.cc | 62 ++++++------ src/libcode/vx_statistics/obs_error.cc | 20 ++-- src/libcode/vx_statistics/pair_base.cc | 18 ++-- .../vx_statistics/pair_data_ensemble.cc | 32 +++---- src/libcode/vx_statistics/pair_data_point.cc | 36 +++---- src/libcode/vx_statistics/read_climo.cc | 8 +- src/libcode/vx_tc_util/atcf_line_base.cc | 10 +- src/libcode/vx_tc_util/atcf_track_line.cc | 10 +- src/libcode/vx_tc_util/diag_file.cc | 8 +- src/libcode/vx_tc_util/pair_data_genesis.cc | 2 +- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 4 +- src/libcode/vx_tc_util/tc_columns.cc | 2 +- src/libcode/vx_tc_util/tc_stat_line.cc | 4 +- src/libcode/vx_tc_util/track_info.cc | 10 +- src/libcode/vx_tc_util/track_pair_info.cc | 12 +-- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 6 +- .../vx_time_series/time_series_util.cc | 2 +- 54 files changed, 351 insertions(+), 344 deletions(-) diff --git a/src/libcode/vx_nc_obs/met_point_data.cc b/src/libcode/vx_nc_obs/met_point_data.cc index 0312f97800..ad30186dbe 100644 --- a/src/libcode/vx_nc_obs/met_point_data.cc +++ b/src/libcode/vx_nc_obs/met_point_data.cc @@ -38,7 +38,7 @@ using namespace std; MetPointData::MetPointData() { // Derived class should set obs_data - obs_data = (MetPointObsData *)0; + obs_data = (MetPointObsData *) nullptr; init_from_scratch(); } @@ -267,31 +267,31 @@ void MetPointObsData::clear() { void MetPointObsData::clear_numbers() { if (0 != obs_ids) { delete [] obs_ids; - obs_ids = (int *)0; + obs_ids = (int *) nullptr; } if (0 != obs_hids) { delete [] obs_hids; - obs_hids = (int *)0; + obs_hids = (int *) nullptr; } if (0 != obs_qids) { delete [] obs_qids; - obs_qids = (int *)0; + obs_qids = (int *) nullptr; } if (0 != obs_lvls) { delete [] obs_lvls; - obs_lvls = (float *)0; + obs_lvls = (float *) nullptr; } if (0 != obs_hgts) { delete [] obs_hgts; - obs_hgts = (float *)0; + obs_hgts = (float *) nullptr; } if (0 != obs_vals) { delete [] obs_vals; - obs_vals = (float *)0; + obs_vals = (float *) nullptr; } if (0 != obs_arr) { delete [] obs_arr; - obs_arr = (float *)0; + obs_arr = (float *) nullptr; } } diff --git a/src/libcode/vx_nc_obs/nc_point_obs.cc b/src/libcode/vx_nc_obs/nc_point_obs.cc index 33e1dfa85b..ea60b62834 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs.cc @@ -55,7 +55,7 @@ void MetNcPointObs::init_from_scratch() { MetPointData::init_from_scratch(); keep_nc = false; - obs_nc = (NcFile *) 0; + obs_nc = (NcFile *) nullptr; } //////////////////////////////////////////////////////////////////////// @@ -65,7 +65,7 @@ void MetNcPointObs::close() { if ( !keep_nc && obs_nc ) { delete obs_nc; - obs_nc = (NcFile *) 0; + obs_nc = (NcFile *) nullptr; } } diff --git a/src/libcode/vx_nc_util/grid_output.cc b/src/libcode/vx_nc_util/grid_output.cc index 079d376844..67ddbd22f6 100644 --- a/src/libcode/vx_nc_util/grid_output.cc +++ b/src/libcode/vx_nc_util/grid_output.cc @@ -882,7 +882,7 @@ if ( standard_name_str ) add_att(&nc_var, standard_name_att_name, standard_name put_nc_data(&nc_var, &var_data[0], nc_dim->getSize(), 0); -if ( var_data ) { delete [] var_data; var_data = (float *) 0; } +if ( var_data ) { delete [] var_data; var_data = (float *) nullptr; } // // done diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index dcd24b59b1..b1140d4d47 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -418,7 +418,7 @@ ConcatString get_log_msg_for_att(const NcVarAtt *att, string var_name, //////////////////////////////////////////////////////////////////////// NcVarAtt *get_nc_att(const NcVar * var, const ConcatString &att_name, bool exit_on_error) { - NcVarAtt *att = (NcVarAtt *)0; + NcVarAtt *att = (NcVarAtt *) nullptr; static const char *method_name = "get_nc_att(NcVar) -> "; // @@ -453,7 +453,7 @@ NcVarAtt *get_nc_att(const NcVar * var, const ConcatString &att_name, bool exit_ //////////////////////////////////////////////////////////////////////// NcGroupAtt *get_nc_att(const NcFile * nc, const ConcatString &att_name, bool exit_on_error) { - NcGroupAtt *att = (NcGroupAtt *)0; + NcGroupAtt *att = (NcGroupAtt *) nullptr; static const char *method_name = "get_nc_att(NcFile) -> "; // @@ -491,7 +491,7 @@ NcGroupAtt *get_nc_att(const NcFile * nc, const ConcatString &att_name, bool exi bool get_nc_att_value(const NcVar *var, const ConcatString &att_name, ConcatString &att_val, int grp_id, bool exit_on_error) { bool status = false; - NcVarAtt *att = (NcVarAtt *) 0; + NcVarAtt *att = (NcVarAtt *) nullptr; // Initialize att_val.clear(); @@ -3456,7 +3456,7 @@ NcVar get_nc_var_time(const NcFile *nc) { //////////////////////////////////////////////////////////////////////// NcFile *open_ncfile(const char * nc_name, bool write) { - NcFile *nc = (NcFile *)0; + NcFile *nc = (NcFile *) nullptr; try { if (write) { diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4d23e8e65b..6804e65592 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -113,7 +113,7 @@ return ( * this ); void NcVarInfo::init_from_scratch() { -Dims = (NcDim **) 0; +Dims = (NcDim **) nullptr; clear(); @@ -127,7 +127,7 @@ return; void NcVarInfo::clear() { -var = (NcVar *) 0; // don't delete +var = (NcVar *) nullptr; // don't delete name.clear(); @@ -147,7 +147,7 @@ AccumTime = 0; Ndims = 0; -if ( Dims ) { delete [] Dims; Dims = (NcDim **) 0; } +if ( Dims ) { delete [] Dims; Dims = (NcDim **) nullptr; } x_slot = y_slot = z_slot = t_slot = -1; diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc index a43b33a768..8672f2bf05 100644 --- a/src/libcode/vx_pb_util/do_blocking.cc +++ b/src/libcode/vx_pb_util/do_blocking.cc @@ -110,7 +110,7 @@ void write_pad(int fd, unsigned int value, PadSize padsize) int n_written, bytes; unsigned int I; unsigned long long L; -unsigned char * b = (unsigned char *) 0; +unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc index 31e07e2631..195b1a8dda 100644 --- a/src/libcode/vx_pb_util/do_unblocking.cc +++ b/src/libcode/vx_pb_util/do_unblocking.cc @@ -80,7 +80,7 @@ int n_read, bytes; int value; unsigned int I; unsigned long long L; -unsigned char * b = (unsigned char *) 0; +unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { diff --git a/src/libcode/vx_plot_util/vx_plot_util.cc b/src/libcode/vx_plot_util/vx_plot_util.cc index abf4e4be7c..83bc4ddf76 100644 --- a/src/libcode/vx_plot_util/vx_plot_util.cc +++ b/src/libcode/vx_plot_util/vx_plot_util.cc @@ -45,7 +45,7 @@ void draw_map(const Grid &gr, const Box &gr_bb, PSfile &p, const Box &dim, } int i; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; ConcatString file_name, line_dash; NumArray line_color; double line_width; diff --git a/src/libcode/vx_pointdata_python/pointdata_python.cc b/src/libcode/vx_pointdata_python/pointdata_python.cc index fdb1cb34a3..e5ec4865bd 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.cc +++ b/src/libcode/vx_pointdata_python/pointdata_python.cc @@ -133,7 +133,7 @@ close(); ConcatString full_path, file_name; int i, file_argc; -char **file_argv = (char **) 0; // allocated +char **file_argv = (char **) nullptr; // allocated StringArray sa; const char *method_name = "MetPythonPointDataFile::open() "; diff --git a/src/libcode/vx_ps/documentmedia_to_string.cc b/src/libcode/vx_ps/documentmedia_to_string.cc index d64d6b9123..78be40f3a3 100644 --- a/src/libcode/vx_ps/documentmedia_to_string.cc +++ b/src/libcode/vx_ps/documentmedia_to_string.cc @@ -39,7 +39,7 @@ ConcatString documentmedia_to_string(const DocumentMedia t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/documentorientation_to_string.cc b/src/libcode/vx_ps/documentorientation_to_string.cc index e98342f078..2ad6baa576 100644 --- a/src/libcode/vx_ps/documentorientation_to_string.cc +++ b/src/libcode/vx_ps/documentorientation_to_string.cc @@ -39,7 +39,7 @@ ConcatString documentorientation_to_string(const DocumentOrientation t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/fontfamily_to_string.cc b/src/libcode/vx_ps/fontfamily_to_string.cc index 4540a5afc9..5d427f1049 100644 --- a/src/libcode/vx_ps/fontfamily_to_string.cc +++ b/src/libcode/vx_ps/fontfamily_to_string.cc @@ -39,7 +39,7 @@ ConcatString fontfamily_to_string(const FontFamily t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/libcode/vx_ps/ps_text.cc b/src/libcode/vx_ps/ps_text.cc index f4438e208b..f8effa1a87 100644 --- a/src/libcode/vx_ps/ps_text.cc +++ b/src/libcode/vx_ps/ps_text.cc @@ -105,9 +105,9 @@ void VxpsTextNode::init_from_scratch() { -Text = (char *) 0; +Text = (char *) nullptr; -next = (VxpsTextNode *) 0; +next = (VxpsTextNode *) nullptr; clear(); @@ -127,7 +127,7 @@ void VxpsTextNode::clear() // clear out this node // -if ( Text ) { delete [] Text; Text = (char *) 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; } Nchars = Nalloc = 0; @@ -144,7 +144,7 @@ Width = 0.0; // send "clear" message down the chain // -if ( next ) { delete next; next = (VxpsTextNode *) 0; } +if ( next ) { delete next; next = (VxpsTextNode *) nullptr; } // // done @@ -287,7 +287,7 @@ void VxpsTextNode::extend(int n) if ( n < Nalloc ) return; int k; -char * u = (char *) 0; +char * u = (char *) nullptr; const char *method_name = "VxpsTextNode::extend"; // @@ -328,11 +328,11 @@ if ( Text ) m_strncpy(u, Text, (n-1), method_name, "Text"); // toss old, grab new // -if ( Text ) { delete [] Text; Text = (char *) 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; } Text = u; -u = (char *) 0; +u = (char *) nullptr; // // done @@ -351,7 +351,7 @@ void VxpsTextNode::set_text(const char * s) { const char *method_name = "VxpsTextNode::set_text"; -if ( Text ) { delete [] Text; Text = (char *) 0; Nalloc = 0; } +if ( Text ) { delete [] Text; Text = (char *) nullptr; Nalloc = 0; } Nchars = m_strlen(s); @@ -627,7 +627,7 @@ if ( (k < 0) || (k > 255) ) { int j; char junk[16]; -char * c = (char *) 0; +char * c = (char *) nullptr; c = junk + (sizeof(junk) - 1); diff --git a/src/libcode/vx_ps/table_helper.cc b/src/libcode/vx_ps/table_helper.cc index 9e1eee2f87..d951a1e220 100644 --- a/src/libcode/vx_ps/table_helper.cc +++ b/src/libcode/vx_ps/table_helper.cc @@ -100,9 +100,9 @@ void TableHelper::init_from_scratch() { -ColWidth = (double *) 0; +ColWidth = (double *) nullptr; -RowHeight = (double *) 0; +RowHeight = (double *) nullptr; clear(); @@ -118,11 +118,11 @@ void TableHelper::clear() { -Plot = (PSfile *) 0; // not allocated, so don't delete +Plot = (PSfile *) nullptr; // not allocated, so don't delete -if ( ColWidth ) { delete [] ColWidth; ColWidth = (double *) 0; } +if ( ColWidth ) { delete [] ColWidth; ColWidth = (double *) nullptr; } -if ( RowHeight ) { delete [] RowHeight; RowHeight = (double *) 0; } +if ( RowHeight ) { delete [] RowHeight; RowHeight = (double *) nullptr; } Xpin = Ypin = Upin = Vpin = 0.0; diff --git a/src/libcode/vx_ps/vx_ps.cc b/src/libcode/vx_ps/vx_ps.cc index 5462b63737..04afccc98c 100644 --- a/src/libcode/vx_ps/vx_ps.cc +++ b/src/libcode/vx_ps/vx_ps.cc @@ -159,7 +159,7 @@ PSfile::~PSfile() close(); -delete afm; afm = (Afm *) 0; +delete afm; afm = (Afm *) nullptr; } @@ -171,7 +171,7 @@ void PSfile::init_from_scratch() { -File = (ofstream *) 0; +File = (ofstream *) nullptr; psout.ignore_columns = true; @@ -399,7 +399,7 @@ if ( File ) { File->close(); - delete File; File = (ofstream *) 0; + delete File; File = (ofstream *) nullptr; } @@ -572,7 +572,7 @@ const double scale = 0.001*font_size; double x_cur, y_cur; double dx, dy; VxpsTextNode node; -VxpsTextNode * n = (VxpsTextNode *) 0; +VxpsTextNode * n = (VxpsTextNode *) nullptr; make_list(current_font, font_size, *afm, node, s); diff --git a/src/libcode/vx_pxm/pcm.cc b/src/libcode/vx_pxm/pcm.cc index f1107ccf20..cf10e9fcaa 100644 --- a/src/libcode/vx_pxm/pcm.cc +++ b/src/libcode/vx_pxm/pcm.cc @@ -122,7 +122,7 @@ void Pcm::clear() clear_common(); -if ( Colormap ) { delete [] Colormap; Colormap = (Color *) 0; } +if ( Colormap ) { delete [] Colormap; Colormap = (Color *) nullptr; } Ncolors = 0; @@ -142,9 +142,9 @@ void Pcm::init_from_scratch() // PxmBase::init_from_scratch(); -Colormap = (Color *) 0; +Colormap = (Color *) nullptr; -Name = (char *) 0; +Name = (char *) nullptr; Ncolors = 0; @@ -753,7 +753,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { @@ -870,7 +870,7 @@ void Pcm::set_colormap(const Color * c, int n) { -if ( Colormap ) { delete [] Colormap; Colormap = (Color *) 0; } +if ( Colormap ) { delete [] Colormap; Colormap = (Color *) nullptr; } Colormap = new Color [n]; diff --git a/src/libcode/vx_pxm/pgm.cc b/src/libcode/vx_pxm/pgm.cc index a38d4fd4e1..06e5294d14 100644 --- a/src/libcode/vx_pxm/pgm.cc +++ b/src/libcode/vx_pxm/pgm.cc @@ -610,7 +610,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { // a == 0 has already been checked for diff --git a/src/libcode/vx_pxm/ppm.cc b/src/libcode/vx_pxm/ppm.cc index 27cf265eb3..033c25a6a5 100644 --- a/src/libcode/vx_pxm/ppm.cc +++ b/src/libcode/vx_pxm/ppm.cc @@ -165,7 +165,7 @@ Color Ppm::getrc(int r, int c) const { int n; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; Color color; @@ -206,7 +206,7 @@ void Ppm::putrc(const Color & color, int r, int c) { int n; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; n = rc_to_n(r, c); @@ -605,7 +605,7 @@ void Ppm::make_gray() int j, n; Color c; -unsigned char * u = (unsigned char *) 0; +unsigned char * u = (unsigned char *) nullptr; n = Nrows*Ncols; @@ -644,7 +644,7 @@ int row, col; int Nrows_new, Ncols_new, bytes; int row_new = 0, col_new = 0; int n_new, n_old; -unsigned char *u = (unsigned char *) 0; +unsigned char *u = (unsigned char *) nullptr; if ( a == 2 ) { diff --git a/src/libcode/vx_pxm/pxm_base.cc b/src/libcode/vx_pxm/pxm_base.cc index bc52724b35..e4db7a82e6 100644 --- a/src/libcode/vx_pxm/pxm_base.cc +++ b/src/libcode/vx_pxm/pxm_base.cc @@ -65,9 +65,9 @@ void PxmBase::init_from_scratch() { -data = (unsigned char *) 0; +data = (unsigned char *) nullptr; -Name = (char *) 0; +Name = (char *) nullptr; clear_common(); @@ -85,11 +85,11 @@ void PxmBase::clear_common() { -if ( data ) { delete [] data; data = (unsigned char *) 0; } +if ( data ) { delete [] data; data = (unsigned char *) nullptr; } Nalloc = 0; -if ( Name ) { delete [] Name; Name = (char *) 0; } +if ( Name ) { delete [] Name; Name = (char *) nullptr; } Nrows = Ncols = 0; @@ -291,7 +291,7 @@ for (j=0; jignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -194,7 +194,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_pcm.cc b/src/libcode/vx_render/render_pcm.cc index 04e99f0414..6fbb3a283f 100644 --- a/src/libcode/vx_render/render_pcm.cc +++ b/src/libcode/vx_render/render_pcm.cc @@ -49,7 +49,7 @@ int nx, ny; double w, h; unsigned char u; Color color; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; @@ -105,7 +105,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; set_up_colortable(plot.file(), pcm, info); @@ -173,7 +173,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_pgm.cc b/src/libcode/vx_render/render_pgm.cc index 11d0d6801e..df72e6f85b 100644 --- a/src/libcode/vx_render/render_pgm.cc +++ b/src/libcode/vx_render/render_pgm.cc @@ -45,7 +45,7 @@ int nx, ny; double w, h; unsigned char u; Color color; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; @@ -101,7 +101,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -173,7 +173,7 @@ for (r=0; reod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_render/render_ppm.cc b/src/libcode/vx_render/render_ppm.cc index 15d4c2200f..cf7e51f97e 100644 --- a/src/libcode/vx_render/render_ppm.cc +++ b/src/libcode/vx_render/render_ppm.cc @@ -34,7 +34,7 @@ plot.gsave(); int j, r, c; double w, h; -PSFilter *out = (PSFilter *) 0; +PSFilter *out = (PSFilter *) nullptr; PSFilter **v = &out; Color color; @@ -92,7 +92,7 @@ psout->ignore_columns = false; *v = psout; -v = (PSFilter **) 0; +v = (PSFilter **) nullptr; @@ -164,7 +164,7 @@ for (r=0; r<(image.nrows()); ++r) { out->eod(); -delete out; out = (PSFilter *) 0; +delete out; out = (PSFilter *) nullptr; plot.file() << "\n\n"; diff --git a/src/libcode/vx_series_data/series_data.cc b/src/libcode/vx_series_data/series_data.cc index 03b227b0f2..1417e785f2 100644 --- a/src/libcode/vx_series_data/series_data.cc +++ b/src/libcode/vx_series_data/series_data.cc @@ -83,7 +83,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, const GrdFileType type, DataPlane& dp, Grid& grid) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile* mtddf = (Met2dDataFile*) 0; + Met2dDataFile* mtddf = (Met2dDataFile*) nullptr; // Check that file exists if(!file_exists(filename.c_str())) { @@ -102,7 +102,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, if(found) grid = mtddf->grid(); // Cleanup - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(found); } @@ -165,7 +165,7 @@ bool read_all_entries(vector &vi_list, const ConcatString &filename, const GrdFileType type, vector &dp_list, Grid &grid) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile* mtddf = (Met2dDataFile*) 0; + Met2dDataFile* mtddf = (Met2dDataFile*) nullptr; // Check that file exists if(!file_exists(filename.c_str())) { @@ -184,7 +184,7 @@ bool read_all_entries(vector &vi_list, const ConcatString &filename, if(n_valid > 0) grid = mtddf->grid(); // Cleanup - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(n_valid > 0); } diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index c393610c2f..dd7ab216c0 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -53,27 +53,27 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(fcst_raw) { delete fcst_raw; - fcst_raw = (ShapeData *) 0; + fcst_raw = (ShapeData *) nullptr; } if(fcst_thresh) { delete fcst_thresh; - fcst_thresh = (ShapeData *) 0; + fcst_thresh = (ShapeData *) nullptr; } if(fcst_conv) { delete fcst_conv; - fcst_conv = (ShapeData *) 0; + fcst_conv = (ShapeData *) nullptr; } if(fcst_mask) { delete fcst_mask; - fcst_mask = (ShapeData *) 0; + fcst_mask = (ShapeData *) nullptr; } if(fcst_split) { delete fcst_split; - fcst_split = (ShapeData *) 0; + fcst_split = (ShapeData *) nullptr; } if(fcst_clus_split) { delete fcst_clus_split; - fcst_clus_split = (ShapeData *) 0; + fcst_clus_split = (ShapeData *) nullptr; } // @@ -81,27 +81,27 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(obs_raw) { delete obs_raw; - obs_raw = (ShapeData *) 0; + obs_raw = (ShapeData *) nullptr; } if(obs_thresh) { delete obs_thresh; - obs_thresh = (ShapeData *) 0; + obs_thresh = (ShapeData *) nullptr; } if(obs_conv) { delete obs_conv; - obs_conv = (ShapeData *) 0; + obs_conv = (ShapeData *) nullptr; } if(obs_mask) { delete obs_mask; - obs_mask = (ShapeData *) 0; + obs_mask = (ShapeData *) nullptr; } if(obs_split) { delete obs_split; - obs_split = (ShapeData *) 0; + obs_split = (ShapeData *) nullptr; } if(obs_clus_split) { delete obs_clus_split; - obs_clus_split = (ShapeData *) 0; + obs_clus_split = (ShapeData *) nullptr; } // @@ -109,11 +109,11 @@ ModeFuzzyEngine::~ModeFuzzyEngine() { // if(fcst_engine) { delete fcst_engine; - fcst_engine = (ModeFuzzyEngine *) 0; + fcst_engine = (ModeFuzzyEngine *) nullptr; } if(obs_engine) { delete obs_engine; - obs_engine = (ModeFuzzyEngine *) 0; + obs_engine = (ModeFuzzyEngine *) nullptr; } } @@ -139,7 +139,7 @@ ModeFuzzyEngine & ModeFuzzyEngine::operator=(const ModeFuzzyEngine & eng) { void ModeFuzzyEngine::init_from_scratch() { - grid = (Grid *) 0; + grid = (Grid *) nullptr; // // Reset all fcst and obs processing flags to initial state @@ -178,8 +178,8 @@ void ModeFuzzyEngine::init_from_scratch() { obs_split = new ShapeData; obs_clus_split = new ShapeData; - fcst_engine = (ModeFuzzyEngine *) 0; - obs_engine = (ModeFuzzyEngine *) 0; + fcst_engine = (ModeFuzzyEngine *) nullptr; + obs_engine = (ModeFuzzyEngine *) nullptr; n_fcst = 0; n_obs = 0; @@ -2925,7 +2925,7 @@ double total_interest(ModeConfInfo &mc, const PairFeature &p, double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) { int i, fcst_i, obs_i, n_values; double interest, ptile; - double *v = (double *) 0; + double *v = (double *) nullptr; NumArray fcst_na, obs_na; if(eng.conf_info.match_flag == 0 || @@ -2993,7 +2993,7 @@ double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) // Done // - if(v) { delete [] v; v = (double *) 0; } + if(v) { delete [] v; v = (double *) nullptr; } return(ptile); } diff --git a/src/libcode/vx_shapedata/interest.cc b/src/libcode/vx_shapedata/interest.cc index d33d32e426..d89ce2a0ff 100644 --- a/src/libcode/vx_shapedata/interest.cc +++ b/src/libcode/vx_shapedata/interest.cc @@ -92,7 +92,7 @@ void SingleFeature::init_from_scratch() { -boundary = (Polyline *) 0; +boundary = (Polyline *) nullptr; clear(); @@ -126,16 +126,16 @@ void SingleFeature::clear() intensity_ptile.sum = 0.0; user_ptile = 0.0; - Raw = (const ShapeData *) 0; - Thresh = (const ShapeData *) 0; - Split = (const ShapeData *) 0; + Raw = (const ShapeData *) nullptr; + Thresh = (const ShapeData *) nullptr; + Split = (const ShapeData *) nullptr; convex_hull.clear(); // // Deallocate memory // - if(boundary) { delete [] boundary; boundary = (Polyline *) 0; } + if(boundary) { delete [] boundary; boundary = (Polyline *) nullptr; } n_bdy = 0; return; @@ -358,8 +358,8 @@ void PairFeature::clear() complexity_ratio = 0.0; percentile_intensity_ratio = 0.0; - Obs = (const SingleFeature *) 0; // DON'T delete - Fcst = (const SingleFeature *) 0; // DON'T delete + Obs = (const SingleFeature *) nullptr; // DON'T delete + Fcst = (const SingleFeature *) nullptr; // DON'T delete return; } @@ -600,8 +600,8 @@ void get_percentiles(DistributionPercentiles &ptile, { int i, x, y, n_values; int nx, ny; - double *v = (double *) 0; - double *v_tmp = (double *) 0; + double *v = (double *) nullptr; + double *v_tmp = (double *) nullptr; const char *method_name = "get_percentiles() -> "; nx = raw.data.nx(); @@ -682,8 +682,8 @@ void get_percentiles(DistributionPercentiles &ptile, // // Free memory // - if(v_tmp) { delete [] v_tmp; v_tmp = (double *) 0; } - if(v) { delete [] v; v = (double *) 0; } + if(v_tmp) { delete [] v_tmp; v_tmp = (double *) nullptr; } + if(v) { delete [] v; v = (double *) nullptr; } // // Done diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index 5852d9f51e..2a5b84514f 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -137,7 +137,7 @@ void ModeConfInfo::assign( const ModeConfInfo &m) } // need to be recomputed, maybe, so do so just in case - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; dict = conf.lookup_dictionary(conf_key_interest_function); centroid_dist_if = parse_interest_function(dict, conf_key_centroid_dist); boundary_dist_if = parse_interest_function(dict, conf_key_boundary_dist); @@ -226,16 +226,16 @@ void ModeConfInfo::clear() inten_perc_value = bad_data_int; - centroid_dist_if = (PiecewiseLinear *) 0; - boundary_dist_if = (PiecewiseLinear *) 0; - convex_hull_dist_if = (PiecewiseLinear *) 0; - angle_diff_if = (PiecewiseLinear *) 0; - aspect_diff_if = (PiecewiseLinear *) 0; - area_ratio_if = (PiecewiseLinear *) 0; - int_area_ratio_if = (PiecewiseLinear *) 0; - curvature_ratio_if = (PiecewiseLinear *) 0; - complexity_ratio_if = (PiecewiseLinear *) 0; - inten_perc_ratio_if = (PiecewiseLinear *) 0; + centroid_dist_if = (PiecewiseLinear *) nullptr; + boundary_dist_if = (PiecewiseLinear *) nullptr; + convex_hull_dist_if = (PiecewiseLinear *) nullptr; + angle_diff_if = (PiecewiseLinear *) nullptr; + aspect_diff_if = (PiecewiseLinear *) nullptr; + area_ratio_if = (PiecewiseLinear *) nullptr; + int_area_ratio_if = (PiecewiseLinear *) nullptr; + curvature_ratio_if = (PiecewiseLinear *) nullptr; + complexity_ratio_if = (PiecewiseLinear *) nullptr; + inten_perc_ratio_if = (PiecewiseLinear *) nullptr; total_interest_thresh = bad_data_double; @@ -308,7 +308,7 @@ void ModeConfInfo::process_config_traditional(GrdFileType ftype, GrdFileType oty void ModeConfInfo::process_config_except_fields() { - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; // Dump the contents of the config file @@ -536,8 +536,8 @@ void ModeConfInfo::process_config_both(GrdFileType ftype, GrdFileType otype, int j, k, n; - Dictionary * fcst_dict = (Dictionary *) 0; - Dictionary * obs_dict = (Dictionary *) 0; + Dictionary * fcst_dict = (Dictionary *) nullptr; + Dictionary * obs_dict = (Dictionary *) nullptr; // Conf: fcst and obs @@ -608,7 +608,7 @@ void ModeConfInfo::process_config_fcst(GrdFileType ftype, int field_index) { int j, k, n; - Dictionary * fcst_dict = (Dictionary *) 0; + Dictionary * fcst_dict = (Dictionary *) nullptr; fcst_dict = conf.lookup_dictionary(conf_key_fcst); shift_right = fcst_dict->lookup_int(conf_key_shift_right); @@ -645,7 +645,7 @@ void ModeConfInfo::process_config_obs(GrdFileType otype, int field_index) { int j, k, n; - Dictionary * obs_dict = (Dictionary *) 0; + Dictionary * obs_dict = (Dictionary *) nullptr; obs_dict = conf.lookup_dictionary(conf_key_obs); shift_right = obs_dict->lookup_int(conf_key_shift_right); @@ -1270,7 +1270,7 @@ void ModeConfInfo::parse_nc_info() { -const DictionaryEntry * e = (const DictionaryEntry *) 0; +const DictionaryEntry * e = (const DictionaryEntry *) nullptr; e = conf.lookup(conf_key_nc_pairs_flag); @@ -1587,7 +1587,7 @@ GrdFileType ModeConfInfo::file_type_for_field(bool isFcst, int field_index) // look at the dictionary for the obs or forecast at index, with // parents - Dictionary * dict = (Dictionary *) 0; + Dictionary * dict = (Dictionary *) nullptr; if (isFcst) { dict = conf.lookup_dictionary(conf_key_fcst); } else { @@ -1682,7 +1682,7 @@ void ModeConfInfo::get_multivar_programs() { -Dictionary * dict = (Dictionary *) 0; +Dictionary * dict = (Dictionary *) nullptr; fcst_multivar_logic.clear(); obs_multivar_logic.clear(); diff --git a/src/libcode/vx_shapedata/node.cc b/src/libcode/vx_shapedata/node.cc index d344322bd5..c687148522 100644 --- a/src/libcode/vx_shapedata/node.cc +++ b/src/libcode/vx_shapedata/node.cc @@ -38,9 +38,9 @@ using namespace std; Node::Node() { - child = (Node *) 0; + child = (Node *) nullptr; - sibling = (Node *) 0; + sibling = (Node *) nullptr; clear(); } @@ -76,12 +76,12 @@ void Node::clear() { if(child) { child->clear(); - delete child; child = (Node *) 0; + delete child; child = (Node *) nullptr; } if(sibling) { sibling->clear(); - delete sibling; sibling = (Node *) 0; + delete sibling; sibling = (Node *) nullptr; } p.clear(); @@ -127,7 +127,7 @@ void Node::assign_tree(const Node *n_ptr) { /////////////////////////////////////////////////////////////////////////////// void Node::add_child(const Polyline * poly) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Check for first child if(child == nullptr) { @@ -183,7 +183,7 @@ void Node::add_child(const Polyline * poly) { int Node::n_children() const { int count; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; count = 0; @@ -207,7 +207,7 @@ int Node::n_children() const { Node *Node::get_child(int n) const { int children_count, i; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; if( n >= (children_count = n_children()) ) { @@ -229,7 +229,7 @@ Node *Node::get_child(int n) const { int Node::is_closed() const { int closed; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Check if the current polyline is closed closed = p.is_closed(); @@ -269,7 +269,7 @@ void Node::centroid(double &ubar, double &vbar) const { /////////////////////////////////////////////////////////////////////////////// void Node::translate(double du, double dv) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; // Translate each point of the current polyline p.translate(du, dv); @@ -339,7 +339,7 @@ void Node::rotate(double deg) { /////////////////////////////////////////////////////////////////////////////// void Node::rotate(double deg, double ubar, double vbar) { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.rotate(deg, ubar, vbar); @@ -359,7 +359,7 @@ void Node::rotate(double deg, double ubar, double vbar) { double Node::uv_signed_area() const { double sum; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; sum = p.uv_signed_area(); @@ -379,7 +379,7 @@ double Node::uv_signed_area() const { int Node::is_inside(double u_test, double v_test) const { int count; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; if(p.is_inside(u_test, v_test)) { @@ -411,7 +411,7 @@ int Node::is_inside(double u_test, double v_test) const { int Node::is_polyline_point(double u_test, double v_test) const { int poly_point; - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; poly_point = p.is_polyline_point(u_test, v_test); @@ -431,7 +431,7 @@ int Node::is_polyline_point(double u_test, double v_test) const { /////////////////////////////////////////////////////////////////////////////// void Node::bounding_box(Box &bb) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.bounding_box(bb); @@ -455,7 +455,7 @@ void Node::bounding_box(Box &bb) const { /////////////////////////////////////////////////////////////////////////////// void Node::sum_first_moments(double &sum_x, double &sum_y) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.sum_first_moments(sum_x, sum_y); @@ -475,7 +475,7 @@ void Node::sum_first_moments(double &sum_x, double &sum_y) const { void Node::sum_second_moments(double x_bar, double y_bar, double &Ixx, double &Ixy, double &Iyy) const { - Node *n_ptr = (Node *) 0; + Node *n_ptr = (Node *) nullptr; p.sum_second_moments(x_bar, y_bar, Ixx, Ixy, Iyy); @@ -500,7 +500,8 @@ void Node::sum_second_moments(double x_bar, double y_bar, double node_dist(const Node &a, const Node &b) { double min_dist, dist; int i_a, i_b, num_a, num_b; - Node *a_ptr = (Node *) 0, *b_ptr = (Node *) 0; + Node *a_ptr = (Node *) nullptr; + Node *b_ptr = (Node *) nullptr; num_a = a.n_children(); num_b = b.n_children(); @@ -538,7 +539,7 @@ double node_dist(const Node &a, const Node &b) { double node_polyline_dist(const Node &a, const Polyline &b) { double min_dist, dist; int i_a, num_a; - Node *a_ptr = (Node *) 0; + Node *a_ptr = (Node *) nullptr; num_a = a.n_children(); diff --git a/src/libcode/vx_shapedata/shapedata.cc b/src/libcode/vx_shapedata/shapedata.cc index bc7332bc94..4fa554cea2 100644 --- a/src/libcode/vx_shapedata/shapedata.cc +++ b/src/libcode/vx_shapedata/shapedata.cc @@ -1253,7 +1253,7 @@ void Cell::clear() { -if ( e ) { delete [] e; e = (int *) 0; } +if ( e ) { delete [] e; e = (int *) nullptr; } n = 0; diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 034c3c1961..7138675705 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -29,7 +29,7 @@ const bool use_weighted_seeps = false; //////////////////////////////////////////////////////////////////////// void parse_row_col(const char *col_name, int &r, int &c) { - const char *ptr = (const char *) 0; + const char *ptr = (const char *) nullptr; // Parse Fi_Oj strings r = atoi(++col_name); @@ -76,7 +76,7 @@ void close_txt_file(ofstream *&out, const char *file_name) { // Close the output file out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; return; } diff --git a/src/libcode/vx_statistics/apply_mask.cc b/src/libcode/vx_statistics/apply_mask.cc index 010c091825..f3073d5f8f 100644 --- a/src/libcode/vx_statistics/apply_mask.cc +++ b/src/libcode/vx_statistics/apply_mask.cc @@ -108,7 +108,7 @@ Grid parse_grid_string(const char *grid_str) { << grid_str << "\".\n"; Met2dDataFileFactory m_factory; - Met2dDataFile *met_ptr = (Met2dDataFile *) 0; + Met2dDataFile *met_ptr = (Met2dDataFile *) nullptr; // Open the data file if(!(met_ptr = m_factory.new_met_2d_data_file(grid_str))) { @@ -251,7 +251,7 @@ void parse_grid_mask(const ConcatString &mask_grid_str, Grid &grid) { << mask_grid_str << "\".\n"; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Attempt to open the data file if(!(mtddf = mtddf_factory.new_met_2d_data_file( @@ -451,11 +451,11 @@ void parse_poly_2d_data_mask(const ConcatString &mask_poly_str, // 2D Data file Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // VarInfo object VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; // Open the data file mtddf = mtddf_factory.new_met_2d_data_file(file_name.c_str(), type); @@ -504,8 +504,8 @@ void parse_poly_2d_data_mask(const ConcatString &mask_poly_str, if(append_thresh) mask_name << st.get_str(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } return; } @@ -603,15 +603,15 @@ DataPlane parse_geog_data(Dictionary *dict, const Grid &vx_grid, StringArray geog_files; RegridInfo regrid_info; GrdFileType ftype; - Dictionary *field_dict = (Dictionary *) 0; + Dictionary *field_dict = (Dictionary *) nullptr; bool found = false; int i; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; if(!dict) { mlog << Error << "\nparse_geog_data() -> " @@ -673,8 +673,8 @@ DataPlane parse_geog_data(Dictionary *dict, const Grid &vx_grid, } // Deallocate memory - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } } if(!found) { diff --git a/src/libcode/vx_statistics/compute_ci.cc b/src/libcode/vx_statistics/compute_ci.cc index e4a9aabae7..e8a2d1df26 100644 --- a/src/libcode/vx_statistics/compute_ci.cc +++ b/src/libcode/vx_statistics/compute_ci.cc @@ -283,14 +283,15 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, int i, j, c; double s; NumArray i_na, ir_na, si_na, sr_na; - CTSInfo *cts_tmp = (CTSInfo *) 0; + CTSInfo *cts_tmp = (CTSInfo *) nullptr; // // Temp file streams for categorical statistics // - ofstream *cts_i_out = (ofstream *) 0, *cts_r_out = (ofstream *) 0; - ConcatString *cts_i_file = (ConcatString *) 0; - ConcatString *cts_r_file = (ConcatString *) 0; + ofstream *cts_i_out = (ofstream *) nullptr; + ofstream *cts_r_out = (ofstream *) nullptr; + ConcatString *cts_i_file = (ConcatString *) nullptr; + ConcatString *cts_r_file = (ConcatString *) nullptr; ConcatString prefix; // @@ -378,11 +379,11 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, } // deallocate memory - if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) 0; } - if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) 0; } - if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) 0; } - if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) 0; } - if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) 0; } + if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) nullptr; } + if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) nullptr; } + 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); } } @@ -712,11 +713,11 @@ void compute_cts_stats_ci_bca(const gsl_rng *rng_ptr, // // Deallocate memory // - if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) 0; } - if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) 0; } - if(cts_r_out) { delete [] cts_r_out; cts_r_out = (ofstream *) 0; } - if(cts_i_file) { delete [] cts_i_file; cts_i_file = (ConcatString *) 0; } - if(cts_r_file) { delete [] cts_r_file; cts_r_file = (ConcatString *) 0; } + if(cts_tmp) { delete [] cts_tmp; cts_tmp = (CTSInfo *) nullptr; } + if(cts_i_out) { delete [] cts_i_out; cts_i_out = (ofstream *) nullptr; } + 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; } return; } @@ -1420,13 +1421,14 @@ void compute_cts_stats_ci_perc(const gsl_rng *rng_ptr, int i, j, m, c; double s; NumArray i_na, ir_na, sr_na; - CTSInfo *cts_tmp = (CTSInfo *) 0; + CTSInfo *cts_tmp = (CTSInfo *) nullptr; // // Temp file streams for categorical statistics // - ofstream *cts_r_out = (ofstream *) 0; - ConcatString *cts_r_file = (ConcatString *) 0, prefix; + ofstream *cts_r_out = (ofstream *) nullptr; + ConcatString *cts_r_file = (ConcatString *) nullptr; + ConcatString prefix; // // Check that the forecast and observation arrays of the same length @@ -1506,9 +1508,9 @@ void compute_cts_stats_ci_perc(const gsl_rng *rng_ptr, // for(i=0; iempty() ) { } -if ( Thresholds ) { delete [] Thresholds; Thresholds = (double *) 0; } +if ( Thresholds ) { delete [] Thresholds; Thresholds = (double *) nullptr; } Thresholds = new double [Nrows + 1]; diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index f103284ee0..62e7a7e2f2 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -1077,8 +1077,8 @@ if ( N == 0 ) return ( bad_data_double ); int j, k, m, n; const double DN = (double) N; double t, sum; -double * p = (double *) 0; -double * s = (double *) 0; +double * p = (double *) nullptr; +double * s = (double *) nullptr; // // can't compute gerrity when the first column contains all zeros @@ -1140,8 +1140,8 @@ for (j=0; jfile_type()); @@ -1090,7 +1090,7 @@ void VxPairDataEnsemble::set_obs_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(obs_info) { delete obs_info; obs_info = (VarInfo *) 0; } + if(obs_info) { delete obs_info; obs_info = (VarInfo *) nullptr; } // Perform a deep copy obs_info = f.new_var_info(info->file_type()); @@ -1439,7 +1439,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, double cmn_v, csd_v, obs_v, wgt_v; int cmn_lvl_blw, cmn_lvl_abv; int csd_lvl_blw, csd_lvl_abv; - ObsErrorEntry *oerr_ptr = (ObsErrorEntry *) 0; + ObsErrorEntry *oerr_ptr = (ObsErrorEntry *) nullptr; // Check the observation VarInfo file type if(obs_info->file_type() != FileType_Gb1) { diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 15aa9133f0..7282d1504d 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -416,18 +416,18 @@ VxPairDataPoint & VxPairDataPoint::operator=(const VxPairDataPoint &vx_pd) { void VxPairDataPoint::init_from_scratch() { - fcst_info = (VarInfo *) 0; - climo_info = (VarInfo *) 0; - obs_info = (VarInfoGrib *) 0; - - pd = (PairDataPoint ***) 0; - rej_typ = (int ***) 0; - rej_mask = (int ***) 0; - rej_fcst = (int ***) 0; - rej_cmn = (int ***) 0; - rej_csd = (int ***) 0; - rej_mpr = (int ***) 0; - rej_dup = (int ***) 0; + fcst_info = (VarInfo *) nullptr; + climo_info = (VarInfo *) nullptr; + obs_info = (VarInfoGrib *) nullptr; + + pd = (PairDataPoint ***) nullptr; + rej_typ = (int ***) nullptr; + rej_mask = (int ***) nullptr; + rej_fcst = (int ***) nullptr; + rej_cmn = (int ***) nullptr; + rej_csd = (int ***) nullptr; + rej_mpr = (int ***) nullptr; + rej_dup = (int ***) nullptr; n_msg_typ = 0; n_mask = 0; @@ -443,9 +443,9 @@ void VxPairDataPoint::init_from_scratch() { void VxPairDataPoint::clear() { int i, j, k; - if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) 0; } - if(climo_info) { delete climo_info; climo_info = (VarInfo *) 0; } - if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) 0; } + if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) nullptr; } + if(climo_info) { delete climo_info; climo_info = (VarInfo *) nullptr; } + if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) nullptr; } desc.clear(); @@ -576,7 +576,7 @@ void VxPairDataPoint::set_fcst_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) 0; } + if(fcst_info) { delete fcst_info; fcst_info = (VarInfo *) nullptr; } // Perform a deep copy fcst_info = f.new_var_info(info->file_type()); @@ -591,7 +591,7 @@ void VxPairDataPoint::set_climo_info(VarInfo *info) { VarInfoFactory f; // Deallocate, if necessary - if(climo_info) { delete climo_info; climo_info = (VarInfo *) 0; } + if(climo_info) { delete climo_info; climo_info = (VarInfo *) nullptr; } // Perform a deep copy climo_info = f.new_var_info(info->file_type()); @@ -605,7 +605,7 @@ void VxPairDataPoint::set_climo_info(VarInfo *info) { void VxPairDataPoint::set_obs_info(VarInfoGrib *info) { // Deallocate, if necessary - if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) 0; } + if(obs_info) { delete obs_info; obs_info = (VarInfoGrib *) nullptr; } // Perform a deep copy obs_info = new VarInfoGrib; diff --git a/src/libcode/vx_statistics/read_climo.cc b/src/libcode/vx_statistics/read_climo.cc index 27fe9e5eae..6e077c9173 100644 --- a/src/libcode/vx_statistics/read_climo.cc +++ b/src/libcode/vx_statistics/read_climo.cc @@ -152,10 +152,10 @@ void read_climo_file(const char *climo_file, GrdFileType ctype, DataPlaneArray &dpa) { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; VarInfoFactory info_factory; - VarInfo *info = (VarInfo *) 0; + VarInfo *info = (VarInfo *) nullptr; DataPlaneArray clm_dpa; DataPlane dp; @@ -240,8 +240,8 @@ void read_climo_file(const char *climo_file, GrdFileType ctype, } // end for i // Deallocate memory - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(info) { delete info; info = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(info) { delete info; info = (VarInfo *) nullptr; } return; } diff --git a/src/libcode/vx_tc_util/atcf_line_base.cc b/src/libcode/vx_tc_util/atcf_line_base.cc index 6db2d00651..7a5f658e5f 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.cc +++ b/src/libcode/vx_tc_util/atcf_line_base.cc @@ -79,10 +79,10 @@ void ATCFLineBase::init_from_scratch() { set_delimiter(","); // Initialize pointers - BasinMap = (map *) 0; - BestTechnique = (StringArray *) 0; - OperTechnique = (StringArray *) 0; - TechSuffix = (ConcatString *) 0; + BasinMap = (map *) nullptr; + BestTechnique = (StringArray *) nullptr; + OperTechnique = (StringArray *) nullptr; + TechSuffix = (ConcatString *) nullptr; clear(); @@ -503,7 +503,7 @@ ATCFLineType string_to_atcflinetype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString atcflinetype_to_string(const ATCFLineType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case ATCFLineType_Track: s = "Track"; break; diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index 106a646f88..19007127d0 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -553,7 +553,7 @@ WatchWarnType string_to_watchwarntype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString watchwarntype_to_string(const WatchWarnType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TropicalStormWatch: s = "TSWATCH"; break; @@ -597,7 +597,7 @@ CycloneLevel string_to_cyclonelevel(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString cyclonelevel_to_string(const CycloneLevel t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case Disturbance: s = "DB"; break; @@ -657,7 +657,7 @@ QuadrantType string_to_quadranttype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString quadranttype_to_string(const QuadrantType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case FullCircle: s = "AAA"; break; @@ -698,7 +698,7 @@ SubregionCode string_to_subregioncode(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString subregioncode_to_string(const SubregionCode t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case Arabian_Sea: s = "A"; break; @@ -733,7 +733,7 @@ SystemsDepth string_to_systemsdepth(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString systemsdepth_to_string(const SystemsDepth t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case DeepDepth: s = "D"; break; diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 95336c7765..35680981a7 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -339,10 +339,10 @@ void DiagFile::read_cira_rt(const ConcatString &path, if(convert_map) { if(convert_map->count(cs) > 0) fx_ptr = &convert_map->at(cs); else if(convert_map->count(dl[1]) > 0) fx_ptr = &convert_map->at(dl[1]); - else fx_ptr = (UserFunc_1Arg *) 0; + else fx_ptr = (UserFunc_1Arg *) nullptr; } else { - fx_ptr = (UserFunc_1Arg *) 0; + fx_ptr = (UserFunc_1Arg *) nullptr; } // Parse the data values @@ -492,10 +492,10 @@ void DiagFile::read_ships_rt(const ConcatString &path, // Check for a conversion function if(convert_map) { if(convert_map->count(cs) > 0) fx_ptr = &convert_map->at(cs); - else fx_ptr = (UserFunc_1Arg *) 0; + else fx_ptr = (UserFunc_1Arg *) nullptr; } else { - fx_ptr = (UserFunc_1Arg *) 0; + fx_ptr = (UserFunc_1Arg *) nullptr; } // Parse the data values diff --git a/src/libcode/vx_tc_util/pair_data_genesis.cc b/src/libcode/vx_tc_util/pair_data_genesis.cc index c5665e318f..9f5dd56f87 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.cc +++ b/src/libcode/vx_tc_util/pair_data_genesis.cc @@ -28,7 +28,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////// ConcatString genesispaircategory_to_string(const GenesisPairCategory c) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(c) { case FYOYGenesis: s = "FYOY"; break; diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 364e754035..e80d254f32 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -71,7 +71,7 @@ void ProbRIRWPairInfo::init_from_scratch() { void ProbRIRWPairInfo::clear() { ProbRIRW.clear(); - BDeck = (TrackInfo *) 0; + BDeck = (TrackInfo *) nullptr; StormName.clear(); BModel.clear(); BLat = BLon = bad_data_double; @@ -274,7 +274,7 @@ void ProbRIRWPairInfo::set(const TCStatLine &l) { ProbRIRW.set(l); // Do not populate the BDECK - BDeck = (TrackInfo *) 0; + BDeck = (TrackInfo *) nullptr; // Store column information StormName = l.get_item("STORM_NAME", false); diff --git a/src/libcode/vx_tc_util/tc_columns.cc b/src/libcode/vx_tc_util/tc_columns.cc index 3e38075aa7..af191ca329 100644 --- a/src/libcode/vx_tc_util/tc_columns.cc +++ b/src/libcode/vx_tc_util/tc_columns.cc @@ -58,7 +58,7 @@ void close_tc_txt_file(ofstream *&out, const char *file_name) { // Close the output file out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; return; } diff --git a/src/libcode/vx_tc_util/tc_stat_line.cc b/src/libcode/vx_tc_util/tc_stat_line.cc index 78bd215196..d30a909a54 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.cc +++ b/src/libcode/vx_tc_util/tc_stat_line.cc @@ -100,7 +100,7 @@ void TCStatLine::clear() { DataLine::clear(); Type = NoTCStatLineType; - HdrLine = (AsciiHeaderLine *) 0; + HdrLine = (AsciiHeaderLine *) nullptr; return; } @@ -382,7 +382,7 @@ TCStatLineType string_to_tcstatlinetype(const char *s) { //////////////////////////////////////////////////////////////////////// ConcatString tcstatlinetype_to_string(const TCStatLineType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TCStatLineType_TCMPR: s = TCStatLineType_TCMPR_Str; break; diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index 379d60faa1..9202fe2afe 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -62,7 +62,7 @@ TrackInfo & TrackInfo::operator=(const TrackInfo & t) { void TrackInfo::init_from_scratch() { - Point = (TrackPoint *) 0; + Point = (TrackPoint *) nullptr; clear(); @@ -106,7 +106,7 @@ void TrackInfo::clear() { void TrackInfo::clear_points() { - if(Point) { delete [] Point; Point = (TrackPoint *) 0; } + if(Point) { delete [] Point; Point = (TrackPoint *) nullptr; } NPoints = NAlloc = 0; return; @@ -249,7 +249,7 @@ void TrackInfo::assign(const TrackInfo &t) { void TrackInfo::extend(int n, bool exact) { int j, k; - TrackPoint *new_line = (TrackPoint *) 0; + TrackPoint *new_line = (TrackPoint *) nullptr; // Check if enough memory is already allocated if(NAlloc >= n) return; @@ -273,12 +273,12 @@ void TrackInfo::extend(int n, bool exact) { // Copy the array contents and delete the old one if(Point) { for(j=0; j= n) return; @@ -1045,12 +1045,12 @@ void TrackPairInfoArray::extend(int n, bool exact) { // Copy the array contents and delete the old one if(Pair) { for(j=0; j Date: Tue, 27 Feb 2024 16:52:17 +0000 Subject: [PATCH 07/72] #2673 Change 0 to nullptr --- src/tools/core/ensemble_stat/ensemble_stat.cc | 12 +-- src/tools/core/ensemble_stat/ensemble_stat.h | 4 +- .../ensemble_stat/ensemble_stat_conf_info.cc | 12 +-- src/tools/core/grid_stat/grid_stat.cc | 4 +- src/tools/core/grid_stat/grid_stat.h | 10 +-- src/tools/core/mode/mode_exec.cc | 74 +++++++++---------- src/tools/core/mode/mode_ps_file.cc | 10 +-- src/tools/core/mode_analysis/mode_analysis.cc | 10 +-- src/tools/core/point_stat/point_stat.cc | 4 +- src/tools/core/point_stat/point_stat.h | 4 +- .../core/series_analysis/series_analysis.cc | 22 +++--- .../core/series_analysis/series_analysis.h | 8 +- .../series_analysis_conf_info.cc | 20 ++--- .../core/stat_analysis/aggr_stat_line.cc | 18 ++--- .../core/stat_analysis/parse_stat_line.cc | 4 +- src/tools/core/stat_analysis/stat_analysis.cc | 2 +- src/tools/core/stat_analysis/stat_analysis.h | 2 +- .../core/stat_analysis/stat_analysis_job.cc | 2 +- src/tools/core/wavelet_stat/wavelet_stat.cc | 71 +++++++++--------- src/tools/core/wavelet_stat/wavelet_stat.h | 12 +-- .../wavelet_stat/wavelet_stat_conf_info.cc | 34 ++++----- 21 files changed, 171 insertions(+), 168 deletions(-) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 8b86abcec5..d5342146f2 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -640,7 +640,7 @@ void process_n_vld() { bool get_data_plane(const char *infile, GrdFileType ftype, VarInfo *info, DataPlane &dp, bool do_regrid) { bool found; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Read the current ensemble file if(!(mtddf = mtddf_factory.new_met_2d_data_file(infile, ftype))) { @@ -916,7 +916,7 @@ void process_point_vx() { void process_point_obs(int i_nc) { int i_obs, j; unixtime hdr_ut; - NcFile *obs_in = (NcFile *) 0; + NcFile *obs_in = (NcFile *) nullptr; const char *method_name = "process_point_obs() -> "; mlog << Debug(2) << "\n" << sep_str << "\n\n" @@ -1122,7 +1122,7 @@ bool process_point_ens(int i_vx, int i_ens, DataPlaneArray &fcst_dpa) { //////////////////////////////////////////////////////////////////////// void process_point_scores() { - PairDataEnsemble *pd_ptr = (PairDataEnsemble *) 0; + PairDataEnsemble *pd_ptr = (PairDataEnsemble *) nullptr; PairDataEnsemble pd; ConcatString cs; int i, j, k, l; @@ -1326,7 +1326,7 @@ void process_grid_vx() { mlog << Debug(3) << "Observation error for gridded verification is " << "defined by a table lookup for each point.\n"; - oerr_ptr = (ObsErrorEntry *) 0; + oerr_ptr = (ObsErrorEntry *) nullptr; } } } @@ -1850,7 +1850,7 @@ void setup_txt_files() { max_col += n_header_columns; // Initialize file stream - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; // Build the file name stat_file << tmp_str << stat_file_ext; @@ -1884,7 +1884,7 @@ void setup_txt_files() { if(i == i_orank && !point_obs_flag) continue; // Initialize file stream - txt_out[i] = (ofstream *) 0; + txt_out[i] = (ofstream *) nullptr; // Build the file name txt_file[i] << tmp_str << "_" << txt_file_abbr[i] diff --git a/src/tools/core/ensemble_stat/ensemble_stat.h b/src/tools/core/ensemble_stat/ensemble_stat.h index 1dde2c06a1..28d26a5585 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.h +++ b/src/tools/core/ensemble_stat/ensemble_stat.h @@ -123,7 +123,7 @@ static int compress_level = -1; // Output NetCDF file static bool out_nc_flag = false; static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim; @@ -133,7 +133,7 @@ static StringArray nc_orank_var_sa; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; 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 8da7df73c6..be18529e0e 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -50,8 +50,8 @@ EnsembleStatConfInfo::~EnsembleStatConfInfo() { void EnsembleStatConfInfo::init_from_scratch() { // Initialize pointers - vx_opt = (EnsembleStatVxOpt *) 0; - rng_ptr = (gsl_rng *) 0; + vx_opt = (EnsembleStatVxOpt *) nullptr; + rng_ptr = (gsl_rng *) nullptr; clear(); @@ -86,7 +86,7 @@ void EnsembleStatConfInfo::clear() { nc_info.clear(); // Deallocate memory - if(vx_opt) { delete [] vx_opt; vx_opt = (EnsembleStatVxOpt *) 0; } + if(vx_opt) { delete [] vx_opt; vx_opt = (EnsembleStatVxOpt *) nullptr; } // Reset counts n_vx = 0; @@ -122,8 +122,8 @@ void EnsembleStatConfInfo::process_config(GrdFileType etype, int i, j, n_ens_files; VarInfoFactory info_factory; mapoutput_map; - Dictionary *fdict = (Dictionary *) 0; - Dictionary *odict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; + Dictionary *odict = (Dictionary *) nullptr; Dictionary i_fdict, i_odict; InterpMthd mthd; @@ -869,7 +869,7 @@ void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict, //////////////////////////////////////////////////////////////////////// void EnsembleStatVxOpt::parse_nc_info(Dictionary &odict) { - const DictionaryEntry * e = (const DictionaryEntry *) 0; + const DictionaryEntry * e = (const DictionaryEntry *) nullptr; e = odict.lookup(conf_key_nc_orank_flag); diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index c65ca49109..59495c569a 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -2608,7 +2608,7 @@ void write_nc(const ConcatString &field_name, const DataPlane &dp, n_masks = (apply_mask ? conf_info.vx_opt[i_vx].get_n_mask() : 1); // Allocate memory - float *data = (float *) 0; + float *data = (float *) nullptr; data = new float [grid.nx()*grid.ny()]; // Set the NetCDF compression level @@ -3070,7 +3070,7 @@ void clean_up() { //nc_out->close(); delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Deallocate memory for data files diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index ec85cacffd..b5db513b57 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -127,7 +127,7 @@ static ConcatString out_dir; // Output Netcdf file static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim; @@ -136,7 +136,7 @@ static StringArray nc_var_sa; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; @@ -163,11 +163,11 @@ static DataPlane wgt_dp; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used -static gsl_rng *rng_ptr = (gsl_rng *) 0; +static gsl_rng *rng_ptr = (gsl_rng *) nullptr; // Strings to be output in the STAT and optional text files static StatHdrColumns shc; diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index 9165051a6c..025177727c 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -87,8 +87,8 @@ void ModeExecutive::init_from_scratch() { - fcst_mtddf = (Met2dDataFile *) 0; - obs_mtddf = (Met2dDataFile *) 0; + fcst_mtddf = (Met2dDataFile *) nullptr; + obs_mtddf = (Met2dDataFile *) nullptr; clear(); @@ -111,8 +111,8 @@ void ModeExecutive::clear() fcst_file.clear(); obs_file.clear(); - if ( fcst_mtddf ) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) 0; } - if ( obs_mtddf ) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) 0; } + if ( fcst_mtddf ) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) nullptr; } + if ( obs_mtddf ) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) nullptr; } for (int j=0; jconv_thresh.get_str(5); const ConcatString obs_thresh = engine.conf_info.Obs->conv_thresh.get_str(5); - float *fcst_raw_data = (float *) 0; - float *fcst_obj_raw_data = (float *) 0; - int *fcst_obj_data = (int *) 0; - int *fcst_clus_data = (int *) 0; + float *fcst_raw_data = (float *) nullptr; + float *fcst_obj_raw_data = (float *) nullptr; + int *fcst_obj_data = (int *) nullptr; + int *fcst_clus_data = (int *) nullptr; - float *obs_raw_data = (float *) 0; - float *obs_obj_raw_data = (float *) 0; - int *obs_obj_data = (int *) 0; - int *obs_clus_data = (int *) 0; + float *obs_raw_data = (float *) nullptr; + float *obs_obj_raw_data = (float *) nullptr; + int *obs_obj_data = (int *) nullptr; + int *obs_clus_data = (int *) nullptr; - NcFile *f_out = (NcFile *) 0; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; @@ -1752,7 +1752,7 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) mlog << Error << "\nModeExecutive::write_obj_netcdf() -> trouble opening output file " << out_file << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -2094,15 +2094,15 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) // Delete allocated memory // - if (fcst_raw_data) { delete [] fcst_raw_data; fcst_raw_data = (float *) 0; } - if (fcst_obj_raw_data) { delete [] fcst_obj_raw_data; fcst_obj_raw_data = (float *) 0; } - if (fcst_obj_data) { delete [] fcst_obj_data; fcst_obj_data = (int *) 0; } - if (fcst_clus_data) { delete [] fcst_clus_data; fcst_clus_data = (int *) 0; } + if (fcst_raw_data) { delete [] fcst_raw_data; fcst_raw_data = (float *) nullptr; } + if (fcst_obj_raw_data) { delete [] fcst_obj_raw_data; fcst_obj_raw_data = (float *) nullptr; } + if (fcst_obj_data) { delete [] fcst_obj_data; fcst_obj_data = (int *) nullptr; } + if (fcst_clus_data) { delete [] fcst_clus_data; fcst_clus_data = (int *) nullptr; } - if (obs_raw_data) { delete [] obs_raw_data; obs_raw_data = (float *) 0; } - if (obs_obj_raw_data) { delete [] obs_obj_raw_data; obs_obj_raw_data = (float *) 0; } - if (obs_obj_data) { delete [] obs_obj_data; obs_obj_data = (int *) 0; } - if (obs_clus_data) { delete [] obs_clus_data; obs_clus_data = (int *) 0; } + if (obs_raw_data) { delete [] obs_raw_data; obs_raw_data = (float *) nullptr; } + if (obs_obj_raw_data) { delete [] obs_obj_raw_data; obs_obj_raw_data = (float *) nullptr; } + if (obs_obj_data) { delete [] obs_obj_data; obs_obj_data = (int *) nullptr; } + if (obs_clus_data) { delete [] obs_clus_data; obs_clus_data = (int *) nullptr; } // // Write out the values of the vertices of the polylines. @@ -2114,7 +2114,7 @@ void ModeExecutive::write_obj_netcdf(const ModeNcOutInfo & info) // Close the NetCDF file // delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; return; } @@ -2179,14 +2179,14 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) int i, j, x, y, n_pts, n_poly; double lat, lon; - Polyline **poly = (Polyline **) 0; + Polyline **poly = (Polyline **) nullptr; - int *poly_start = (int *) 0; - int *poly_npts = (int *) 0; - float *poly_lat = (float *) 0; - float *poly_lon = (float *) 0; - int *poly_x = (int *) 0; - int *poly_y = (int *) 0; + int *poly_start = (int *) nullptr; + int *poly_npts = (int *) nullptr; + float *poly_lat = (float *) nullptr; + float *poly_lon = (float *) nullptr; + int *poly_x = (int *) nullptr; + int *poly_y = (int *) nullptr; // Dimensions and variables for each object NcDim obj_dim ; @@ -2436,13 +2436,13 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) // // Delete allocated memory // - if(poly) { delete [] poly; poly = (Polyline **) 0; } - if(poly_start) { delete [] poly_start; poly_start = (int *) 0; } - if(poly_npts) { delete [] poly_npts; poly_npts = (int *) 0; } - if(poly_lat) { delete [] poly_lat; poly_lat = (float *) 0; } - if(poly_lon) { delete [] poly_lon; poly_lon = (float *) 0; } - if(poly_x) { delete [] poly_x; poly_x = (int *) 0; } - if(poly_y) { delete [] poly_y; poly_y = (int *) 0; } + if(poly) { delete [] poly; poly = (Polyline **) nullptr; } + if(poly_start) { delete [] poly_start; poly_start = (int *) nullptr; } + if(poly_npts) { delete [] poly_npts; poly_npts = (int *) nullptr; } + if(poly_lat) { delete [] poly_lat; poly_lat = (float *) nullptr; } + if(poly_lon) { delete [] poly_lon; poly_lon = (float *) nullptr; } + if(poly_x) { delete [] poly_x; poly_x = (int *) nullptr; } + if(poly_y) { delete [] poly_y; poly_y = (int *) nullptr; } return; } diff --git a/src/tools/core/mode/mode_ps_file.cc b/src/tools/core/mode/mode_ps_file.cc index 2a9c518599..66cba3b5d5 100644 --- a/src/tools/core/mode/mode_ps_file.cc +++ b/src/tools/core/mode/mode_ps_file.cc @@ -115,11 +115,11 @@ void ModePsFile::mpsf_init_from_scratch() { - Engine = (ModeFuzzyEngine *) 0; + Engine = (ModeFuzzyEngine *) nullptr; - ConfInfo = (ModeConfInfo *) 0; + ConfInfo = (ModeConfInfo *) nullptr; - grid = (Grid *) 0; + grid = (Grid *) nullptr; MetDataDir = replace_path("MET_BASE"); @@ -916,7 +916,7 @@ void ModePsFile::draw_colorbar(bool fcst) int i, n_colors; char label[max_str_len]; double bar_width, bar_height, x_ll, y_ll; - ColorTable * ct = (ColorTable *) 0; + ColorTable * ct = (ColorTable *) nullptr; Box b; Color c; @@ -1013,7 +1013,7 @@ void ModePsFile::render_ppm(ModeFuzzyEngine & eng, EngineType eng_type, const Sh double mag, v; Color c; Color fill_color; - ColorTable *ct = (ColorTable *) 0; + ColorTable *ct = (ColorTable *) nullptr; const int L = nint(XY_box.left()); const int B = nint(XY_box.bottom()); diff --git a/src/tools/core/mode_analysis/mode_analysis.cc b/src/tools/core/mode_analysis/mode_analysis.cc index 95e1bd43d1..e0ae0f8bb4 100644 --- a/src/tools/core/mode_analysis/mode_analysis.cc +++ b/src/tools/core/mode_analysis/mode_analysis.cc @@ -58,7 +58,7 @@ static const char * default_config_filename = "MET_BASE/config/MODEAnalysisConfi static ConcatString config_filename; -static BasicModeAnalysisJob * job = (BasicModeAnalysisJob *) 0; +static BasicModeAnalysisJob * job = (BasicModeAnalysisJob *) nullptr; static ModeAttributes config_atts; @@ -70,9 +70,9 @@ static StringArray mode_files; static StringArray lookin_dirs; -static ofstream * dumpfile = (ofstream *) 0; +static ofstream * dumpfile = (ofstream *) nullptr; -static ofstream * outfile = (ofstream *) 0; +static ofstream * outfile = (ofstream *) nullptr; //////////////////////////////////////////////////////////////////////// @@ -181,8 +181,8 @@ job->clear(); // done // -if ( dumpfile ) { delete dumpfile; dumpfile = (ofstream *) 0; } -if ( outfile ) { delete outfile; outfile = (ofstream *) 0; } +if ( dumpfile ) { delete dumpfile; dumpfile = (ofstream *) nullptr; } +if ( outfile ) { delete outfile; outfile = (ofstream *) nullptr; } return ( 0 ); diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 6c50ea880c..d950486015 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -414,7 +414,7 @@ void setup_txt_files() { max_col += n_header_columns + 1; // Initialize file stream - stat_out = (ofstream *) 0; + stat_out = (ofstream *) nullptr; // Build the file name stat_file << base_name << stat_file_ext; @@ -445,7 +445,7 @@ void setup_txt_files() { if(conf_info.output_flag[i] == STATOutputType_Both) { // Initialize file stream - txt_out[i] = (ofstream *) 0; + txt_out[i] = (ofstream *) nullptr; // Build the file name txt_file[i] << base_name << "_" << txt_file_abbr[i] diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 510693068b..7d69a62b62 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -128,7 +128,7 @@ static int fcst_lead_sec = bad_data_int; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; @@ -150,7 +150,7 @@ static bool is_first_pass = true; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used static gsl_rng *rng_ptr = (gsl_rng *) nullptr; diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 223ce9ad65..5ce2b81d6d 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -378,7 +378,7 @@ void process_grid(const Grid &fcst_grid, const Grid &obs_grid) { Met2dDataFile *get_mtddf(const StringArray &file_list, const GrdFileType type) { int i; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Find the first file that actually exists for(i=0; igrid(); // Close the data file - delete mtddf; mtddf = (Met2dDataFile *) 0; + delete mtddf; mtddf = (Met2dDataFile *) nullptr; return(found); } @@ -677,9 +677,9 @@ bool read_single_entry(VarInfo *info, const ConcatString &cur_file, void process_scores() { int i, x, y, i_read, i_series, i_point, i_fcst; - VarInfo *fcst_info = (VarInfo *) 0; - VarInfo *obs_info = (VarInfo *) 0; - PairDataPoint *pd_ptr = (PairDataPoint *) 0; + VarInfo *fcst_info = (VarInfo *) nullptr; + VarInfo *obs_info = (VarInfo *) nullptr; + PairDataPoint *pd_ptr = (PairDataPoint *) nullptr; DataPlane fcst_dp, obs_dp; const char *method_name = "process_scores() "; @@ -878,7 +878,7 @@ void process_scores() { add_att(nc_out, "obs_lead_end", (string)sec_to_hhmmss(obs_lead_end)); // Clean up - if(pd_ptr) { delete [] pd_ptr; pd_ptr = (PairDataPoint *) 0; } + if(pd_ptr) { delete [] pd_ptr; pd_ptr = (PairDataPoint *) nullptr; } // Print summary counts mlog << Debug(2) @@ -964,7 +964,7 @@ void do_cts(int n, const PairDataPoint *pd_ptr) { } // end for i // Deallocate memory - if(cts_info) { delete [] cts_info; cts_info = (CTSInfo *) 0; } + if(cts_info) { delete [] cts_info; cts_info = (CTSInfo *) nullptr; } return; } @@ -2238,12 +2238,12 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Deallocate memory for data files - if(fcst_mtddf) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) 0; } - if(obs_mtddf) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) 0; } + if(fcst_mtddf) { delete fcst_mtddf; fcst_mtddf = (Met2dDataFile *) nullptr; } + if(obs_mtddf) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) nullptr; } // Deallocate memory for the random number generator rng_free(rng_ptr); diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index 51225c08ef..d50df6cb94 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -88,7 +88,7 @@ static SeriesAnalysisConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim lat_dim; static netCDF::NcDim lon_dim ; @@ -113,11 +113,11 @@ static int n_reads = 1; // Initialize to at least one pass // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Pointer to the random number generator to be used -static gsl_rng *rng_ptr = (gsl_rng *) 0; +static gsl_rng *rng_ptr = (gsl_rng *) nullptr; // Enumeration of ways that a series can be defined enum SeriesType { diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.cc b/src/tools/core/series_analysis/series_analysis_conf_info.cc index 7d22d83643..08b97c1fd8 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -46,8 +46,8 @@ SeriesAnalysisConfInfo::~SeriesAnalysisConfInfo() { void SeriesAnalysisConfInfo::init_from_scratch() { // Initialize pointers - fcst_info = (VarInfo **) 0; - obs_info = (VarInfo **) 0; + fcst_info = (VarInfo **) nullptr; + obs_info = (VarInfo **) nullptr; clear(); @@ -92,15 +92,15 @@ void SeriesAnalysisConfInfo::clear() { // Clear fcst_info if(fcst_info) { for(i=0; i::iterator it; @@ -220,8 +220,8 @@ void SeriesAnalysisConfInfo::process_config(GrdFileType ftype, obs_info = new VarInfo * [n_obs]; // Initialize pointers - for(i=0; ilookup_thresh_array(conf_key_cat_thresh); diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 99b5906429..b9c4df9a25 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -2377,8 +2377,8 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // if(m.count(key) == 0) { aggr.isc_info.clear(); - aggr.total_na = aggr.mse_na = aggr.fen_na = (NumArray *) 0; - aggr.oen_na = aggr.baser_na = aggr.fbias_na = (NumArray *) 0; + aggr.total_na = aggr.mse_na = aggr.fen_na = (NumArray *) nullptr; + aggr.oen_na = aggr.baser_na = aggr.fbias_na = (NumArray *) nullptr; aggr.hdr.clear(); m[key] = aggr; mlog << Debug(3) << "[Case " << m.size() @@ -2568,12 +2568,12 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, // // Deallocate memory // - if(it->second.total_na) { delete [] it->second.total_na; it->second.total_na = (NumArray *) 0; } - if(it->second.mse_na ) { delete [] it->second.mse_na; it->second.mse_na = (NumArray *) 0; } - if(it->second.fen_na ) { delete [] it->second.fen_na; it->second.fen_na = (NumArray *) 0; } - if(it->second.oen_na ) { delete [] it->second.oen_na; it->second.oen_na = (NumArray *) 0; } - if(it->second.baser_na) { delete [] it->second.baser_na; it->second.baser_na = (NumArray *) 0; } - if(it->second.fbias_na) { delete [] it->second.fbias_na; it->second.fbias_na = (NumArray *) 0; } + if(it->second.total_na) { delete [] it->second.total_na; it->second.total_na = (NumArray *) nullptr; } + if(it->second.mse_na ) { delete [] it->second.mse_na; it->second.mse_na = (NumArray *) nullptr; } + if(it->second.fen_na ) { delete [] it->second.fen_na; it->second.fen_na = (NumArray *) nullptr; } + if(it->second.oen_na ) { delete [] it->second.oen_na; it->second.oen_na = (NumArray *) nullptr; } + if(it->second.baser_na) { delete [] it->second.baser_na; it->second.baser_na = (NumArray *) nullptr; } + if(it->second.fbias_na) { delete [] it->second.fbias_na; it->second.fbias_na = (NumArray *) nullptr; } } // end for it @@ -3878,7 +3878,7 @@ void mpr_to_ctc(STATAnalysisJob &job, const AggrMPRInfo &info, void mpr_to_cts(STATAnalysisJob &job, const AggrMPRInfo &info, int i_thresh, CTSInfo &cts_info, const char *tmp_dir, gsl_rng *rng_ptr) { - CTSInfo *cts_info_ptr = (CTSInfo *) 0; + CTSInfo *cts_info_ptr = (CTSInfo *) nullptr; // // Initialize diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index 57bc92eb46..47c91c099d 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -150,7 +150,7 @@ void parse_nbrctc_ctable(STATLine &l, TTContingencyTable &ct) { void parse_nx2_ctable(STATLine &l, Nx2ContingencyTable &pct) { int i, n, oy, on; char col_str[max_str_len]; - double *thresh = (double *) 0; + double *thresh = (double *) nullptr; // N_THRESH n = atoi(l.get_item("N_THRESH")); @@ -181,7 +181,7 @@ void parse_nx2_ctable(STATLine &l, Nx2ContingencyTable &pct) { thresh[n-1] = atof(l.get_item(col_str)); pct.set_thresholds(thresh); - if ( thresh ) { delete [] thresh; thresh = (double *) 0; } + if ( thresh ) { delete [] thresh; thresh = (double *) nullptr; } return; } diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index 912617a213..366dbab0a3 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -639,7 +639,7 @@ while((*f) >> line) { f->close(); -if(pldf) { delete pldf; pldf = (PyLineDataFile *) 0; } +if(pldf) { delete pldf; pldf = (PyLineDataFile *) nullptr; } return; diff --git a/src/tools/core/stat_analysis/stat_analysis.h b/src/tools/core/stat_analysis/stat_analysis.h index b4992e75b0..0fa44910db 100644 --- a/src/tools/core/stat_analysis/stat_analysis.h +++ b/src/tools/core/stat_analysis/stat_analysis.h @@ -70,7 +70,7 @@ static StringArray files; // Output file set with -out static ConcatString out_file; -static std::ofstream *sa_out = (std::ofstream *) 0; +static std::ofstream *sa_out = (std::ofstream *) nullptr; // Config file set with -config static ConcatString config_file; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index dce6d0014f..a868b6b1d0 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -158,7 +158,7 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, const ConcatString &tmp_path, ofstream *sa_out) { LineDataFile f; int n_in, n_out; - gsl_rng *rng_ptr = (gsl_rng *) 0; + gsl_rng *rng_ptr = (gsl_rng *) nullptr; // // Open up the temp file for reading the intermediate STAT line data diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index b182a4538d..c1675cb365 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -506,12 +506,12 @@ void process_scores() { for(j=0; jclose(); delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } // Close the output PSfile as long as it was opened @@ -1906,7 +1909,7 @@ void close_out_files() { mlog << Debug(1) << "Output file: " << out_ps_file << "\n"; ps_out->close(); delete ps_out; - ps_out = (PSfile *) 0; + ps_out = (PSfile *) nullptr; } return; @@ -2614,7 +2617,7 @@ void draw_colorbar(PSfile *p, Box &dim, int fcst, int raw) { int i; char label[max_str_len]; double bar_width, bar_height, x_ll, y_ll, step, v; - ColorTable *ct_ptr = (ColorTable *) 0; + ColorTable *ct_ptr = (ColorTable *) nullptr; Color c; // @@ -2814,8 +2817,8 @@ void render_image(PSfile *p, const DataPlane &dp, Box &dim, int fcst) { int x, y, grid_x, grid_y; double mag; Color c; - Color *c_fill_ptr = (Color *) 0; - ColorTable *ct_ptr = (ColorTable *) 0; + Color *c_fill_ptr = (Color *) nullptr; + ColorTable *ct_ptr = (ColorTable *) nullptr; // // Set up pointers to the appropriate colortable and fill color @@ -2904,8 +2907,8 @@ void render_tile(PSfile *p, const double *data, int n, int i_tile, int i, x, y; double mag; Color c; - Color *c_fill_ptr = (Color *) 0; - ColorTable *ct_ptr = (ColorTable *) 0; + Color *c_fill_ptr = (Color *) nullptr; + ColorTable *ct_ptr = (ColorTable *) nullptr; // // Set up pointers to the appropriate colortable and fill color diff --git a/src/tools/core/wavelet_stat/wavelet_stat.h b/src/tools/core/wavelet_stat/wavelet_stat.h index 0b42b68e39..470477fa6b 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.h +++ b/src/tools/core/wavelet_stat/wavelet_stat.h @@ -93,7 +93,7 @@ static ConcatString out_dir; // Output NetCDF file static ConcatString out_nc_file; -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; static netCDF::NcDim x_dim ; static netCDF::NcDim y_dim ; static netCDF::NcDim scale_dim ; @@ -104,17 +104,17 @@ static netCDF::NcVar diff_var ; // Output PostScript file static ConcatString out_ps_file; -static PSfile *ps_out = (PSfile *) 0; +static PSfile *ps_out = (PSfile *) nullptr; // Output STAT file static ConcatString stat_file; -static std::ofstream *stat_out = (std::ofstream *) 0; +static std::ofstream *stat_out = (std::ofstream *) nullptr; static AsciiTable stat_at; static int i_stat_row; // Optional ISC output file static ConcatString isc_file; -static std::ofstream *isc_out = (std::ofstream *) 0; +static std::ofstream *isc_out = (std::ofstream *) nullptr; static AsciiTable isc_at; static int i_isc_row; @@ -177,8 +177,8 @@ static bool is_first_pass = true; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) 0; -static Met2dDataFile *obs_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *fcst_mtddf = (Met2dDataFile *) nullptr; +static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; // Strings to be output in the STAT and optional text files static StatHdrColumns shc; 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 8a2a896544..0d5ccedaa5 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -47,12 +47,12 @@ WaveletStatConfInfo::~WaveletStatConfInfo() { void WaveletStatConfInfo::init_from_scratch() { // Initialize pointers - fcst_info = (VarInfo **) 0; - obs_info = (VarInfo **) 0; - fcat_ta = (ThreshArray *) 0; - ocat_ta = (ThreshArray *) 0; - wvlt_ptr = (gsl_wavelet *) 0; - wvlt_work_ptr = (gsl_wavelet_workspace *) 0; + fcst_info = (VarInfo **) nullptr; + obs_info = (VarInfo **) nullptr; + fcat_ta = (ThreshArray *) nullptr; + ocat_ta = (ThreshArray *) nullptr; + wvlt_ptr = (gsl_wavelet *) nullptr; + wvlt_work_ptr = (gsl_wavelet_workspace *) nullptr; clear(); @@ -91,21 +91,21 @@ void WaveletStatConfInfo::clear() { // Deallocate memory if(wvlt_ptr) { wavelet_free(wvlt_ptr); } if(wvlt_work_ptr) { wavelet_workspace_free(wvlt_work_ptr); } - if(fcat_ta) { delete [] fcat_ta; fcat_ta = (ThreshArray *) 0; } - if(ocat_ta) { delete [] ocat_ta; ocat_ta = (ThreshArray *) 0; } + if(fcat_ta) { delete [] fcat_ta; fcat_ta = (ThreshArray *) nullptr; } + if(ocat_ta) { delete [] ocat_ta; ocat_ta = (ThreshArray *) nullptr; } // Clear fcst_info if(fcst_info) { for(i=0; ioutput_map; - Dictionary *fcst_dict = (Dictionary *) 0; - Dictionary *obs_dict = (Dictionary *) 0; - Dictionary *dict = (Dictionary *) 0; + Dictionary *fcst_dict = (Dictionary *) nullptr; + Dictionary *obs_dict = (Dictionary *) nullptr; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_fdict, i_odict; gsl_wavelet_type type; @@ -202,7 +202,7 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, ocat_ta = new ThreshArray [n_vx]; // Initialize pointers - for(i=0; i Date: Tue, 27 Feb 2024 16:52:25 +0000 Subject: [PATCH 08/72] #2673 Change 0 to nullptr --- src/tools/dev_utils/chk4copyright.cc | 4 +- src/tools/dev_utils/gen_climo_bin.cc | 14 ++-- src/tools/dev_utils/gribtab.dat_to_flat.cc | 6 +- src/tools/dev_utils/insitu_nc_file.cc | 6 +- src/tools/dev_utils/met_nc_file.cc | 8 +- src/tools/dev_utils/nceptab_to_flat.cc | 4 +- src/tools/other/ascii2nc/file_handler.cc | 2 +- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 34 ++++---- src/tools/other/gen_ens_prod/gen_ens_prod.h | 6 +- .../gen_ens_prod/gen_ens_prod_conf_info.cc | 2 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 24 +++--- src/tools/other/grid_diag/grid_diag.cc | 8 +- src/tools/other/grid_diag/grid_diag.h | 4 +- .../other/grid_diag/grid_diag_conf_info.cc | 12 +-- src/tools/other/gsi_tools/gsidens2orank.h | 2 +- src/tools/other/madis2nc/madis2nc.cc | 8 +- src/tools/other/madis2nc/madis2nc.h | 4 +- src/tools/other/mode_graphics/cgraph_font.cc | 4 +- src/tools/other/mode_graphics/cgraph_main.cc | 36 ++++---- .../cgraphbase_plottype_to_string.cc | 2 +- src/tools/other/mode_graphics/color_stack.cc | 10 +-- .../mode_graphics/mode_nc_output_file.cc | 26 +++--- src/tools/other/mode_time_domain/2d_att.cc | 2 +- .../other/mode_time_domain/2d_att_array.cc | 8 +- src/tools/other/mode_time_domain/3d_att.cc | 2 +- .../mode_time_domain/3d_att_pair_array.cc | 8 +- .../mode_time_domain/3d_att_single_array.cc | 8 +- .../other/mode_time_domain/fo_node_array.cc | 8 +- src/tools/other/mode_time_domain/mm_engine.cc | 2 +- .../other/mode_time_domain/mtd_config_info.cc | 34 ++++---- .../other/mode_time_domain/mtd_file_base.cc | 6 +- .../other/mode_time_domain/mtd_file_int.cc | 16 ++-- .../other/mode_time_domain/mtd_partition.cc | 22 ++--- .../mode_time_domain/mtdfiletype_to_string.cc | 2 +- .../other/mode_time_domain/nc_utils_local.cc | 2 +- .../other/modis_regrid/cloudsat_swath_file.cc | 84 +++++++++---------- src/tools/other/modis_regrid/data_averager.cc | 2 +- .../modis_regrid/data_plane_to_netcdf.cc | 10 +-- src/tools/other/modis_regrid/modis_file.cc | 2 +- src/tools/other/modis_regrid/modis_regrid.cc | 4 +- src/tools/other/pb2nc/pb2nc.cc | 4 +- src/tools/other/pb2nc/pb2nc_conf_info.cc | 4 +- .../plot_point_obs_conf_info.cc | 8 +- src/tools/other/point2grid/point2grid.cc | 30 +++---- .../other/point2grid/point2grid_conf_info.cc | 2 +- .../regrid_data_plane/regrid_data_plane.cc | 14 ++-- .../shift_data_plane/shift_data_plane.cc | 10 +-- src/tools/other/wwmca_tool/af_cp_file.cc | 4 +- src/tools/other/wwmca_tool/af_file.cc | 4 +- src/tools/other/wwmca_tool/af_pt_file.cc | 4 +- src/tools/other/wwmca_tool/ave_interp.cc | 2 +- src/tools/other/wwmca_tool/interp_base.cc | 4 +- src/tools/other/wwmca_tool/max_interp.cc | 2 +- src/tools/other/wwmca_tool/min_interp.cc | 2 +- src/tools/other/wwmca_tool/nc_output.cc | 4 +- src/tools/other/wwmca_tool/nearest_interp.cc | 2 +- src/tools/other/wwmca_tool/wwmca_plot.cc | 6 +- src/tools/other/wwmca_tool/wwmca_ref.cc | 36 ++++---- .../tc_utils/rmw_analysis/rmw_analysis.h | 4 +- .../rmw_analysis/rmw_analysis_conf_info.cc | 10 +-- src/tools/tc_utils/tc_diag/tc_diag.cc | 44 +++++----- .../tc_utils/tc_diag/tc_diag_conf_info.cc | 8 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 12 +-- src/tools/tc_utils/tc_dland/tc_poly.cc | 10 +-- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 12 +-- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 12 +-- .../tc_utils/tc_pairs/tc_pairs_conf_info.cc | 10 +-- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 8 +- src/tools/tc_utils/tc_rmw/tc_rmw.h | 2 +- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 10 +-- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 66 +++++++-------- src/tools/tc_utils/tc_stat/tc_stat.cc | 8 +- src/tools/tc_utils/tc_stat/tc_stat.h | 2 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 10 +-- 74 files changed, 409 insertions(+), 409 deletions(-) diff --git a/src/tools/dev_utils/chk4copyright.cc b/src/tools/dev_utils/chk4copyright.cc index e145909d31..d61649b318 100644 --- a/src/tools/dev_utils/chk4copyright.cc +++ b/src/tools/dev_utils/chk4copyright.cc @@ -210,8 +210,8 @@ void set_quiet(const StringArray &) void process_directory(const char * dir_name) { - DIR *dir = (DIR *) 0; // pointer to a DIR structure - dirent *pde = (dirent *) 0; // pointer to a portable directory entry + DIR *dir = (DIR *) nullptr; // pointer to a DIR structure + dirent *pde = (dirent *) nullptr; // pointer to a portable directory entry ConcatString new_directory; ConcatString tmp_directory; ConcatString new_filename; diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index fea08a5d9d..997ff00abd 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -53,7 +53,7 @@ static ConcatString program_name; static Grid grid; static ConcatString out_file; -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim, lon_dim, cdf_dim; static NcVar cdf_x_var, cdf_y_var; @@ -127,7 +127,7 @@ int met_main(int argc, char *argv[]) { mlog << Debug(1) << "Finished writing output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; return(0); } @@ -326,7 +326,7 @@ void write_nc_bin(const DataPlane &dp, int i_cdf, double cdf_y) { } // Deallocate and clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -335,9 +335,9 @@ void write_nc_bin(const DataPlane &dp, int i_cdf, double cdf_y) { void get_field(const char *file, const char *config_str, DataPlane &dp) { GrdFileType ftype; - Met2dDataFile * mtddf_ptr = (Met2dDataFile * ) 0; + Met2dDataFile * mtddf_ptr = (Met2dDataFile * ) nullptr; Met2dDataFileFactory m_factory; - VarInfo * vi_ptr = (VarInfo * ) 0; + VarInfo * vi_ptr = (VarInfo * ) nullptr; VarInfoFactory v_factory; double dmin, dmax; @@ -416,8 +416,8 @@ void get_field(const char *file, const char *config_str, DataPlane &dp) { } // Clean up - if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile * ) 0; } - if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) 0; } + if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile * ) nullptr; } + if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) nullptr; } return; } diff --git a/src/tools/dev_utils/gribtab.dat_to_flat.cc b/src/tools/dev_utils/gribtab.dat_to_flat.cc index fbf84434e1..1fca331615 100644 --- a/src/tools/dev_utils/gribtab.dat_to_flat.cc +++ b/src/tools/dev_utils/gribtab.dat_to_flat.cc @@ -96,7 +96,7 @@ int j; int i[6]; const char i_delim [] = "{} ,\""; const char s_delim [] = ",\""; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; char line2[512]; char * s = line2; const char *method_name = "parse_line() -> "; @@ -113,7 +113,7 @@ for (j=0; j<6; ++j) { i[j] = atoi(c); - s = (char *) 0; + s = (char *) nullptr; } // while @@ -134,7 +134,7 @@ for (j=0; j<3; ++j) { cout << ' ' << '\"' << c << '\"'; - s = (char *) 0; + s = (char *) nullptr; } // while diff --git a/src/tools/dev_utils/insitu_nc_file.cc b/src/tools/dev_utils/insitu_nc_file.cc index 7566eb366f..83df32b874 100644 --- a/src/tools/dev_utils/insitu_nc_file.cc +++ b/src/tools/dev_utils/insitu_nc_file.cc @@ -75,7 +75,7 @@ void InsituNcFile::init_from_scratch() { // Initialize the pointers - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; // Close any existing file @@ -96,7 +96,7 @@ void InsituNcFile::close() if (_ncFile) { delete _ncFile; - _ncFile = (NcFile *)0; + _ncFile = (NcFile *) nullptr; } // Reclaim the space used for the variables @@ -144,7 +144,7 @@ bool InsituNcFile::open(const char * filename) if (_ncFile) // close() is called already { delete _ncFile; - _ncFile = (NcFile *)0; + _ncFile = (NcFile *) nullptr; } return false; } diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 0389f8e883..4a962f9e68 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -83,7 +83,7 @@ bool MetNcFile::readFile(const int desired_grib_code, << _filePath << "\n\n"; //_ncFile->close(); delete _ncFile; - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; return false; } @@ -177,7 +177,7 @@ bool MetNcFile::readFile(const int desired_grib_code, char hdr_typ_str_full[hdr_buf_size][typ_len]; char hdr_sid_str_full[hdr_buf_size][sid_len]; char hdr_vld_str_full[hdr_buf_size][vld_len]; - //float **hdr_arr_full = (float **) 0, **obs_arr_block = (float **) 0; + //float **hdr_arr_full = (float **) nullptr, **obs_arr_block = (float **) nullptr; float hdr_arr_full[hdr_buf_size][hdr_arr_len]; float obs_arr_block[ buf_size][obs_arr_len]; @@ -327,8 +327,8 @@ bool MetNcFile::readFile(const int desired_grib_code, } // Cleanup - if (obs_arr) { delete [] obs_arr; obs_arr = (float *) 0; } - if (hdr_arr) { delete [] hdr_arr; hdr_arr = (float *) 0; } + if (obs_arr) { delete [] obs_arr; obs_arr = (float *) nullptr; } + if (hdr_arr) { delete [] hdr_arr; hdr_arr = (float *) nullptr; } return true; } diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index ab05cb7698..cfbf1378a2 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -243,7 +243,7 @@ bool parse_line(const char * line) int n, k; char line2[1024]; char * s = line2; -char * c = (char *) 0; +char * c = (char *) nullptr; const char *method_name = "parse_line() -> "; m_strncpy(line2, line, sizeof(line2), method_name); @@ -260,7 +260,7 @@ if ( ! strchr(line, '\"') ) return ( false ); c = strtok(s, " /*"); -s = (char *) 0; +s = (char *) nullptr; if ( !c ) return ( false ); diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 6c2a686abd..6e2521f0c8 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -194,7 +194,7 @@ bool FileHandler::summarizeObs(const TimeSummaryInfo &summary_info) void FileHandler::_closeNetcdf() { delete _ncFile; - _ncFile = (NcFile *) 0; + _ncFile = (NcFile *) nullptr; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index dd6d003289..ea51bc749b 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -121,7 +121,7 @@ void process_command_line(int argc, char **argv) { int i; CommandLine cline; ConcatString default_config_file; - Met2dDataFile *ens_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *ens_mtddf = (Met2dDataFile *) nullptr; // // Check for zero arguments @@ -250,7 +250,7 @@ void process_command_line(int argc, char **argv) { } // Deallocate memory for data files - if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) 0; } + if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) nullptr; } return; } @@ -626,7 +626,7 @@ void get_ens_mean_stdev(GenEnsProdVarInfo *ens_info, bool get_data_plane(const char *infile, GrdFileType ftype, VarInfo *info, DataPlane &dp) { bool found; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; // Read the current ensemble file if(!(mtddf = mtddf_factory.new_met_2d_data_file(infile, ftype))) { @@ -668,7 +668,7 @@ bool get_data_plane(const char *infile, GrdFileType ftype, } // end if found // Deallocate the data file pointer, if necessary - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(found); } @@ -1049,14 +1049,14 @@ void write_ens_nc(GenEnsProdVarInfo *ens_info, int n_ens_vld, } // Deallocate and clean up - if(ens_mean) { delete [] ens_mean; ens_mean = (float *) 0; } - if(ens_stdev) { delete [] ens_stdev; ens_stdev = (float *) 0; } - if(ens_minus) { delete [] ens_minus; ens_minus = (float *) 0; } - if(ens_plus) { delete [] ens_plus; ens_plus = (float *) 0; } - if(ens_min) { delete [] ens_min; ens_min = (float *) 0; } - if(ens_max) { delete [] ens_max; ens_max = (float *) 0; } - if(ens_range) { delete [] ens_range; ens_range = (float *) 0; } - if(ens_vld) { delete [] ens_vld; ens_vld = (int *) 0; } + if(ens_mean) { delete [] ens_mean; ens_mean = (float *) nullptr; } + if(ens_stdev) { delete [] ens_stdev; ens_stdev = (float *) nullptr; } + if(ens_minus) { delete [] ens_minus; ens_minus = (float *) nullptr; } + if(ens_plus) { delete [] ens_plus; ens_plus = (float *) nullptr; } + if(ens_min) { delete [] ens_min; ens_min = (float *) nullptr; } + if(ens_max) { delete [] ens_max; ens_max = (float *) nullptr; } + if(ens_range) { delete [] ens_range; ens_range = (float *) nullptr; } + if(ens_vld) { delete [] ens_vld; ens_vld = (int *) nullptr; } return; } @@ -1179,7 +1179,7 @@ void write_ens_data_plane(GenEnsProdVarInfo *ens_info, const DataPlane &ens_dp, write_ens_var_float(ens_info, ens_data, dp, type_str, long_name_str); // Cleanup - if(ens_data) { delete [] ens_data; ens_data = (float *) 0; } + if(ens_data) { delete [] ens_data; ens_data = (float *) nullptr; } return; } @@ -1226,7 +1226,7 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; // Close the output NetCDF file - if(nc_out) { delete nc_out; nc_out = (NcFile *) 0; } + if(nc_out) { delete nc_out; nc_out = (NcFile *) nullptr; } // Deallocate threshold count arrays if(thresh_cnt_na) { @@ -1234,7 +1234,7 @@ void clean_up() { thresh_cnt_na[i].clear(); } delete [] thresh_cnt_na; - thresh_cnt_na = (NumArray *) 0; + thresh_cnt_na = (NumArray *) nullptr; } if(thresh_nbrhd_cnt_na) { for(i=0; i " @@ -452,7 +452,7 @@ void get_data_plane(const ConcatString &file_name, // Allocate new VarInfo object VarInfoFactory vi_factory; - VarInfo *vi_ptr = (VarInfo *) 0; + VarInfo *vi_ptr = (VarInfo *) nullptr; vi_ptr = vi_factory.new_var_info(mtddf_ptr->file_type()); if(!vi_ptr) { mlog << Error << "\nget_data_plane() -> " @@ -480,7 +480,7 @@ void get_data_plane(const ConcatString &file_name, << dmin << " to " << dmax << ".\n"; // Clean up - if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) 0; } + if(vi_ptr) { delete vi_ptr; vi_ptr = (VarInfo *) nullptr; } } // end if @@ -488,7 +488,7 @@ void get_data_plane(const ConcatString &file_name, dp_grid = mtddf_ptr->grid(); // Clean up - if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile *) 0; } + if(mtddf_ptr) { delete mtddf_ptr; mtddf_ptr = (Met2dDataFile *) nullptr; } return; } @@ -1395,8 +1395,8 @@ void write_netcdf(const DataPlane &dp) { int n, x, y; ConcatString cs; - float *mask_data = (float *) 0; - NcFile *f_out = (NcFile *) 0; + float *mask_data = (float *) nullptr; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim; NcDim lon_dim; NcVar mask_var; @@ -1409,7 +1409,7 @@ void write_netcdf(const DataPlane &dp) { << "trouble opening output file " << out_filename << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -1474,15 +1474,15 @@ void write_netcdf(const DataPlane &dp) { mlog << Error << "\nwrite_netcdf() -> " << "error with mask_var->put\n\n"; // Delete allocated memory - if(mask_data) { delete[] mask_data; mask_data = (float *) 0; } + if(mask_data) { delete[] mask_data; mask_data = (float *) nullptr; } exit(1); } // Delete allocated memory - if(mask_data) { delete[] mask_data; mask_data = (float *) 0; } + if(mask_data) { delete[] mask_data; mask_data = (float *) nullptr; } delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; mlog << Debug(1) << "Output File:\t\t" << out_filename << "\n"; @@ -1525,7 +1525,7 @@ MaskType string_to_masktype(const char *s) { //////////////////////////////////////////////////////////////////////// const char * masktype_to_string(const MaskType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case MaskType_Poly: s = "poly"; break; @@ -1541,7 +1541,7 @@ const char * masktype_to_string(const MaskType t) { case MaskType_Lon: s = "lon"; break; case MaskType_Shape: s = "shape"; break; case MaskType_None: s = na_str; break; - default: s = (const char *) 0; break; + default: s = (const char *) nullptr; break; } return(s); diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index 4a54b42ee2..a8c603fab4 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -207,7 +207,7 @@ void process_command_line(int argc, char **argv) { // Deallocate memory for data files if(data_mtddf) { delete data_mtddf; - data_mtddf = (Met2dDataFile *) 0; + data_mtddf = (Met2dDataFile *) nullptr; } } // end for i @@ -748,8 +748,8 @@ void write_joint_histograms(void) { Met2dDataFile *get_mtddf(const StringArray &file_list, const int i_field) { - Met2dDataFile *mtddf = (Met2dDataFile *) 0; - Dictionary *dict = (Dictionary *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_dict; GrdFileType file_type; int i; @@ -798,7 +798,7 @@ void clean_up() { mlog << Debug(1) << "Output file: " << out_file << "\n"; delete nc_out; - nc_out = (NcFile *) 0; + nc_out = (NcFile *) nullptr; } return; diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 06f1c50895..5f661bdb22 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -85,7 +85,7 @@ static GridDiagConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; vector data_var_dims; vector hist_vars; vector joint_hist_vars; @@ -107,7 +107,7 @@ static Grid grid; // Data file factory and input files static Met2dDataFileFactory mtddf_factory; -static Met2dDataFile *data_mtddf = (Met2dDataFile *) 0; +static Met2dDataFile *data_mtddf = (Met2dDataFile *) nullptr; // Variable min/max values vector var_mins; diff --git a/src/tools/other/grid_diag/grid_diag_conf_info.cc b/src/tools/other/grid_diag/grid_diag_conf_info.cc index b463db9081..d0d60908f0 100644 --- a/src/tools/other/grid_diag/grid_diag_conf_info.cc +++ b/src/tools/other/grid_diag/grid_diag_conf_info.cc @@ -44,7 +44,7 @@ GridDiagConfInfo::~GridDiagConfInfo() { void GridDiagConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo **) 0; + data_info = (VarInfo **) nullptr; clear(); @@ -69,10 +69,10 @@ void GridDiagConfInfo::clear() { for(int i=0; i file_types) { ConcatString s; StringArray sa; VarInfoFactory info_factory; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; Dictionary i_dict; GrdFileType file_type; @@ -143,7 +143,7 @@ void GridDiagConfInfo::process_config(vector file_types) { data_info = new VarInfo * [n_data]; // Initialize pointers - for(int i=0; i " << "trouble opening output file: " << ncfile << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index a513946260..ab108d497c 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -132,7 +132,7 @@ static int rej_sid = 0; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -NcFile *f_out = (NcFile *) 0; +NcFile *f_out = (NcFile *) nullptr; int processed_count; @@ -142,7 +142,7 @@ static Madis2NcConfInfo conf_info; static bool do_summary; static bool save_summary_only = false; -static SummaryObs *summary_obs = 0; +static SummaryObs *summary_obs = nullptr; #endif // __MADIS2NC_H__ diff --git a/src/tools/other/mode_graphics/cgraph_font.cc b/src/tools/other/mode_graphics/cgraph_font.cc index 451b6f9c90..e3ed2db3b2 100644 --- a/src/tools/other/mode_graphics/cgraph_font.cc +++ b/src/tools/other/mode_graphics/cgraph_font.cc @@ -108,7 +108,7 @@ void CgFont::init_from_scratch() { -afm = (Afm *) 0; +afm = (Afm *) nullptr; face = 0; @@ -147,7 +147,7 @@ ps_name.clear(); orig_ps_size = scaled_ps_size = 0.0; -if ( afm ) { delete afm; afm = (Afm *) 0; } +if ( afm ) { delete afm; afm = (Afm *) nullptr; } ps_font_number = -1; diff --git a/src/tools/other/mode_graphics/cgraph_main.cc b/src/tools/other/mode_graphics/cgraph_main.cc index baa2b3be01..2c85c7525e 100644 --- a/src/tools/other/mode_graphics/cgraph_main.cc +++ b/src/tools/other/mode_graphics/cgraph_main.cc @@ -167,15 +167,15 @@ void CgraphBase::cgraph_init_from_scratch() { -Surface = (cairo_surface_t *) 0; +Surface = (cairo_surface_t *) nullptr; -Cr = (cairo_t *) 0; +Cr = (cairo_t *) nullptr; Ptype = no_cgraph_plot_type; Filename.clear(); -Library = (FT_Library) 0; +Library = (FT_Library) nullptr; CurrentFont = 0; @@ -205,11 +205,11 @@ void CgraphBase::close() { -if ( Cr ) { cairo_destroy (Cr); Cr = (cairo_t *) 0; } +if ( Cr ) { cairo_destroy (Cr); Cr = (cairo_t *) nullptr; } if ( Ptype != no_cgraph_plot_type ) write(); -if ( Surface ) { cairo_surface_destroy (Surface); Surface = (cairo_surface_t *) 0; } +if ( Surface ) { cairo_surface_destroy (Surface); Surface = (cairo_surface_t *) nullptr; } Ptype = no_cgraph_plot_type; @@ -220,7 +220,7 @@ DoLigatures = true; Fonts.clear(); -if ( Library ) { FT_Done_FreeType(Library); Library = (FT_Library) 0; } +if ( Library ) { FT_Done_FreeType(Library); Library = (FT_Library) nullptr; } Family = default_font_family; @@ -794,7 +794,7 @@ double x_page, y_page; double x_char_origin; FT_Face face = CurrentFont->face; // this should be nonzero FT_UInt previous; -FT_Glyph_Metrics * metrics = (FT_Glyph_Metrics *) 0; +FT_Glyph_Metrics * metrics = (FT_Glyph_Metrics *) nullptr; FT_Vector k_delta; const bool use_kerning = DoKerning && FT_HAS_KERNING(face); const char * new_string = (const char *) nullptr; @@ -1036,7 +1036,7 @@ if ( render_flag ) { // if ( DoLigatures ) delete [] new_string; -new_string = (char *) 0; +new_string = (char *) nullptr; return; @@ -1126,8 +1126,8 @@ void CgraphBase::import_image(const Ppm & ppm, double x, double y, double u, dou { double x_ll, y_ll; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; gsave(); @@ -1155,7 +1155,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); @@ -1175,9 +1175,9 @@ int R, G, B, alpha; int row, col, n; int bytes_per_row; int error; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; -unsigned char * d = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; +unsigned char * d = (unsigned char *) nullptr; const Color cc = current_color(); const int IR = (int) (cc.red()); const int IG = (int) (cc.green()); @@ -1262,7 +1262,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); @@ -1788,8 +1788,8 @@ void Cgraph::import_image(const Ppm & ppm, double x, double y, double u, double { double x_ll, y_ul, y_ll; -cairo_surface_t * i = (cairo_surface_t *) 0; -unsigned char * buf = (unsigned char *) 0; +cairo_surface_t * i = (cairo_surface_t *) nullptr; +unsigned char * buf = (unsigned char *) nullptr; const double scaled_nx = x_scale*(ppm.nx()); const double scaled_ny = y_scale*(ppm.ny()); @@ -1827,7 +1827,7 @@ cairo_paint (Cr); // done // -cairo_surface_destroy (i); i = (cairo_surface_t *) 0; +cairo_surface_destroy (i); i = (cairo_surface_t *) nullptr; grestore(); diff --git a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc index 313b169ca4..15b2cb6aa1 100644 --- a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc +++ b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc @@ -39,7 +39,7 @@ ConcatString cgraphbase_plottype_to_string(const CgraphBase::PlotType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { diff --git a/src/tools/other/mode_graphics/color_stack.cc b/src/tools/other/mode_graphics/color_stack.cc index fb9d750364..8d53f2d0c8 100644 --- a/src/tools/other/mode_graphics/color_stack.cc +++ b/src/tools/other/mode_graphics/color_stack.cc @@ -93,7 +93,7 @@ void ColorStack::init_from_scratch() { -e = (Color **) 0; +e = (Color **) nullptr; AllocInc = 10; // default value @@ -117,11 +117,11 @@ if ( e ) { for (j=0; j 0 ) { - delete [] ObjVolume; ObjVolume = (int *) 0; + delete [] ObjVolume; ObjVolume = (int *) nullptr; ObjVolume = new_volumes; @@ -1442,7 +1442,7 @@ if ( n_new > 0 ) { // done // -if ( old_to_new ) { delete [] old_to_new; old_to_new = (int *) 0; } +if ( old_to_new ) { delete [] old_to_new; old_to_new = (int *) nullptr; } return; @@ -1616,7 +1616,7 @@ void MtdIntFile::set_volumes(int n, const int * V) { -if ( ObjVolume ) { delete [] ObjVolume; ObjVolume = (int *) 0; } +if ( ObjVolume ) { delete [] ObjVolume; ObjVolume = (int *) nullptr; } int j; diff --git a/src/tools/other/mode_time_domain/mtd_partition.cc b/src/tools/other/mode_time_domain/mtd_partition.cc index 57db83dde7..4e3d34d4a2 100644 --- a/src/tools/other/mode_time_domain/mtd_partition.cc +++ b/src/tools/other/mode_time_domain/mtd_partition.cc @@ -110,7 +110,7 @@ void EquivalenceClass::init_from_scratch() { -E = (int *) 0; +E = (int *) nullptr; clear(); @@ -126,7 +126,7 @@ void EquivalenceClass::clear() { -if ( E ) { delete [] E; E = (int *) 0; } +if ( E ) { delete [] E; E = (int *) nullptr; } Nelements = Nalloc = 0; @@ -182,11 +182,11 @@ if ( E ) { memcpy(u, E, Nelements*sizeof(int)); - delete [] E; E = (int *) 0; + delete [] E; E = (int *) nullptr; } -E = u; u = (int *) 0; +E = u; u = (int *) nullptr; Nalloc = n; @@ -393,7 +393,7 @@ void Mtd_Partition::init_from_scratch() { -C = (EquivalenceClass **) 0; +C = (EquivalenceClass **) nullptr; clear(); @@ -415,11 +415,11 @@ if ( C ) { for (j=0; j can't get attribute names\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } if ( retval == 0 ) { - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } return; } parse_csl(att_buf, a); @@ -1331,7 +1331,7 @@ for (j=0; j can't get info on attribute \"" << (a[j]) << "\"\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } @@ -1345,7 +1345,7 @@ for (j=0; j can't get value for attribute \"" << (a[j]) << "\"\n\n"; - if ( att_buf ) { delete [] att_buf; att_buf = (char *) 0; } + if ( att_buf ) { delete [] att_buf; att_buf = (char *) nullptr; } exit ( 1 ); } @@ -1360,7 +1360,7 @@ for (j=0; j " << "trouble opening output file " << out_filename << "\n\n"; - delete f_out; f_out = (NcFile *) 0; + delete f_out; f_out = (NcFile *) nullptr; exit(1); } @@ -127,7 +127,7 @@ void write_grid_to_netcdf(const DataPlane & plane, const Grid & grid, const char // Close and clean up delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; return; } diff --git a/src/tools/other/modis_regrid/modis_file.cc b/src/tools/other/modis_regrid/modis_file.cc index c712f2330f..e478a867e1 100644 --- a/src/tools/other/modis_regrid/modis_file.cc +++ b/src/tools/other/modis_regrid/modis_file.cc @@ -557,7 +557,7 @@ FileId = -1; Filename.clear(); -if ( Swath ) { delete Swath; Swath = (CloudsatSwath *) 0; } +if ( Swath ) { delete Swath; Swath = (CloudsatSwath *) nullptr; } Latitude = 0; diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 788898b60f..d98f42ef1b 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -270,7 +270,7 @@ void get_grid() // stole this code from plot_data_plane.cc // -Met2dDataFile * met_ptr = (Met2dDataFile * ) 0; +Met2dDataFile * met_ptr = (Met2dDataFile * ) nullptr; Met2dDataFileFactory m_factory; mlog << Debug(1) << "Opening data file: " << grid_data_file << "\n"; @@ -289,7 +289,7 @@ grid = met_ptr->grid(); // done // -delete met_ptr; met_ptr = (Met2dDataFile *) 0; +delete met_ptr; met_ptr = (Met2dDataFile *) nullptr; return; diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 2922c23d0a..1eededdeef 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -2617,7 +2617,7 @@ void clean_up() { if(f_out) { delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; } return; @@ -3003,7 +3003,7 @@ int combine_tqz_and_uv(map pqtzuv_map_tq, // Select first record by 1) merging two records with the same pressure // level or 2) interpolate int tq_pres, uv_pres; - next_pqtzuv = (float *)0; + next_pqtzuv = (float *)nullptr; it_tq = pqtzuv_map_tq.begin(); it_uv = pqtzuv_map_uv.begin(); pqtzuv_tq = (float *)it_tq->second; diff --git a/src/tools/other/pb2nc/pb2nc_conf_info.cc b/src/tools/other/pb2nc/pb2nc_conf_info.cc index 69af15a22d..81aba47688 100644 --- a/src/tools/other/pb2nc/pb2nc_conf_info.cc +++ b/src/tools/other/pb2nc/pb2nc_conf_info.cc @@ -144,7 +144,7 @@ void PB2NCConfInfo::process_config() { ConcatString s, mask_name; StringArray sa; StringArray * sid_list = 0; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Dump the contents of the config file if(mlog.verbosity_level() >= 5) conf.dump(cout); @@ -268,7 +268,7 @@ void PB2NCConfInfo::process_config() { obs_bufr_map = parse_conf_obs_bufr_map(&conf); message_type_map = parse_conf_message_type_map(&conf); - if ( sid_list ) { delete [] sid_list; sid_list = (StringArray *) 0; } + if ( sid_list ) { delete [] sid_list; sid_list = (StringArray *) nullptr; } return; } diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc index 04b798e71a..78e998fafa 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc @@ -350,7 +350,7 @@ PlotPointObsConfInfo::~PlotPointObsConfInfo() { void PlotPointObsConfInfo::init_from_scratch() { // Initialize pointers - grid_data_info = (VarInfo *) 0; + grid_data_info = (VarInfo *) nullptr; clear(); @@ -405,12 +405,12 @@ void PlotPointObsConfInfo::read_config(const char *user_file_name) { void PlotPointObsConfInfo::process_config( const char *plot_grid_string) { - Dictionary *dict = (Dictionary *) 0; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; + Dictionary *fdict = (Dictionary *) nullptr; Dictionary i_fdict; StringArray sa; Met2dDataFileFactory m_factory; - Met2dDataFile *met_ptr = (Met2dDataFile *) 0; + Met2dDataFile *met_ptr = (Met2dDataFile *) nullptr; PlotPointObsOpt opt; int i, n_vx; diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 2737e125c9..e6b8718c2b 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -120,7 +120,7 @@ static bool do_gaussian_filter = false; static SingleThresh prob_cat_thresh; // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim ; static NcDim lon_dim ; @@ -338,7 +338,7 @@ void process_command_line(int argc, char **argv) { else var_names.add(vname); } // Clean up - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } } // Check that the number of output names and fields match else if(VarNameSA.n() != FieldSA.n()) { @@ -367,7 +367,7 @@ void process_data_file() { Grid fr_grid, to_grid; GrdFileType ftype; ConcatString run_cs; - NcFile *nc_in = (NcFile *)0; + NcFile *nc_in = (NcFile *) nullptr; static const char *method_name = "process_data_file() -> "; // Initialize configuration object @@ -387,7 +387,7 @@ void process_data_file() { bool use_python = false; int obs_type; Met2dDataFileFactory m_factory; - Met2dDataFile *fr_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *fr_mtddf = (Met2dDataFile *) nullptr; #ifdef WITH_PYTHON string python_command = InputFilename; bool use_xarray = (0 == python_command.find(conf_val_python_xarray)); @@ -496,8 +496,8 @@ void process_data_file() { // Clean up if(nc_in) { delete nc_in; nc_in = 0; } - if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } return; } @@ -745,7 +745,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI // Loop through the requested fields int obs_count_zero_to, obs_count_non_zero_to; int obs_count_zero_from, obs_count_non_zero_from; - IntArray *cellMapping = (IntArray *)0; + IntArray *cellMapping = (IntArray *) nullptr; obs_count_zero_to = obs_count_non_zero_to = 0; obs_count_zero_from = obs_count_non_zero_from = 0; @@ -1130,7 +1130,7 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI } // end for i if (cellMapping) { - delete [] cellMapping; cellMapping = (IntArray *)0; + delete [] cellMapping; cellMapping = (IntArray *) nullptr; } } @@ -1387,7 +1387,7 @@ void process_point_nccf_file(NcFile *nc_in, MetConfig &config, } // end for i delete [] cellMapping; - cellMapping = (IntArray *)0; + cellMapping = (IntArray *) nullptr; if( 0 < filtered_by_time ) { mlog << Debug(2) << method_name << "Filtered by time: " << filtered_by_time << " out of " << from_size @@ -1594,7 +1594,7 @@ void write_nc_data(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -1624,7 +1624,7 @@ void write_nc_data_int(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (int *) 0; } + if(data) { delete [] data; data = (int *) nullptr; } return; } @@ -1687,7 +1687,7 @@ void process_goes_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo, int global_attr_count; bool opt_all_attrs = false; clock_t start_clock = clock(); - NcFile *nc_adp = (NcFile *)0; + NcFile *nc_adp = (NcFile *) nullptr; static const char *method_name = "process_goes_file() -> "; ConcatString tmp_dir = config.get_tmp_dir(); @@ -1816,7 +1816,7 @@ void process_goes_file(NcFile *nc_in, MetConfig &config, VarInfo *vinfo, //copy_nc_atts(_nc_in, nc_out, opt_all_attrs); delete nc_adp; nc_adp = 0; - delete [] cellMapping; cellMapping = (IntArray *)0; + delete [] cellMapping; cellMapping = (IntArray *) nullptr; mlog << Debug(LEVEL_FOR_PERFORMANCE) << method_name << "took " << (clock()-start_clock)/double(CLOCKS_PER_SEC) << " seconds\n"; @@ -2184,7 +2184,7 @@ void get_grid_mapping(Grid fr_grid, Grid to_grid, IntArray *cellMapping, } // Override the from nx & ny from NetCDF if exists - NcFile *coord_nc_in = (NcFile *)0; + NcFile *coord_nc_in = (NcFile *) nullptr; if (has_coord_input) { mlog << Debug(2) << method_name << "Reading coord file: " << cur_coord_name << "\n"; coord_nc_in = open_ncfile(cur_coord_name.c_str()); @@ -2720,7 +2720,7 @@ void close_nc() { // Clean up if(nc_out) { - delete nc_out; nc_out = (NcFile *) 0; + delete nc_out; nc_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/point2grid/point2grid_conf_info.cc b/src/tools/other/point2grid/point2grid_conf_info.cc index 84cfec4a12..e9fa0e0392 100644 --- a/src/tools/other/point2grid/point2grid_conf_info.cc +++ b/src/tools/other/point2grid/point2grid_conf_info.cc @@ -83,7 +83,7 @@ void PointToGridConfInfo::read_config(const char *default_file_name, void PointToGridConfInfo::process_config() { ConcatString s; StringArray sa; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Dump the contents of the config file if(mlog.verbosity_level() >= 5) conf.dump(cout); diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 309aaf3d6a..dd9b85bb0b 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -78,7 +78,7 @@ static StringArray VarNameSA; static int compress_level = -1; // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; +static NcFile *nc_out = (NcFile *) nullptr; static NcDim lat_dim ; static NcDim lon_dim ; @@ -219,7 +219,7 @@ void process_data_file() { //Variables for GOES unixtime valid_time = 0; bool opt_all_attrs = false; - NcFile *nc_in = (NcFile *)0; + NcFile *nc_in = (NcFile *) nullptr; static const char *method_name = "process_data_file() "; // Initialize configuration object @@ -235,7 +235,7 @@ void process_data_file() { // Read the input data file Met2dDataFileFactory m_factory; - Met2dDataFile *fr_mtddf = (Met2dDataFile *) 0; + Met2dDataFile *fr_mtddf = (Met2dDataFile *) nullptr; // Determine the "from" grid mlog << Debug(1) << "Reading data file: " << InputFilename << "\n"; @@ -348,8 +348,8 @@ void process_data_file() { delete nc_in; nc_in = 0; // Clean up - if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(fr_mtddf) { delete fr_mtddf; fr_mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } return; } @@ -408,7 +408,7 @@ void write_nc_data(const DataPlane &dp, const Grid &grid, NcVar *data_var) { } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } return; } @@ -439,7 +439,7 @@ void close_nc() { // Clean up if(nc_out) { - delete nc_out; nc_out = (NcFile *) 0; + delete nc_out; nc_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 411f5dd10f..e14fff46fd 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -185,7 +185,7 @@ void process_data_file() { // Read the input data file Met2dDataFileFactory m_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; mlog << Debug(1) << "Reading input file: " << InputFilename << "\n"; mtddf = m_factory.new_met_2d_data_file(InputFilename.c_str(), ftype); @@ -271,8 +271,8 @@ void process_data_file() { write_netcdf(dp_shift, grid, vinfo, mtddf->file_type()); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - if(vinfo) { delete vinfo; vinfo = (VarInfo *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } + if(vinfo) { delete vinfo; vinfo = (VarInfo *) nullptr; } #ifdef WITH_PYTHON GP.finalize(); @@ -352,9 +352,9 @@ void write_netcdf(const DataPlane &dp, const Grid &grid, } // Clean up - if(data) { delete [] data; data = (float *) 0; } + if(data) { delete [] data; data = (float *) nullptr; } if(f_out) { - delete f_out; f_out = (NcFile *) 0; + delete f_out; f_out = (NcFile *) nullptr; } // List the output file diff --git a/src/tools/other/wwmca_tool/af_cp_file.cc b/src/tools/other/wwmca_tool/af_cp_file.cc index 70acdb4941..969e4d2238 100644 --- a/src/tools/other/wwmca_tool/af_cp_file.cc +++ b/src/tools/other/wwmca_tool/af_cp_file.cc @@ -109,7 +109,7 @@ void AFCloudPctFile::init_from_scratch() { -Buf = (unsigned char *) 0; +Buf = (unsigned char *) nullptr; clear(); @@ -125,7 +125,7 @@ void AFCloudPctFile::clear() { -if ( Buf ) { delete [] Buf; Buf = (unsigned char *) 0; } +if ( Buf ) { delete [] Buf; Buf = (unsigned char *) nullptr; } AFDataFile::clear(); diff --git a/src/tools/other/wwmca_tool/af_file.cc b/src/tools/other/wwmca_tool/af_file.cc index e0618a2b41..bcbce8a719 100644 --- a/src/tools/other/wwmca_tool/af_file.cc +++ b/src/tools/other/wwmca_tool/af_file.cc @@ -102,7 +102,7 @@ void AFDataFile::init_from_scratch() { -grid = (const Grid *) 0; +grid = (const Grid *) nullptr; clear(); @@ -118,7 +118,7 @@ void AFDataFile::clear() { -if ( grid ) { delete grid; grid = (const Grid *) 0; } +if ( grid ) { delete grid; grid = (const Grid *) nullptr; } Filename.clear(); diff --git a/src/tools/other/wwmca_tool/af_pt_file.cc b/src/tools/other/wwmca_tool/af_pt_file.cc index 4b875257d4..eebc9a9d5c 100644 --- a/src/tools/other/wwmca_tool/af_pt_file.cc +++ b/src/tools/other/wwmca_tool/af_pt_file.cc @@ -112,7 +112,7 @@ void AFPixelTimeFile::init_from_scratch() { -Buf = (unsigned char *) 0; +Buf = (unsigned char *) nullptr; clear(); @@ -128,7 +128,7 @@ void AFPixelTimeFile::clear() { -if ( Buf ) { delete [] Buf; Buf = (unsigned char *) 0; } +if ( Buf ) { delete [] Buf; Buf = (unsigned char *) nullptr; } AFDataFile::clear(); diff --git a/src/tools/other/wwmca_tool/ave_interp.cc b/src/tools/other/wwmca_tool/ave_interp.cc index a9a2cbcf32..e0b27b9834 100644 --- a/src/tools/other/wwmca_tool/ave_interp.cc +++ b/src/tools/other/wwmca_tool/ave_interp.cc @@ -135,7 +135,7 @@ Interpolator * Ave_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Ave_Interp (*this); diff --git a/src/tools/other/wwmca_tool/interp_base.cc b/src/tools/other/wwmca_tool/interp_base.cc index 0b7dd9f182..cd41a5f94e 100644 --- a/src/tools/other/wwmca_tool/interp_base.cc +++ b/src/tools/other/wwmca_tool/interp_base.cc @@ -203,7 +203,7 @@ void Interpolator::init_from_scratch() { -Data = (InterpolationValue *) 0; +Data = (InterpolationValue *) nullptr; clear(); @@ -219,7 +219,7 @@ void Interpolator::clear() { -if ( Data ) { delete [] Data; Data = (InterpolationValue *) 0; } +if ( Data ) { delete [] Data; Data = (InterpolationValue *) nullptr; } Width = 0; diff --git a/src/tools/other/wwmca_tool/max_interp.cc b/src/tools/other/wwmca_tool/max_interp.cc index 42a1fe322c..2531579e27 100644 --- a/src/tools/other/wwmca_tool/max_interp.cc +++ b/src/tools/other/wwmca_tool/max_interp.cc @@ -135,7 +135,7 @@ Interpolator * Max_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Max_Interp (*this); diff --git a/src/tools/other/wwmca_tool/min_interp.cc b/src/tools/other/wwmca_tool/min_interp.cc index 536aa90211..c82811fae2 100644 --- a/src/tools/other/wwmca_tool/min_interp.cc +++ b/src/tools/other/wwmca_tool/min_interp.cc @@ -136,7 +136,7 @@ Interpolator * Min_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Min_Interp (*this); diff --git a/src/tools/other/wwmca_tool/nc_output.cc b/src/tools/other/wwmca_tool/nc_output.cc index 7e68c7ab11..808c974b48 100644 --- a/src/tools/other/wwmca_tool/nc_output.cc +++ b/src/tools/other/wwmca_tool/nc_output.cc @@ -47,7 +47,7 @@ void WwmcaRegridder::do_output(const char * output_filename) { - NcFile * ncfile = (NcFile *) 0; + NcFile * ncfile = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; NcVar data_var ; @@ -233,7 +233,7 @@ void WwmcaRegridder::do_output(const char * output_filename) // done // - if ( ncfile ) { delete ncfile; ncfile = (NcFile *) 0; } + if ( ncfile ) { delete ncfile; ncfile = (NcFile *) nullptr; } // // list output file name diff --git a/src/tools/other/wwmca_tool/nearest_interp.cc b/src/tools/other/wwmca_tool/nearest_interp.cc index 2951fdd635..6192a2145a 100644 --- a/src/tools/other/wwmca_tool/nearest_interp.cc +++ b/src/tools/other/wwmca_tool/nearest_interp.cc @@ -135,7 +135,7 @@ Interpolator * Nearest_Interp::copy() const { -Interpolator * i = (Interpolator *) 0; +Interpolator * i = (Interpolator *) nullptr; i = new Nearest_Interp (*this); diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index b960362156..a0a0141213 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -68,7 +68,7 @@ static CommandLine cline; static const Grid nh(wwmca_north_data); static const Grid sh(wwmca_south_data); -static const Grid * grid = (const Grid *) 0; +static const Grid * grid = (const Grid *) nullptr; static int Nx, Ny; @@ -243,7 +243,7 @@ AFCloudPctFile f_cp; AFPixelTimeFile f_pt; ConcatString short_name; ConcatString output_filename; -char * pt_filename = (char *) 0; +char * pt_filename = (char *) nullptr; Pgm image; RenderInfo info; PSfile plot; @@ -280,7 +280,7 @@ if ( !(f_pt.read(pt_filename, bad_data_char)) ) { } -if (pt_filename) { delete [] pt_filename; pt_filename = (char *) 0; } +if (pt_filename) { delete [] pt_filename; pt_filename = (char *) nullptr; } if ( output_directory.length() > 0 ) output_filename << output_directory << '/'; diff --git a/src/tools/other/wwmca_tool/wwmca_ref.cc b/src/tools/other/wwmca_tool/wwmca_ref.cc index ff66c54268..4937a18290 100644 --- a/src/tools/other/wwmca_tool/wwmca_ref.cc +++ b/src/tools/other/wwmca_tool/wwmca_ref.cc @@ -62,8 +62,8 @@ WwmcaRegridder::~WwmcaRegridder() clear(); -if ( NHgrid ) { delete NHgrid; NHgrid = (const Grid *) 0; } -if ( SHgrid ) { delete SHgrid; SHgrid = (const Grid *) 0; } +if ( NHgrid ) { delete NHgrid; NHgrid = (const Grid *) nullptr; } +if ( SHgrid ) { delete SHgrid; SHgrid = (const Grid *) nullptr; } } @@ -78,15 +78,15 @@ void WwmcaRegridder::init_from_scratch() NHgrid = new Grid (wwmca_north_data); SHgrid = new Grid (wwmca_south_data); -cp_nh = (const AFCloudPctFile *) 0; -cp_sh = (const AFCloudPctFile *) 0; +cp_nh = (const AFCloudPctFile *) nullptr; +cp_sh = (const AFCloudPctFile *) nullptr; -pt_nh = (const AFPixelTimeFile *) 0; -pt_sh = (const AFPixelTimeFile *) 0; +pt_nh = (const AFPixelTimeFile *) nullptr; +pt_sh = (const AFPixelTimeFile *) nullptr; -ToGrid = (const Grid *) 0; +ToGrid = (const Grid *) nullptr; -Config = (MetConfig *) 0; +Config = (MetConfig *) nullptr; interp_func = 0; @@ -106,19 +106,19 @@ void WwmcaRegridder::clear() { -if ( cp_nh ) { delete cp_nh; cp_nh = (const AFCloudPctFile *) 0; } -if ( cp_sh ) { delete cp_sh; cp_sh = (const AFCloudPctFile *) 0; } +if ( cp_nh ) { delete cp_nh; cp_nh = (const AFCloudPctFile *) nullptr; } +if ( cp_sh ) { delete cp_sh; cp_sh = (const AFCloudPctFile *) nullptr; } -if ( pt_nh ) { delete pt_nh; pt_nh = (const AFPixelTimeFile *) 0; } -if ( pt_sh ) { delete pt_sh; pt_sh = (const AFPixelTimeFile *) 0; } +if ( pt_nh ) { delete pt_nh; pt_nh = (const AFPixelTimeFile *) nullptr; } +if ( pt_sh ) { delete pt_sh; pt_sh = (const AFPixelTimeFile *) nullptr; } -if ( ToGrid ) { delete ToGrid; ToGrid = (const Grid *) 0; } +if ( ToGrid ) { delete ToGrid; ToGrid = (const Grid *) nullptr; } Hemi = no_hemisphere; grid_strings.clear(); -Config = (MetConfig *) 0; +Config = (MetConfig *) nullptr; ConfigFilename.clear(); @@ -230,7 +230,7 @@ if ( !(f->read(filename, 'N')) ) { } -cp_nh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) 0; +cp_nh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) nullptr; return; @@ -255,7 +255,7 @@ if ( !(f->read(filename, 'S')) ) { } -cp_sh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) 0; +cp_sh = (const AFCloudPctFile *) f; f = (AFCloudPctFile *) nullptr; return; @@ -282,7 +282,7 @@ if ( !(f->read(filename, 'N')) ) { f->set_swap_endian(swap); -pt_nh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) 0; +pt_nh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) nullptr; return; @@ -309,7 +309,7 @@ if ( !(f->read(filename, 'S')) ) { f->set_swap_endian(swap); -pt_sh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) 0; +pt_sh = (const AFPixelTimeFile *) f; f = (AFPixelTimeFile *) nullptr; return; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index f5d5474610..87a9baf100 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -81,8 +81,8 @@ static ConcatString out_dir; ConcatString out_file; // NetCDF file information -static netCDF::NcFile* nc_in = (netCDF::NcFile*) 0; -static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_in = (netCDF::NcFile*) nullptr; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) nullptr; // Grid dimension information static netCDF::NcDim range_dim; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index 6862e56cae..9104c30279 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -46,7 +46,7 @@ RMWAnalysisConfInfo::~RMWAnalysisConfInfo() { void RMWAnalysisConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; clear(); @@ -80,11 +80,11 @@ void RMWAnalysisConfInfo::clear() { if(data_info) { for(int i = 0; i < n_data; i++) { if(data_info[i]) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } } delete data_info; - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; } // Reset field count @@ -115,7 +115,7 @@ void RMWAnalysisConfInfo::read_config(const char* default_file_name, void RMWAnalysisConfInfo::process_config() { VarInfoFactory info_factory; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; ConcatString poly_file; GrdFileType ftype = FileType_NcCF; @@ -184,7 +184,7 @@ void RMWAnalysisConfInfo::process_config() { // Initialize pointers for(int i = 0; i < n_data; i++) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } // Parse data field information diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 332587b9eb..f5d0c106fb 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -244,7 +244,7 @@ void process_command_line(int argc, char **argv) { void get_file_type() { Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; int i; // Build one long list of input data files @@ -284,7 +284,7 @@ void get_file_type() { file_type = mtddf->file_type(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return; } @@ -973,7 +973,7 @@ void process_fields(const TrackInfoArray &tracks, int i, j, i_pnt; Grid grid_dp; VarInfoFactory vi_factory; - VarInfo *vi = (VarInfo *) 0; + VarInfo *vi = (VarInfo *) nullptr; vector vi_list; DataPlane dp; vector dp_list; @@ -1063,7 +1063,7 @@ void process_fields(const TrackInfoArray &tracks, // Deallocate memory if(vi_list[i]) { delete vi_list[i]; - vi_list[i] = (VarInfo *) 0; + vi_list[i] = (VarInfo *) nullptr; } } // end for i @@ -1188,7 +1188,7 @@ void process_out_files(const TrackInfoArray& tracks) { //////////////////////////////////////////////////////////////////////// void merge_tmp_files(const vector tmp_files) { - NcFile *nc_out = (NcFile *) 0; + NcFile *nc_out = (NcFile *) nullptr; // Loop over temp files for(int i_tmp=0; i_tmpclose(); delete nc_diag_out; - nc_diag_out = (NcFile *) 0; + nc_diag_out = (NcFile *) nullptr; } nc_diag_file.clear(); @@ -1418,7 +1418,7 @@ void OutFileInfo::clear() { // Close the output file cira_diag_out->close(); delete cira_diag_out; - cira_diag_out = (ofstream *) 0; + cira_diag_out = (ofstream *) nullptr; } cira_diag_file.clear(); @@ -1706,7 +1706,7 @@ void OutFileInfo::write_nc_diag() { } // Clean up - if(prs_data) { delete [] prs_data; prs_data = (float *) 0; } + if(prs_data) { delete [] prs_data; prs_data = (float *) nullptr; } return; } @@ -2085,9 +2085,9 @@ TmpFileInfo::~TmpFileInfo() { void TmpFileInfo::init_from_scratch() { // Initialize pointers - trk_ptr = (TrackInfo *) 0; - pnt_ptr = (TrackPoint *) 0; - tmp_out = (NcFile *) 0; + trk_ptr = (TrackInfo *) nullptr; + pnt_ptr = (TrackPoint *) nullptr; + tmp_out = (NcFile *) nullptr; clear(); @@ -2127,7 +2127,7 @@ void TmpFileInfo::close() { << tmp_file << "\n"; delete tmp_out; - tmp_out = (NcFile *) 0; + tmp_out = (NcFile *) nullptr; } return; @@ -2137,8 +2137,8 @@ void TmpFileInfo::close() { void TmpFileInfo::clear() { - trk_ptr = (TrackInfo *) 0; - pnt_ptr = (TrackPoint *) 0; + trk_ptr = (TrackInfo *) nullptr; + pnt_ptr = (TrackPoint *) nullptr; // Clear the diagnostics keys and maps diag_storm_keys.clear(); @@ -2167,7 +2167,7 @@ void TmpFileInfo::clear() { remove_temp_file(tmp_file); - tmp_out = (NcFile *) 0; + tmp_out = (NcFile *) nullptr; } tmp_file.clear(); @@ -2267,8 +2267,8 @@ void TmpFileInfo::setup_nc_file(const DomainInfo &di, write_tc_track_point(tmp_out, vld_dim, *pnt_ptr); // Clean up - if(lat_arr) { delete[] lat_arr; lat_arr = (double *) 0; } - if(lon_arr) { delete[] lon_arr; lon_arr = (double *) 0; } + if(lat_arr) { delete[] lat_arr; lat_arr = (double *) nullptr; } + if(lon_arr) { delete[] lon_arr; lon_arr = (double *) nullptr; } return; } diff --git a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc index 7684308b81..688308e356 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc @@ -81,7 +81,7 @@ void DomainInfo::clear() { data_files.clear(); domain.clear(); - data.name = (const char *) 0; + data.name = (const char *) nullptr; data.range_n = bad_data_int; data.azimuth_n = bad_data_int; data.range_max_km = bad_data_double; @@ -181,7 +181,7 @@ void TCDiagConfInfo::clear() { // Deallocate memory for(int i=0; i dmap) { int i, j; StringArray sa; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; VarInfoFactory vi_factory; // Conf: version @@ -368,7 +368,7 @@ void TCDiagConfInfo::process_config(GrdFileType file_type, //////////////////////////////////////////////////////////////////////// void TCDiagConfInfo::parse_domain_info(map dmap) { - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; int i, j; bool found; diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index dbdc7d976a..5a360479f4 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -201,13 +201,13 @@ void process_land_data() { void process_distances() { int n, x, y, c, npts, nlog, imin; double lat, lon; - float *dland = (float *) 0; + float *dland = (float *) nullptr; // Instantiate the grid Grid grid(GridData); // NetCDF variables - NcFile *f_out = (NcFile *) 0; + NcFile *f_out = (NcFile *) nullptr; NcDim lat_dim ; NcDim lon_dim ; NcVar dland_var ; @@ -220,7 +220,7 @@ void process_distances() { << "trouble opening output file " << out_filename << "\n\n"; delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; exit(1); } @@ -293,18 +293,18 @@ void process_distances() { // Write the computed distances to the output file mlog << Debug(3) << "Writing distance to land variable.\n"; if(!put_nc_data_with_dims(&dland_var, &dland[0], grid.ny(), grid.nx())) { - if(dland) { delete [] dland; dland = (float *) 0; } + if(dland) { delete [] dland; dland = (float *) nullptr; } mlog << Error << "\nprocess_distances() -> " << "error with dland_var->put\n\n"; exit(1); } // Delete allocated memory - if(dland) { delete [] dland; dland = (float *) 0; } + if(dland) { delete [] dland; dland = (float *) nullptr; } // Close the output NetCDF file delete f_out; - f_out = (NcFile *) 0; + f_out = (NcFile *) nullptr; // List the output file mlog << Debug(1) diff --git a/src/tools/tc_utils/tc_dland/tc_poly.cc b/src/tools/tc_utils/tc_dland/tc_poly.cc index 9f3f892097..1eb7ac1a48 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.cc +++ b/src/tools/tc_utils/tc_dland/tc_poly.cc @@ -168,7 +168,7 @@ TCPolyArray & TCPolyArray::operator=(const TCPolyArray & a) { void TCPolyArray::init_from_scratch() { - Poly = (TCPoly *) 0; + Poly = (TCPoly *) nullptr; clear(); @@ -179,7 +179,7 @@ void TCPolyArray::init_from_scratch() { void TCPolyArray::clear() { - if(Poly) { delete [] Poly; Poly = (TCPoly *) 0; } + if(Poly) { delete [] Poly; Poly = (TCPoly *) nullptr; } NPolys = NAlloc = 0; @@ -222,7 +222,7 @@ void TCPolyArray::extend(int n, bool exact) { n = k*tc_poly_array_alloc_inc; } - TCPoly * p = (TCPoly *) 0; + TCPoly * p = (TCPoly *) nullptr; p = new TCPoly [n]; @@ -234,10 +234,10 @@ void TCPolyArray::extend(int n, bool exact) { if(Poly) { for(i=0; iclose(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } return; @@ -2174,7 +2174,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { TcHdrColumns tchc; ConcatString out_file; AsciiTable out_at; - ofstream *out = (ofstream *) 0; + ofstream *out = (ofstream *) nullptr; // Set the track pair output file name out_file << out_base << "_PROBRIRW" << tc_stat_file_ext; @@ -2239,7 +2239,7 @@ void write_prob_rirw(const ProbRIRWPairInfoArray &p) { *out << out_at; out->close(); delete out; - out = (ofstream *) 0; + out = (ofstream *) nullptr; } return; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc index cfd22631b5..6b2cb8254d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc @@ -54,7 +54,7 @@ TCPairsConfInfo::~TCPairsConfInfo() { void TCPairsConfInfo::init_from_scratch() { // Initialize pointers - Consensus = (ConsensusInfo *) 0; + Consensus = (ConsensusInfo *) nullptr; clear(); @@ -66,7 +66,7 @@ void TCPairsConfInfo::init_from_scratch() { void TCPairsConfInfo::clear() { // Deallocate memory - if(Consensus) { delete [] Consensus; Consensus = (ConsensusInfo *) 0; } + if(Consensus) { delete [] Consensus; Consensus = (ConsensusInfo *) nullptr; } Desc.clear(); Model.clear(); @@ -139,7 +139,7 @@ void TCPairsConfInfo::process_config() { int i, j; StringArray sa; ConcatString poly_file; - Dictionary *dict = (Dictionary *) 0; + Dictionary *dict = (Dictionary *) nullptr; // Conf: Version Version = Conf.lookup_string(conf_key_version); @@ -395,7 +395,7 @@ void DiagInfo::clear() { void parse_conf_diag_info_map(Dictionary *dict, map &source_map) { int i; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; ConcatString diag_source; DiagInfo cur_info; @@ -445,7 +445,7 @@ void parse_conf_diag_info_map(Dictionary *dict, map &sour void parse_conf_diag_convert_map(Dictionary *dict, map< ConcatString,map > &source_map) { int i, j; - Dictionary *map_dict = (Dictionary *) 0; + Dictionary *map_dict = (Dictionary *) nullptr; map cur_map; ConcatString diag_source, key; StringArray sa; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 4520b1d5ca..dfcf84a9f9 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -214,7 +214,7 @@ GrdFileType get_file_type(const StringArray &file_list, const GrdFileType in_ftype) { int i; Met2dDataFileFactory mtddf_factory; - Met2dDataFile *mtddf = (Met2dDataFile *) 0; + Met2dDataFile *mtddf = (Met2dDataFile *) nullptr; GrdFileType out_ftype; // Find the first file that actually exists @@ -239,7 +239,7 @@ GrdFileType get_file_type(const StringArray &file_list, out_ftype = mtddf->file_type(); // Clean up - if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } + if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } return(out_ftype); } @@ -561,7 +561,7 @@ void setup_grid() { //////////////////////////////////////////////////////////////////////// void setup_nc_file() { - VarInfo* data_info = (VarInfo*) 0; + VarInfo* data_info = (VarInfo*) nullptr; // Create NetCDF file nc_out = open_ncfile(out_file.c_str(), true); @@ -650,7 +650,7 @@ void compute_lat_lon(TcrmwGrid& tcrmw_grid, //////////////////////////////////////////////////////////////////////// void process_fields(const TrackInfoArray& tracks) { - VarInfo *data_info = (VarInfo *) 0; + VarInfo *data_info = (VarInfo *) nullptr; DataPlane data_dp; // Define latitude and longitude arrays diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 10aded04c4..b97f136188 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -97,7 +97,7 @@ static ConcatString out_prefix; // Output NetCDF file static ConcatString out_file; -static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) nullptr; static netCDF::NcDim range_dim; static netCDF::NcDim azimuth_dim; static netCDF::NcDim pressure_dim; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 19fa16a3c6..96f038f6ab 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -45,7 +45,7 @@ TCRMWConfInfo::~TCRMWConfInfo() { void TCRMWConfInfo::init_from_scratch() { // Initialize pointers - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; clear(); @@ -86,11 +86,11 @@ void TCRMWConfInfo::clear() { if(data_info) { for(int i = 0; i < n_data; i++) { if(data_info[i]) { - data_info[i] = (VarInfo*) 0; + data_info[i] = (VarInfo*) nullptr; } } delete data_info; - data_info = (VarInfo**) 0; + data_info = (VarInfo**) nullptr; } // Reset field count @@ -122,7 +122,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { int i; StringArray sa; VarInfoFactory info_factory; - Dictionary *fdict = (Dictionary *) 0; + Dictionary *fdict = (Dictionary *) nullptr; // Conf: version check_met_version(Conf.lookup_string(conf_key_version).c_str()); @@ -212,7 +212,7 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { // Initialize pointers for(i=0; iget_n_data(); i_var++) { data_info = _conf->data_info[i_var]; string varname = data_info->name_attr().string(); @@ -128,8 +128,8 @@ void TCRMW_WindConverter::update_input(const string &variableName, const string //////////////////////////////////////////////////////////////////////// void TCRMW_WindConverter::append_nc_output_vars(map > &variable_levels, - map &variable_long_names, - map &variable_units) { + map &variable_long_names, + map &variable_units) { if (!_computeWinds) { return; } @@ -145,11 +145,11 @@ void TCRMW_WindConverter::append_nc_output_vars(map > &va else { if (!_foundUInInput) { mlog << Warning << "\nTCWRMW_WindConverter::checkInputs() -> " - << "field not found in input \"" << _conf->u_wind_field_name << "\"\n\n"; + << "field not found in input \"" << _conf->u_wind_field_name << "\"\n\n"; } if (!_foundVInInput) { mlog << Warning << "\nTCWRMW_WindConverter::checkInputs() -> " - << "field not found in input \"" << _conf->v_wind_field_name << "\"\n\n"; + << "field not found in input \"" << _conf->v_wind_field_name << "\"\n\n"; } mlog << Warning << "\nNot computing radial and tangential winds\n\n"; _computeWinds = false; @@ -159,24 +159,24 @@ void TCRMW_WindConverter::append_nc_output_vars(map > &va //////////////////////////////////////////////////////////////////////// bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, - const string &varName, - const string &varLevel, - unixtime valid_time, - const StringArray &data_files, - const GrdFileType &ftype, - const Grid &latlon_arr, - const double *lat_arr, - const double *lon_arr, - const Grid &grid, - const DataPlane &data_dp, - const TcrmwGrid &tcrmw_grid) { + const string &varName, + const string &varLevel, + unixtime valid_time, + const StringArray &data_files, + const GrdFileType &ftype, + const Grid &latlon_arr, + const double *lat_arr, + const double *lon_arr, + const Grid &grid, + const DataPlane &data_dp, + const TcrmwGrid &tcrmw_grid) { if (!_computeWinds) { return false; } int uIndex = -1; int vIndex = -1; - VarInfo *data_infoV = (VarInfo *) 0; + VarInfo *data_infoV = (VarInfo *) nullptr; if (varName == _conf->u_wind_field_name.string()) { uIndex = _uIndexMap[varLevel]; vIndex = _vIndexMap[varLevel]; @@ -191,7 +191,7 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, DataPlane data_dpV; Grid latlon_arrV; get_series_entry(i_point, data_infoV, data_files, ftype, data_dpV, - latlon_arrV); + latlon_arrV); double data_min, data_max; data_dpV.data_range(data_min, data_max); mlog << Debug(4) << "V data_min:" << data_min << "\n"; @@ -203,7 +203,7 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, // here's the conversion, at last wind_ne_to_ra(tcrmw_grid, data_dp, data_dpV, lat_arr, lon_arr, - _windR, _windT); + _windR, _windT); // _windR and _windT now set return true; } @@ -212,9 +212,9 @@ bool TCRMW_WindConverter::compute_winds_if_input_is_u(int i_point, //////////////////////////////////////////////////////////////////////// void wind_ne_to_ra(const TcrmwGrid& tcrmw_grid, - const DataPlane& u_dp, const DataPlane& v_dp, - const double* lat_arr, const double* lon_arr, - double* wind_r_arr, double* wind_t_arr) { + const DataPlane& u_dp, const DataPlane& v_dp, + const double* lat_arr, const double* lon_arr, + double* wind_r_arr, double* wind_t_arr) { // Transform (u, v) to (radial, azimuthal) for(int ir = 0; ir < tcrmw_grid.range_n(); ir++) { for(int ia = 0; ia < tcrmw_grid.azimuth_n(); ia++) { @@ -225,15 +225,15 @@ void wind_ne_to_ra(const TcrmwGrid& tcrmw_grid, double v = v_dp.data()[i]; double wind_r; double wind_t; - if(is_bad_data(u) || is_bad_data(v)) { - mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " winds are missing\n"; - wind_r = bad_data_double; - wind_t = bad_data_double; - } else { - tcrmw_grid.wind_ne_to_ra(lat, lon, u, v, wind_r, wind_t); - mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " uv:" << u << "," - << v << ", rt:" << wind_r << "," << wind_t <<"\n"; - } + if(is_bad_data(u) || is_bad_data(v)) { + mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " winds are missing\n"; + wind_r = bad_data_double; + wind_t = bad_data_double; + } else { + tcrmw_grid.wind_ne_to_ra(lat, lon, u, v, wind_r, wind_t); + mlog << Debug(4) << "wind_ne_to_ra: latlon:" << lat << "," << lon << " uv:" << u << "," + << v << ", rt:" << wind_r << "," << wind_t <<"\n"; + } wind_r_arr[i] = wind_r; wind_t_arr[i] = wind_t; } diff --git a/src/tools/tc_utils/tc_stat/tc_stat.cc b/src/tools/tc_utils/tc_stat/tc_stat.cc index d1e85b0855..3bfd0b13a4 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -165,7 +165,7 @@ void process_search_dirs() { void process_jobs() { TCStatJobFactory factory; - TCStatJob *cur_job = (TCStatJob *) 0; + TCStatJob *cur_job = (TCStatJob *) nullptr; ConcatString jobstring; int i, n_jobs; TCPointCounts n; @@ -258,7 +258,7 @@ void process_jobs() { << "Rejected for out valid mask = " << n.RejOutValidMask << "\n"; // Deallocate current job - if(cur_job) { delete cur_job; cur_job = (TCStatJob *) 0; } + if(cur_job) { delete cur_job; cur_job = (TCStatJob *) nullptr; } } // end for i @@ -293,7 +293,7 @@ void open_out_file() { void close_out_file() { // Close the output file - if(tc_stat_out != (ofstream *) 0) { + if(tc_stat_out != (ofstream *) nullptr) { // List the file being closed mlog << Debug(1) @@ -302,7 +302,7 @@ void close_out_file() { // Close the output file tc_stat_out->close(); delete tc_stat_out; - tc_stat_out = (ofstream *) 0; + tc_stat_out = (ofstream *) nullptr; } return; diff --git a/src/tools/tc_utils/tc_stat/tc_stat.h b/src/tools/tc_utils/tc_stat/tc_stat.h index 1bf28f1610..64a3a214c0 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.h +++ b/src/tools/tc_utils/tc_stat/tc_stat.h @@ -81,7 +81,7 @@ static ConcatString command_line_job; //////////////////////////////////////////////////////////////////////// // Output file stream -static std::ofstream *tc_stat_out = (std::ofstream *) 0; +static std::ofstream *tc_stat_out = (std::ofstream *) nullptr; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 197c4f2f12..9814f759c4 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -2703,7 +2703,7 @@ TCStatJobType string_to_tcstatjobtype(const ConcatString s) { //////////////////////////////////////////////////////////////////////// ConcatString tcstatjobtype_to_string(const TCStatJobType t) { - const char *s = (const char *) 0; + const char *s = (const char *) nullptr; switch(t) { case TCStatJobType_Filter: s = TCStatJobType_FilterStr; break; @@ -2936,7 +2936,7 @@ TCStatJobRIRW & TCStatJobRIRW::operator=(const TCStatJobRIRW &j) { void TCStatJobRIRW::init_from_scratch() { int i; - for(i=0; i<4; i++) DumpOutCTC[i] = (ofstream *) 0; + for(i=0; i<4; i++) DumpOutCTC[i] = (ofstream *) nullptr; TCStatJob::init_from_scratch(); @@ -3066,7 +3066,7 @@ void TCStatJobRIRW::close_dump_file() { DumpOutCTC[i]->close(); delete DumpOutCTC[i]; - DumpOutCTC[i] = (ofstream *) 0; + DumpOutCTC[i] = (ofstream *) nullptr; } } @@ -3977,7 +3977,7 @@ TCStatJobProbRIRW & TCStatJobProbRIRW::operator=(const TCStatJobProbRIRW &j) { void TCStatJobProbRIRW::init_from_scratch() { - StatOut = (ofstream *) 0; + StatOut = (ofstream *) nullptr; TCStatJob::init_from_scratch(); @@ -4081,7 +4081,7 @@ void TCStatJobProbRIRW::close_dump_file() { if(DumpOut) { DumpOut->close(); delete DumpOut; - DumpOut = (ofstream *) 0; + DumpOut = (ofstream *) nullptr; } // Prepare nicely formatted AsciiTable object From 83730cf63202081db6e78ca269e2056c80b0909c Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 01:31:58 +0000 Subject: [PATCH 09/72] #2673 Removed the redundant parentheses with return --- src/basic/enum_to_string/code.cc | 4 +- src/basic/enum_to_string/info.cc | 10 +-- src/basic/enum_to_string/my_enum_scanner.cc | 42 ++++----- src/basic/enum_to_string/scope.cc | 6 +- src/basic/vx_config/builtin.cc | 4 +- src/basic/vx_config/celltype_to_string.cc | 48 +++++----- src/basic/vx_config/config_file.cc | 4 +- src/basic/vx_config/config_util.cc | 6 +- src/basic/vx_config/dictionary.cc | 8 +- src/basic/vx_config/grdfiletype_to_string.cc | 34 +++---- src/basic/vx_config/my_config_scanner.cc | 88 +++++++++---------- src/basic/vx_config/number_stack.cc | 4 +- src/basic/vx_config/threshold.cc | 16 ++-- src/basic/vx_log/concat_string.cc | 88 +++++++++---------- src/basic/vx_log/file_fxns.cc | 10 +-- src/basic/vx_log/indent.cc | 6 +- src/basic/vx_log/logger.cc | 50 +++++------ src/basic/vx_log/string_array.cc | 32 +++---- src/basic/vx_math/affine.cc | 46 +++++----- src/basic/vx_math/angles.cc | 22 ++--- src/basic/vx_math/hist.cc | 18 ++-- src/basic/vx_math/legendre.cc | 10 +-- src/basic/vx_math/nint.cc | 2 +- src/basic/vx_math/nti.cc | 10 +-- src/basic/vx_math/ptile.cc | 24 ++--- src/basic/vx_math/pwl.cc | 16 ++-- src/basic/vx_math/viewgravity_to_string.cc | 2 +- src/basic/vx_math/vx_vector.cc | 54 ++++++------ src/basic/vx_util/ascii_header.cc | 22 ++--- src/basic/vx_util/ascii_table.cc | 54 ++++++------ src/basic/vx_util/asciitablejust_to_string.cc | 2 +- src/basic/vx_util/comma_string.cc | 2 +- src/basic/vx_util/command_line.cc | 36 ++++---- src/basic/vx_util/conversions.cc | 18 ++-- src/basic/vx_util/data_line.cc | 74 ++++++++-------- src/basic/vx_util/data_plane.cc | 42 ++++----- src/basic/vx_util/data_plane_util.cc | 12 +-- src/basic/vx_util/file_exists.cc | 10 +-- src/basic/vx_util/file_linecount.cc | 2 +- src/basic/vx_util/file_size.cc | 2 +- src/basic/vx_util/filename_suffix.cc | 6 +- src/basic/vx_util/get_filenames.cc | 10 +-- src/basic/vx_util/grib_constants.cc | 4 +- src/basic/vx_util/interp_mthd.cc | 4 +- src/basic/vx_util/interp_util.cc | 50 +++++------ src/basic/vx_util/is_number.cc | 64 +++++++------- src/basic/vx_util/long_array.cc | 10 +-- src/basic/vx_util/make_path.cc | 14 +-- src/basic/vx_util/mask_poly.cc | 10 +-- src/basic/vx_util/met_buffer.cc | 10 +-- src/basic/vx_util/normalize.cc | 2 +- src/basic/vx_util/num_array.cc | 62 ++++++------- src/basic/vx_util/polyline.cc | 36 ++++---- src/basic/vx_util/python_line.cc | 18 ++-- src/basic/vx_util/read_fortran_binary.cc | 24 ++--- src/basic/vx_util/smart_buffer.cc | 8 +- src/basic/vx_util/string_fxns.cc | 24 ++--- src/basic/vx_util/thresh_array.cc | 64 +++++++------- src/basic/vx_util/two_to_one.cc | 8 +- src/basic/vx_util_math/so3.cc | 34 +++---- 60 files changed, 701 insertions(+), 701 deletions(-) diff --git a/src/basic/enum_to_string/code.cc b/src/basic/enum_to_string/code.cc index 93f2b1e6c0..fb62ba003f 100644 --- a/src/basic/enum_to_string/code.cc +++ b/src/basic/enum_to_string/code.cc @@ -869,7 +869,7 @@ for (j=0; j= Nids) ) { } -return ( s[n] ); +return s[n]; } @@ -259,7 +259,7 @@ int EnumInfo::max_id_length() const { -if ( Nids == 0 ) return ( 0 ); +if ( Nids == 0 ) return 0; int j, k; int max_len; @@ -468,7 +468,7 @@ for (j=0; j<(e.Nids); ++j) { s.flush(); -return ( s ); +return s; } diff --git a/src/basic/enum_to_string/my_enum_scanner.cc b/src/basic/enum_to_string/my_enum_scanner.cc index 2d71fe65c0..40e1577c42 100644 --- a/src/basic/enum_to_string/my_enum_scanner.cc +++ b/src/basic/enum_to_string/my_enum_scanner.cc @@ -134,7 +134,7 @@ while ( 1 ) { t = next_token(); - if ( t == eof ) return ( 0 ); + if ( t == eof ) return 0; if ( t < 0 ) continue; @@ -186,7 +186,7 @@ while ( 1 ) { } // while -if ( c == eof ) return ( eof ); +if ( c == eof ) return eof; clear_lexeme(); @@ -196,11 +196,11 @@ switch ( c ) { // single character tokens // - case '{': { if ( do_left_curly() ) return ( token(L_CURLY) ); } break; - case '}': { if ( do_right_curly() ) return ( token(R_CURLY) ); } break; - case '=': { if ( do_equals() ) return ( token (EQ) ); } break; - case ';': { if ( do_semi() ) return ( token(';') ); } break; - case ',': { if ( do_comma() ) return ( token(',') ); } break; + case '{': { if ( do_left_curly() ) return token(L_CURLY); } break; + case '}': { if ( do_right_curly() ) return token(R_CURLY); } break; + case '=': { if ( do_equals() ) return token (EQ); } break; + case ';': { if ( do_semi() ) return token(';'); } break; + case ',': { if ( do_comma() ) return token(','); } break; default: break; @@ -215,13 +215,13 @@ if ( c == '/' ) { c2 = nextchar(); - if ( c2 == EOF ) return ( EOF ); + if ( c2 == EOF ) return EOF; if ( c2 == '*' ) do_c_comment(); else if ( c2 == '/' ) do_cpp_comment(); else ungetc(c2, yyin); - return ( skip ); + return skip; } @@ -231,7 +231,7 @@ if ( c == '/' ) { int k = char_class[c]; -if ( k == char_class_other ) return ( skip ); +if ( k == char_class_other ) return skip; // // from this point on, we're only interested in characters @@ -255,14 +255,14 @@ while ( count < max_lexeme_size ) { lexeme[max_lexeme_size] = (char) 0; -if ( count == 0 ) return ( skip ); +if ( count == 0 ) return skip; -if ( strncmp((char *) lexeme, "enum", max_lexeme_size) == 0 ) { do_enum(); return ( token(ENUM) ); } -if ( strncmp((char *) lexeme, "class", max_lexeme_size) == 0 ) { do_class(); return ( token(CLASS) ); } +if ( strncmp((char *) lexeme, "enum", max_lexeme_size) == 0 ) { do_enum(); return token(ENUM) ; } +if ( strncmp((char *) lexeme, "class", max_lexeme_size) == 0 ) { do_class(); return token(CLASS); } -if ( is_int() ) { if ( do_int() ) return ( token(INTEGER) ); } +if ( is_int() ) { if ( do_int() ) return token(INTEGER); } -if ( is_id() ) { if ( do_id() ) return ( token(ID) ); } +if ( is_id() ) { if ( do_id() ) return token(ID); } @@ -326,9 +326,9 @@ bool char_ok(int c) const int k = char_class[c]; -if ( k == char_class_digit ) return ( true ); +if ( k == char_class_digit ) return true; -if ( k == char_class_alpha ) return ( true ); +if ( k == char_class_alpha ) return true; return false; @@ -357,7 +357,7 @@ for (j=j_start; jlookup_bool(conf_key_flag); // If disabled, skip remainder of the dictionary. - if(!info.flag) return(info); + if(!info.flag) return info; // Conf: vld_thresh info.vld_thresh = hira_dict->lookup_double(conf_key_vld_thresh); @@ -3308,7 +3308,7 @@ StringArray parse_conf_ens_member_ids(Dictionary *dict) { << sa.n() << " entries.\n"; } - return(sa); + return sa; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/dictionary.cc b/src/basic/vx_config/dictionary.cc index bc1a34bff0..569b183629 100644 --- a/src/basic/vx_config/dictionary.cc +++ b/src/basic/vx_config/dictionary.cc @@ -1281,7 +1281,7 @@ scope = Name.split("."); if ( scope.n_elements() == 1 ) { - return ( lookup_simple(name, search_parent) ); + return lookup_simple(name, search_parent); } @@ -1505,7 +1505,7 @@ if ( !Entry || !is_correct_type ) { } - return ( false ); + return false; } @@ -1529,7 +1529,7 @@ for (int i=0; ipush_array(); return ( token(lexeme[0]) ); } - case '{': { do_single_char_token(lexeme[0]); is_lhs = true; dict_stack->push(); return ( token(lexeme[0]) ); } + case '[': { do_single_char_token(lexeme[0]); is_lhs = false; dict_stack->push_array(); return token(lexeme[0]); } + case '{': { do_single_char_token(lexeme[0]); is_lhs = true; dict_stack->push(); return token(lexeme[0]); } - case ']': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } - case '}': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + case ']': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } + case '}': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - case '(': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } - case ')': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + case '(': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } + case ')': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - case '+': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + case '+': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - case '-': { if ( ! need_number ) { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } } break; + case '-': { if ( ! need_number ) { do_single_char_token(lexeme[0]); return token(lexeme[0]); } } break; - case '*': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } - case '^': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + case '*': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } + case '^': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - // case '=': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + // case '=': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - case ';': { do_single_char_token(lexeme[0]); is_lhs = true; return ( token( ';' ) ); } - case ',': { do_single_char_token(lexeme[0]); return ( token(lexeme[0]) ); } + case ';': { do_single_char_token(lexeme[0]); is_lhs = true; return token( ';' ); } + case ',': { do_single_char_token(lexeme[0]); return token(lexeme[0]); } - case '\"': { do_quoted_string(); return ( token ( QUOTED_STRING ) ); } + case '\"': { do_quoted_string(); return token ( QUOTED_STRING ); } - case '\n': { ++LineNumber; Column = 1; return ( -1 ); } + case '\n': { ++LineNumber; Column = 1; return -1; } default: break; @@ -281,27 +281,27 @@ if ( c == '/' ) { c2 = nextchar(); - if ( c2 == eof ) return ( eof ); + if ( c2 == eof ) return eof; - if ( c2 == '*' ) { do_c_comment(); return ( skip ); } - else if ( c2 == '/' ) { do_cpp_comment(); return ( skip ); } + if ( c2 == '*' ) { do_c_comment(); return skip; } + else if ( c2 == '/' ) { do_cpp_comment(); return skip; } else putback(c2); - return ( token('/') ); + return token('/'); } c2 = nextchar(); - if ( strncmp(configtext, "<=", 2) == 0 ) { need_number = true; return ( do_comp() ); } -else if ( strncmp(configtext, ">=", 2) == 0 ) { need_number = true; return ( do_comp() ); } -else if ( strncmp(configtext, "==", 2) == 0 ) { need_number = true; return ( do_comp() ); } + if ( strncmp(configtext, "<=", 2) == 0 ) { need_number = true; return do_comp(); } +else if ( strncmp(configtext, ">=", 2) == 0 ) { need_number = true; return do_comp(); } +else if ( strncmp(configtext, "==", 2) == 0 ) { need_number = true; return do_comp(); } -else if ( strncmp(configtext, "!=", 2) == 0 ) { need_number = true; return ( do_comp() ); } -else if ( strncmp(configtext, "NA", 2) == 0 ) return ( do_comp() ); +else if ( strncmp(configtext, "!=", 2) == 0 ) { need_number = true; return do_comp(); } +else if ( strncmp(configtext, "NA", 2) == 0 ) return do_comp(); -else if ( strncmp(configtext, "&&", 2) == 0 ) { Column += 2; return ( LOGICAL_OP_AND ); } -else if ( strncmp(configtext, "||", 2) == 0 ) { Column += 2; return ( LOGICAL_OP_OR ); } +else if ( strncmp(configtext, "&&", 2) == 0 ) { Column += 2; return LOGICAL_OP_AND; } +else if ( strncmp(configtext, "||", 2) == 0 ) { Column += 2; return LOGICAL_OP_OR ; } else { @@ -310,10 +310,10 @@ else { } -if ( strncmp(configtext, "<" , 1) == 0 ) { need_number = true; return ( do_comp() ); } -if ( strncmp(configtext, ">" , 1) == 0 ) { need_number = true; return ( do_comp() ); } -if ( strncmp(configtext, "=" , 1) == 0 ) return ( token( '=' ) ); -if ( strncmp(configtext, "!" , 1) == 0 ) return ( token( LOGICAL_OP_NOT ) ); +if ( strncmp(configtext, "<" , 1) == 0 ) { need_number = true; return do_comp(); } +if ( strncmp(configtext, ">" , 1) == 0 ) { need_number = true; return do_comp(); } +if ( strncmp(configtext, "=" , 1) == 0 ) return token( '=' ); +if ( strncmp(configtext, "!" , 1) == 0 ) return token( LOGICAL_OP_NOT ); // putback(configtext[0]); @@ -324,7 +324,7 @@ if ( strncmp(configtext, "!" , 1) == 0 ) return ( token( LOGICAL_OP_NOT ) ); int k = char_class[c]; -if ( k == char_class_other ) return ( skip ); +if ( k == char_class_other ) return skip; // // quote? @@ -350,22 +350,22 @@ while ( pos < max_id_length ) { lexeme[max_id_length] = (char) 0; -if ( pos == 0 ) return ( skip ); +if ( pos == 0 ) return skip; -// if ( strncmp((char *) lexeme, "enum", max_id_length) == 0 ) { do_enum(); return ( token(ENUM) ); } -// if ( strncmp((char *) lexeme, "class", max_id_length) == 0 ) { do_class(); return ( token(CLASS) ); } +// if ( strncmp((char *) lexeme, "enum", max_id_length) == 0 ) { do_enum(); return token(ENUM) ; } +// if ( strncmp((char *) lexeme, "class", max_id_length) == 0 ) { do_class(); return token(CLASS); } -if ( is_int() ) { if ( do_int() ) return ( token(INTEGER) ); } +if ( is_int() ) { if ( do_int() ) return token(INTEGER); } -if ( is_float_v2() ) { if ( do_float() ) return ( token(FLOAT) ); } +if ( is_float_v2() ) { if ( do_float() ) return token(FLOAT); } -if ( is_fort_thresh_no_spaces() ) { return ( do_fort_thresh() ); } +if ( is_fort_thresh_no_spaces() ) { return do_fort_thresh(); } -if ( is_simple_perc_thresh() ) { return ( do_simple_perc_thresh() ); } +if ( is_simple_perc_thresh() ) { return do_simple_perc_thresh(); } int t; -if ( is_id() ) { t = do_id(); return ( token(t) ); } +if ( is_id() ) { t = do_id(); return token(t); } @@ -528,7 +528,7 @@ if ( is_lhs ) { // print? // -if ( strcmp(configtext, "print" ) == 0 ) { return ( PRINT ); } +if ( strcmp(configtext, "print" ) == 0 ) { return PRINT; } // // boolean? @@ -546,7 +546,7 @@ if ( strcmp(configtext, "FALSE" ) == 0 ) { configlval.bval = false; return BOO for (j=0; jcheck(x, cmn, csd); -return ( ! tf ); +return !tf; } @@ -796,7 +796,7 @@ bool Simple_Node::check(double x, double cmn, double csd) const { -if ( op == thresh_na ) return ( true ); +if ( op == thresh_na ) return true; double tval; @@ -1371,7 +1371,7 @@ SingleThresh & SingleThresh::operator=(const SingleThresh & c) { -if ( this == &c ) return ( * this ); +if ( this == &c ) return *this; assign(c); @@ -1389,9 +1389,9 @@ bool SingleThresh::operator==(const SingleThresh &st) const // return true when both null and false when only one is null -if ( !node && !(st.node) ) return ( true ); +if ( !node && !(st.node) ) return true; -if ( !node || !(st.node) ) return ( false ); +if ( !node || !(st.node) ) return false; // for complex thresholds, check the string representation @@ -1644,11 +1644,11 @@ bool SingleThresh::need_perc() const if ( node ) { - return ( node->need_perc() ); + return node->need_perc(); } -return ( false ); +return false; } diff --git a/src/basic/vx_log/concat_string.cc b/src/basic/vx_log/concat_string.cc index 353bd44c5d..233985802e 100644 --- a/src/basic/vx_log/concat_string.cc +++ b/src/basic/vx_log/concat_string.cc @@ -165,7 +165,7 @@ ConcatString & ConcatString::operator=(const std::string & Text) init_from_scratch(); if (s) s->assign(Text); - return(*this); + return *this; } @@ -192,7 +192,7 @@ if ( ! Text ) { (*s) = s2; - return(*this); + return *this; } @@ -455,7 +455,7 @@ ConcatString ConcatString::dirname() const c = c.s->substr(start, end-start); } - return(c); + return c; } @@ -483,7 +483,7 @@ ConcatString ConcatString::basename() const c = c.s->substr(start+1, end-start); } - return(c); + return c; } @@ -612,7 +612,7 @@ const string ConcatString::contents(const char * str) const if (s->empty() || *s == "") { return (str ? str : "(nul)"); } else { - return ( *s ); + return *s; } } @@ -655,7 +655,7 @@ ConcatString uc = cs; uc.set_upper(); -return ( uc ); +return uc; } @@ -671,7 +671,7 @@ ConcatString lc = cs; lc.set_lower(); -return ( lc ); +return lc; } @@ -700,7 +700,7 @@ ConcatString & operator<<(ConcatString & cs, const char c) cs.add(c); -return ( cs ); +return cs; } @@ -714,7 +714,7 @@ ConcatString & operator<<(ConcatString & cs, const char * s) cs.add(s); -return ( cs ); +return cs; } @@ -727,7 +727,7 @@ ConcatString & operator<<(ConcatString & cs, const std::string & s) cs.add(s); -return ( cs ); +return cs; } @@ -741,7 +741,7 @@ ConcatString & operator<<(ConcatString & a, const ConcatString & b) a.add(b); -return ( a ); +return a; } @@ -757,7 +757,7 @@ std::ostringstream sstream; sstream << k; a.add(sstream.str()); -return ( a ); +return a; } @@ -772,7 +772,7 @@ std::ostringstream sstream; sstream << k; a.add(sstream.str()); -return ( a ); +return a; } @@ -787,7 +787,7 @@ std::ostringstream sstream; sstream << k; a.add(sstream.str()); -return ( a ); +return a; } @@ -806,7 +806,7 @@ sstream << x; a.add(sstream.str()); -return ( a ); +return a; } @@ -831,7 +831,7 @@ switch ( c ) { } // switch -return ( a ); +return a; } @@ -857,7 +857,7 @@ for (j=0; jcompare(*(b.s)); @@ -899,7 +899,7 @@ bool ConcatString::operator==(const char * text) const { -if ( !text || empty() ) return ( false ); +if ( !text || empty() ) return false; int status = s->compare(text); @@ -915,7 +915,7 @@ bool operator==(const char * text, const ConcatString & a) { -if ( !text || !a.text() ) return ( false ); +if ( !text || !a.text() ) return false; int status = strcmp(text, a.text()); @@ -931,7 +931,7 @@ bool operator!=(const ConcatString & a, const ConcatString & b) { -return ( !(a == b) ); +return !(a == b); } @@ -943,7 +943,7 @@ bool operator!=(const ConcatString & a, const char * text) { -return ( !(a == text) ); +return !(a == text); } @@ -955,7 +955,7 @@ bool operator!=(const char * text, const ConcatString & a) { -return ( !(text == a) ); +return !(text == a); } @@ -967,8 +967,8 @@ bool operator>=(const ConcatString & a, const ConcatString & b) { -if ( a.empty() ) return ( false ); -if ( b.empty() ) return ( false ); +if ( a.empty() ) return false; +if ( b.empty() ) return false; int status = strcmp(a.text(), b.text()); @@ -984,7 +984,7 @@ bool operator>=(const ConcatString & a, const char * text) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(a.text(), text); @@ -1000,7 +1000,7 @@ bool operator>=(const char * text, const ConcatString & a) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(text, a.text()); @@ -1016,8 +1016,8 @@ bool operator<=(const ConcatString & a, const ConcatString & b) { -if ( a.empty() ) return ( false ); -if ( b.empty() ) return ( false ); +if ( a.empty() ) return false; +if ( b.empty() ) return false; int status = strcmp(a.text(), b.text()); @@ -1033,7 +1033,7 @@ bool operator<=(const ConcatString & a, const char * text) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(a.text(), text); @@ -1049,7 +1049,7 @@ bool operator<=(const char * text, const ConcatString & a) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(text, a.text()); @@ -1065,8 +1065,8 @@ bool operator>(const ConcatString & a, const ConcatString & b) { -if ( a.empty() ) return ( false ); -if ( b.empty() ) return ( false ); +if ( a.empty() ) return false; +if ( b.empty() ) return false; int status = strcmp(a.text(), b.text()); @@ -1082,7 +1082,7 @@ bool operator>(const ConcatString & a, const char * text) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(a.text(), text); @@ -1098,7 +1098,7 @@ bool operator>(const char * text, const ConcatString & a) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(text, a.text()); @@ -1114,8 +1114,8 @@ bool operator<(const ConcatString & a, const ConcatString & b) { -if ( a.empty() ) return ( false ); -if ( b.empty() ) return ( false ); +if ( a.empty() ) return false; +if ( b.empty() ) return false; int status = strcmp(a.text(), b.text()); @@ -1131,7 +1131,7 @@ bool operator<(const ConcatString & a, const char * text) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(a.text(), text); @@ -1147,7 +1147,7 @@ bool operator<(const char * text, const ConcatString & a) { -if ( a.empty() || !text ) return ( false ); +if ( a.empty() || !text ) return false; int status = strcmp(text, a.text()); @@ -1169,7 +1169,7 @@ for ( int i=0; i 0) { << env_name << " to \"" << env_value << "\"\n"; } -return(true); +return true; } diff --git a/src/basic/vx_log/file_fxns.cc b/src/basic/vx_log/file_fxns.cc index fd0e19938f..66f0fa6de2 100644 --- a/src/basic/vx_log/file_fxns.cc +++ b/src/basic/vx_log/file_fxns.cc @@ -28,7 +28,7 @@ using namespace std; bool is_regular_file(const char *path) { struct stat path_stat; - return(!stat(path, &path_stat) && S_ISREG(path_stat.st_mode)); + return (!stat(path, &path_stat) && S_ISREG(path_stat.st_mode)); } //////////////////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ ConcatString replace_path(const ConcatString path) { s.replace(met_base_str, met_base_val.c_str()); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ ConcatString replace_path(const char * path) { //////////////////////////////////////////////////////////////////////// int met_open(const char *path, int oflag) { - return(open(replace_path(path).c_str(), oflag)); + return open(replace_path(path).c_str(), oflag); } //////////////////////////////////////////////////////////////////////// @@ -89,13 +89,13 @@ void met_open(ofstream &out, const char *path) { //////////////////////////////////////////////////////////////////////// FILE *met_fopen(const char *path, const char *mode) { - return(fopen(replace_path(path).c_str(), mode)); + return fopen(replace_path(path).c_str(), mode); } //////////////////////////////////////////////////////////////////////// DIR *met_opendir(const char *path) { - return(opendir(replace_path(path).c_str())); + return opendir(replace_path(path).c_str()); } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_log/indent.cc b/src/basic/vx_log/indent.cc index ce07dfbe29..46a4846c5a 100644 --- a/src/basic/vx_log/indent.cc +++ b/src/basic/vx_log/indent.cc @@ -72,11 +72,11 @@ Indent & Indent::operator=(const Indent & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -185,7 +185,7 @@ for (j=0; j= n()) ) { } -return ( s[len] ); +return s[len]; } @@ -427,7 +427,7 @@ string StringArray::serialize(const char *sep) const if((it+1) != s.end()) all_s.append(sep); } - return(all_s); + return all_s; } @@ -469,7 +469,7 @@ bool StringArray::has(const std::string text) const found = binary_search(s.begin(), s.end(), text); } else { - return ( has(text, forward) ); + return has(text, forward); } return found; @@ -483,7 +483,7 @@ bool StringArray::has(const std::string text, bool forward) const { int index; - return ( has(text, index, forward) ); + return has(text, index, forward); } //////////////////////////////////////////////////////////////////////// @@ -661,13 +661,13 @@ for (j=0; j= n()) ) { } -return ( s[k].length() ); +return s[k].length(); } @@ -818,7 +818,7 @@ const char ** cb = (const char **) b; status = strcmp(*ca, *cb); -return ( status ); +return status; } diff --git a/src/basic/vx_math/affine.cc b/src/basic/vx_math/affine.cc index c2dcc01cda..66f4fa13e7 100644 --- a/src/basic/vx_math/affine.cc +++ b/src/basic/vx_math/affine.cc @@ -105,11 +105,11 @@ Box & Box::operator=(const Box & b) { -if ( this == &b ) return ( * this ); +if ( this == &b ) return *this; assign(b); -return ( * this ); +return *this; } @@ -209,7 +209,7 @@ double Box::x_to_u(double x) const { -return ( (x - Left)/(Right - Left) ); +return (x - Left)/(Right - Left); } @@ -221,7 +221,7 @@ double Box::y_to_v(double y) const { -return ( (y - Bottom)/(Top - Bottom) ); +return (y - Bottom)/(Top - Bottom); } @@ -400,11 +400,11 @@ Affine & Affine::operator=(const Affine & g) { -if ( this == &g ) return ( * this ); +if ( this == &g ) return *this; assign(g); -return ( * this ); +return *this; } @@ -528,25 +528,25 @@ c = M22*M22 + M12*M12; // diagonal elements (nearly) equal? // -if ( fabs (a - c) > tol ) return ( false ); +if ( fabs (a - c) > tol ) return false; // // off-diagonal elements (nearly) zero? // -if ( fabs(b) > tol ) return ( false ); +if ( fabs(b) > tol ) return false; // // determinant positive? // -if ( Det < 0.0 ) return ( false ); +if ( Det < 0.0 ) return false; // // ok // -return ( true ); +return true; } @@ -750,7 +750,7 @@ GeneralAffine * Affine::copy() const Affine * a = new Affine ( *this ); -return ( a ); +return a; } @@ -842,11 +842,11 @@ ConformalAffine & ConformalAffine::operator=(const ConformalAffine & c) { -if ( this == &c ) return ( * this ); +if ( this == &c ) return *this; assign(c); -return ( * this ); +return *this; } @@ -995,7 +995,7 @@ ConformalAffine ca = *this; ca.invert(); -return ( ca ); +return ca; } @@ -1009,7 +1009,7 @@ GeneralAffine * ConformalAffine::copy() const ConformalAffine * ca = new ConformalAffine ( *this ); -return ( ca ); +return ca; } @@ -1203,7 +1203,7 @@ Affine a; a.set_mb(m11(), m12(), m21(), m22(), tx(), ty()); -return ( a ); +return a; } @@ -1264,7 +1264,7 @@ mag = min(rho, 1.0); mag *= (view_width)/(image_width); -return ( mag ); +return mag; } @@ -1280,7 +1280,7 @@ double mag; mag = calc_mag(image.width(), image.height(), view.width(), view.height()); -return ( mag ); +return mag; } @@ -1304,7 +1304,7 @@ a.forward(b.TX, b.TY, c.TX, c.TY); c.calc_det(); -return ( c ); +return c; } @@ -1331,7 +1331,7 @@ c.set_angle( a.Angle + b.Angle ); a.forward(b.TX, b.TY, c.TX, c.TY); -return ( c ); +return c; } @@ -1363,7 +1363,7 @@ bool bb_intersect(const Box &b1, const Box &b2) { intersect = true; } - return(intersect); + return intersect; } //////////////////////////////////////////////////////////////////////// @@ -1376,7 +1376,7 @@ bool is_inside_bb(const Box &bb, double x, double y) { inside = true; } - return(inside); + return inside; } //////////////////////////////////////////////////////////////////////// @@ -1389,7 +1389,7 @@ bool is_between(double a, double b, double x) { between = true; } - return(between); + return between; } diff --git a/src/basic/vx_math/angles.cc b/src/basic/vx_math/angles.cc index 71044245f5..bd14841c6f 100644 --- a/src/basic/vx_math/angles.cc +++ b/src/basic/vx_math/angles.cc @@ -41,7 +41,7 @@ double new_lon; // Check for bad data -if( is_bad_data(lon) ) return ( bad_data_double ); +if( is_bad_data(lon) ) return bad_data_double; new_lon = lon; @@ -57,7 +57,7 @@ if ( new_lon > 180.0 ) { } -return ( new_lon ); +return new_lon; } @@ -76,7 +76,7 @@ double new_deg; // Check for bad data -if ( is_bad_data(deg) ) return ( bad_data_double ); +if ( is_bad_data(deg) ) return bad_data_double; if ( ! is_eq(fabs(upper - lower), 360.0) || lower > upper ) { @@ -100,7 +100,7 @@ if ( new_deg > upper ) { } -return ( new_deg ); +return new_deg; } @@ -118,7 +118,7 @@ double d, d1, d2; // Check for bad data -if ( is_bad_data(a) || is_bad_data(b) ) return(bad_data_double); +if ( is_bad_data(a) || is_bad_data(b) ) return bad_data_double; // Compute the difference between the angles, and rescale them from // 0 to 360 @@ -129,7 +129,7 @@ d2 = rescale_deg(b - a, 0.0, 360.0); if ( min(d1, d2) < 90.0 ) d = min(d1, d2); else d = max(d1, d2) - 180.0; -return ( d ); +return d; } @@ -149,7 +149,7 @@ double d, a, b; // Check for bad data -if ( is_bad_data(uf) || is_bad_data(vf) || is_bad_data(uo) || is_bad_data(vo) ) return ( bad_data_double ); +if ( is_bad_data(uf) || is_bad_data(vf) || is_bad_data(uo) || is_bad_data(vo) ) return bad_data_double; // Normalize the vectors to unit length @@ -158,7 +158,7 @@ convert_u_v_to_unit(uo, vo); // Check for bad data in the normalized vectors -if ( is_bad_data(uf) || is_bad_data(vf) || is_bad_data(uo) || is_bad_data(vo) ) return ( bad_data_double ); +if ( is_bad_data(uf) || is_bad_data(vf) || is_bad_data(uo) || is_bad_data(vo) ) return bad_data_double; // Compute sums @@ -170,7 +170,7 @@ b = uo*uf + vo*vf; if(is_eq(a, 0.0) && is_eq(b, 0.0)) d = bad_data_double; else d = atan2d(a, b); -return ( d ); +return d; } @@ -192,7 +192,7 @@ else { } -return ( wdir ); +return wdir; } @@ -213,7 +213,7 @@ else { } -return ( wind ); +return wind; } diff --git a/src/basic/vx_math/hist.cc b/src/basic/vx_math/hist.cc index fb3cfa52c6..6ddd0034dc 100644 --- a/src/basic/vx_math/hist.cc +++ b/src/basic/vx_math/hist.cc @@ -78,11 +78,11 @@ Histogram & Histogram::operator=(const Histogram & h) { -if ( this == &h ) return ( * this ); +if ( this == &h ) return *this; assign(h); -return ( * this ); +return *this; } @@ -208,7 +208,7 @@ if ( (k < 0) || (k >= Nbins) ) { } -return ( Count[k] ); +return Count[k]; } @@ -270,7 +270,7 @@ int Histogram::total_bin_count() const { -if ( Nbins == 0 ) return ( 0 ); +if ( Nbins == 0 ) return 0; int j, t; @@ -283,7 +283,7 @@ for (j=0; j 0.3 ) ++a; -return ( a ); +return a; } diff --git a/src/basic/vx_math/nti.cc b/src/basic/vx_math/nti.cc index f89f3aa6a7..2fd4db712b 100644 --- a/src/basic/vx_math/nti.cc +++ b/src/basic/vx_math/nti.cc @@ -32,9 +32,9 @@ int gcdi(int a, int b) a = abs(a); b = abs(b); -if ( a == 0 ) return ( b ); +if ( a == 0 ) return b; -if ( b == 0 ) return ( a ); +if ( b == 0 ) return a; int c; @@ -51,7 +51,7 @@ do { -return ( a ); +return a; } @@ -66,7 +66,7 @@ int lcmi(int a, int b) a = abs(a); b = abs(b); -if ( (a == 0) || (b == 0) ) return ( 0 ); +if ( (a == 0) || (b == 0) ) return 0; int c, d; @@ -76,7 +76,7 @@ d = gcdi(a, b); c = (a/d)*b; -return ( c ); +return c; } diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 31d3152284..dfeda84c14 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -91,7 +91,7 @@ if ( n > 0 ) { } -return ( p ); +return p; } @@ -150,7 +150,7 @@ if ( n > 0 ) { } -return ( p ); +return p; } @@ -166,12 +166,12 @@ const double *a = (const double *) p1; const double *b = (const double *) p2; -if ( (*a) < (*b) ) return ( -1 ); +if ( (*a) < (*b) ) return -1; -if ( (*a) > (*b) ) return ( 1 ); +if ( (*a) > (*b) ) return 1; -return ( 0 ); +return 0; } @@ -187,12 +187,12 @@ const float * a = (const float *) p1; const float * b = (const float *) p2; -if ( (*a) < (*b) ) return ( -1 ); +if ( (*a) < (*b) ) return -1; -if ( (*a) > (*b) ) return ( 1 ); +if ( (*a) > (*b) ) return 1; -return ( 0 ); +return 0; } @@ -211,7 +211,7 @@ int do_rank(const double *array, double *rank, int n) { -if ( n <= 1 ) return(0); +if ( n <= 1 ) return 0; int i, j, ties_current, ties_total, tie_rank_start = 0, tie_rank_end; double tie_rank_mean; @@ -314,11 +314,11 @@ int compare_rank(const void *p1, const void *p2) const RankInfo a = *((RankInfo *) p1); const RankInfo b = *((RankInfo *) p2); -if ( a.data[a.index] < b.data[b.index] ) return ( -1 ); +if ( a.data[a.index] < b.data[b.index] ) return -1; -if ( a.data[a.index] > b.data[b.index] ) return ( 1 ); +if ( a.data[a.index] > b.data[b.index] ) return 1; -return ( 0 ); +return 0; } diff --git a/src/basic/vx_math/pwl.cc b/src/basic/vx_math/pwl.cc index 0622c07312..26cf232dac 100644 --- a/src/basic/vx_math/pwl.cc +++ b/src/basic/vx_math/pwl.cc @@ -83,11 +83,11 @@ PiecewiseLinear & PiecewiseLinear::operator=(const PiecewiseLinear & pl) { -if ( this == &pl ) return ( *this ); +if ( this == &pl ) return *this; assign(pl); -return ( *this ); +return *this; } @@ -234,7 +234,7 @@ if ( k < 0 || k >= X.size() ) { } -return ( X[k] ); +return X[k]; } @@ -254,7 +254,7 @@ if ( k < 0 || k >= Y.size() ) { } -return ( Y[k] ); +return Y[k]; } @@ -283,9 +283,9 @@ double PiecewiseLinear::operator()(double t) const int N = X.size(); -if ( t < X[0] ) return ( Y[0] ); +if ( t < X[0] ) return Y[0]; -if ( t > X[N - 1] ) return ( Y[N - 1] ); +if ( t > X[N - 1] ) return Y[N - 1]; int j; @@ -293,7 +293,7 @@ for (j=0; j<(N - 1); ++j) { if ( (t >= X[j]) && (t <= X[j + 1]) ) { - return ( linear_interpolate(t, X[j], Y[j], X[j + 1], Y[j + 1]) ); + return linear_interpolate(t, X[j], Y[j], X[j + 1], Y[j + 1]); } @@ -335,7 +335,7 @@ m = (y_1 - y_0)/(x_1 - x_0); y = y_0 + (x - x_0)*m; -return ( y ); +return y; } diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc index 9a7034fbcf..ad20fa7543 100644 --- a/src/basic/vx_math/viewgravity_to_string.cc +++ b/src/basic/vx_math/viewgravity_to_string.cc @@ -64,7 +64,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/basic/vx_math/vx_vector.cc b/src/basic/vx_math/vx_vector.cc index 3d9ea15a06..95a380baed 100644 --- a/src/basic/vx_math/vx_vector.cc +++ b/src/basic/vx_math/vx_vector.cc @@ -137,11 +137,11 @@ Vector & Vector::operator=(const Vector &v) { -if ( this == &v ) return ( * this ); +if ( this == &v ) return *this; assign(v); -return ( * this ); +return *this; } @@ -233,7 +233,7 @@ double Vector::abs() const { -return ( sqrt( X*X + Y*Y + Z*Z ) ); +return sqrt( X*X + Y*Y + Z*Z ); } @@ -602,7 +602,7 @@ double t; t = a.abs(); -return ( t ); +return t; } @@ -618,7 +618,7 @@ double t; t = a.abs_squared(); -return ( t ); +return t; } @@ -639,7 +639,7 @@ denom = (a.abs())*(b.abs()); deg = acosd(num/denom); -return ( deg ); +return deg; } @@ -655,7 +655,7 @@ double d; d = (a.x())*(b.x()) + (a.y())*(b.y()) + (a.z())*(b.z()); -return ( d ); +return d; } @@ -676,7 +676,7 @@ zz = (a.x())*(b.y()) - (a.y())*(b.x()); c.set_xyz(xx, yy, zz); -return ( c ); +return c; } @@ -692,7 +692,7 @@ double det; det = dot(cross(a, b), c); -return ( det ); +return det; } @@ -714,7 +714,7 @@ z = cosd(alt); v.set_xyz(x, y, z); -return ( v ); +return v; } @@ -736,7 +736,7 @@ z = 0.0; v.set_xyz(x, y, z); -return ( v ); +return v; } @@ -758,7 +758,7 @@ z = 0.0; v.set_xyz(x, y, z); -return ( v ); +return v; } @@ -782,7 +782,7 @@ z = cosd(lat); v.set_xyz(x, y, z); -return ( v ); +return v; } @@ -801,7 +801,7 @@ bn.normalize(); c = bn*dot(bn, a); -return ( c ); +return c; } @@ -817,7 +817,7 @@ Vector c; c = a - proj_onto(a, b); -return ( c ); +return c; } @@ -838,7 +838,7 @@ z = -(a.z()); c.set_xyz(x, y, z); -return ( c ); +return c; } @@ -859,7 +859,7 @@ z = t*(a.z()); b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -881,7 +881,7 @@ z = t*(a.z()); b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -911,7 +911,7 @@ z = (a.z())/t; b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -942,7 +942,7 @@ z = (a.z())/t; b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -963,7 +963,7 @@ z = t*(a.z()); b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -985,7 +985,7 @@ z = t*(a.z()); b.set_xyz(x, y, z); -return ( b ); +return b; } @@ -1005,7 +1005,7 @@ z = (a.z()) + (b.z()); c.set_xyz(x, y, z); -return ( c ); +return c; } @@ -1026,7 +1026,7 @@ z = (a.z()) - (b.z()); c.set_xyz(x, y, z); -return ( c ); +return c; } @@ -1042,7 +1042,7 @@ Vector v; v.set_latlon(lat, lon); -return ( v ); +return v; } @@ -1097,7 +1097,7 @@ snprintf(junk, sizeof(junk), "%11.8f", v.z()); out << junk << " ]"; -return ( out ); +return out; } @@ -1113,7 +1113,7 @@ Vector b = a; b.normalize(); -return ( b ); +return b; } diff --git a/src/basic/vx_util/ascii_header.cc b/src/basic/vx_util/ascii_header.cc index f9a5228a98..639e50ed66 100644 --- a/src/basic/vx_util/ascii_header.cc +++ b/src/basic/vx_util/ascii_header.cc @@ -69,11 +69,11 @@ AsciiHeaderLine::AsciiHeaderLine(const AsciiHeaderLine &a) { AsciiHeaderLine & AsciiHeaderLine::operator=(const AsciiHeaderLine & a) { - if(this == &a) return(*this); + if(this == &a) return *this; assign(a); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -216,7 +216,7 @@ int AsciiHeaderLine::col_offset(const char *name, const int dim) const { if(!is_var_length()) { // Check for no match - if(!ColNames.has(name, offset)) return(bad_data_int); + if(!ColNames.has(name, offset)) return bad_data_int; } // Handle variable length lines @@ -232,7 +232,7 @@ int AsciiHeaderLine::col_offset(const char *name, const int dim) const { } // Check for no match - if(is_bad_data(match)) return(bad_data_int); + if(is_bad_data(match)) return bad_data_int; // Fixed columns before variable ones if(match < VarBegOffset) { @@ -277,7 +277,7 @@ int AsciiHeaderLine::col_offset(const char *name, const int dim) const { } } // end else - return(offset); + return offset; } //////////////////////////////////////////////////////////////////////// @@ -324,7 +324,7 @@ ConcatString AsciiHeaderLine::col_name(const int offset, int const dim) const { } // end else } - return(name); + return name; } //////////////////////////////////////////////////////////////////////// @@ -363,11 +363,11 @@ AsciiHeader::AsciiHeader(const char *version) { AsciiHeader & AsciiHeader::operator=(const AsciiHeader & a) { - if(this == &a) return(*this); + if(this == &a) return *this; assign(a); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -490,7 +490,7 @@ const AsciiHeaderLine * AsciiHeader::header(const char *version, exit(1); } - return(&(*it)); + return &(*it); } //////////////////////////////////////////////////////////////////////// @@ -500,7 +500,7 @@ int AsciiHeader::col_offset(const char *version, const char *data_type, const int dim) { const AsciiHeaderLine *line = header(version, data_type, line_type); - return(line->col_offset(name, dim)); + return line->col_offset(name, dim); } //////////////////////////////////////////////////////////////////////// @@ -510,7 +510,7 @@ ConcatString AsciiHeader::col_name(const char *version, const char *data_type, const int dim) { const AsciiHeaderLine *line = header(version, data_type, line_type); - return(line->col_name(offset, dim)); + return line->col_name(offset, dim); } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/ascii_table.cc b/src/basic/vx_util/ascii_table.cc index ff70dff926..1783a8b965 100644 --- a/src/basic/vx_util/ascii_table.cc +++ b/src/basic/vx_util/ascii_table.cc @@ -99,11 +99,11 @@ AsciiTable & AsciiTable::operator=(const AsciiTable & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -231,7 +231,7 @@ int n; n = r*Ncols + c; -return ( n ); +return n; } @@ -556,9 +556,9 @@ if ( (col_left < 0) || (col_left >= (Ncols - 1)) ) { } -if ( InterColumnSpace.empty() ) return ( 0 ); +if ( InterColumnSpace.empty() ) return 0; -return ( InterColumnSpace[col_left] ); +return InterColumnSpace[col_left]; } @@ -632,9 +632,9 @@ if ( (row_top < 0) || (row_top >= (Nrows - 1)) ) { } -if ( InterRowSpace.empty() ) return ( 0 ); +if ( InterRowSpace.empty() ) return 0; -return ( InterRowSpace[row_top] ); +return InterRowSpace[row_top]; } @@ -914,7 +914,7 @@ n = rc_to_n(r, c); // "rc_to_n" does range checking on r and c, // so we don't need to do that here -return ( Just[n] ); +return Just[n]; } @@ -1083,7 +1083,7 @@ int n; n = rc_to_n(r, c); // "rc_to_n" does range checking on r and c, // so we don't need to do that here -return ( e[n] ); // might be null +return e[n]; // might be null } @@ -1095,7 +1095,7 @@ int AsciiTable::col_width(int k) const { -if ( e.empty() ) return ( 0 ); +if ( e.empty() ) return 0; if ( (k < 0) || (k >= Ncols) ) { @@ -1105,7 +1105,7 @@ if ( (k < 0) || (k >= Ncols) ) { } -return ( ColWidth[k] ); +return ColWidth[k]; } @@ -1117,7 +1117,7 @@ int AsciiTable::max_col_width() const { -if ( e.empty() ) return ( 0 ); +if ( e.empty() ) return 0; int c, w, k; @@ -1131,7 +1131,7 @@ for (c=0; c " << "output header column " << to_upper(col_name) << " is empty!\n\n"; - return(na_string); + return na_string; } // Check for embedded whitespace @@ -1742,7 +1742,7 @@ ConcatString check_hdr_str(const ConcatString &col_name, exit(1); } - return(cs_tmp); + return cs_tmp; } diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc index 50fbf4387e..d4bd88e02b 100644 --- a/src/basic/vx_util/asciitablejust_to_string.cc +++ b/src/basic/vx_util/asciitablejust_to_string.cc @@ -54,7 +54,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/basic/vx_util/comma_string.cc b/src/basic/vx_util/comma_string.cc index f7702df5f7..3caf47a931 100644 --- a/src/basic/vx_util/comma_string.cc +++ b/src/basic/vx_util/comma_string.cc @@ -77,7 +77,7 @@ ConcatString str; comma_string(i, str); -return ( str ); +return str; } diff --git a/src/basic/vx_util/command_line.cc b/src/basic/vx_util/command_line.cc index 2063d37d51..a4aecdd812 100644 --- a/src/basic/vx_util/command_line.cc +++ b/src/basic/vx_util/command_line.cc @@ -79,11 +79,11 @@ CLOptionInfo & CLOptionInfo::operator=(const CLOptionInfo & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -218,11 +218,11 @@ CLOptionInfoArray & CLOptionInfoArray::operator=(const CLOptionInfoArray & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -437,7 +437,7 @@ if ( (n < 0) || (n >= Nelements) ) { exit ( 1 ); } -return ( e[n] ); +return e[n]; } @@ -454,7 +454,7 @@ ConcatString cs = name; for (j=0; j= 0 ) return ( j ); + if ( option_index >= 0 ) return j; // // option not recognized @@ -804,7 +804,7 @@ for (j=0; j 100.0) rh = 100.0; } - return(rh); + return rh; } //////////////////////////////////////////////////////////////////////// @@ -181,7 +181,7 @@ double gop_by_lat(double lat) { 2.64e-3 * cos(2.0*lat) + 5.90e-10 * cos(2.0*lat) * cos(2.0*lat)); - return(gphi); + return gphi; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/data_line.cc b/src/basic/vx_util/data_line.cc index 0613376ff1..6c871d7a26 100644 --- a/src/basic/vx_util/data_line.cc +++ b/src/basic/vx_util/data_line.cc @@ -90,11 +90,11 @@ DataLine & DataLine::operator=(const DataLine & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -276,7 +276,7 @@ const char * DataLine::operator[](int k) const const char * c = get_item(k); -return ( c ); +return c; } @@ -288,7 +288,7 @@ int DataLine::max_item_width() const { -if ( Line.empty() ) return ( 0 ); +if ( Line.empty() ) return 0; int j, n, w; @@ -303,7 +303,7 @@ for (j=0; jlast_line_number() + 1; -return ( 1 ); +return 1; } @@ -373,7 +373,7 @@ clear(); ifstream & f = *(ldf->in); -if ( !f ) return ( 0 ); +if ( !f ) return 0; File = ldf; @@ -400,7 +400,7 @@ for( i=0; i 0) while ( f.get(c) ) { - if ( !f ) { clear(); return ( 0 ); } + if ( !f ) { clear(); return 0; } if ( c == '\n' ) break; } -if ( !f ) { clear(); return ( 0 ); } +if ( !f ) { clear(); return 0; } N_items = count; LineNumber = ldf->last_line_number() + 1; -return ( 1 ); +return 1; } @@ -484,9 +484,9 @@ bool DataLine::is_ok() const { -if ( N_items == 0 ) return ( false ); +if ( N_items == 0 ) return false; -return ( true ); +return true; } @@ -498,7 +498,7 @@ bool DataLine::is_header() const { -return ( IsHeader ); +return IsHeader; } @@ -522,7 +522,7 @@ bool DataLine::read_single_text_line(LineDataFile * ldf) { -if ( !ldf ) return ( false ); +if ( !ldf ) return false; #ifdef WITH_PYTHON @@ -532,7 +532,7 @@ if ( pldf ) { const bool status = read_py_single_text_line(pldf); - return ( status ); + return status; } @@ -540,7 +540,7 @@ if ( pldf ) { ifstream & f = *(ldf->in); -if ( !f ) return ( false ); +if ( !f ) return false; File = ldf; @@ -549,7 +549,7 @@ char c; while ( f.get(c) ) { - if ( !f ) return ( false ); + if ( !f ) return false; if ( c == '\n' ) { break; } @@ -557,10 +557,10 @@ while ( f.get(c) ) { } -if ( !f ) return ( false ); +if ( !f ) return false; -return ( true ); +return true; } @@ -579,11 +579,11 @@ ConcatString s; status = pldf->next_line(s); -if ( ! status ) return ( false ); +if ( ! status ) return false; Line = s.text(); -return ( true ); +return true; } @@ -697,7 +697,7 @@ met_open((*in), path); if ( !(*in) ) { - return ( 0 ); + return 0; } @@ -716,7 +716,7 @@ ShortFilename.assign(get_short_name(path)); Last_Line_Number = 0; -return ( 1 ); +return 1; } @@ -775,12 +775,12 @@ int LineDataFile::ok() const { -if ( !in ) return ( 0 ); +if ( !in ) return 0; -if ( !(*in) ) return ( 0 ); +if ( !(*in) ) return 0; -return ( 1 ); +return 1; } @@ -798,7 +798,7 @@ do { status = a.read_line(this); - if ( !status ) return ( 0 ); + if ( !status ) return 0; ++Last_Line_Number; @@ -807,7 +807,7 @@ do { } while ( !(a.is_ok()) ); -return ( 1 ); +return 1; } @@ -835,7 +835,7 @@ if ( ok() ) { } -return ( 1 ); +return 1; } @@ -876,14 +876,14 @@ do { status = a.read_fwf_line(this, wdth, n_wdth); - if ( !status ) return ( 0 ); + if ( !status ) return 0; ++Last_Line_Number; } while ( !(a.is_ok()) ); -return ( 1 ); +return 1; } @@ -903,7 +903,7 @@ ostream & operator<<(ostream & out, const DataLine & L) { -if ( L.n_items() == 0 ) return ( out ); +if ( L.n_items() == 0 ) return out; int j; @@ -918,7 +918,7 @@ out.put('\n'); out.flush(); -return ( out ); +return out; } @@ -930,7 +930,7 @@ Logger & operator<<(Logger & lgr, const DataLine & L) { -if ( L.n_items() == 0 ) return ( lgr ); +if ( L.n_items() == 0 ) return lgr; for (int j = 0; j < L.Items.size(); j++) { lgr << L.Items[j]; @@ -941,7 +941,7 @@ for (int j = 0; j < L.Items.size(); j++) { lgr << '\n'; -return ( lgr ); +return lgr; } diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index a46cb4664d..9a96e2358c 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -64,11 +64,11 @@ DataPlane::DataPlane(const DataPlane &d) { DataPlane & DataPlane::operator=(const DataPlane &d) { - if(this == &d) return(*this); + if(this == &d) return *this; assign(d); - return(*this); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -93,7 +93,7 @@ DataPlane & DataPlane::operator+=(const DataPlane &d) { Data[i] = v; } - return(*this); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ DataPlane & DataPlane::operator/=(const double v) { if(!is_bad_data(Data[i])) Data[i] /= v; } - return(*this); + return *this; } bool DataPlane::operator==(const DataPlane &d) const { @@ -451,7 +451,7 @@ int DataPlane::n_good_data() const { if(!is_bad_data(Data[j])) n++; } - return(n); + return n; } /////////////////////////////////////////////////////////////////////////////// @@ -640,7 +640,7 @@ int DataPlane::two_to_one(int x, int y, bool to_north) const { n = (to_north ? y : (Ny-1-y))*Nx + x; // don't change this! lots of downstream code depends on this! - return(n); + return n; } /////////////////////////////////////////////////////////////////////////////// @@ -680,15 +680,15 @@ bool DataPlane::f_is_on(int x, int y) const { // Return true if any corner of that box is non-zero. // - 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; } /////////////////////////////////////////////////////////////////////////////// @@ -734,7 +734,7 @@ MaskPlane DataPlane::mask_plane() const { mp.buf()[i] = (is_bad_data(Data[i]) ? false : !is_eq(Data[i], 0.0)); } - return(mp); + return mp; } /////////////////////////////////////////////////////////////////////////////// @@ -934,7 +934,7 @@ const unsigned int mnw = (Nx + 1)/2; // for (j=0; j= Nplanes) ) { double value = Plane[p]->get(x, y); -return ( value ); +return value; } diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc index 05bcf6736d..c6894ba54b 100644 --- a/src/basic/vx_util/data_plane_util.cc +++ b/src/basic/vx_util/data_plane_util.cc @@ -194,7 +194,7 @@ DataPlane smooth_field(const DataPlane &dp, smooth_field(dp, smooth_dp, mthd, width, shape, wrap_lon, t, gaussian); - return(smooth_dp); + return smooth_dp; } //////////////////////////////////////////////////////////////////////// @@ -495,7 +495,7 @@ DataPlane subtract(const DataPlane &dp1, const DataPlane &dp2) { } } - return(diff); + return diff; } //////////////////////////////////////////////////////////////////////// @@ -525,7 +525,7 @@ DataPlane normal_cdf(const DataPlane &dp, const DataPlane &mn, } } - return(cdf); + return cdf; } //////////////////////////////////////////////////////////////////////// @@ -561,7 +561,7 @@ DataPlane normal_cdf_inv(const double area, const DataPlane &mn, } } - return(cdf_inv); + return cdf_inv; } //////////////////////////////////////////////////////////////////////// @@ -597,7 +597,7 @@ DataPlane gradient(const DataPlane &dp, int dim, int delta) { } } - return(grad_dp); + return grad_dp; } //////////////////////////////////////////////////////////////////////// @@ -728,7 +728,7 @@ DataPlane distance_map(const DataPlane &dp) { // Mask the distance map with bad data values of the input field mask_bad_data(dm, dp); - return(dm); + return dm; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/file_exists.cc b/src/basic/vx_util/file_exists.cc index 9ffcde76fe..3c8831bcf5 100644 --- a/src/basic/vx_util/file_exists.cc +++ b/src/basic/vx_util/file_exists.cc @@ -38,9 +38,9 @@ int status; status = access(path, F_OK); -if ( status == 0 ) return ( true ); +if ( status == 0 ) return true; -return ( false ); +return false; } @@ -60,7 +60,7 @@ if ( empty(path) ) { } -if ( ! file_exists(path) ) return ( false ); +if ( ! file_exists(path) ) return false; struct stat s; @@ -73,9 +73,9 @@ if ( stat(path, &s) < 0 ) { } -if ( S_ISDIR(s.st_mode) ) return ( true ); +if ( S_ISDIR(s.st_mode) ) return true; -return ( false ); +return false; } diff --git a/src/basic/vx_util/file_linecount.cc b/src/basic/vx_util/file_linecount.cc index ad652df68d..f261540817 100644 --- a/src/basic/vx_util/file_linecount.cc +++ b/src/basic/vx_util/file_linecount.cc @@ -60,7 +60,7 @@ while ( in.get(c) ) { in.close(); -return ( count ); +return count; } diff --git a/src/basic/vx_util/file_size.cc b/src/basic/vx_util/file_size.cc index 95f2bccf16..be3c11c793 100644 --- a/src/basic/vx_util/file_size.cc +++ b/src/basic/vx_util/file_size.cc @@ -53,7 +53,7 @@ if ( status < 0 ) { // return the file size in bytes // -return( (long long) sbuf.st_size ); +return (long long) sbuf.st_size; } diff --git a/src/basic/vx_util/filename_suffix.cc b/src/basic/vx_util/filename_suffix.cc index 0e46663cc7..639a7bfc5a 100644 --- a/src/basic/vx_util/filename_suffix.cc +++ b/src/basic/vx_util/filename_suffix.cc @@ -35,7 +35,7 @@ ConcatString filename_suffix(const char * filename, bool make_lowercase) ConcatString suffix; char t; -if ( !filename || !(*filename) ) return ( suffix ); +if ( !filename || !(*filename) ) return suffix; const char * f = get_short_name(filename); // to avoid things like "./foo" @@ -51,7 +51,7 @@ const char * s = f + (m_strlen(f) - 1); while ( (s >= f) && (*s != '.') ) --s; -if ( s < f ) return ( suffix ); +if ( s < f ) return suffix; if ( make_lowercase ) { @@ -68,7 +68,7 @@ if ( make_lowercase ) { // done // -return ( suffix ); +return suffix; } diff --git a/src/basic/vx_util/get_filenames.cc b/src/basic/vx_util/get_filenames.cc index ae633f32f2..089e34788f 100644 --- a/src/basic/vx_util/get_filenames.cc +++ b/src/basic/vx_util/get_filenames.cc @@ -84,7 +84,7 @@ for (j=0; j " << "can't stat \"" << search_dir << "\"\n\n"; - return ( a ); + return a; } @@ -152,7 +152,7 @@ if ( S_ISDIR(sbuf.st_mode) ) { } } -return ( a ); +return a; } @@ -232,7 +232,7 @@ while ( (entry = readdir(directory)) != nullptr ) { closedir(directory); directory = (DIR *) 0; -return ( a ); +return a; } @@ -272,7 +272,7 @@ if ( keep && suffix ) { } -return(keep); +return keep; } diff --git a/src/basic/vx_util/grib_constants.cc b/src/basic/vx_util/grib_constants.cc index 9bf702f209..86d5a31089 100644 --- a/src/basic/vx_util/grib_constants.cc +++ b/src/basic/vx_util/grib_constants.cc @@ -41,7 +41,7 @@ bool is_precip_grib_code(int gc) { gc == apcp_grib_code || gc == ncpcp_grib_code || gc == acpcp_grib_code) match = true; - return(match); + return match; } /////////////////////////////////////////////////////////////////////////////// @@ -63,7 +63,7 @@ bool is_precip_grib_name(const char * grib_name) { 0 == strcmp(grib_name, ncpcp_grib_name) || 0 == strcmp(grib_name, acpcp_grib_name)); - return(match); + return match; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/interp_mthd.cc b/src/basic/vx_util/interp_mthd.cc index 06af350e9e..20d9dd3888 100644 --- a/src/basic/vx_util/interp_mthd.cc +++ b/src/basic/vx_util/interp_mthd.cc @@ -50,7 +50,7 @@ ConcatString interpmthd_to_string(const InterpMthd m) { default: out = interpmthd_none_str; break; } // switch - return(out); + return out; } /////////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ InterpMthd string_to_interpmthd(const char *mthd_str) { else if(strcmp(mthd_str, interpmthd_hira_str) == 0) m = InterpMthd_HiRA; else m = InterpMthd_None; - return(m); + return m; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc index 4858682276..0840c29b6d 100644 --- a/src/basic/vx_util/interp_util.cc +++ b/src/basic/vx_util/interp_util.cc @@ -61,7 +61,7 @@ NumArray interp_points(const DataPlane &dp, const GridTemplate >, double x_dbl y = floor(y_dbl); } - return(interp_points(dp, gt, x, y)); + return interp_points(dp, gt, x, y); } //////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ NumArray interp_points(const DataPlane &dp, const GridTemplate >, int x, int y } } - return(points); + return points; } //////////////////////////////////////////////////////////////////////// @@ -151,7 +151,7 @@ double interp_min_ll(const DataPlane &dp, int x_ll, int y_ll, int wdth, double t min_v = bad_data_double; } - return(min_v); + return min_v; } //////////////////////////////////////////////////////////////////////// @@ -218,7 +218,7 @@ double interp_max_ll(const DataPlane &dp, int x_ll, int y_ll, int wdth, double t max_v = bad_data_double; } - return(max_v); + return max_v; } //////////////////////////////////////////////////////////////////////// @@ -304,7 +304,7 @@ double interp_median_ll(const DataPlane &dp, int x_ll, int y_ll, int wdth, doubl if(data) { delete [] data; data = (double *) 0; } - return(median_v); + return median_v; } //////////////////////////////////////////////////////////////////////// @@ -377,7 +377,7 @@ double interp_uw_mean_ll(const DataPlane &dp, int x_ll, int y_ll, int wdth, doub uw_mean_v = sum/count; } - return(uw_mean_v); + return uw_mean_v; } //////////////////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ double interp_dw_mean(const DataPlane &dp, const GridTemplate >, return bad_data_double; } - return(numerator/wght_sum); + return numerator/wght_sum; } //////////////////////////////////////////////////////////////////////// @@ -533,7 +533,7 @@ double interp_ls_fit(const DataPlane &dp, const GridTemplate >, z = bad_data_double; } - return(z); + return z; } //////////////////////////////////////////////////////////////////////// @@ -624,7 +624,7 @@ double interp_gaussian(const DataPlane &dp, const DataPlane &g_dp, gaussian_value /= weight_sum; } - return(gaussian_value); + return gaussian_value; } //////////////////////////////////////////////////////////////////////// @@ -692,7 +692,7 @@ double interp_geog_match(const DataPlane &dp, const GridTemplate >, << interp_x << ", " << interp_y << ").\n"; } - return(interp_v); + return interp_v; } //////////////////////////////////////////////////////////////////////// @@ -729,7 +729,7 @@ double interp_nbrhd(const DataPlane &dp, const GridTemplate >, int x, int y, return bad_data_double; } - return((double) count_thr/count); + return (double) count_thr/count; } //////////////////////////////////////////////////////////////////////// @@ -756,7 +756,7 @@ double interp_bilin(const DataPlane &dp, bool wrap_lon, if(!(*mp)(x, y ) || !(*mp)(xp1, y ) || !(*mp)(x, y+1) || - !(*mp)(xp1, y+1)) return(bad_data_double); + !(*mp)(xp1, y+1)) return bad_data_double; } // Compute dx and dy @@ -831,7 +831,7 @@ double interp_bilin(const DataPlane &dp, bool wrap_lon, } } - return(bilin_v); + return bilin_v; } //////////////////////////////////////////////////////////////////////// @@ -849,13 +849,13 @@ double interp_xy(const DataPlane &dp, bool wrap_lon, int x, int y, // Check the optional mask if(mp) { - if(!(*mp)(x, y)) return(bad_data_double); + if(!(*mp)(x, y)) return bad_data_double; } if(x < 0 || x >= dp.nx() || y < 0 || y >= dp.ny()) v = bad_data_double; else v = dp.get(x, y); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -897,7 +897,7 @@ double interp_best(const DataPlane &dp, const GridTemplate >, return bad_data_double; } - return(min_v); + return min_v; } //////////////////////////////////////////////////////////////////////// @@ -1024,7 +1024,7 @@ double compute_sfc_interp(const DataPlane &dp, } delete gt; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -1082,7 +1082,7 @@ MaskPlane compute_sfc_mask(const GridTemplate >, int x, int y, mp.put((land_ok & topo_ok), gp->x, gp->y); } - return(mp); + return mp; } //////////////////////////////////////////////////////////////////////// @@ -1097,9 +1097,9 @@ double compute_horz_interp(const DataPlane &dp, const GridTemplateFactory::GridTemplates shape, bool wrap_lon, double interp_thresh, const SingleThresh *cat_thresh) { - return(compute_horz_interp(dp, obs_x, obs_y, obs_v, bad_data_double, + return compute_horz_interp(dp, obs_x, obs_y, obs_v, bad_data_double, bad_data_double, mthd, width, shape, wrap_lon, - interp_thresh, cat_thresh)); + interp_thresh, cat_thresh); } //////////////////////////////////////////////////////////////////////// @@ -1198,7 +1198,7 @@ double compute_horz_interp(const DataPlane &dp, } delete gt; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -1230,7 +1230,7 @@ double compute_vert_pinterp(double v1, double prs1, v_interp = v1 + ((v2-v1)*log(prs1/to_prs)/log(prs1/prs2)); - return(v_interp); + return v_interp; } //////////////////////////////////////////////////////////////////////// @@ -1266,7 +1266,7 @@ double compute_vert_zinterp(double v1, double lvl1, // Linearly interpolate betwen lvl_1 and lvl_2 v_interp = v1*(1.0 - d1/(d1+d2)) + v2*(1.0 - d2/(d1+d2)); - return(v_interp); + return v_interp; } //////////////////////////////////////////////////////////////////////// @@ -1285,7 +1285,7 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, dp2 = (in1.valid() > in2.valid() ? in1 : in2); // Check for matching valid times - if(dp1.valid() == dp2.valid()) return(dp1); + if(dp1.valid() == dp2.valid()) return dp1; // Range check the times if(dp1.valid() > to_ut || dp2.valid() < to_ut) { @@ -1372,7 +1372,7 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, } // end for y } // end for x - return(dp); + return dp; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/is_number.cc b/src/basic/vx_util/is_number.cc index f8f9f59388..0469b7d7c9 100644 --- a/src/basic/vx_util/is_number.cc +++ b/src/basic/vx_util/is_number.cc @@ -58,18 +58,18 @@ int is_number(const char * text) { -if ( !text ) return ( 0 ); +if ( !text ) return 0; -if ( text[0] == 0 ) return ( 0 ); +if ( text[0] == 0 ) return 0; -if ( is_integer(text) ) return ( 1 ); +if ( is_integer(text) ) return 1; -if ( is_float(text) ) return ( 1 ); +if ( is_float(text) ) return 1; -return ( 0 ); +return 0; } @@ -81,25 +81,25 @@ int is_integer(const char * text) { -if ( !text ) return ( 0 ); +if ( !text ) return 0; -if ( text[0] == 0 ) return ( 0 ); +if ( text[0] == 0 ) return 0; if ( is_sign_char(text[0]) ) { - if ( all_digits(text + 1) ) return ( 1 ); + if ( all_digits(text + 1) ) return 1; } else { - if ( all_digits(text) ) return ( 1 ); + if ( all_digits(text) ) return 1; } -return ( 0 ); +return 0; } @@ -111,11 +111,11 @@ int is_float(const char * text) { -if ( !text ) return ( 0 ); +if ( !text ) return 0; const int n = m_strlen(text); -if ( n == 0 ) return ( 0 ); +if ( n == 0 ) return 0; int j; @@ -130,7 +130,7 @@ const char * c = (const char *) 0; for (j=0; j 1 ) return ( 0 ); +if ( dp_count > 1 ) return 0; -return ( 1 ); +return 1; } @@ -229,7 +229,7 @@ char junk[128]; n = m_strlen(text); -if ( (exp_pos == 0) || (exp_pos == (n - 1)) ) return ( 0 ); +if ( (exp_pos == 0) || (exp_pos == (n - 1)) ) return 0; // // grab the mantissa @@ -242,7 +242,7 @@ substring(text, junk, 0, exp_pos - 1); // or a valid integer // -if ( !is_regular_float(junk) && !is_integer(junk) ) return ( 0 ); +if ( !is_regular_float(junk) && !is_integer(junk) ) return 0; // // grab the exponent @@ -254,12 +254,12 @@ substring(text, junk, exp_pos + 1, n - 1); // the exponent must be a valid integer // -if ( !is_integer(junk) ) return ( 0 ); +if ( !is_integer(junk) ) return 0; -return ( 1 ); +return 1; } @@ -271,9 +271,9 @@ int is_digit(const char c) { -if ( (c >= '0') && (c <= '9') ) return ( 1 ); +if ( (c >= '0') && (c <= '9') ) return 1; -return ( 0 ); +return 0; } @@ -285,20 +285,20 @@ int all_digits(const char * text) { -if ( text[0] == 0 ) return ( 0 ); +if ( text[0] == 0 ) return 0; const char * c = text; while ( *c ) { - if ( !(is_digit(*c)) ) return ( 0 ); + if ( !(is_digit(*c)) ) return 0; ++c; } -return ( 1 ); +return 1; } @@ -310,9 +310,9 @@ int is_sign_char(const char c) { -if ( (c == '+') || (c == '-') ) return ( 1 ); +if ( (c == '+') || (c == '-') ) return 1; -return ( 0 ); +return 0; } @@ -329,13 +329,13 @@ int j; for (j=0; j= Nelements) ) { exit ( 1 ); } -return ( e[n] ); +return e[n]; } diff --git a/src/basic/vx_util/make_path.cc b/src/basic/vx_util/make_path.cc index dd639112b6..b1d60feff0 100644 --- a/src/basic/vx_util/make_path.cc +++ b/src/basic/vx_util/make_path.cc @@ -42,7 +42,7 @@ int make_path(const char * path, int mode) { -if ( path_exists(path) ) return ( 1 ); +if ( path_exists(path) ) return 1; int j; int status; @@ -66,7 +66,7 @@ if (subpath) { if ( m_strlen(subpath) == 0 ) { if (subpath) { delete [] subpath; subpath = (char *) 0; } - return ( 0 ); + return 0; } if ( !(path_exists(subpath)) ) { @@ -79,9 +79,9 @@ status = mkdir(path, mode); if (subpath) { delete [] subpath; subpath = (char *) 0; } -if ( status < 0 ) return ( 0 ); +if ( status < 0 ) return 0; -return ( 1 ); +return 1; } @@ -109,7 +109,7 @@ if ( status < 0 ) { } - if ( errno == ENOENT ) return ( 0 ); + if ( errno == ENOENT ) return 0; // // must be some obscure error @@ -124,9 +124,9 @@ if ( status < 0 ) { status = S_ISDIR(sbuf.st_mode); -if ( status ) return ( 1 ); +if ( status ) return 1; -return ( 0 ); +return 0; } diff --git a/src/basic/vx_util/mask_poly.cc b/src/basic/vx_util/mask_poly.cc index e8786ae2d9..57d30dcedb 100644 --- a/src/basic/vx_util/mask_poly.cc +++ b/src/basic/vx_util/mask_poly.cc @@ -87,11 +87,11 @@ MaskPoly & MaskPoly::operator=(const MaskPoly & m) { -if ( this == &m ) return ( * this ); +if ( this == &m ) return *this; assign(m); -return ( * this ); +return *this; } @@ -229,7 +229,7 @@ if ( i < 0 || i >= Npoints ) { // done // -return ( Lat[i] ); +return Lat[i]; } @@ -257,7 +257,7 @@ adj_lon -= 360.0*floor((adj_lon + 180.0)/360.0); // done // -return ( adj_lon ); +return adj_lon; } @@ -520,7 +520,7 @@ for (j=0; j= 0) v = uniq_v[max_j]; else v = bad_data_double; - return(v); + return v; } @@ -912,7 +912,7 @@ double NumArray::min() const { - if(n_elements() == 0) return(bad_data_double); + if(n_elements() == 0) return bad_data_double; int j; @@ -923,7 +923,7 @@ double NumArray::min() const if(e[j] < min_v) min_v = e[j]; } - return(min_v); + return min_v; } @@ -935,7 +935,7 @@ double NumArray::max() const { - if(n_elements() == 0) return(bad_data_double); + if(n_elements() == 0) return bad_data_double; int j; @@ -946,7 +946,7 @@ double NumArray::max() const if(e[j] > max_v) max_v = e[j]; } - return(max_v); + return max_v; } @@ -964,7 +964,7 @@ double NumArray::range() const v2 = min(); v = (is_bad_data(v1) || is_bad_data(v2) ? bad_data_double : v1 - v2); - return(v); + return v; } @@ -982,7 +982,7 @@ int NumArray::n_valid() const if(!is_bad_data(e[j])) n_vld++; } - return(n_vld); + return n_vld; } @@ -996,14 +996,14 @@ ConcatString NumArray::serialize() const ConcatString s; - if(n_elements() == 0) return(s); + if(n_elements() == 0) return s; int j; s << e[0]; for(j=1; j= N ) return ( false ); +if ( index >= N ) return false; s_out = make_data_line(); -return ( true ); +return true; } @@ -612,7 +612,7 @@ bool is_na (PyObject * obj) { -if ( ! PyUnicode_Check(obj) ) return ( false ); +if ( ! PyUnicode_Check(obj) ) return false; // // now we know it's a string, the value had better be "NA" @@ -620,13 +620,13 @@ if ( ! PyUnicode_Check(obj) ) return ( false ); ConcatString s = pyobject_as_concat_string(obj); -if ( strcmp(s.text(), na_string.c_str()) == 0 ) return ( true ); +if ( strcmp(s.text(), na_string.c_str()) == 0 ) return true; // // done // -return ( false ); // control flow should never get here +return false; // control flow should never get here } diff --git a/src/basic/vx_util/read_fortran_binary.cc b/src/basic/vx_util/read_fortran_binary.cc index ae6e771bb4..86213ab2cb 100644 --- a/src/basic/vx_util/read_fortran_binary.cc +++ b/src/basic/vx_util/read_fortran_binary.cc @@ -84,9 +84,9 @@ int bytes; n_read = ::read(fd, local_buf, rec_pad_length); -if ( n_read == 0 ) return ( 0LL ); +if ( n_read == 0 ) return 0LL; -if ( n_read < 0 ) return ( (long long) (-1) ); +if ( n_read < 0 ) return (long long) (-1); if ( swap_endian ) shuffle(local_buf); @@ -149,7 +149,7 @@ if ( rec_size_2 != rec_size_1 ) { // done // -return ( rec_size_1 ); +return rec_size_1; } @@ -191,9 +191,9 @@ long long rec_size_1, rec_size_2; n_read = ::read(fd, local_buf, rec_pad_length); -if ( n_read == 0 ) return ( 0LL ); +if ( n_read == 0 ) return 0LL; -if ( n_read < 0 ) return ( (long long) (-1) ); +if ( n_read < 0 ) return (long long) (-1); if ( swap_endian ) shuffle(local_buf); @@ -272,7 +272,7 @@ if ( rec_size_2 != rec_size_1 ) { // done // -return ( rec_size_1 ); +return rec_size_1; } @@ -299,7 +299,7 @@ if ( rec_pad_length >= (int) sizeof(peek_buf) ) { n_read = read(fd, peek_buf, rec_pad_length); -if ( n_read == 0 ) return ( 0LL ); +if ( n_read == 0 ) return 0LL; switch ( rec_pad_length ) { @@ -335,7 +335,7 @@ if ( lseek(fd, -rec_pad_length, SEEK_CUR) < 0 ) { // done // -return ( size ); +return size; } @@ -368,7 +368,7 @@ if ( rec_pad_length == 4 ) { } -return ( s ); +return s; } @@ -450,7 +450,7 @@ if ( lseek(fd, 0, SEEK_SET) < 0 ) { // nope // -return ( status ); +return status; } @@ -518,7 +518,7 @@ if ( test_pad_len == 4 ) { } -if ( (rec_size_1 + 2*test_pad_len) > ((unsigned long long) file_size) ) return ( false ); +if ( (rec_size_1 + 2*test_pad_len) > ((unsigned long long) file_size) ) return false; // // lseek to the end of this data record @@ -575,7 +575,7 @@ if ( rec_size_1 == rec_size_2 ) status = true; // nope // -return ( status ); +return status; } diff --git a/src/basic/vx_util/smart_buffer.cc b/src/basic/vx_util/smart_buffer.cc index e8dfb9dced..63e277be90 100644 --- a/src/basic/vx_util/smart_buffer.cc +++ b/src/basic/vx_util/smart_buffer.cc @@ -84,11 +84,11 @@ SmartBuffer & SmartBuffer::operator=(const SmartBuffer & b) { -if ( this == &b ) return ( * this ); +if ( this == &b ) return *this; assign(b); -return ( * this ); +return *this; } @@ -206,7 +206,7 @@ n_read = ::read(fd, Buf, bytes); // done // -return ( n_read ); +return n_read; } @@ -236,7 +236,7 @@ n_written = ::write(fd, Buf, bytes); // done // -return ( n_written ); +return n_written; } diff --git a/src/basic/vx_util/string_fxns.cc b/src/basic/vx_util/string_fxns.cc index 3162cc0299..97284fb9bf 100644 --- a/src/basic/vx_util/string_fxns.cc +++ b/src/basic/vx_util/string_fxns.cc @@ -62,7 +62,7 @@ bool match_met_version(const char * check_version) { ConcatString check_major(parse_version_major(check_version)); ConcatString met_major(parse_version_major(met_version)); - return(check_major == met_major); + return (check_major == met_major); } @@ -105,7 +105,7 @@ ConcatString parse_version(const char * version, const int ndots) { cs = s.substr(0, i); - return(cs); + return cs; } @@ -113,7 +113,7 @@ ConcatString parse_version(const char * version, const int ndots) { ConcatString parse_version_major(const char * version) { - return(parse_version(version, 1)); + return parse_version(version, 1); } @@ -121,7 +121,7 @@ ConcatString parse_version_major(const char * version) { ConcatString parse_version_major_minor(const char * version) { - return(parse_version(version, 2)); + return parse_version(version, 2); } @@ -147,7 +147,7 @@ if ( path ) { } -return ( short_name ); +return short_name; } @@ -215,10 +215,10 @@ int num_tokens(const char *test_str, const char *separator) // // Check for an empty string // - if(!test_str) return(0); + if(!test_str) return 0; int buf_len = m_strlen(test_str); - if(buf_len <= 0) return(0); + if(buf_len <= 0) return 0; // // Initialize the temp string for use in tokenizing @@ -235,7 +235,7 @@ int num_tokens(const char *test_str, const char *separator) if(temp_str) { delete [] temp_str; temp_str = (char *) nullptr; } - return(n); + return n; } @@ -262,7 +262,7 @@ bool has_prefix(const char **prefix_list, int n_prefix, } } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -333,7 +333,7 @@ void regex_clean(char** &mat) ConcatString str_replace(const char* data, const char* old, const char* repl){ ConcatString ret; - if(!data) return(ret); + if(!data) return ret; string str = data; size_t pos = str.find( old ); @@ -348,7 +348,7 @@ ConcatString str_replace(const char* data, const char* old, const char* repl){ ConcatString str_replace_all(const char* data, const char* old, const char* repl){ ConcatString ret; - if(!data) return(ret); + if(!data) return ret; string str = data; while( string::npos != str.find(old) ) str = str_replace(str.c_str(), old, repl); @@ -400,7 +400,7 @@ int parse_thresh_index(const char *col_name) { exit(1); } - return(i); + return i; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index eae780063f..f32eca1053 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -54,11 +54,11 @@ ThreshArray::ThreshArray(const ThreshArray & a) { ThreshArray & ThreshArray::operator=(const ThreshArray & a) { - if(this == &a) return(*this); + if(this == &a) return *this; assign(a); - return(* this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -156,14 +156,14 @@ void ThreshArray::extend(int n, bool exact) { bool ThreshArray::operator==(const ThreshArray &ta) const { // Check for the same length - if(Nelements != ta.n()) return(false); + if(Nelements != ta.n()) return false; // Check for equality of individual elements for(int i=0; i tol ) return ( false ); +if ( t > tol ) return false; // // check diagonal elements @@ -504,13 +504,13 @@ if ( t > tol ) return ( false ); t = fabs(M11) + fabs(M22) + fabs(M33) - 3.0; -if ( t > tol ) return ( false ); +if ( t > tol ) return false; // // yup // -return ( true ); +return true; } @@ -641,7 +641,7 @@ bool SO3::is_z_axis() const { -if ( is_identity() ) return ( true ); +if ( is_identity() ) return true; double ax, ay, az; double angle; @@ -677,7 +677,7 @@ bool SO3::is_x_axis() const { -if ( is_identity() ) return ( true ); +if ( is_identity() ) return true; double ax, ay, az; double angle; @@ -713,7 +713,7 @@ bool SO3::is_y_axis() const { -if ( is_identity() ) return ( true ); +if ( is_identity() ) return true; double ax, ay, az; double angle; @@ -784,7 +784,7 @@ switch ( k ) { } -return ( x ); +return x; } @@ -821,7 +821,7 @@ c.M32 = (a.M31)*(b.M12) + (a.M32)*(b.M22) + (a.M33)*(b.M32); c.M33 = (a.M31)*(b.M13) + (a.M32)*(b.M23) + (a.M33)*(b.M33); -return ( c ); +return c; } @@ -852,11 +852,11 @@ int my_signum(double t) { -if ( t > 0.0 ) return ( 1 ); +if ( t > 0.0 ) return 1; -if ( t < 0.0 ) return ( -1 ); +if ( t < 0.0 ) return -1; -return ( 0 ); +return 0; } From 4d60e06abf4e55afde5b5594805ebf507e8fbb33 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 01:33:05 +0000 Subject: [PATCH 10/72] #2673 Removed the redundant parentheses with return --- src/libcode/vx_afm/afm.cc | 54 ++--- src/libcode/vx_afm/afm_keywords.cc | 4 +- src/libcode/vx_afm/afm_line.cc | 36 +-- src/libcode/vx_afm/afm_token.cc | 6 +- src/libcode/vx_afm/afmkeyword_to_string.cc | 2 +- src/libcode/vx_afm/afmtokentype_to_string.cc | 2 +- .../vx_analysis_util/analysis_utils.cc | 6 +- src/libcode/vx_analysis_util/by_case_info.cc | 4 +- src/libcode/vx_analysis_util/mode_atts.cc | 220 +++++++++--------- src/libcode/vx_analysis_util/mode_job.cc | 12 +- src/libcode/vx_analysis_util/mode_line.cc | 194 +++++++-------- src/libcode/vx_analysis_util/stat_job.cc | 130 +++++------ src/libcode/vx_analysis_util/stat_line.cc | 96 ++++---- src/libcode/vx_analysis_util/time_series.cc | 6 +- src/libcode/vx_bool_calc/bool_calc.cc | 2 +- src/libcode/vx_bool_calc/make_program.cc | 4 +- src/libcode/vx_bool_calc/token.cc | 8 +- src/libcode/vx_bool_calc/token_stack.cc | 16 +- src/libcode/vx_bool_calc/tokenizer.cc | 6 +- .../vx_bool_calc/tokentype_to_string.cc | 20 +- src/libcode/vx_color/color.cc | 24 +- src/libcode/vx_color/color_list.cc | 14 +- src/libcode/vx_color/color_table.cc | 58 ++--- src/libcode/vx_color/my_color_scanner.cc | 94 ++++---- src/libcode/vx_data2d/data2d_utils.cc | 12 +- src/libcode/vx_data2d/data_class.cc | 10 +- src/libcode/vx_data2d/level_info.cc | 4 +- src/libcode/vx_data2d/leveltype_to_string.cc | 18 +- src/libcode/vx_data2d/table_lookup.cc | 48 ++-- src/libcode/vx_data2d/var_info.cc | 14 +- .../vx_data2d_factory/data2d_factory.cc | 8 +- .../vx_data2d_factory/data2d_factory_utils.cc | 14 +- src/libcode/vx_data2d_factory/is_bufr_file.cc | 8 +- src/libcode/vx_data2d_factory/is_grib_file.cc | 8 +- .../vx_data2d_factory/parse_file_list.cc | 8 +- .../vx_data2d_factory/var_info_factory.cc | 8 +- src/libcode/vx_data2d_grib/data2d_grib.cc | 34 +-- .../vx_data2d_grib/data2d_grib_utils.cc | 56 ++--- src/libcode/vx_data2d_grib/grib_classes.cc | 80 +++---- src/libcode/vx_data2d_grib/grib_strings.cc | 22 +- src/libcode/vx_data2d_grib/grib_utils.cc | 4 +- src/libcode/vx_data2d_grib/var_info_grib.cc | 8 +- src/libcode/vx_data2d_grib2/data2d_grib2.cc | 6 +- src/libcode/vx_data2d_grib2/var_info_grib2.cc | 4 +- src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc | 12 +- src/libcode/vx_data2d_nc_cf/nc_cf_file.cc | 4 +- src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc | 24 +- src/libcode/vx_data2d_nc_met/data2d_nc_met.cc | 14 +- src/libcode/vx_data2d_nc_met/get_met_grid.cc | 26 +-- src/libcode/vx_data2d_nc_met/met_file.cc | 12 +- .../vx_data2d_nc_met/var_info_nc_met.cc | 24 +- src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc | 10 +- src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc | 14 +- .../vx_data2d_nc_wrf/var_info_nc_wrf.cc | 30 +-- src/libcode/vx_data2d_nc_wrf/wrf_file.cc | 48 ++-- src/libcode/vx_data2d_python/data2d_python.cc | 22 +- .../dataplane_from_numpy_array.cc | 2 +- .../vx_data2d_python/dataplane_from_xarray.cc | 2 +- .../vx_data2d_python/python_dataplane.cc | 22 +- .../vx_data2d_python/var_info_python.cc | 16 +- src/libcode/vx_data2d_ugrid/data2d_ugrid.cc | 14 +- src/libcode/vx_data2d_ugrid/var_info_ugrid.cc | 24 +- src/libcode/vx_geodesy/spheroid.cc | 28 +-- src/libcode/vx_gis/dbf_file.cc | 32 +-- src/libcode/vx_gis/shapetype_to_string.cc | 2 +- src/libcode/vx_gis/shp_file.cc | 24 +- src/libcode/vx_gis/shp_point_record.cc | 4 +- src/libcode/vx_gis/shp_poly_record.cc | 10 +- src/libcode/vx_gnomon/gnomon.cc | 8 +- src/libcode/vx_grid/earth_rotation.cc | 4 +- src/libcode/vx_grid/find_grid_by_name.cc | 38 +-- src/libcode/vx_grid/gaussian_grid.cc | 18 +- src/libcode/vx_grid/goes_grid.cc | 18 +- src/libcode/vx_grid/grid_base.cc | 6 +- src/libcode/vx_grid/latlon_grid.cc | 16 +- src/libcode/vx_grid/lc_grid.cc | 42 ++-- src/libcode/vx_grid/merc_grid.cc | 40 ++-- src/libcode/vx_grid/rot_latlon_grid.cc | 16 +- src/libcode/vx_grid/semilatlon_grid.cc | 18 +- src/libcode/vx_grid/st_grid.cc | 42 ++-- src/libcode/vx_grid/tcrmw_grid.cc | 4 +- src/libcode/vx_grid/unstructured_grid.cc | 2 +- src/libcode/vx_gsl_prob/gsl_bvn.cc | 6 +- src/libcode/vx_gsl_prob/gsl_cdf.cc | 28 +-- src/libcode/vx_gsl_prob/gsl_randist.cc | 6 +- src/libcode/vx_gsl_prob/gsl_statistics.cc | 4 +- src/libcode/vx_gsl_prob/gsl_wavelet2d.cc | 4 +- src/libcode/vx_nav/nav.cc | 20 +- src/libcode/vx_nc_util/nc_utils.cc | 6 +- src/libcode/vx_nc_util/nc_var_info.cc | 12 +- src/libcode/vx_pb_util/do_blocking.cc | 10 +- src/libcode/vx_pb_util/do_unblocking.cc | 4 +- src/libcode/vx_plot_util/map_region.cc | 12 +- src/libcode/vx_plot_util/vx_plot_util.cc | 4 +- .../pointdata_from_array.cc | 18 +- .../vx_pointdata_python/pointdata_python.cc | 2 +- .../vx_pointdata_python/python_pointdata.cc | 16 +- src/libcode/vx_ps/documentmedia_to_string.cc | 2 +- .../vx_ps/documentorientation_to_string.cc | 2 +- src/libcode/vx_ps/fontfamily_to_string.cc | 2 +- src/libcode/vx_ps/ps_text.cc | 14 +- src/libcode/vx_ps/table_helper.cc | 30 +-- src/libcode/vx_ps/vx_ps.cc | 30 +-- src/libcode/vx_pxm/pbm.cc | 28 +-- src/libcode/vx_pxm/pcm.cc | 46 ++-- src/libcode/vx_pxm/pgm.cc | 40 ++-- src/libcode/vx_pxm/ppm.cc | 30 +-- src/libcode/vx_pxm/pxm_base.cc | 6 +- src/libcode/vx_pxm/pxm_utils.cc | 2 +- src/libcode/vx_python3_utils/python3_dict.cc | 12 +- src/libcode/vx_python3_utils/python3_list.cc | 2 +- src/libcode/vx_python3_utils/python3_numpy.cc | 2 +- .../vx_python3_utils/python3_script.cc | 4 +- src/libcode/vx_python3_utils/python3_util.cc | 14 +- src/libcode/vx_regrid/vx_regrid.cc | 12 +- src/libcode/vx_regrid/vx_regrid_budget.cc | 2 +- src/libcode/vx_render/ps_filter.cc | 8 +- src/libcode/vx_render/renderinfo.cc | 6 +- src/libcode/vx_render/uc_queue.cc | 18 +- 119 files changed, 1274 insertions(+), 1274 deletions(-) diff --git a/src/libcode/vx_afm/afm.cc b/src/libcode/vx_afm/afm.cc index e40ac65256..ed39ff5611 100644 --- a/src/libcode/vx_afm/afm.cc +++ b/src/libcode/vx_afm/afm.cc @@ -99,11 +99,11 @@ AfmBBox & AfmBBox::operator=(const AfmBBox & b) { -if ( this == &b ) return ( * this ); +if ( this == &b ) return *this; assign(b); -return ( * this ); +return *this; } @@ -237,11 +237,11 @@ LigatureInfo & LigatureInfo::operator=(const LigatureInfo & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -408,11 +408,11 @@ AfmCharMetrics & AfmCharMetrics::operator=(const AfmCharMetrics & m) { -if ( this == &m ) return ( * this ); +if ( this == &m ) return *this; assign(m); -return ( * this ); +return *this; } @@ -606,11 +606,11 @@ PCC & PCC::operator=(const PCC & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -746,11 +746,11 @@ AfmCompositeInfo & AfmCompositeInfo::operator=(const AfmCompositeInfo & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -910,11 +910,11 @@ KPX & KPX::operator=(const KPX & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -1053,11 +1053,11 @@ Afm & Afm::operator=(const Afm & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -1448,7 +1448,7 @@ delete in; in = (ifstream *) 0; line_number = 0; -return ( 1 ); +return 1; } @@ -2133,13 +2133,13 @@ int j; for (j=0; j 0) && !(model.has(c)) ) return ( 0 ); +if ( (model.n_elements() > 0) && !(model.has(c)) ) return 0; c = L.desc(); -if ( (desc.n_elements() > 0) && !(desc.has(c)) ) return ( 0 ); +if ( (desc.n_elements() > 0) && !(desc.has(c)) ) return 0; c = L.fcst_thr(); -if ( (fcst_thr.n_elements() > 0) && !(fcst_thr.has(c)) ) return ( 0 ); +if ( (fcst_thr.n_elements() > 0) && !(fcst_thr.has(c)) ) return 0; c = L.obs_thr(); -if ( (obs_thr.n_elements() > 0) && !(obs_thr.has(c)) ) return ( 0 ); +if ( (obs_thr.n_elements() > 0) && !(obs_thr.has(c)) ) return 0; c = L.fcst_var(); -if ( (fcst_var.n_elements() > 0) && !(fcst_var.has(c)) ) return ( 0 ); +if ( (fcst_var.n_elements() > 0) && !(fcst_var.has(c)) ) return 0; c = L.fcst_units(); -if ( (fcst_units.n_elements() > 0) && !(fcst_units.has(c)) ) return ( 0 ); +if ( (fcst_units.n_elements() > 0) && !(fcst_units.has(c)) ) return 0; c = L.fcst_lev(); -if ( (fcst_lev.n_elements() > 0) && !(fcst_lev.has(c)) ) return ( 0 ); +if ( (fcst_lev.n_elements() > 0) && !(fcst_lev.has(c)) ) return 0; c = L.obs_var(); -if ( (obs_var.n_elements() > 0) && !(obs_var.has(c)) ) return ( 0 ); +if ( (obs_var.n_elements() > 0) && !(obs_var.has(c)) ) return 0; c = L.obs_units(); -if ( (obs_units.n_elements() > 0) && !(obs_units.has(c)) ) return ( 0 ); +if ( (obs_units.n_elements() > 0) && !(obs_units.has(c)) ) return 0; c = L.obs_lev(); -if ( (obs_lev.n_elements() > 0) && !(obs_lev.has(c)) ) return ( 0 ); +if ( (obs_lev.n_elements() > 0) && !(obs_lev.has(c)) ) return 0; // @@ -1450,43 +1450,43 @@ if ( (obs_lev.n_elements() > 0) && !(obs_lev.has(c)) ) return ( 0 ); i = L.fcst_lead(); -if ( (fcst_lead.n_elements() > 0) && !(fcst_lead.has(i)) ) return ( 0 ); +if ( (fcst_lead.n_elements() > 0) && !(fcst_lead.has(i)) ) return 0; i = L.fcst_valid_hour(); -if ( (fcst_valid_hour.n_elements() > 0) && !(fcst_valid_hour.has(i)) ) return ( 0 ); +if ( (fcst_valid_hour.n_elements() > 0) && !(fcst_valid_hour.has(i)) ) return 0; i = L.fcst_init_hour(); -if ( (fcst_init_hour.n_elements() > 0) && !(fcst_init_hour.has(i)) ) return ( 0 ); +if ( (fcst_init_hour.n_elements() > 0) && !(fcst_init_hour.has(i)) ) return 0; i = L.fcst_accum(); -if ( (fcst_accum.n_elements() > 0) && !(fcst_accum.has(i)) ) return ( 0 ); +if ( (fcst_accum.n_elements() > 0) && !(fcst_accum.has(i)) ) return 0; i = L.obs_lead(); -if ( (obs_lead.n_elements() > 0) && !(obs_lead.has(i)) ) return ( 0 ); +if ( (obs_lead.n_elements() > 0) && !(obs_lead.has(i)) ) return 0; i = L.obs_valid_hour(); -if ( (obs_valid_hour.n_elements() > 0) && !(obs_valid_hour.has(i)) ) return ( 0 ); +if ( (obs_valid_hour.n_elements() > 0) && !(obs_valid_hour.has(i)) ) return 0; i = L.obs_init_hour(); -if ( (obs_init_hour.n_elements() > 0) && !(obs_init_hour.has(i)) ) return ( 0 ); +if ( (obs_init_hour.n_elements() > 0) && !(obs_init_hour.has(i)) ) return 0; i = L.obs_accum(); -if ( (obs_accum.n_elements() > 0) && !(obs_accum.has(i)) ) return ( 0 ); +if ( (obs_accum.n_elements() > 0) && !(obs_accum.has(i)) ) return 0; i = L.fcst_rad(); -if ( (fcst_rad.n_elements() > 0) && !(fcst_rad.has(i)) ) return ( 0 ); +if ( (fcst_rad.n_elements() > 0) && !(fcst_rad.has(i)) ) return 0; i = L.obs_rad(); -if ( (obs_rad.n_elements() > 0) && !(obs_rad.has(i)) ) return ( 0 ); +if ( (obs_rad.n_elements() > 0) && !(obs_rad.has(i)) ) return 0; // @@ -1497,9 +1497,9 @@ if ( fcst_valid_min_set || fcst_valid_max_set ) { t = L.fcst_valid(); - if ( fcst_valid_min_set && (t < fcst_valid_min) ) return ( 0 ); + if ( fcst_valid_min_set && (t < fcst_valid_min) ) return 0; - if ( fcst_valid_max_set && (t > fcst_valid_max) ) return ( 0 ); + if ( fcst_valid_max_set && (t > fcst_valid_max) ) return 0; } @@ -1507,9 +1507,9 @@ if ( obs_valid_min_set || obs_valid_max_set ) { t = L.obs_valid(); - if ( obs_valid_min_set && (t < obs_valid_min) ) return ( 0 ); + if ( obs_valid_min_set && (t < obs_valid_min) ) return 0; - if ( obs_valid_max_set && (t > obs_valid_max) ) return ( 0 ); + if ( obs_valid_max_set && (t > obs_valid_max) ) return 0; } @@ -1517,9 +1517,9 @@ if ( fcst_init_min_set || fcst_init_max_set ) { t = L.fcst_init(); - if ( fcst_init_min_set && (t < fcst_init_min) ) return ( 0 ); + if ( fcst_init_min_set && (t < fcst_init_min) ) return 0; - if ( fcst_init_max_set && (t > fcst_init_max) ) return ( 0 ); + if ( fcst_init_max_set && (t > fcst_init_max) ) return 0; } @@ -1527,9 +1527,9 @@ if ( obs_init_min_set || obs_init_max_set ) { t = L.obs_init(); - if ( obs_init_min_set && (t < obs_init_min) ) return ( 0 ); + if ( obs_init_min_set && (t < obs_init_min) ) return 0; - if ( obs_init_max_set && (t > obs_init_max) ) return ( 0 ); + if ( obs_init_max_set && (t > obs_init_max) ) return 0; } @@ -1542,9 +1542,9 @@ if ( area_min_set || area_max_set ) { i = L.area(); - if ( !is_bad_data( i ) && area_min_set && (i < area_min) ) return ( 0 ); + if ( !is_bad_data( i ) && area_min_set && (i < area_min) ) return 0; - if ( !is_bad_data( i ) && area_max_set && (i > area_max) ) return ( 0 ); + if ( !is_bad_data( i ) && area_max_set && (i > area_max) ) return 0; } @@ -1552,9 +1552,9 @@ if ( area_thresh_min_set || area_thresh_max_set ) { i = L.area_thresh(); - if ( !is_bad_data( i ) && area_thresh_min_set && (i < area_thresh_min) ) return ( 0 ); + if ( !is_bad_data( i ) && area_thresh_min_set && (i < area_thresh_min) ) return 0; - if ( !is_bad_data( i ) && area_thresh_max_set && (i > area_thresh_max) ) return ( 0 ); + if ( !is_bad_data( i ) && area_thresh_max_set && (i > area_thresh_max) ) return 0; } @@ -1562,9 +1562,9 @@ if ( intersection_area_min_set || intersection_area_max_set ) { i = L.intersection_area(); - if ( !is_bad_data( i ) && intersection_area_min_set && (i < intersection_area_min) ) return ( 0 ); + if ( !is_bad_data( i ) && intersection_area_min_set && (i < intersection_area_min) ) return 0; - if ( !is_bad_data( i ) && intersection_area_max_set && (i > intersection_area_max) ) return ( 0 ); + if ( !is_bad_data( i ) && intersection_area_max_set && (i > intersection_area_max) ) return 0; } @@ -1572,9 +1572,9 @@ if ( union_area_min_set || union_area_max_set ) { i = L.union_area(); - if ( !is_bad_data( i ) && union_area_min_set && (i < union_area_min) ) return ( 0 ); + if ( !is_bad_data( i ) && union_area_min_set && (i < union_area_min) ) return 0; - if ( !is_bad_data( i ) && union_area_max_set && (i > union_area_max) ) return ( 0 ); + if ( !is_bad_data( i ) && union_area_max_set && (i > union_area_max) ) return 0; } @@ -1582,9 +1582,9 @@ if ( symmetric_diff_min_set || symmetric_diff_max_set ) { i = L.symmetric_diff(); - if ( !is_bad_data( i ) && symmetric_diff_min_set && (i < symmetric_diff_min) ) return ( 0 ); + if ( !is_bad_data( i ) && symmetric_diff_min_set && (i < symmetric_diff_min) ) return 0; - if ( !is_bad_data( i ) && symmetric_diff_max_set && (i > symmetric_diff_max) ) return ( 0 ); + if ( !is_bad_data( i ) && symmetric_diff_max_set && (i > symmetric_diff_max) ) return 0; } @@ -1597,9 +1597,9 @@ if ( centroid_x_min_set || centroid_x_max_set ) { x = L.centroid_x(); - if ( !is_bad_data( x ) && centroid_x_min_set && (x < centroid_x_min) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_x_min_set && (x < centroid_x_min) ) return 0; - if ( !is_bad_data( x ) && centroid_x_max_set && (x > centroid_x_max) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_x_max_set && (x > centroid_x_max) ) return 0; } @@ -1607,9 +1607,9 @@ if ( centroid_y_min_set || centroid_y_max_set ) { x = L.centroid_y(); - if ( !is_bad_data( x ) && centroid_y_min_set && (x < centroid_y_min) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_y_min_set && (x < centroid_y_min) ) return 0; - if ( !is_bad_data( x ) && centroid_y_max_set && (x > centroid_y_max) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_y_max_set && (x > centroid_y_max) ) return 0; } @@ -1617,9 +1617,9 @@ if ( centroid_lat_min_set || centroid_lat_max_set ) { x = L.centroid_lat(); - if ( !is_bad_data( x ) && centroid_lat_min_set && (x < centroid_lat_min) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_lat_min_set && (x < centroid_lat_min) ) return 0; - if ( !is_bad_data( x ) && centroid_lat_max_set && (x > centroid_lat_max) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_lat_max_set && (x > centroid_lat_max) ) return 0; } @@ -1627,9 +1627,9 @@ if ( centroid_lon_min_set || centroid_lon_max_set ) { x = L.centroid_lon(); - if ( !is_bad_data( x ) && centroid_lon_min_set && (x < centroid_lon_min) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_lon_min_set && (x < centroid_lon_min) ) return 0; - if ( !is_bad_data( x ) && centroid_lon_max_set && (x > centroid_lon_max) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_lon_max_set && (x > centroid_lon_max) ) return 0; } @@ -1637,9 +1637,9 @@ if ( axis_ang_min_set || axis_ang_max_set ) { x = L.axis_ang(); - if ( !is_bad_data( x ) && axis_ang_min_set && (x < axis_ang_min) ) return ( 0 ); + if ( !is_bad_data( x ) && axis_ang_min_set && (x < axis_ang_min) ) return 0; - if ( !is_bad_data( x ) && axis_ang_max_set && (x > axis_ang_max) ) return ( 0 ); + if ( !is_bad_data( x ) && axis_ang_max_set && (x > axis_ang_max) ) return 0; } @@ -1647,9 +1647,9 @@ if ( length_min_set || length_max_set ) { x = L.length(); - if ( !is_bad_data( x ) && length_min_set && (x < length_min) ) return ( 0 ); + if ( !is_bad_data( x ) && length_min_set && (x < length_min) ) return 0; - if ( !is_bad_data( x ) && length_max_set && (x > length_max) ) return ( 0 ); + if ( !is_bad_data( x ) && length_max_set && (x > length_max) ) return 0; } @@ -1657,9 +1657,9 @@ if ( width_min_set || width_max_set ) { x = L.width(); - if ( !is_bad_data( x ) && width_min_set && (x < width_min) ) return ( 0 ); + if ( !is_bad_data( x ) && width_min_set && (x < width_min) ) return 0; - if ( !is_bad_data( x ) && width_max_set && (x > width_max) ) return ( 0 ); + if ( !is_bad_data( x ) && width_max_set && (x > width_max) ) return 0; } @@ -1667,9 +1667,9 @@ if ( aspect_ratio_min_set || aspect_ratio_max_set ) { x = L.aspect_ratio(); - if ( !is_bad_data( x ) && aspect_ratio_min_set && (x < aspect_ratio_min) ) return ( 0 ); + if ( !is_bad_data( x ) && aspect_ratio_min_set && (x < aspect_ratio_min) ) return 0; - if ( !is_bad_data( x ) && aspect_ratio_max_set && (x > aspect_ratio_max) ) return ( 0 ); + if ( !is_bad_data( x ) && aspect_ratio_max_set && (x > aspect_ratio_max) ) return 0; } @@ -1677,9 +1677,9 @@ if ( curvature_min_set || curvature_max_set ) { x = L.curvature(); - if ( !is_bad_data( x ) && curvature_min_set && (x < curvature_min) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_min_set && (x < curvature_min) ) return 0; - if ( !is_bad_data( x ) && curvature_max_set && (x > curvature_max) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_max_set && (x > curvature_max) ) return 0; } @@ -1687,9 +1687,9 @@ if ( curvature_x_min_set || curvature_x_max_set ) { x = L.curvature_x(); - if ( !is_bad_data( x ) && curvature_x_min_set && (x < curvature_x_min) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_x_min_set && (x < curvature_x_min) ) return 0; - if ( !is_bad_data( x ) && curvature_x_max_set && (x > curvature_x_max) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_x_max_set && (x > curvature_x_max) ) return 0; } @@ -1697,9 +1697,9 @@ if ( curvature_y_min_set || curvature_y_max_set ) { x = L.curvature_y(); - if ( !is_bad_data( x ) && curvature_y_min_set && (x < curvature_y_min) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_y_min_set && (x < curvature_y_min) ) return 0; - if ( !is_bad_data( x ) && curvature_y_max_set && (x > curvature_y_max) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_y_max_set && (x > curvature_y_max) ) return 0; } @@ -1707,9 +1707,9 @@ if ( complexity_min_set || complexity_max_set ) { x = L.complexity(); - if ( !is_bad_data( x ) && complexity_min_set && (x < complexity_min) ) return ( 0 ); + if ( !is_bad_data( x ) && complexity_min_set && (x < complexity_min) ) return 0; - if ( !is_bad_data( x ) && complexity_max_set && (x > complexity_max) ) return ( 0 ); + if ( !is_bad_data( x ) && complexity_max_set && (x > complexity_max) ) return 0; } @@ -1717,9 +1717,9 @@ if ( intensity_10_min_set || intensity_10_max_set ) { x = L.intensity_10(); - if ( !is_bad_data( x ) && intensity_10_min_set && (x < intensity_10_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_10_min_set && (x < intensity_10_min) ) return 0; - if ( !is_bad_data( x ) && intensity_10_max_set && (x > intensity_10_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_10_max_set && (x > intensity_10_max) ) return 0; } @@ -1727,9 +1727,9 @@ if ( intensity_25_min_set || intensity_25_max_set ) { x = L.intensity_25(); - if ( !is_bad_data( x ) && intensity_25_min_set && (x < intensity_25_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_25_min_set && (x < intensity_25_min) ) return 0; - if ( !is_bad_data( x ) && intensity_25_max_set && (x > intensity_25_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_25_max_set && (x > intensity_25_max) ) return 0; } @@ -1737,9 +1737,9 @@ if ( intensity_50_min_set || intensity_50_max_set ) { x = L.intensity_50(); - if ( !is_bad_data( x ) && intensity_50_min_set && (x < intensity_50_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_50_min_set && (x < intensity_50_min) ) return 0; - if ( !is_bad_data( x ) && intensity_50_max_set && (x > intensity_50_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_50_max_set && (x > intensity_50_max) ) return 0; } @@ -1747,9 +1747,9 @@ if ( intensity_75_min_set || intensity_75_max_set ) { x = L.intensity_75(); - if ( !is_bad_data( x ) && intensity_75_min_set && (x < intensity_75_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_75_min_set && (x < intensity_75_min) ) return 0; - if ( !is_bad_data( x ) && intensity_75_max_set && (x > intensity_75_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_75_max_set && (x > intensity_75_max) ) return 0; } @@ -1757,9 +1757,9 @@ if ( intensity_90_min_set || intensity_90_max_set ) { x = L.intensity_90(); - if ( !is_bad_data( x ) && intensity_90_min_set && (x < intensity_90_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_90_min_set && (x < intensity_90_min) ) return 0; - if ( !is_bad_data( x ) && intensity_90_max_set && (x > intensity_90_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_90_max_set && (x > intensity_90_max) ) return 0; } @@ -1767,9 +1767,9 @@ if ( intensity_user_min_set || intensity_user_max_set ) { x = L.intensity_user(); - if ( !is_bad_data( x ) && intensity_user_min_set && (x < intensity_user_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_user_min_set && (x < intensity_user_min) ) return 0; - if ( !is_bad_data( x ) && intensity_user_max_set && (x > intensity_user_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_user_max_set && (x > intensity_user_max) ) return 0; } @@ -1777,9 +1777,9 @@ if ( intensity_sum_min_set || intensity_sum_max_set ) { x = L.intensity_sum(); - if ( !is_bad_data( x ) && intensity_sum_min_set && (x < intensity_sum_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_sum_min_set && (x < intensity_sum_min) ) return 0; - if ( !is_bad_data( x ) && intensity_sum_max_set && (x > intensity_sum_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intensity_sum_max_set && (x > intensity_sum_max) ) return 0; } @@ -1787,9 +1787,9 @@ if ( centroid_dist_min_set || centroid_dist_max_set ) { x = L.centroid_dist(); - if ( !is_bad_data( x ) && centroid_dist_min_set && (x < centroid_dist_min) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_dist_min_set && (x < centroid_dist_min) ) return 0; - if ( !is_bad_data( x ) && centroid_dist_max_set && (x > centroid_dist_max) ) return ( 0 ); + if ( !is_bad_data( x ) && centroid_dist_max_set && (x > centroid_dist_max) ) return 0; } @@ -1797,9 +1797,9 @@ if ( boundary_dist_min_set || boundary_dist_max_set ) { x = L.boundary_dist(); - if ( !is_bad_data( x ) && boundary_dist_min_set && (x < boundary_dist_min) ) return ( 0 ); + if ( !is_bad_data( x ) && boundary_dist_min_set && (x < boundary_dist_min) ) return 0; - if ( !is_bad_data( x ) && boundary_dist_max_set && (x > boundary_dist_max) ) return ( 0 ); + if ( !is_bad_data( x ) && boundary_dist_max_set && (x > boundary_dist_max) ) return 0; } @@ -1807,9 +1807,9 @@ if ( convex_hull_dist_min_set || convex_hull_dist_max_set ) { x = L.convex_hull_dist(); - if ( !is_bad_data( x ) && convex_hull_dist_min_set && (x < convex_hull_dist_min) ) return ( 0 ); + if ( !is_bad_data( x ) && convex_hull_dist_min_set && (x < convex_hull_dist_min) ) return 0; - if ( !is_bad_data( x ) && convex_hull_dist_max_set && (x > convex_hull_dist_max) ) return ( 0 ); + if ( !is_bad_data( x ) && convex_hull_dist_max_set && (x > convex_hull_dist_max) ) return 0; } @@ -1817,9 +1817,9 @@ if ( angle_diff_min_set || angle_diff_max_set ) { x = L.angle_diff(); - if ( !is_bad_data( x ) && angle_diff_min_set && (x < angle_diff_min) ) return ( 0 ); + if ( !is_bad_data( x ) && angle_diff_min_set && (x < angle_diff_min) ) return 0; - if ( !is_bad_data( x ) && angle_diff_max_set && (x > angle_diff_max) ) return ( 0 ); + if ( !is_bad_data( x ) && angle_diff_max_set && (x > angle_diff_max) ) return 0; } @@ -1827,9 +1827,9 @@ if ( aspect_diff_min_set || aspect_diff_max_set ) { x = L.aspect_diff(); - if ( !is_bad_data( x ) && aspect_diff_min_set && (x < aspect_diff_min) ) return ( 0 ); + if ( !is_bad_data( x ) && aspect_diff_min_set && (x < aspect_diff_min) ) return 0; - if ( !is_bad_data( x ) && aspect_diff_max_set && (x > aspect_diff_max) ) return ( 0 ); + if ( !is_bad_data( x ) && aspect_diff_max_set && (x > aspect_diff_max) ) return 0; } @@ -1837,9 +1837,9 @@ if ( area_ratio_min_set || area_ratio_max_set ) { x = L.area_ratio(); - if ( !is_bad_data( x ) && area_ratio_min_set && (x < area_ratio_min) ) return ( 0 ); + if ( !is_bad_data( x ) && area_ratio_min_set && (x < area_ratio_min) ) return 0; - if ( !is_bad_data( x ) && area_ratio_max_set && (x > area_ratio_max) ) return ( 0 ); + if ( !is_bad_data( x ) && area_ratio_max_set && (x > area_ratio_max) ) return 0; } @@ -1847,9 +1847,9 @@ if ( intersection_over_area_min_set || intersection_over_area_max_set ) { x = L.intersection_over_area(); - if ( !is_bad_data( x ) && intersection_over_area_min_set && (x < intersection_over_area_min) ) return ( 0 ); + if ( !is_bad_data( x ) && intersection_over_area_min_set && (x < intersection_over_area_min) ) return 0; - if ( !is_bad_data( x ) && intersection_over_area_max_set && (x > intersection_over_area_max) ) return ( 0 ); + if ( !is_bad_data( x ) && intersection_over_area_max_set && (x > intersection_over_area_max) ) return 0; } @@ -1857,9 +1857,9 @@ if ( curvature_ratio_min_set || curvature_ratio_max_set ) { x = L.curvature_ratio(); - if ( !is_bad_data( x ) && curvature_ratio_min_set && (x < curvature_ratio_min) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_ratio_min_set && (x < curvature_ratio_min) ) return 0; - if ( !is_bad_data( x ) && curvature_ratio_max_set && (x > curvature_ratio_max) ) return ( 0 ); + if ( !is_bad_data( x ) && curvature_ratio_max_set && (x > curvature_ratio_max) ) return 0; } @@ -1867,9 +1867,9 @@ if ( complexity_ratio_min_set || complexity_ratio_max_set ) { x = L.complexity_ratio(); - if ( !is_bad_data( x ) && complexity_ratio_min_set && (x < complexity_ratio_min) ) return ( 0 ); + if ( !is_bad_data( x ) && complexity_ratio_min_set && (x < complexity_ratio_min) ) return 0; - if ( !is_bad_data( x ) && complexity_ratio_max_set && (x > complexity_ratio_max) ) return ( 0 ); + if ( !is_bad_data( x ) && complexity_ratio_max_set && (x > complexity_ratio_max) ) return 0; } @@ -1877,9 +1877,9 @@ if ( percentile_intensity_ratio_min_set || percentile_intensity_ratio_max_set ) x = L.percentile_intensity_ratio(); - if ( !is_bad_data( x ) && percentile_intensity_ratio_min_set && (x < percentile_intensity_ratio_min) ) return ( 0 ); + if ( !is_bad_data( x ) && percentile_intensity_ratio_min_set && (x < percentile_intensity_ratio_min) ) return 0; - if ( !is_bad_data( x ) && percentile_intensity_ratio_max_set && (x > percentile_intensity_ratio_max) ) return ( 0 ); + if ( !is_bad_data( x ) && percentile_intensity_ratio_max_set && (x > percentile_intensity_ratio_max) ) return 0; } @@ -1887,9 +1887,9 @@ if ( interest_min_set || interest_max_set ) { x = L.interest(); - if ( !is_bad_data( x ) && interest_min_set && (x < interest_min) ) return ( 0 ); + if ( !is_bad_data( x ) && interest_min_set && (x < interest_min) ) return 0; - if ( !is_bad_data( x ) && interest_max_set && (x > interest_max) ) return ( 0 ); + if ( !is_bad_data( x ) && interest_max_set && (x > interest_max) ) return 0; } @@ -1900,7 +1900,7 @@ if ( interest_min_set || interest_max_set ) { if ( poly ) { - if ( !(poly->latlon_is_inside_dege(L.centroid_lat(), L.centroid_lon())) ) return ( 0 ); + if ( !(poly->latlon_is_inside_dege(L.centroid_lat(), L.centroid_lon())) ) return 0; } @@ -1910,7 +1910,7 @@ if ( poly ) { // ok, already // -return ( 1 ); +return 1; } diff --git a/src/libcode/vx_analysis_util/mode_job.cc b/src/libcode/vx_analysis_util/mode_job.cc index b2e0b1339f..cc291eb511 100644 --- a/src/libcode/vx_analysis_util/mode_job.cc +++ b/src/libcode/vx_analysis_util/mode_job.cc @@ -91,11 +91,11 @@ BasicModeAnalysisJob & BasicModeAnalysisJob::operator=(const BasicModeAnalysisJo { -if ( this == &aj ) return ( * this ); +if ( this == &aj ) return *this; assign_basic_job(aj); -return ( * this ); +return *this; } @@ -412,11 +412,11 @@ SummaryJob & SummaryJob::operator=(const SummaryJob & job) { -if ( this == &job ) return ( * this ); +if ( this == &job ) return *this; assign(job); -return ( * this ); +return *this; } @@ -740,11 +740,11 @@ ByCaseJob & ByCaseJob::operator=(const ByCaseJob & job) { -if ( this == &job ) return ( * this ); +if ( this == &job ) return *this; assign(job); -return ( * this ); +return *this; } diff --git a/src/libcode/vx_analysis_util/mode_line.cc b/src/libcode/vx_analysis_util/mode_line.cc index 5a7319565f..ef758dad20 100644 --- a/src/libcode/vx_analysis_util/mode_line.cc +++ b/src/libcode/vx_analysis_util/mode_line.cc @@ -87,11 +87,11 @@ ModeLine & ModeLine::operator=(const ModeLine & L) { -if ( this == &L ) return ( * this ); +if ( this == &L ) return *this; assign(L); -return ( * this ); +return *this; } @@ -219,7 +219,7 @@ if ( !status || n_items() == 0 ) { clear(); - return ( 0 ); + return 0; } @@ -231,7 +231,7 @@ if ( strcmp(get_item(0), "VERSION") == 0 ) { HdrFlag = true; - return ( 1 ); + return 1; } // @@ -240,7 +240,7 @@ if ( strcmp(get_item(0), "VERSION") == 0 ) { HdrLine = METHdrTable.header(get_item(0), "MODE", "OBJ"); -return ( 1 ); +return 1; } @@ -252,7 +252,7 @@ bool ModeLine::is_ok() const { -return ( DataLine::is_ok() ); +return DataLine::is_ok(); } @@ -264,7 +264,7 @@ bool ModeLine::is_header() const { -return ( HdrFlag ); +return HdrFlag; } @@ -296,8 +296,8 @@ if ( is_bad_data(offset) ) { // Return bad data string for no match // -if ( is_bad_data(offset) ) return ( bad_data_str ); -else return ( get_item(offset, check_na) ); +if ( is_bad_data(offset) ) return bad_data_str; +else return get_item(offset, check_na); } @@ -313,7 +313,7 @@ const char * ModeLine::get_item(int offset, bool check_na) const // Range check // -if ( offset < 0 || offset >= N_items ) return ( bad_data_str ); +if ( offset < 0 || offset >= N_items ) return bad_data_str; const char * c = DataLine::get_item(offset); @@ -321,8 +321,8 @@ const char * c = DataLine::get_item(offset); // Check for the NA string and interpret it as bad data // -if ( check_na && strcmp(c, na_str) == 0 ) return ( bad_data_str ); -else return ( c ); +if ( check_na && strcmp(c, na_str) == 0 ) return bad_data_str; +else return c; } @@ -336,7 +336,7 @@ const char * ModeLine::version() const const char * c = get_item("VERSION", false); -return ( c ); +return c; } @@ -350,7 +350,7 @@ const char * ModeLine::model() const const char * c = get_item("MODEL", false); -return ( c ); +return c; } @@ -364,7 +364,7 @@ const char * ModeLine::desc() const const char * c = get_item("DESC", false); -return ( c ); +return c; } @@ -382,7 +382,7 @@ const char * c = get_item("FCST_LEAD"); s = timestring_to_sec(c); -return ( s ); +return s; } @@ -400,7 +400,7 @@ const char * c = get_item("FCST_VALID"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -412,7 +412,7 @@ int ModeLine::fcst_valid_hour() const { -return ( unix_to_sec_of_day(fcst_valid()) ); +return unix_to_sec_of_day(fcst_valid()); } @@ -448,7 +448,7 @@ int ModeLine::fcst_init_hour() const { -return ( unix_to_sec_of_day(fcst_init()) ); +return unix_to_sec_of_day(fcst_init()); } @@ -466,7 +466,7 @@ const char * c = get_item("FCST_ACCUM"); s = timestring_to_sec(c); -return ( s ); +return s; } @@ -484,7 +484,7 @@ const char * c = get_item("OBS_LEAD"); s = timestring_to_sec(c); -return ( s ); +return s; } @@ -502,7 +502,7 @@ const char * c = get_item("OBS_VALID"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -514,7 +514,7 @@ int ModeLine::obs_valid_hour() const { -return ( unix_to_sec_of_day(obs_valid()) ); +return unix_to_sec_of_day(obs_valid()); } @@ -550,7 +550,7 @@ int ModeLine::obs_init_hour() const { -return ( unix_to_sec_of_day(obs_init()) ); +return unix_to_sec_of_day(obs_init()); } @@ -568,7 +568,7 @@ const char * c = get_item("OBS_ACCUM"); s = timestring_to_sec(c); -return ( s ); +return s; } @@ -586,7 +586,7 @@ const char * c = get_item("FCST_RAD"); i = atoi(c); -return ( i ); +return i; } @@ -600,7 +600,7 @@ const char * ModeLine::fcst_thr() const const char * c = get_item("FCST_THR", false); -return ( c ); +return c; } @@ -618,7 +618,7 @@ const char * c = get_item("OBS_RAD"); i = atoi(c); -return ( i ); +return i; } @@ -632,7 +632,7 @@ const char * ModeLine::obs_thr() const const char * c = get_item("OBS_THR", false); -return ( c ); +return c; } @@ -646,7 +646,7 @@ const char * ModeLine::fcst_var() const const char * c = get_item("FCST_VAR", false); -return ( c ); +return c; } @@ -660,7 +660,7 @@ const char * ModeLine::fcst_units() const const char * c = get_item("FCST_UNITS", false); -return ( c ); +return c; } @@ -674,7 +674,7 @@ const char * ModeLine::fcst_lev() const const char * c = get_item("FCST_LEV", false); -return ( c ); +return c; } @@ -688,7 +688,7 @@ const char * ModeLine::obs_var() const const char * c = get_item("OBS_VAR", false); -return ( c ); +return c; } @@ -702,7 +702,7 @@ const char * ModeLine::obs_units() const const char * c = get_item("OBS_UNITS", false); -return ( c ); +return c; } @@ -716,7 +716,7 @@ const char * ModeLine::obs_lev() const const char * c = get_item("OBS_LEV", false); -return ( c ); +return c; } @@ -732,7 +732,7 @@ const char * ModeLine::object_id() const const char * c = get_item("OBJECT_ID", false); -return ( c ); +return c; } @@ -748,7 +748,7 @@ const char * ModeLine::object_cat() const const char * c = get_item("OBJECT_CAT", false); -return ( c ); +return c; } @@ -764,7 +764,7 @@ int ModeLine::is_fcst() const // has to be a single object, not a pair // -if ( is_pair() ) return ( 0 ); +if ( is_pair() ) return 0; // // look for an "F" or "CF" at the start of the OBJECT_ID field @@ -774,11 +774,11 @@ if ( is_pair() ) return ( 0 ); const char * c = object_id(); -if ( c[0] == 'F' ) return ( 1 ); +if ( c[0] == 'F' ) return 1; -if ( strncmp(c, "CF", 2) == 0 ) return ( 1 ); +if ( strncmp(c, "CF", 2) == 0 ) return 1; -return ( 0 ); +return 0; } @@ -794,7 +794,7 @@ int ModeLine::is_obs() const // has to be a single object, not a pair // -if ( is_pair() ) return ( 0 ); +if ( is_pair() ) return 0; // // look for an "O" or "CO" at the start of the OBJECT_ID field @@ -804,15 +804,15 @@ if ( is_pair() ) return ( 0 ); const char * c = object_id(); -if ( c[0] == 'O' ) return ( 1 ); +if ( c[0] == 'O' ) return 1; -if ( strncmp(c, "CO", 2) == 0 ) return ( 1 ); +if ( strncmp(c, "CO", 2) == 0 ) return 1; // // nope // -return ( 0 ); +return 0; } @@ -832,9 +832,9 @@ int ModeLine::is_single() const const char * c = object_id(); -if ( strchr(c, '_') ) return ( 0 ); +if ( strchr(c, '_') ) return 0; -return ( 1 ); +return 1; } @@ -850,7 +850,7 @@ int status; status = is_single(); -return ( !status ); +return !status; } @@ -870,9 +870,9 @@ int ModeLine::is_simple() const const char * c = object_id(); -if ( c[0] == 'C' ) return ( 0 ); +if ( c[0] == 'C' ) return 0; -return ( 1 ); +return 1; } @@ -888,7 +888,7 @@ int status; status = is_simple(); -return ( !status ); +return !status; } @@ -904,7 +904,7 @@ int ModeLine::is_matched() const // has to be a single object (not a pair) // -if ( is_pair() ) return ( 0 ); +if ( is_pair() ) return 0; // // look for a number > 0 in the OBJECT_CAT field @@ -917,9 +917,9 @@ const char * c = object_cat(); k = atoi(c + 2); // skip the leading "CF" or "CO" in the OBJECT_CAT field -if ( k > 0 ) return ( 1 ); +if ( k > 0 ) return 1; -return ( 0 ); +return 0; } @@ -935,7 +935,7 @@ int status; status = is_matched(); -return ( !status ); +return !status; } @@ -947,8 +947,8 @@ int ModeLine::simple_obj_number() const { -if ( !is_single() ) return ( -1 ); -if ( !is_simple() ) return ( -1 ); +if ( !is_single() ) return -1; +if ( !is_simple() ) return -1; int k; @@ -959,7 +959,7 @@ k = atoi(c + 1); // skip leading 'F' or 'O' --k; // object numbers start at zero -return ( k ); +return k; } @@ -971,7 +971,7 @@ int ModeLine::cluster_obj_number() const { -if ( is_pair() ) return ( -1 ); +if ( is_pair() ) return -1; int k; @@ -982,7 +982,7 @@ k = atoi(c + 2); // skip leading "CF" or "CO" --k; // object numbers start at zero -return ( k ); +return k; } @@ -996,7 +996,7 @@ bool ModeLine::pair_obj_numbers(int & nfcst, int & nobs) const nfcst = nobs = -1; -if ( is_single() ) return ( false ); +if ( is_single() ) return false; const char * c = object_id(); const char * u = (const char *) 0; @@ -1036,7 +1036,7 @@ else nobs = atoi(u + 1); // ok // -return ( true ); +return true; } @@ -1054,7 +1054,7 @@ const char * c = get_item("CENTROID_X"); x = atof(c); -return ( x ); +return x; } @@ -1072,7 +1072,7 @@ const char * c = get_item("CENTROID_Y"); x = atof(c); -return ( x ); +return x; } @@ -1090,7 +1090,7 @@ const char * c = get_item("CENTROID_LAT"); x = atof(c); -return ( x ); +return x; } @@ -1108,7 +1108,7 @@ const char * c = get_item("CENTROID_LON"); x = atof(c); -return ( x ); +return x; } @@ -1126,7 +1126,7 @@ const char * c = get_item("AXIS_ANG"); x = atof(c); -return ( x ); +return x; } @@ -1144,7 +1144,7 @@ const char * c = get_item("LENGTH"); x = atof(c); -return ( x ); +return x; } @@ -1162,7 +1162,7 @@ const char * c = get_item("WIDTH"); x = atof(c); -return ( x ); +return x; } @@ -1181,7 +1181,7 @@ const char * w = get_item("WIDTH"); x = atof(w)/atof(l); -return ( x ); +return x; } @@ -1199,7 +1199,7 @@ const char * c = get_item("AREA"); a = atoi(c); -return ( a ); +return a; } @@ -1217,7 +1217,7 @@ const char * c = get_item("AREA_THRESH"); a = atoi(c); -return ( a ); +return a; } @@ -1234,7 +1234,7 @@ const char * c = get_item("CURVATURE"); x = atof(c); -return ( x ); +return x; } @@ -1252,7 +1252,7 @@ const char * c = get_item("CURVATURE_X"); x = atof(c); -return ( x ); +return x; } @@ -1270,7 +1270,7 @@ const char * c = get_item("CURVATURE_Y"); x = atof(c); -return ( x ); +return x; } @@ -1288,7 +1288,7 @@ const char * c = get_item("COMPLEXITY"); x = atof(c); -return ( x ); +return x; } @@ -1306,7 +1306,7 @@ const char * c = get_item("INTENSITY_10"); x = atof(c); -return ( x ); +return x; } @@ -1324,7 +1324,7 @@ const char * c = get_item("INTENSITY_25"); x = atof(c); -return ( x ); +return x; } @@ -1342,7 +1342,7 @@ const char * c = get_item("INTENSITY_50"); x = atof(c); -return ( x ); +return x; } @@ -1360,7 +1360,7 @@ const char * c = get_item("INTENSITY_75"); x = atof(c); -return ( x ); +return x; } @@ -1378,7 +1378,7 @@ const char * c = get_item("INTENSITY_90"); x = atof(c); -return ( x ); +return x; } @@ -1402,7 +1402,7 @@ const char * c = get_item(i+1); x = atof(c); -return ( x ); +return x; } @@ -1420,7 +1420,7 @@ const char * c = get_item("INTENSITY_SUM"); x = atof(c); -return ( x ); +return x; } @@ -1438,7 +1438,7 @@ const char * c = get_item("CENTROID_DIST"); x = atof(c); -return ( x ); +return x; } @@ -1456,7 +1456,7 @@ const char * c = get_item("BOUNDARY_DIST"); x = atof(c); -return ( x ); +return x; } @@ -1474,7 +1474,7 @@ const char * c = get_item("CONVEX_HULL_DIST"); x = atof(c); -return ( x ); +return x; } @@ -1492,7 +1492,7 @@ const char * c = get_item("ANGLE_DIFF"); x = atof(c); -return ( x ); +return x; } @@ -1510,7 +1510,7 @@ const char * c = get_item("ASPECT_DIFF"); x = atof(c); -return ( x ); +return x; } @@ -1528,7 +1528,7 @@ const char * c = get_item("AREA_RATIO"); x = atof(c); -return ( x ); +return x; } @@ -1546,7 +1546,7 @@ const char * c = get_item("INTERSECTION_AREA"); i = atoi(c); -return ( i ); +return i; } @@ -1564,7 +1564,7 @@ const char * c = get_item("UNION_AREA"); i = atoi(c); -return ( i ); +return i; } @@ -1582,7 +1582,7 @@ const char * c = get_item("SYMMETRIC_DIFF"); i = atoi(c); -return ( i ); +return i; } @@ -1600,7 +1600,7 @@ const char * c = get_item("INTERSECTION_OVER_AREA"); x = atof(c); -return ( x ); +return x; } @@ -1618,7 +1618,7 @@ const char * c = get_item("CURVATURE_RATIO"); x = atof(c); -return ( x ); +return x; } @@ -1636,7 +1636,7 @@ const char * c = get_item("COMPLEXITY_RATIO"); x = atof(c); -return ( x ); +return x; } @@ -1654,7 +1654,7 @@ const char * c = get_item("PERCENTILE_INTENSITY_RATIO"); x = atof(c); -return ( x ); +return x; } @@ -1672,7 +1672,7 @@ const char * c = get_item("INTEREST"); x = atof(c); -return ( x ); +return x; } diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 963271d905..fa7ab2bdd0 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -64,11 +64,11 @@ STATAnalysisJob::STATAnalysisJob(const STATAnalysisJob & aj) { STATAnalysisJob & STATAnalysisJob::operator=( const STATAnalysisJob & aj) { - if(this == &aj ) return ( * this ); + if(this == &aj ) return *this; assign(aj); - return (* this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -664,41 +664,41 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // model // if(model.n() > 0) { - if(!(model.has(L.model()))) return(0); + if(!(model.has(L.model()))) return 0; } // // desc // if(desc.n() > 0) { - if(!(desc.has(L.desc()))) return(0); + if(!(desc.has(L.desc()))) return 0; } // // fcst_lead (in seconds) // if(fcst_lead.n() > 0) { - if(!fcst_lead.has(L.fcst_lead())) return(0); + if(!fcst_lead.has(L.fcst_lead())) return 0; } // // fcst_valid_beg // if((fcst_valid_beg > 0) && (L.fcst_valid_beg() < fcst_valid_beg)) - return(0); + return 0; // // fcst_valid_end // if((fcst_valid_end > 0) && (L.fcst_valid_end() > fcst_valid_end)) - return(0); + return 0; // // fcst_valid_inc // if(fcst_valid_inc.n() > 0) { if(!fcst_valid_inc.has(L.fcst_valid_beg()) || - !fcst_valid_inc.has(L.fcst_valid_end())) return(0); + !fcst_valid_inc.has(L.fcst_valid_end())) return 0; } // @@ -706,7 +706,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // if(fcst_valid_exc.n() > 0) { if(fcst_valid_exc.has(L.fcst_valid_beg()) || - fcst_valid_exc.has(L.fcst_valid_end())) return(0); + fcst_valid_exc.has(L.fcst_valid_end())) return 0; } // @@ -716,29 +716,29 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { if(fcst_valid_hour.n() > 0) { // Check that fcst_valid_beg = fcst_valid_end - if(L.fcst_valid_beg() != L.fcst_valid_end()) return(0); + if(L.fcst_valid_beg() != L.fcst_valid_end()) return 0; - if(!fcst_valid_hour.has(L.fcst_valid_hour())) return(0); + if(!fcst_valid_hour.has(L.fcst_valid_hour())) return 0; } // // fcst_init_beg // if((fcst_init_beg > 0) && (L.fcst_init_beg() < fcst_init_beg)) - return(0); + return 0; // // fcst_init_end // if((fcst_init_end > 0) && (L.fcst_init_end() > fcst_init_end)) - return(0); + return 0; // // fcst_init_inc // if(fcst_init_inc.n() > 0) { if(!fcst_init_inc.has(L.fcst_init_beg()) || - !fcst_init_inc.has(L.fcst_init_end())) return(0); + !fcst_init_inc.has(L.fcst_init_end())) return 0; } // @@ -746,7 +746,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // if(fcst_init_exc.n() > 0) { if(fcst_init_exc.has(L.fcst_init_beg()) || - fcst_init_exc.has(L.fcst_init_end())) return(0); + fcst_init_exc.has(L.fcst_init_end())) return 0; } // @@ -756,36 +756,36 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { if(fcst_init_hour.n() > 0) { // Check that fcst_init_beg = fcst_init_end - if(L.fcst_init_beg() != L.fcst_init_end()) return(0); + if(L.fcst_init_beg() != L.fcst_init_end()) return 0; - if(!fcst_init_hour.has(L.fcst_init_hour())) return(0); + if(!fcst_init_hour.has(L.fcst_init_hour())) return 0; } // // obs_lead (in seconds) // if(obs_lead.n() > 0) { - if(!obs_lead.has(L.obs_lead())) return(0); + if(!obs_lead.has(L.obs_lead())) return 0; } // // obs_valid_beg // if((obs_valid_beg > 0) && (L.obs_valid_beg() < obs_valid_beg)) - return(0); + return 0; // // obs_valid_end // if((obs_valid_end > 0) && (L.obs_valid_end() > obs_valid_end)) - return(0); + return 0; // // obs_valid_inc // if(obs_valid_inc.n() > 0) { if(!obs_valid_inc.has(L.obs_valid_beg()) || - !obs_valid_inc.has(L.obs_valid_end())) return(0); + !obs_valid_inc.has(L.obs_valid_end())) return 0; } // @@ -793,7 +793,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // if(obs_valid_exc.n() > 0) { if(obs_valid_exc.has(L.obs_valid_beg()) || - obs_valid_exc.has(L.obs_valid_end())) return(0); + obs_valid_exc.has(L.obs_valid_end())) return 0; } // @@ -803,29 +803,29 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { if(obs_valid_hour.n() > 0) { // Check that obs_valid_beg = obs_valid_end - if(L.obs_valid_beg() != L.obs_valid_end()) return(0); + if(L.obs_valid_beg() != L.obs_valid_end()) return 0; - if(!obs_valid_hour.has(L.obs_valid_hour())) return(0); + if(!obs_valid_hour.has(L.obs_valid_hour())) return 0; } // // obs_init_beg // if((obs_init_beg > 0) && (L.obs_init_beg() < obs_init_beg)) - return(0); + return 0; // // obs_init_end // if((obs_init_end > 0) && (L.obs_init_end() > obs_init_end)) - return(0); + return 0; // // obs_init_inc // if(obs_init_inc.n() > 0) { if(!obs_init_inc.has(L.obs_init_beg()) || - !obs_init_inc.has(L.obs_init_end())) return(0); + !obs_init_inc.has(L.obs_init_end())) return 0; } // @@ -833,7 +833,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // if(obs_init_exc.n() > 0) { if(obs_init_exc.has(L.obs_init_beg()) || - obs_init_exc.has(L.obs_init_end())) return(0); + obs_init_exc.has(L.obs_init_end())) return 0; } // @@ -843,120 +843,120 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { if(obs_init_hour.n() > 0) { // Check that obs_init_beg = obs_init_end - if(L.obs_init_beg() != L.obs_init_end()) return(0); + if(L.obs_init_beg() != L.obs_init_end()) return 0; - if(!obs_init_hour.has(L.obs_init_hour())) return(0); + if(!obs_init_hour.has(L.obs_init_hour())) return 0; } // // fcst_var // if(fcst_var.n() > 0) { - if(!(fcst_var.has(L.fcst_var()))) return(0); + if(!(fcst_var.has(L.fcst_var()))) return 0; } // // fcst_units // if(fcst_units.n() > 0) { - if(!(fcst_units.has(L.fcst_units()))) return(0); + if(!(fcst_units.has(L.fcst_units()))) return 0; } // // fcst_lev // if(fcst_lev.n() > 0) { - if(!(fcst_lev.has(L.fcst_lev()))) return(0); + if(!(fcst_lev.has(L.fcst_lev()))) return 0; } // // obs_var // if(obs_var.n() > 0) { - if(!(obs_var.has(L.obs_var()))) return(0); + if(!(obs_var.has(L.obs_var()))) return 0; } // // obs_units // if(obs_units.n() > 0) { - if(!(obs_units.has(L.obs_units()))) return(0); + if(!(obs_units.has(L.obs_units()))) return 0; } // // obs_lev // if(obs_lev.n() > 0) { - if(!(obs_lev.has(L.obs_lev()))) return(0); + if(!(obs_lev.has(L.obs_lev()))) return 0; } // // obtype // if(obtype.n() > 0) { - if(!(obtype.has(L.obtype()))) return(0); + if(!(obtype.has(L.obtype()))) return 0; } // // vx_mask // if(vx_mask.n() > 0) { - if(!(vx_mask.has(L.vx_mask()))) return(0); + if(!(vx_mask.has(L.vx_mask()))) return 0; } // // interp_mthd // if(interp_mthd.n() > 0) { - if(!(interp_mthd.has(L.interp_mthd()))) return(0); + if(!(interp_mthd.has(L.interp_mthd()))) return 0; } // // interp_pnts // if(interp_pnts.n() > 0) { - if(!interp_pnts.has(L.interp_pnts())) return(0); + if(!interp_pnts.has(L.interp_pnts())) return 0; } // // fcst_thresh // if(fcst_thresh.n() > 0) { - if(!check_thresh_column(fcst_thresh, L.fcst_thresh())) return(0); + if(!check_thresh_column(fcst_thresh, L.fcst_thresh())) return 0; } // // obs_thresh // if(obs_thresh.n() > 0) { - if(!check_thresh_column(obs_thresh, L.obs_thresh())) return(0); + if(!check_thresh_column(obs_thresh, L.obs_thresh())) return 0; } // // cov_thresh // if(cov_thresh.n() > 0) { - if(!check_thresh_column(cov_thresh, L.cov_thresh())) return(0); + if(!check_thresh_column(cov_thresh, L.cov_thresh())) return 0; } // // thresh_logic // if(thresh_logic != SetLogic_None && - thresh_logic != L.thresh_logic()) return(0); + thresh_logic != L.thresh_logic()) return 0; // // alpha // if(alpha.n() > 0) { - if(!alpha.has(L.alpha())) return(0); + if(!alpha.has(L.alpha())) return 0; } // // line_type // if(line_type.n() > 0) { - if(!(line_type.has(L.line_type()))) return(0); + if(!(line_type.has(L.line_type()))) return 0; } // @@ -973,7 +973,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // // Check the column threshold // - if(!thr_it->second.check_dbl(v_dbl)) return(0); + if(!thr_it->second.check_dbl(v_dbl)) return 0; } // @@ -985,7 +985,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // // Check if the current value is in the list for the column // - if(!str_it->second.has(L.get_item(str_it->first.c_str(), false))) return(0); + if(!str_it->second.has(L.get_item(str_it->first.c_str(), false))) return 0; } // @@ -997,7 +997,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // // Check if the current value is not in the list for the column // - if(str_it->second.has(L.get_item(str_it->first.c_str(), false))) return(0); + if(str_it->second.has(L.get_item(str_it->first.c_str(), false))) return 0; } // @@ -1009,10 +1009,10 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { if(!is_in_mask_grid(lat, lon) || !is_in_mask_poly(lat, lon) || - !is_in_mask_sid (L.get_item("OBS_SID"))) return(0); + !is_in_mask_sid (L.get_item("OBS_SID"))) return 0; } - return(1); + return 1; } //////////////////////////////////////////////////////////////////////// @@ -1059,7 +1059,7 @@ double STATAnalysisJob::get_column_double(const STATLine &L, // Apply absolute value, if requested if(abs_flag && !is_bad_data(v)) v = fabs(v); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -1704,8 +1704,8 @@ int STATAnalysisJob::set_job_type(const char *c) { job_type = string_to_statjobtype(c); - if(job_type == no_stat_job_type) return(1); - else return(0); + if(job_type == no_stat_job_type) return 1; + else return 0; } //////////////////////////////////////////////////////////////////////// @@ -2333,7 +2333,7 @@ ConcatString STATAnalysisJob::get_case_info(const STATLine & L) const { key << (i == 0 ? "" : ":") << cs; } - return(key); + return key; } //////////////////////////////////////////////////////////////////////// @@ -2871,7 +2871,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { js << "-vif_flag " << vif_flag << " "; } - return(js); + return js; } //////////////////////////////////////////////////////////////////////// @@ -2899,7 +2899,7 @@ int STATAnalysisJob::is_in_mask_grid(double lat, double lon) const { } } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -2914,7 +2914,7 @@ int STATAnalysisJob::is_in_mask_poly(double lat, double lon) const { r = mask_poly.latlon_is_inside_dege(lat, lon); } - return(r); + return r; } //////////////////////////////////////////////////////////////////////// @@ -2927,7 +2927,7 @@ int STATAnalysisJob::is_in_mask_sid(const char *sid) const { // if(mask_sid.n() > 0) r = mask_sid.has(sid); - return(r); + return r; } //////////////////////////////////////////////////////////////////////// @@ -2937,7 +2937,7 @@ int STATAnalysisJob::is_in_mask_sid(const char *sid) const { //////////////////////////////////////////////////////////////////////// const char * statjobtype_to_string(const STATJobType t) { - return(statjobtype_str[t]); + return statjobtype_str[t]; } //////////////////////////////////////////////////////////////////////// @@ -2974,7 +2974,7 @@ STATJobType string_to_statjobtype(const char *str) { else t = no_stat_job_type; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -2989,7 +2989,7 @@ ConcatString timestring(const unixtime t) { short_month_name[month], day, year, hour, minute, second); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -2997,15 +2997,15 @@ ConcatString timestring(const unixtime t) { bool check_thresh_column(const ThreshArray &list, const ThreshArray &item) { // Return true for an empty search list. - if(list.n() == 0) return(true); + if(list.n() == 0) return true; // If the item is a single threshold, search for it in the list. if(item.n() == 1) { - return(list.has(item[0])); + return list.has(item[0]); } // Otherwise, check that the list and item exactly match. - return(list == item); + return (list == item); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index faf5c409f3..5edf5519aa 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -89,11 +89,11 @@ STATLine & STATLine::operator=(const STATLine & L) { -if ( this == &L ) return ( * this ); +if ( this == &L ) return *this; assign(L); -return ( * this ); +return *this; } @@ -255,7 +255,7 @@ if ( !status || n_items() == 0 ) { clear(); - return ( 0 ); + return 0; } @@ -267,7 +267,7 @@ if ( strcmp(get_item(0), "VERSION") == 0 ) { Type = stat_header; - return ( 1 ); + return 1; } // @@ -280,7 +280,7 @@ if( is_bad_data(offset) || n_items() < (offset + 1) ) { Type = no_stat_line_type; - return ( 0 ); + return 0; } // @@ -291,7 +291,7 @@ HdrLine = METHdrTable.header(get_item(0), "STAT", get_item(offset)); Type = string_to_statlinetype(get_item(offset)); -return ( 1 ); +return 1; } @@ -303,7 +303,7 @@ bool STATLine::is_ok() const { -return ( DataLine::is_ok() ); +return DataLine::is_ok(); } @@ -327,7 +327,7 @@ bool STATLine::has(const char *col_str) const { -return ( !is_bad_data(get_offset(col_str)) ); +return !is_bad_data(get_offset(col_str)); } @@ -368,7 +368,7 @@ if ( is_bad_data(offset) ) { // Return the offset value // -return ( offset ); +return offset; } @@ -407,7 +407,7 @@ if ( cs == bad_data_str ) { } -return ( cs ); +return cs; } @@ -448,8 +448,8 @@ if ( is_bad_data(offset) ) { // Return bad data string for no match // -if ( is_bad_data(offset) ) return ( bad_data_str ); -else return ( get_item(offset, check_na) ); +if ( is_bad_data(offset) ) return bad_data_str; +else return get_item(offset, check_na); } @@ -465,7 +465,7 @@ const char * STATLine::get_item(int offset, bool check_na) const // Range check // -if ( offset < 0 || offset >= N_items ) return ( bad_data_str ); +if ( offset < 0 || offset >= N_items ) return bad_data_str; const char * c = DataLine::get_item(offset); @@ -473,8 +473,8 @@ const char * c = DataLine::get_item(offset); // Check for the NA string and interpret it as bad data // -if ( check_na && strcmp(c, na_str) == 0 ) return ( bad_data_str ); -else return ( c ); +if ( check_na && strcmp(c, na_str) == 0 ) return bad_data_str; +else return c; } @@ -488,7 +488,7 @@ const char * STATLine::version() const const char * c = get_item("VERSION", false); -return ( c ); +return c; } @@ -502,7 +502,7 @@ const char * STATLine::model() const const char * c = get_item("MODEL", false); -return ( c ); +return c; } @@ -516,7 +516,7 @@ const char * STATLine::desc() const const char * c = get_item("DESC", false); -return ( c ); +return c; } @@ -533,7 +533,7 @@ const char * c = get_item("FCST_LEAD"); j = timestring_to_sec(c); -return ( j ); +return j; } @@ -549,7 +549,7 @@ unixtime t; const char * c = get_item("FCST_VALID_BEG"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -565,7 +565,7 @@ unixtime t; const char * c = get_item("FCST_VALID_END"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -577,7 +577,7 @@ int STATLine::fcst_valid_hour() const { -return ( unix_to_sec_of_day(fcst_valid_beg()) ); +return unix_to_sec_of_day(fcst_valid_beg()); } @@ -594,7 +594,7 @@ const char * c = get_item("OBS_LEAD"); j = timestring_to_sec(c); -return ( j ); +return j; } @@ -610,7 +610,7 @@ unixtime t; const char * c = get_item("OBS_VALID_BEG"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -626,7 +626,7 @@ unixtime t; const char * c = get_item("OBS_VALID_END"); t = timestring_to_unix(c); -return ( t ); +return t; } @@ -638,7 +638,7 @@ int STATLine::obs_valid_hour() const { -return ( unix_to_sec_of_day(obs_valid_beg()) ); +return unix_to_sec_of_day(obs_valid_beg()); } @@ -652,7 +652,7 @@ const char * STATLine::fcst_var() const const char * c = get_item("FCST_VAR", false); -return ( c ); +return c; } @@ -666,7 +666,7 @@ const char * STATLine::fcst_units() const const char * c = get_item("FCST_UNITS", false); -return ( c ); +return c; } @@ -680,7 +680,7 @@ const char * STATLine::fcst_lev() const const char * c = get_item("FCST_LEV", false); -return ( c ); +return c; } @@ -694,7 +694,7 @@ const char * STATLine::obs_var() const const char * c = get_item("OBS_VAR", false); -return ( c ); +return c; } @@ -708,7 +708,7 @@ const char * STATLine::obs_units() const const char * c = get_item("OBS_UNITS", false); -return ( c ); +return c; } @@ -722,7 +722,7 @@ const char * STATLine::obs_lev() const const char * c = get_item("OBS_LEV", false); -return ( c ); +return c; } @@ -736,7 +736,7 @@ const char * STATLine::obtype() const const char * c = get_item("OBTYPE", false); -return ( c ); +return c; } @@ -750,7 +750,7 @@ const char * STATLine::vx_mask() const const char * c = get_item("VX_MASK", false); -return ( c ); +return c; } @@ -764,7 +764,7 @@ const char * STATLine::interp_mthd() const const char * c = get_item("INTERP_MTHD", false); -return ( c ); +return c; } @@ -781,7 +781,7 @@ const char * c = get_item("INTERP_PNTS", false); k = atoi(c); -return ( k ); +return k; } @@ -799,7 +799,7 @@ const char * c = get_item("FCST_THRESH", false); ta.add_css(c); -return ( ta ); +return ta; } @@ -817,7 +817,7 @@ const char * c = get_item("OBS_THRESH", false); ta.add_css(c); -return ( ta ); +return ta; } @@ -838,7 +838,7 @@ else if(cs.endswith(setlogic_symbol_intersection)) t = SetLogic_Intersection; else if(cs.endswith(setlogic_symbol_symdiff)) t = SetLogic_SymDiff; else t = SetLogic_None; -return ( t ); +return t; } @@ -856,7 +856,7 @@ const char * c = get_item("COV_THRESH", false); ta.add_css(c); -return ( ta ); +return ta; } @@ -874,7 +874,7 @@ const char * c = get_item("ALPHA"); a = atof(c); -return ( a ); +return a; } @@ -888,7 +888,7 @@ const char * STATLine::line_type() const const char * c = get_item("LINE_TYPE", false); -return ( c ); +return c; } @@ -909,7 +909,7 @@ s = fcst_lead(); t -= s; -return ( t ); +return t; } @@ -930,7 +930,7 @@ s = fcst_lead(); t -= s; -return ( t ); +return t; } @@ -942,7 +942,7 @@ int STATLine::fcst_init_hour() const { -return ( unix_to_sec_of_day(fcst_init_beg()) ); +return unix_to_sec_of_day(fcst_init_beg()); } @@ -963,7 +963,7 @@ s = obs_lead(); t -= s; -return ( t ); +return t; } @@ -984,7 +984,7 @@ s = obs_lead(); t -= s; -return ( t ); +return t; } @@ -996,7 +996,7 @@ int STATLine::obs_init_hour() const { -return ( unix_to_sec_of_day(obs_init_beg()) ); +return unix_to_sec_of_day(obs_init_beg()); } diff --git a/src/libcode/vx_analysis_util/time_series.cc b/src/libcode/vx_analysis_util/time_series.cc index a07c07debd..2ee96c92fd 100644 --- a/src/libcode/vx_analysis_util/time_series.cc +++ b/src/libcode/vx_analysis_util/time_series.cc @@ -78,11 +78,11 @@ TimeSeries & TimeSeries::operator=(const TimeSeries & ts) { -if ( this == &ts ) return ( * this ); +if ( this == &ts ) return *this; assign(ts); -return ( * this ); +return *this; } @@ -220,7 +220,7 @@ if ( (index < 0) || (index >= Nelements) ) { } -return ( Value[index] ); +return Value[index]; } diff --git a/src/libcode/vx_bool_calc/bool_calc.cc b/src/libcode/vx_bool_calc/bool_calc.cc index 21ccd83921..a2ac217ed5 100644 --- a/src/libcode/vx_bool_calc/bool_calc.cc +++ b/src/libcode/vx_bool_calc/bool_calc.cc @@ -247,7 +247,7 @@ result = s->top(); s->pop(); -return ( result ); +return result; } diff --git a/src/libcode/vx_bool_calc/make_program.cc b/src/libcode/vx_bool_calc/make_program.cc index 0072a3f658..a8945973f2 100644 --- a/src/libcode/vx_bool_calc/make_program.cc +++ b/src/libcode/vx_bool_calc/make_program.cc @@ -250,7 +250,7 @@ for (j=0; j<(int) program.size(); ++j) { } // for j -return ( n ); +return n; } @@ -295,7 +295,7 @@ for (j=0; j<(int) program.size(); ++j) { -return ( n ); +return n; } diff --git a/src/libcode/vx_bool_calc/token.cc b/src/libcode/vx_bool_calc/token.cc index d2bff4c067..57e81f19bc 100644 --- a/src/libcode/vx_bool_calc/token.cc +++ b/src/libcode/vx_bool_calc/token.cc @@ -68,11 +68,11 @@ Token & Token::operator=(const Token & t) { -if ( this == &t ) return ( * this ); +if ( this == &t ) return *this; assign(t); -return ( * this ); +return *this; } @@ -357,7 +357,7 @@ const bool tf = (type == tok_union) || (type == tok_negation); -return ( tf ); +return tf; } @@ -379,7 +379,7 @@ ostream & operator<<(ostream & out, const Token & t) t.dump(out); -return ( out ); +return out; } diff --git a/src/libcode/vx_bool_calc/token_stack.cc b/src/libcode/vx_bool_calc/token_stack.cc index cdcdb2f039..35737396f9 100644 --- a/src/libcode/vx_bool_calc/token_stack.cc +++ b/src/libcode/vx_bool_calc/token_stack.cc @@ -83,11 +83,11 @@ TokenStack & TokenStack::operator=(const TokenStack & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -292,7 +292,7 @@ Token _t = e[Nelements - 1]; --Nelements; -return ( _t ); +return _t; } @@ -314,7 +314,7 @@ if ( Nelements <= 0 ) { Token _t = e[Nelements - 1]; -return ( _t ); +return _t; } @@ -336,7 +336,7 @@ if ( Nelements <= 0 ) { int k = e[Nelements - 1].in_prec; -return ( k ); +return k; } @@ -358,7 +358,7 @@ if ( Nelements <= 0 ) { char c = e[Nelements - 1].value; -return ( c ); +return c; } */ @@ -381,7 +381,7 @@ if ( Nelements <= 0 ) { bool tf = e[Nelements - 1].is_mark(); -return ( tf ); +return tf; } @@ -403,7 +403,7 @@ ostream & operator<<(ostream & out, const TokenStack & ts) ts.dump(out); -return ( out ); +return out; } diff --git a/src/libcode/vx_bool_calc/tokenizer.cc b/src/libcode/vx_bool_calc/tokenizer.cc index 7b676f452e..960172b1ae 100644 --- a/src/libcode/vx_bool_calc/tokenizer.cc +++ b/src/libcode/vx_bool_calc/tokenizer.cc @@ -139,7 +139,7 @@ while ( (c = source[pos]) != 0 ) { } -return ( value ); +return value; } @@ -168,7 +168,7 @@ while ( 1 ) { tok.set_eof(); - return ( tok ); + return tok; } @@ -236,7 +236,7 @@ else { } -return ( tok ); +return tok; } diff --git a/src/libcode/vx_bool_calc/tokentype_to_string.cc b/src/libcode/vx_bool_calc/tokentype_to_string.cc index ef5df73887..eafea54a4c 100644 --- a/src/libcode/vx_bool_calc/tokentype_to_string.cc +++ b/src/libcode/vx_bool_calc/tokentype_to_string.cc @@ -72,20 +72,20 @@ bool string_to_tokentype(const char * text, TokenType & t) { - if ( strcmp(text, "tok_union" ) == 0 ) { t = tok_union; return ( true ); } -else if ( strcmp(text, "tok_intersection") == 0 ) { t = tok_intersection; return ( true ); } -else if ( strcmp(text, "tok_negation" ) == 0 ) { t = tok_negation; return ( true ); } -else if ( strcmp(text, "tok_local_var" ) == 0 ) { t = tok_local_var; return ( true ); } -else if ( strcmp(text, "tok_mark" ) == 0 ) { t = tok_mark; return ( true ); } - -else if ( strcmp(text, "tok_unmark" ) == 0 ) { t = tok_unmark; return ( true ); } -else if ( strcmp(text, "tok_eof" ) == 0 ) { t = tok_eof; return ( true ); } -else if ( strcmp(text, "no_token_type" ) == 0 ) { t = no_token_type; return ( true ); } + if ( strcmp(text, "tok_union" ) == 0 ) { t = tok_union; return true; } +else if ( strcmp(text, "tok_intersection") == 0 ) { t = tok_intersection; return true; } +else if ( strcmp(text, "tok_negation" ) == 0 ) { t = tok_negation; return true; } +else if ( strcmp(text, "tok_local_var" ) == 0 ) { t = tok_local_var; return true; } +else if ( strcmp(text, "tok_mark" ) == 0 ) { t = tok_mark; return true; } + +else if ( strcmp(text, "tok_unmark" ) == 0 ) { t = tok_unmark; return true; } +else if ( strcmp(text, "tok_eof" ) == 0 ) { t = tok_eof; return true; } +else if ( strcmp(text, "no_token_type" ) == 0 ) { t = no_token_type; return true; } // // nope // -return ( false ); +return false; } diff --git a/src/libcode/vx_color/color.cc b/src/libcode/vx_color/color.cc index 715968ecab..49508193e4 100644 --- a/src/libcode/vx_color/color.cc +++ b/src/libcode/vx_color/color.cc @@ -81,11 +81,11 @@ Color & Color::operator=(const Color &c) { -if ( this == &c ) return ( *this ); +if ( this == &c ) return *this; assign(c); -return ( *this ); +return *this; } @@ -288,11 +288,11 @@ int operator==(const Color &a, const Color &b) { -if ( a.R != b.R ) return ( 0 ); -if ( a.G != b.G ) return ( 0 ); -if ( a.B != b.B ) return ( 0 ); +if ( a.R != b.R ) return 0; +if ( a.G != b.G ) return 0; +if ( a.B != b.B ) return 0; -return ( 1 ); +return 1; } @@ -304,11 +304,11 @@ int operator!=(const Color &a, const Color &b) { -if ( a.R != b.R ) return ( 1 ); -if ( a.G != b.G ) return ( 1 ); -if ( a.B != b.B ) return ( 1 ); +if ( a.R != b.R ) return 1; +if ( a.G != b.G ) return 1; +if ( a.B != b.B ) return 1; -return ( 0 ); +return 0; } @@ -335,7 +335,7 @@ if ( j > 255 ) j = 255; a = (unsigned char) j; -return ( a ); +return a; } @@ -554,7 +554,7 @@ B = nint( t*(color1.blue() ) + omt*(color0.blue() ) ); result.set_rgb((unsigned char) R, (unsigned char) G, (unsigned char) B); -return ( result ); +return result; } diff --git a/src/libcode/vx_color/color_list.cc b/src/libcode/vx_color/color_list.cc index eb3c8cad18..08ef845cb4 100644 --- a/src/libcode/vx_color/color_list.cc +++ b/src/libcode/vx_color/color_list.cc @@ -77,11 +77,11 @@ ClistEntry & ClistEntry::operator=(const ClistEntry & e) { -if ( this == &e ) return ( * this ); +if ( this == &e ) return *this; assign(e); -return ( * this ); +return *this; } @@ -245,11 +245,11 @@ ColorList & ColorList::operator=(const ColorList & c) { -if ( this == &c ) return ( * this ); +if ( this == &c ) return *this; assign(c); -return ( * this ); +return *this; } @@ -412,7 +412,7 @@ for (j=0; j= Nelements) ) { } -return ( e[n] ); +return e[n]; } diff --git a/src/libcode/vx_color/color_table.cc b/src/libcode/vx_color/color_table.cc index 341a5f00d2..7fe08ea8a3 100644 --- a/src/libcode/vx_color/color_table.cc +++ b/src/libcode/vx_color/color_table.cc @@ -128,11 +128,11 @@ CtableEntry & CtableEntry::operator=(const CtableEntry & entry) { -if ( this == &entry ) return ( * this ); +if ( this == &entry ) return *this; assign(entry); -return ( * this ); +return *this; } @@ -292,11 +292,11 @@ ColorTable & ColorTable::operator=(const ColorTable & c) { -if ( this == &c ) return ( * this ); +if ( this == &c ) return *this; assign(c); -return ( * this ); +return *this; } @@ -395,11 +395,11 @@ Color color; double t = ( is_bad_data(t_in) ? bad_data_double : t_in ); -if ( Nentries == 0 ) return ( black ); +if ( Nentries == 0 ) return black; -if ( t <= Entry[0].value_low() ) return ( Entry[0].color() ); +if ( t <= Entry[0].value_low() ) return Entry[0].color(); -if ( t >= Entry[Nentries - 1].value_high() ) return ( Entry[Nentries - 1].color() ); +if ( t >= Entry[Nentries - 1].value_high() ) return Entry[Nentries - 1].color(); int j; double vlo, vhi; @@ -422,7 +422,7 @@ for (j=0; j= Entry[Nentries - 1].value_high() ) return ( Entry[Nentries - 1].color() ); +if ( z >= Entry[Nentries - 1].value_high() ) return Entry[Nentries - 1].color(); int j, k; @@ -496,7 +496,7 @@ for (j=0; j= Nentries) ) { } -return ( Entry[n] ); +return Entry[n]; } @@ -933,13 +933,13 @@ double ColorTable::data_min() const { -if ( Nentries == 0 ) return ( 0.0 ); +if ( Nentries == 0 ) return 0.0; double v; v = Entry[0].value_low(); -return ( v ); +return v; } @@ -956,7 +956,7 @@ double ColorTable::data_min(double bad_data_value) const { -if ( Nentries == 0 ) return ( 0.0 ); +if ( Nentries == 0 ) return 0.0; double v_low; int i; @@ -970,7 +970,7 @@ for(i=0; i= 4 ) { } -return ( true ); +return true; } diff --git a/src/libcode/vx_data2d/level_info.cc b/src/libcode/vx_data2d/level_info.cc index a02966fb95..d83fdeb0e5 100644 --- a/src/libcode/vx_data2d/level_info.cc +++ b/src/libcode/vx_data2d/level_info.cc @@ -57,11 +57,11 @@ LevelInfo::LevelInfo(const LevelInfo &f) { LevelInfo & LevelInfo::operator=(const LevelInfo &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/leveltype_to_string.cc b/src/libcode/vx_data2d/leveltype_to_string.cc index 1c7d52b24e..f66d4f2552 100644 --- a/src/libcode/vx_data2d/leveltype_to_string.cc +++ b/src/libcode/vx_data2d/leveltype_to_string.cc @@ -59,7 +59,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } @@ -71,19 +71,19 @@ bool string_to_leveltype(const char * text, LevelType & t) { - if ( strcmp(text, "LevelType_None" ) == 0 ) { t = LevelType_None; return ( true ); } -else if ( strcmp(text, "LevelType_Accum" ) == 0 ) { t = LevelType_Accum; return ( true ); } -else if ( strcmp(text, "LevelType_Vert" ) == 0 ) { t = LevelType_Vert; return ( true ); } -else if ( strcmp(text, "LevelType_Pres" ) == 0 ) { t = LevelType_Pres; return ( true ); } -else if ( strcmp(text, "LevelType_RecNumber") == 0 ) { t = LevelType_RecNumber; return ( true ); } + if ( strcmp(text, "LevelType_None" ) == 0 ) { t = LevelType_None; return true; } +else if ( strcmp(text, "LevelType_Accum" ) == 0 ) { t = LevelType_Accum; return true; } +else if ( strcmp(text, "LevelType_Vert" ) == 0 ) { t = LevelType_Vert; return true; } +else if ( strcmp(text, "LevelType_Pres" ) == 0 ) { t = LevelType_Pres; return true; } +else if ( strcmp(text, "LevelType_RecNumber") == 0 ) { t = LevelType_RecNumber; return true; } -else if ( strcmp(text, "LevelType_SFC" ) == 0 ) { t = LevelType_SFC; return ( true ); } -else if ( strcmp(text, "LevelType_Time" ) == 0 ) { t = LevelType_Time; return ( true ); } +else if ( strcmp(text, "LevelType_SFC" ) == 0 ) { t = LevelType_SFC; return true; } +else if ( strcmp(text, "LevelType_Time" ) == 0 ) { t = LevelType_Time; return true; } // // nope // -return ( false ); +return false; } diff --git a/src/libcode/vx_data2d/table_lookup.cc b/src/libcode/vx_data2d/table_lookup.cc index 0fba08a268..fdbb905ead 100644 --- a/src/libcode/vx_data2d/table_lookup.cc +++ b/src/libcode/vx_data2d/table_lookup.cc @@ -98,11 +98,11 @@ Grib1TableEntry & Grib1TableEntry::operator=(const Grib1TableEntry & e) { -if ( this == &e ) return ( * this ); +if ( this == &e ) return *this; assign(e); -return ( * this ); +return *this; } @@ -210,10 +210,10 @@ StringArray tok; tok.parse_wsss(line); -if (tok.n_elements() < 4) return (false); +if (tok.n_elements() < 4) return false; for (j=0; j<4; ++j) { - if(!is_number(tok[j].c_str())) return (false); + if(!is_number(tok[j].c_str())) return false; } code = atoi(tok[0].c_str()); @@ -227,7 +227,7 @@ subcenter = atoi(tok[3].c_str()); tok.parse_delim(line, "\""); -if (tok.n_elements() < 6) return (false); +if (tok.n_elements() < 6) return false; parm_name = tok[1]; full_name = tok[3]; @@ -246,7 +246,7 @@ if (units.empty()) units = na_str; // done // -return ( true ); +return true; } @@ -304,11 +304,11 @@ Grib2TableEntry & Grib2TableEntry::operator=(const Grib2TableEntry & e) { -if ( this == &e ) return ( * this ); +if ( this == &e ) return *this; assign(e); -return ( * this ); +return *this; } @@ -424,10 +424,10 @@ StringArray tok; tok.parse_wsss(line); -if (tok.n_elements() < 8) return (false); +if (tok.n_elements() < 8) return false; for (j=0; j<8; ++j) { - if(!is_number(tok[j].c_str())) return (false); + if(!is_number(tok[j].c_str())) return false; } index_a = atoi(tok[0].c_str()); @@ -445,7 +445,7 @@ index_c = atoi(tok[7].c_str()); tok.parse_delim(line, "\""); -if (tok.n_elements() < 6) return (false); +if (tok.n_elements() < 6) return false; parm_name = tok[1]; full_name = tok[3]; @@ -464,7 +464,7 @@ if (units.empty()) units = na_str; // done // -return ( true ); +return true; } @@ -817,7 +817,7 @@ else { in.close(); -return ( status ); +return status; } @@ -892,7 +892,7 @@ N_grib1_elements += j; // done // -return ( true ); +return true; } @@ -963,7 +963,7 @@ while ( line.read_line(in) ) { N_grib2_elements += j; -return ( true ); +return true; } @@ -985,13 +985,13 @@ for (j=0; jfile_type()); *vi_copy = *vi_in; - return(vi_copy); + return vi_copy; } diff --git a/src/libcode/vx_data2d_grib/data2d_grib.cc b/src/libcode/vx_data2d_grib/data2d_grib.cc index 09dc80815a..6b6c202bb4 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib.cc @@ -152,7 +152,7 @@ if ( ! (GF->open(_filename)) ) { close(); - return ( false ); + return false; } @@ -187,7 +187,7 @@ if ( ShiftRight != 0 ) Plane.shift_right(ShiftRight); // done // -return ( true ); +return true; } @@ -238,7 +238,7 @@ double MetGrib1DataFile::get(int x, int y) const double value = Plane.get(x, y); -return ( value ); +return value; } @@ -252,7 +252,7 @@ bool MetGrib1DataFile::data_ok(int x, int y) const const double value = get(x, y); -return ( !is_bad_data(value) ); +return !is_bad_data(value); } @@ -303,7 +303,7 @@ if ( ! ( (*GF) >> CurrentRecord) ) { mlog << Error << "\nMetGrib1DataFile::read_record() -> " << "trouble reading record number " << n << "\n\n"; -return (false); +return false; } @@ -314,7 +314,7 @@ if( read_plane ) get_data_plane(CurrentRecord, Plane); if ( ShiftRight != 0 ) Plane.shift_right(ShiftRight); -return (true); +return true; } @@ -331,7 +331,7 @@ if ( !GF ) { mlog << Error << "\nMetGrib1DataFile::read_record(const VarInfoGrib &) -> " << "no grib file open!\n\n"; - return ( -1 ); + return -1; } @@ -349,7 +349,7 @@ for (j=0; j<(GF->n_records()); ++j) { mlog << Error << "\nMetGrib1DataFile::read_record(const VarInfoGrib &) -> trouble reading record!\n\n"; - return ( -1 ); + return -1; } @@ -388,7 +388,7 @@ if ( j_match >= 0 ) { mlog << Error << "\nMetGrib1DataFile::read_record(const VarInfoGrib &) -> " << "trouble reading record!\n\n"; - return ( -1 ); + return -1; } @@ -398,7 +398,7 @@ if ( j_match >= 0 ) { // done // -return ( count ); +return count; } @@ -458,7 +458,7 @@ bool MetGrib1DataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { << filename() << "\".\n\n"; } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -572,7 +572,7 @@ int MetGrib1DataFile::data_plane_array(VarInfo &vinfo, << u_plane_array.n_planes() << ") does not match the " << "number of V-wind records (" << v_plane_array.n_planes() << ") for GRIB file \"" << filename() << "\".\n\n"; - return(0); + return 0; } // Loop through each of the data planes @@ -590,7 +590,7 @@ int MetGrib1DataFile::data_plane_array(VarInfo &vinfo, << v_plane_array.lower(i) << ", " << v_plane_array.upper(i) << ") in GRIB file \"" << filename() << "\".\n\n"; plane_array.clear(); - return(0); + return 0; } // Derive wind direction @@ -616,7 +616,7 @@ int MetGrib1DataFile::data_plane_array(VarInfo &vinfo, << vinfo.magic_str() << "\" in GRIB file \"" << filename() << "\".\n"; - return(plane_array.n_planes()); + return plane_array.n_planes(); } //////////////////////////////////////////////////////////////////////// @@ -711,7 +711,7 @@ bool MetGrib1DataFile::data_plane_scalar(VarInfoGrib &vinfo_grib, << filename() << "\".\n\n"; } - return(status); + return status; } /////////////////////////////////////////////////////////////////////////////// @@ -780,9 +780,9 @@ int get_bit_from_octet(unsigned char u, int bit) { unsigned char mask = (unsigned char) (1 << (8 - bit)); - if(u & mask) return(1); + if(u & mask) return 1; - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc index 2f1f66385b..c0459daa1d 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc @@ -143,7 +143,7 @@ bool is_prelim_match( VarInfoGrib & vinfo, const GribRecord & g) if ( vinfo_ptv != ptv || vinfo_center != center || vinfo_subcenter != subcenter || - !isEnsMatch ) return ( false ); + !isEnsMatch ) return false; // if p_flag is 'on' (probability field) and the request name is set, // get the real name of the field from the begining of a request name @@ -168,7 +168,7 @@ bool is_prelim_match( VarInfoGrib & vinfo, const GribRecord & g) if( !GribTable.lookup_grib1(field_name.c_str(), default_grib1_ptv, code_for_lookup, default_grib1_center, default_grib1_subcenter, tab, tab_match) ) { // if the lookup still fails, then it's not a match - return ( false ); + return false; } } @@ -217,7 +217,7 @@ if ( !is_bad_data(vinfo.level().type_num()) && << ") does not match the current level type (" << (int) pds->type << ").\n"; - return ( false ); + return false; } // @@ -235,8 +235,8 @@ upper = nint ( vinfo.level().upper() ); if ( vinfo.level().type() == LevelType_RecNumber ) { if ( lower == g.rec_num && - vinfo.code() == g.gribcode() ) return ( true ); - else return ( false ); + vinfo.code() == g.gribcode() ) return true; + else return false; } @@ -244,7 +244,7 @@ if ( vinfo.level().type() == LevelType_RecNumber ) { // gribcode // -if ( vinfo.code() != g.gribcode() ) return ( false ); +if ( vinfo.code() != g.gribcode() ) return false; // // parse timing info from pds @@ -258,7 +258,7 @@ read_pds(g, bms_flag, init_ut, valid_ut, accum); ut = vinfo.init(); -if ( ut != 0 && ut != init_ut ) return ( false ); +if ( ut != 0 && ut != init_ut ) return false; // // valid time @@ -266,7 +266,7 @@ if ( ut != 0 && ut != init_ut ) return ( false ); ut = vinfo.valid(); -if ( ut != 0 && ut != valid_ut ) return ( false ); +if ( ut != 0 && ut != valid_ut ) return false; // // lead time @@ -274,7 +274,7 @@ if ( ut != 0 && ut != valid_ut ) return ( false ); k = vinfo.lead(); -if ( k >= 0 && k != ( valid_ut - init_ut) ) return ( false ); +if ( k >= 0 && k != ( valid_ut - init_ut) ) return false; // // accumulation interval @@ -286,20 +286,20 @@ if ( vinfo.level().type() == LevelType_Accum ) { // time range indicator of 4 for accumulation // - if ( pds->tri != 4 ) return ( false ); + if ( pds->tri != 4 ) return false; // // check that the accumulation seconds match the limits // - if ( lower != accum || upper != accum ) return ( false ); + if ( lower != accum || upper != accum ) return false; } // // time range indicator // -if ( !is_bad_data(vinfo.tri()) && pds->tri != vinfo.tri() ) return ( false ); +if ( !is_bad_data(vinfo.tri()) && pds->tri != vinfo.tri() ) return false; // // probability info @@ -320,21 +320,21 @@ if ( vinfo.p_flag() && // probabilistic gribcode // - if ( vinfo.p_code() != p_code ) return ( false ); + if ( vinfo.p_code() != p_code ) return false; // // lower probabiility threshold // if ( !is_bad_data ( p_thresh_lo ) && - !is_eq ( vinfo.p_thresh_lo().get_value(), p_thresh_lo, loose_tol ) ) return ( false ); + !is_eq ( vinfo.p_thresh_lo().get_value(), p_thresh_lo, loose_tol ) ) return false; // // upper probability threshold // if ( !is_bad_data ( p_thresh_hi ) && - !is_eq ( vinfo.p_thresh_hi().get_value(), p_thresh_hi, loose_tol ) ) return ( false ); + !is_eq ( vinfo.p_thresh_hi().get_value(), p_thresh_hi, loose_tol ) ) return false; } @@ -345,7 +345,7 @@ if ( vinfo.p_flag() && for ( j=0; jtype == grib_level_list[j].level ) break; } -if ( j == n_grib_level_list ) return ( false ); +if ( j == n_grib_level_list ) return false; // // check that the record level type is consistent with the @@ -353,16 +353,16 @@ if ( j == n_grib_level_list ) return ( false ); // if ( vinfo.level().type() == LevelType_Pres && - grib_level_list[j].type != 3 ) return ( false ); + grib_level_list[j].type != 3 ) return false; if ( vinfo.level().type() == LevelType_Vert && - grib_level_list[j].type != 2 ) return ( false ); + grib_level_list[j].type != 2 ) return false; // // done // -return ( true ); +return true; } @@ -378,7 +378,7 @@ int lower, upper, grib_lower, grib_upper, grib_type_num; // check common logic // -if ( !is_prelim_match(vinfo, g) ) return ( false ); +if ( !is_prelim_match(vinfo, g) ) return false; // // store requested lower and upper limits @@ -406,7 +406,7 @@ if ( !is_bad_data(vinfo.level().type_num()) && << ") does not match the current level type (" << grib_type_num << ").\n"; - return ( false ); + return false; } @@ -425,7 +425,7 @@ if ( ( vinfo.level().type() != LevelType_Accum ) && << ") do not match the current level values " << "(" << grib_lower << " and " << grib_upper << ").\n"; - return ( false ); + return false; } @@ -433,7 +433,7 @@ if ( ( vinfo.level().type() != LevelType_Accum ) && // done // -return ( true ); +return true; } @@ -451,7 +451,7 @@ int lower, upper, grib_lower, grib_upper, grib_type_num; // check common logic // -if ( !is_prelim_match(vinfo, g) ) return ( false ); +if ( !is_prelim_match(vinfo, g) ) return false; // // store requested lower and upper limits @@ -479,7 +479,7 @@ if ( !is_bad_data(vinfo.level().type_num()) && << ") does not match the current level type (" << grib_type_num << ").\n"; - return ( false ); + return false; } // // for non-accumulation intervals and specific record number, @@ -496,14 +496,14 @@ if ( ( vinfo.level().type() != LevelType_Accum ) && << ") do not fall within the current range of level values " << "(" << grib_lower << " and " << grib_upper << ").\n"; - return ( false ); + return false; } // // done // -return ( true ); +return true; } @@ -565,7 +565,7 @@ plane.set_accum ( accum ); // done // -return ( true ); +return true; } diff --git a/src/libcode/vx_data2d_grib/grib_classes.cc b/src/libcode/vx_data2d_grib/grib_classes.cc index 5954a6ed7d..7962db7b3f 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.cc +++ b/src/libcode/vx_data2d_grib/grib_classes.cc @@ -223,7 +223,7 @@ GribRecord & GribRecord::operator=(const GribRecord &g) { -if ( this == &g ) return ( *this ); // check for a = a +if ( this == &g ) return *this; // check for a = a pds = new unsigned char [g.pds_len]; @@ -274,7 +274,7 @@ if ( g.bitmap.size() ) { TO = g.TO; -return ( *this ); +return *this; } @@ -350,7 +350,7 @@ shift = 32 - word_size - (k%8); value = (u >> shift) & mask; -return ( value ); +return value; } @@ -373,7 +373,7 @@ u = long_data_value(n); y = m_value*u + b_value; -return ( y ); +return y; } @@ -452,7 +452,7 @@ a = 0; if ( bitmap[byte] & uc_mask ) a = 1; -return ( a ); +return a; } @@ -469,7 +469,7 @@ Section1_Header *pds_ptr = (Section1_Header *) pds; j = (int) (pds_ptr->grib_code); -return ( j ); +return j; } @@ -723,13 +723,13 @@ if ( !(rep->buf = new unsigned char [default_gribfile_buf_size]) ) { rep->buf_size = default_gribfile_buf_size; -if(!skip_header()) return ( false ); +if(!skip_header()) return false; index_records(); lseek(rep->fd, rep->file_start, SEEK_SET); -return ( true ); +return true; } @@ -755,7 +755,7 @@ GribFile & GribFile::operator=(const GribFile &g) { -if ( this == &g ) return ( *this ); +if ( this == &g ) return *this; close(); @@ -763,7 +763,7 @@ rep = g.rep; if ( rep ) ++rep->referenceCount; -return ( *this ); +return *this; } @@ -789,11 +789,11 @@ int GribFile::operator>>(GribRecord &g) int j = read_record(g); -if ( j < 0 ) return ( -1 ); +if ( j < 0 ) return -1; -if ( j > 0 ) return ( 1 ); +if ( j > 0 ) return 1; -return ( 0 ); +return 0; } @@ -847,7 +847,7 @@ g.Sec0_offset_in_record = bytes_processed; bytes = sizeof(Section0_Header); -if ( (n_read = read(rep->buf, bytes)) == 0 ) return ( 0 ); +if ( (n_read = read(rep->buf, bytes)) == 0 ) return 0; memcpy(g.is, rep->buf, 8); @@ -855,7 +855,7 @@ if ( (n_read < 0) || (n_read != bytes) ) { mlog << Error << "\nGribFile::read_record() -> error reading section 0 header ... nread = " << n_read << "\n\n"; - return ( -1 ); + return -1; } @@ -867,7 +867,7 @@ if ( strncmp(g.is->grib_name, "GRIB", 4) != 0 ) { << " reading record number " << (rep->n_records) << ", bytes left in file = " << (pos2 - file_pos) << "\n\n"; - return ( 0 ); + return 0; } @@ -877,13 +877,13 @@ g.record_lseek_offset = file_pos; if ( s > (rep->buf_size) ) rep->realloc_buf(s); -if ( read(8, s - 8) == 0 ) return ( 0 ); +if ( read(8, s - 8) == 0 ) return 0; if ( strncmp((char *) (rep->buf + (s - 4)), "7777", 4) != 0 ) { mlog << Error << "\nGribFile::read_record(GribRecord &) -> trailing \"7777\" not found in grib record\n\n"; - return ( 0 ); + return 0; } bytes_processed += 8; @@ -1088,7 +1088,7 @@ for (j=0; j<(g.word_size); ++j) g.mask |= (1 << j); // Done // -return ( 1 ); +return 1; } @@ -1122,13 +1122,13 @@ if ( n_read == 0 ) { mlog << Error << "\nGribFile::skip_header() -> " << "\"GRIB\" magic cookie not found in grib file!!\n\n"; - return ( 0 ); + return 0; } if ( n_read < 0 ) { - return ( 0 ); + return 0; } @@ -1145,7 +1145,7 @@ if ( !found ) { mlog << Error << "\nGribFile::skip_header() -> " << "can't find \"GRIB\" magic cookie\n\n"; - return ( 0 ); + return 0; } @@ -1153,7 +1153,7 @@ rep->file_start = (long) (pos + j); lseek(rep->fd, rep->file_start, SEEK_SET); -return ( 1 ); +return 1; } @@ -1208,7 +1208,7 @@ if ( (n_read = ::read(rep->fd, (char *) rep->buf, rep->buf_size)) < 0 ) { } -return ( n_read ); +return n_read; } @@ -1239,7 +1239,7 @@ if ( (n_read = ::read(rep->fd, (char *) rep->buf, bytes)) < 0 ) { } -return ( n_read ); +return n_read; } @@ -1274,7 +1274,7 @@ if ( n_read != B ) { } -return ( n_read ); +return n_read; } @@ -1296,7 +1296,7 @@ if ( (n_read = ::read(rep->fd, c, bytes)) < 0 ) { } -return ( n_read ); +return n_read; } @@ -1475,7 +1475,7 @@ double char4_to_dbl(const unsigned char *c) value = value * mant / 16777216.0; if (positive == 0) value = -value; - return(value); + return value; } @@ -1492,7 +1492,7 @@ i = 0; for (j=0; j<3; ++j) i = i*256 + c[j]; -return ( i ); +return i; } @@ -1510,7 +1510,7 @@ i = 0; for (j=0; j<2; ++j) i = i*256 + c[j]; -return ( i ); +return i; } @@ -1618,7 +1618,7 @@ file << " Sec 4 (BDS) offset in file " << g.Sec4_offset_in_file << ", offse file << separator << "\n"; -return ( file ); +return file; } @@ -1657,7 +1657,7 @@ file << " length: " << char3_to_int(h.length) << "\n"; file << " ed_num: " << (int) (h.ed_num) << "\n\n"; -return ( file ); +return file; } @@ -1725,7 +1725,7 @@ file << " ens_number: " << (int) (h.ens_number) << "\n"; file << " d_value: " << char2_to_int(h.d_value) << "\n\n"; -return ( file ); +return file; } @@ -1844,7 +1844,7 @@ else if ((h.type == 10)) file << " rotation: " << char4_to_dbl(h.grid_type.rot_latlon_grid.rotation) << "\n\n"; } -return ( file ); +return file; } @@ -1883,7 +1883,7 @@ file << " num: " << (int) h.num << "\n"; file << " flag: " << char2_to_int(h.flag) << "\n\n"; -return ( file ); +return file; } @@ -1931,7 +1931,7 @@ file << " size: " << (int) h.size << "\n"; file << " data_start: " << (int) h.data_start << "\n\n"; -return ( file ); +return file; } @@ -1960,13 +1960,13 @@ while ( (n_read = read(fd, buf, sizeof(buf))) > 0 ) { lseek(fd, pos + 2, SEEK_SET); - return ( pos ); + return pos; } } // for j - if ( n_read < 10 ) return ( -1 ); + if ( n_read < 10 ) return -1; pos += n_read - 5; @@ -1974,7 +1974,7 @@ while ( (n_read = read(fd, buf, sizeof(buf))) > 0 ) { } // while -if ( n_read == 0 ) return ( -1 ); +if ( n_read == 0 ) return -1; if ( n_read < 0 ) { @@ -1984,7 +1984,7 @@ if ( n_read < 0 ) { } -return ( pos ); +return pos; } diff --git a/src/libcode/vx_data2d_grib/grib_strings.cc b/src/libcode/vx_data2d_grib/grib_strings.cc index f9b3edcdac..5af9e5227e 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.cc +++ b/src/libcode/vx_data2d_grib/grib_strings.cc @@ -64,7 +64,7 @@ ConcatString get_grib_code_name(int grib_code, int ptv) ConcatString str = get_grib_code_list_str(0, grib_code, ptv); - return ( str ); + return str; } /////////////////////////////////////////////////////////////////////////////// @@ -75,7 +75,7 @@ ConcatString get_grib_code_unit(int grib_code, int ptv) ConcatString str = get_grib_code_list_str(1, grib_code, ptv); - return ( str ); + return str; } @@ -87,7 +87,7 @@ ConcatString get_grib_code_abbr(int grib_code, int ptv) ConcatString str = get_grib_code_list_str(2, grib_code, ptv); - return ( str ); + return str; } @@ -129,7 +129,7 @@ ConcatString get_grib_level_list_str(int k, int grib_level) } // if - return ( str ); + return str; } @@ -141,7 +141,7 @@ ConcatString get_grib_level_name(int grib_level) ConcatString str = get_grib_level_list_str(0, grib_level); -return ( str ); +return str; } @@ -153,7 +153,7 @@ ConcatString get_grib_level_abbr(int grib_level) ConcatString str = get_grib_level_list_str(1, grib_level); -return ( str ); +return str; } @@ -187,7 +187,7 @@ ConcatString get_grib_level_str(int grib_level, unsigned char *level_info) } - return ( str ); + return str; } /////////////////////////////////////////////////////////////////////////////// @@ -211,7 +211,7 @@ int str_to_grib_code(const char *c) if(is_bad_data(gc)) gc = str_to_grib_code(c, 140); if(is_bad_data(gc)) gc = str_to_grib_code(c, 141); - return(gc); + return gc; } /////////////////////////////////////////////////////////////////////////////// @@ -256,7 +256,7 @@ int str_to_grib_code(const char *c, int &pcode, double &pthresh_lo, double &pthr if(is_bad_data(gc)) gc = str_to_grib_code(c, pcode, pthresh_lo, pthresh_hi, 140); if(is_bad_data(gc)) gc = str_to_grib_code(c, pcode, pthresh_lo, pthresh_hi, 141); - return(gc); + return gc; } /////////////////////////////////////////////////////////////////////////////// @@ -298,7 +298,7 @@ int str_to_grib_code(const char *c, int &pcode, pthresh_lo = pthresh_hi = bad_data_double; } - return(gc); + return gc; } /////////////////////////////////////////////////////////////////////////////// @@ -363,7 +363,7 @@ int str_to_prob_info(const char *c, double &pthresh_lo, double &pthresh_hi, exit(1); } - return(gc); + return gc; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_utils.cc b/src/libcode/vx_data2d_grib/grib_utils.cc index 095be46d0a..3dfaeb766b 100644 --- a/src/libcode/vx_data2d_grib/grib_utils.cc +++ b/src/libcode/vx_data2d_grib/grib_utils.cc @@ -696,11 +696,11 @@ int i; for (i=0; i listMatch.size() ) @@ -1649,7 +1649,7 @@ int MetGrib2DataFile::index( VarInfo &vinfo ){ //////////////////////////////////////////////////////////////////////// double scaled2dbl(int scale_factor, int scale_value) { - if (scale_factor == 0) return ( (double) scale_value ); + if (scale_factor == 0) return (double) scale_value; if (scale_factor < 0) return ( scale_value * pow(10.0, -scale_factor) ); return ( scale_value / pow(10.0, scale_factor) ); } @@ -1674,7 +1674,7 @@ int parse_int4(g2int i) { i_val = (c[0] << 24) + (c[1] << 16) + (c[2] << 8) + c[3]; } - return(i_val); + return i_val; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib2/var_info_grib2.cc b/src/libcode/vx_data2d_grib2/var_info_grib2.cc index 9d67ab1929..1a555e1027 100644 --- a/src/libcode/vx_data2d_grib2/var_info_grib2.cc +++ b/src/libcode/vx_data2d_grib2/var_info_grib2.cc @@ -68,11 +68,11 @@ VarInfoGrib2::VarInfoGrib2(const VarInfoGrib2 &f) { VarInfoGrib2 & VarInfoGrib2::operator=(const VarInfoGrib2 &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// 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 72275ecd9f..0a50084ec1 100644 --- a/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/data2d_nc_cf.cc @@ -128,7 +128,7 @@ bool MetNcCFDataFile::open(const char * _filename) { << "unable to open NetCDF file \"" << _filename << "\"\n\n"; close(); - return(false); + return false; } Filename = _filename; @@ -141,7 +141,7 @@ bool MetNcCFDataFile::open(const char * _filename) { (*Dest_Grid) = (*Raw_Grid); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -377,7 +377,7 @@ int MetNcCFDataFile::data_plane_array(VarInfo &vinfo, } } - return(n_rec); + return n_rec; } //////////////////////////////////////////////////////////////////////// @@ -397,7 +397,7 @@ LongArray MetNcCFDataFile::collect_time_offsets(VarInfo &vinfo) { mlog << Warning << "\n" << method_name << "can't find NetCDF variable \"" << vinfo_nc->req_name() << "\" in file \"" << Filename << "\".\n\n"; - return(time_offsets); + return time_offsets; } int time_dim_slot = info->t_slot; @@ -406,7 +406,7 @@ LongArray MetNcCFDataFile::collect_time_offsets(VarInfo &vinfo) { // The time dimension does not exist at the variable and the time // variable exists. Stop time slicing and set the time offset to 0. time_offsets.add(0); - return(time_offsets); + return time_offsets; } double time_lower = bad_data_double; @@ -584,7 +584,7 @@ LongArray MetNcCFDataFile::collect_time_offsets(VarInfo &vinfo) { exit(1); } - return(time_offsets); + return time_offsets; } 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 84c147a749..eebf2ae1b6 100644 --- a/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc +++ b/src/libcode/vx_data2d_nc_cf/nc_cf_file.cc @@ -2214,7 +2214,7 @@ double get_nc_var_att_double(const NcVar *nc_var, const char *att_name, bool is_ double att_val = get_att_value_double(nc_att); if (nc_att) delete nc_att; - return(att_val); + return att_val; } @@ -3450,7 +3450,7 @@ LatLonData NcCfFile::get_data_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, swap_to_north = false; } - return(data); + return data; } diff --git a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc index 00695d8da5..2d95ec8cf4 100644 --- a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc @@ -67,11 +67,11 @@ VarInfoNcCF::VarInfoNcCF(const VarInfoNcCF &f) { VarInfoNcCF & VarInfoNcCF::operator=(const VarInfoNcCF &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -368,9 +368,9 @@ bool VarInfoNcCF::is_precipitation() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any precipitation variables. // - return(has_prefix(grib_precipitation_abbr, + return has_prefix(grib_precipitation_abbr, n_grib_precipitation_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -388,9 +388,9 @@ bool VarInfoNcCF::is_specific_humidity() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any specific humidity variables. // - return(has_prefix(grib_specific_humidity_abbr, + return has_prefix(grib_specific_humidity_abbr, n_grib_specific_humidity_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -404,7 +404,7 @@ bool VarInfoNcCF::is_u_wind() const { return(SetAttrIsUWind != 0); } - return(is_grib_code_abbr_match(Name, ugrd_grib_code)); + return is_grib_code_abbr_match(Name, ugrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -418,7 +418,7 @@ bool VarInfoNcCF::is_v_wind() const { return(SetAttrIsVWind != 0); } - return(is_grib_code_abbr_match(Name, vgrd_grib_code)); + return is_grib_code_abbr_match(Name, vgrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -432,7 +432,7 @@ bool VarInfoNcCF::is_wind_speed() const { return(SetAttrIsWindSpeed != 0); } - return(is_grib_code_abbr_match(Name, wind_grib_code)); + return is_grib_code_abbr_match(Name, wind_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -446,7 +446,7 @@ bool VarInfoNcCF::is_wind_direction() const { return(SetAttrIsWindDirection != 0); } - return(is_grib_code_abbr_match(Name, wdir_grib_code)); + return is_grib_code_abbr_match(Name, wdir_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -459,7 +459,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { ConcatString abbr_str; bool match = false; - if(str.empty()) return(false); + if(str.empty()) return false; // // Use the default GRIB1 parameter table version number 2 @@ -472,7 +472,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { // if(strncasecmp(str.c_str(), abbr_str.c_str(), abbr_str.length()) == 0) match = true; - return(match); + return match; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc index 40caecba95..b504207ad4 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc @@ -92,7 +92,7 @@ bool MetNcMetDataFile::open(const char * _filename) { << "unable to open NetCDF file \"" << _filename << "\"\n\n"; close(); - return(false); + return false; } Filename = _filename; @@ -105,7 +105,7 @@ bool MetNcMetDataFile::open(const char * _filename) { (*Dest_Grid) = (*Raw_Grid); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -188,7 +188,7 @@ bool MetNcMetDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { if(info->units_att.length() > 0) vinfo.set_units(info->units_att.c_str()); } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -211,7 +211,7 @@ int MetNcMetDataFile::data_plane_array(VarInfo &vinfo, n_rec = 1; } - return(n_rec); + return n_rec; } //////////////////////////////////////////////////////////////////////// @@ -220,14 +220,14 @@ int MetNcMetDataFile::index(VarInfo &vinfo) { NcVarInfo *ncinfo = MetNc->find_var_name( vinfo.name().c_str() ); - if( !ncinfo ) return(-1); + if( !ncinfo ) return -1; if( ( vinfo.valid() != 0 && ncinfo->ValidTime != vinfo.valid() ) || ( vinfo.init() != 0 && ncinfo->InitTime != vinfo.init() ) || ( !is_bad_data(vinfo.lead()) && ncinfo->lead_time() != vinfo.lead() ) ) - return(-1); + return -1; - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index 7ae924bd34..67fdd3ca1d 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -183,7 +183,7 @@ int has_variable(NcFile *f_in, const char *var_name) { // found = (has_var(f_in, var_name) ? 1 : 0); - return(found); + return found; } /////////////////////////////////////////////////////////////////////////////// @@ -216,7 +216,7 @@ LatLonData get_latlon_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -257,7 +257,7 @@ RotatedLatLonData get_rot_latlon_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -314,7 +314,7 @@ LambertData get_lambert_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -374,7 +374,7 @@ LaeaData get_laea_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -431,7 +431,7 @@ StereographicData get_stereographic_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -465,7 +465,7 @@ MercatorData get_mercator_data(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -498,7 +498,7 @@ LatLonData get_latlon_data_v2(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -550,7 +550,7 @@ LambertData get_lambert_data_v2(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -605,7 +605,7 @@ StereographicData get_stereographic_data_v2(NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -639,7 +639,7 @@ MercatorData get_mercator_data_v2(NcFile * ncfile) { data.dump(); - return(data); + return data; } @@ -663,7 +663,7 @@ GaussianData get_gaussian_data (NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// @@ -681,7 +681,7 @@ SemiLatLonData get_semilatlon_data (NcFile * ncfile) { data.dump(); - return(data); + return data; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/met_file.cc b/src/libcode/vx_data2d_nc_met/met_file.cc index 443fe6ff60..0f3a40fd4d 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.cc +++ b/src/libcode/vx_data2d_nc_met/met_file.cc @@ -155,7 +155,7 @@ close(); Nc = open_ncfile(filename); -if ( IS_INVALID_NC_P(Nc) ) { close(); return ( false ); } +if ( IS_INVALID_NC_P(Nc) ) { close(); return false; } // // grid @@ -280,7 +280,7 @@ for (j=0; jvar, a, plane); @@ -653,7 +653,7 @@ plane.set_accum ( info->AccumTime ); // done // -return ( found ); +return found; } diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc index 338d83e8f4..f263d5b399 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc @@ -67,11 +67,11 @@ VarInfoNcMet::VarInfoNcMet(const VarInfoNcMet &f) { VarInfoNcMet & VarInfoNcMet::operator=(const VarInfoNcMet &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -257,9 +257,9 @@ bool VarInfoNcMet::is_precipitation() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any precipitation variables. // - return(has_prefix(grib_precipitation_abbr, + return has_prefix(grib_precipitation_abbr, n_grib_precipitation_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -277,9 +277,9 @@ bool VarInfoNcMet::is_specific_humidity() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any specific humidity variables. // - return(has_prefix(grib_specific_humidity_abbr, + return has_prefix(grib_specific_humidity_abbr, n_grib_specific_humidity_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -293,7 +293,7 @@ bool VarInfoNcMet::is_u_wind() const { return(SetAttrIsUWind != 0); } - return(is_grib_code_abbr_match(Name, ugrd_grib_code)); + return is_grib_code_abbr_match(Name, ugrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -307,7 +307,7 @@ bool VarInfoNcMet::is_v_wind() const { return(SetAttrIsVWind != 0); } - return(is_grib_code_abbr_match(Name, vgrd_grib_code)); + return is_grib_code_abbr_match(Name, vgrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -321,7 +321,7 @@ bool VarInfoNcMet::is_wind_speed() const { return(SetAttrIsWindSpeed != 0); } - return(is_grib_code_abbr_match(Name, wind_grib_code)); + return is_grib_code_abbr_match(Name, wind_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -335,7 +335,7 @@ bool VarInfoNcMet::is_wind_direction() const { return(SetAttrIsWindDirection != 0); } - return(is_grib_code_abbr_match(Name, wdir_grib_code)); + return is_grib_code_abbr_match(Name, wdir_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -348,7 +348,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { ConcatString abbr_str; bool match = false; - if(str.empty()) return(false); + if(str.empty()) return false; // // Use the default GRIB1 parameter table version number 2 @@ -361,7 +361,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { // if(strncasecmp(str.c_str(), abbr_str.c_str(), abbr_str.length()) == 0) match = true; - return(match); + return match; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc index e249856a7a..79f6f5683c 100644 --- a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc @@ -93,7 +93,7 @@ bool MetNcWrfDataFile::open(const char * _filename) { << "unable to open NetCDF file \"" << _filename << "\"\n\n"; close(); - return(false); + return false; } Filename = _filename; @@ -106,7 +106,7 @@ bool MetNcWrfDataFile::open(const char * _filename) { (*Dest_Grid) = (*Raw_Grid); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -191,7 +191,7 @@ bool MetNcWrfDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) { } } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -276,7 +276,7 @@ int MetNcWrfDataFile::data_plane_array(VarInfo &vinfo, } // Check for bad status - if(!status) return(0); + if(!status) return 0; // Add current plane to the data plane array plane_array.add(cur_plane, pressure, pressure); @@ -302,7 +302,7 @@ int MetNcWrfDataFile::data_plane_array(VarInfo &vinfo, << "-" << nint(min_level); vinfo.set_level_name(level_str.c_str()); - return(n_level); + return n_level; } //////////////////////////////////////////////////////////////////////// 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 7f32821921..a6d6a28ca6 100644 --- a/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc +++ b/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc @@ -77,7 +77,7 @@ NcFile nc(wrf_filename, NcFile::read); status = get_wrf_grid(nc, grid); -return ( status ); +return status; } @@ -118,7 +118,7 @@ else { // done // -return ( status ); +return status; } @@ -199,7 +199,7 @@ grid.set(data); data.dump(); -return ( true ); +return true; } @@ -282,7 +282,7 @@ grid.set(data); data.dump(); -return ( true ); +return true; } @@ -387,7 +387,7 @@ grid.set(data); data.dump(); -return ( true ); +return true; } @@ -405,7 +405,7 @@ lon_rad = lon*rad_per_deg; u = -lon_rad; -return ( u ); +return u; } @@ -421,7 +421,7 @@ double v; v = log(tand(45.0 + 0.5*lat)); -return ( v ); +return v; } diff --git a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc index 62c1d9c834..e4be5ed3ba 100644 --- a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc @@ -63,11 +63,11 @@ VarInfoNcWrf::VarInfoNcWrf(const VarInfoNcWrf &f) { VarInfoNcWrf & VarInfoNcWrf::operator=(const VarInfoNcWrf &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -308,9 +308,9 @@ bool VarInfoNcWrf::is_precipitation() const { // Check to see if the VarInfo name matches any of expected Pinterp // precipitation variables. // - return(has_prefix(pinterp_precipitation_names, + return has_prefix(pinterp_precipitation_names, n_pinterp_precipitation_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -328,9 +328,9 @@ bool VarInfoNcWrf::is_specific_humidity() const { // Check to see if the VarInfo name matches any of expected Pinterp // specific humidity variables. // - return(has_prefix(pinterp_specific_humidity_names, + return has_prefix(pinterp_specific_humidity_names, n_pinterp_specific_humidity_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -353,9 +353,9 @@ bool VarInfoNcWrf::is_u_wind() const { // Check to see if the VarInfo name matches any of expected Pinterp // U-component of wind variables. // - return(has_prefix(pinterp_u_wind_names, + return has_prefix(pinterp_u_wind_names, n_pinterp_u_wind_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -378,9 +378,9 @@ bool VarInfoNcWrf::is_v_wind() const { // Check to see if the VarInfo name matches any of expected Pinterp // V-component of wind variables. // - return(has_prefix(pinterp_v_wind_names, + return has_prefix(pinterp_v_wind_names, n_pinterp_v_wind_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -398,9 +398,9 @@ bool VarInfoNcWrf::is_wind_speed() const { // Check to see if the VarInfo name matches any of expected Pinterp // wind speed variables. // - return(has_prefix(pinterp_wind_speed_names, + return has_prefix(pinterp_wind_speed_names, n_pinterp_wind_speed_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -414,7 +414,7 @@ bool VarInfoNcWrf::is_wind_direction() const { return(SetAttrIsWindDirection != 0); } - return(false); + return false; } @@ -426,9 +426,9 @@ bool VarInfoNcWrf::is_grid_relative() const { // Check to see if the VarInfo name matches any of expected Pinterp // variables that should be rotated from grid-relative to earth-relative. // - return(has_prefix(pinterp_grid_relative_names, + return has_prefix(pinterp_grid_relative_names, n_pinterp_grid_relative_names, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc index 19c99b6de8..922f7926e1 100644 --- a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc +++ b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc @@ -195,13 +195,13 @@ Nc = open_ncfile(filename); mlog << Debug(5) << "\n" << method_name << "open \"" << filename << "\".\n\n"; -if ( IS_INVALID_NC_P(Nc) ) { close(); return ( false ); } +if ( IS_INVALID_NC_P(Nc) ) { close(); return false; } // // grid // -if ( !get_wrf_grid(*Nc, grid) ) { close(); return ( false ); } +if ( !get_wrf_grid(*Nc, grid) ) { close(); return false; } // // dimensions @@ -224,7 +224,7 @@ for (j=0; j= Ntimes) ) { } -return ( Time [n] ); +return Time[n]; } @@ -496,7 +496,7 @@ if ( (n < 0) || (n >= Ntimes) ) { unixtime dt = Time[n] - InitTime; -return ( (int) dt ); +return (int) dt; } @@ -557,7 +557,7 @@ if ( !status ) { // done // -return ( d ); +return d; } @@ -575,7 +575,7 @@ if ( !args_ok(a) ) { a.dump(cerr); - return ( false ); + return false; } @@ -596,7 +596,7 @@ if (dim_count >= max_wrf_args ) { mlog << Warning << "\n" << method_name << " too may arguments for variable \"" << (var_name) << "\"\n\n"; - return ( false ); + return false; } @@ -628,7 +628,7 @@ if ( !found ) { mlog << Warning << "\n" << method_name << "variable " << (var_name) << " not found!\n\n"; - return ( false ); + return false; } @@ -658,7 +658,7 @@ if ( !found ) { mlog << Error << "\n" << method_name << "X Dimension \"" << x_dim_subgrid_name << "\" is not supported.\n\n"; - return ( false ); + return false; } @@ -682,7 +682,7 @@ if ( !found ) { mlog << Error << "\n" << method_name << "Y Dimension \"" << y_dim_subgrid_name << "\" is not supported.\n\n"; - return ( false ); + return false; } @@ -787,7 +787,7 @@ if ( var == nullptr || (var->x_slot < 0) || (var->y_slot < 0) ) { << "can't find needed dimensions(s) for variable \"" << var_name << "\" ... one of the dimensions may be staggered.\n\n"; - return ( false ); + return false; } @@ -807,7 +807,7 @@ for (j=0; j<(a.n_elements()); ++j) { mlog << Warning << "\n" << method_name << " star found in bad slot\n\n"; - return ( false ); + return false; } @@ -819,7 +819,7 @@ if ( count != 2 ) { mlog << Warning << "\n" << method_name << " bad star count ... " << count << "\n\n"; - return ( false ); + return false; } @@ -835,7 +835,7 @@ if ( (x_slot < 0) || (y_slot < 0) ) { mlog << Warning << "\n" << method_name << " bad x|y slot\n\n"; - return ( false ); + return false; } @@ -905,7 +905,7 @@ if ( P && z_slot > 0 ) { // done // -return ( true ); +return true; } @@ -922,7 +922,7 @@ bool WrfFile::data(const char * var_name, const LongArray & a, DataPlane & plane if (nullptr != info) found = true; else found = get_nc_var_info(var_name, info); - if ( !found ) return ( false ); + if ( !found ) return false; found = data(info->var, a, plane, pressure); @@ -955,7 +955,7 @@ bool WrfFile::data(const char * var_name, const LongArray & a, DataPlane & plane // done // - return ( found ); + return found; } @@ -1018,7 +1018,7 @@ if ( j != 6 ) { t = mdyhms_to_unix(month, day, year, hour, minute, second); -return ( t ); +return t; } @@ -1030,8 +1030,8 @@ bool is_bad_data_wrf(double v) { -if (v < wrf_missing ) return ( false ); -else return ( true ); +if (v < wrf_missing ) return false; +else return true; } @@ -1052,7 +1052,7 @@ for ( j=0; j " << "an error occurred initializing python\n\n"; - return ( false ); + return false; } @@ -435,7 +435,7 @@ if ( PyErr_Occurred() ) { << "an error occurred importing module " << '\"' << path << "\"\n\n"; - return ( false ); + return false; } @@ -444,7 +444,7 @@ if ( ! module_obj ) { mlog << Warning << "\ntmp_nc_dataplane() -> " << "error running python script\n\n"; - return ( false ); + return false; } @@ -495,7 +495,7 @@ remove_temp_file(tmp_nc_path); // done // -return ( true ); +return true; } diff --git a/src/libcode/vx_data2d_python/var_info_python.cc b/src/libcode/vx_data2d_python/var_info_python.cc index 62bbdcd7aa..02c4eb2daa 100644 --- a/src/libcode/vx_data2d_python/var_info_python.cc +++ b/src/libcode/vx_data2d_python/var_info_python.cc @@ -66,11 +66,11 @@ VarInfoPython::VarInfoPython(const VarInfoPython &f) { VarInfoPython & VarInfoPython::operator=(const VarInfoPython &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -196,7 +196,7 @@ bool VarInfoPython::is_precipitation() const { return(SetAttrIsPrecipitation != 0); } - return ( false ); + return false; } @@ -212,7 +212,7 @@ bool VarInfoPython::is_specific_humidity() const { return(SetAttrIsSpecificHumidity != 0); } - return ( false ); + return false; } @@ -228,7 +228,7 @@ bool VarInfoPython::is_u_wind() const { return(SetAttrIsUWind != 0); } - return ( false ); + return false; } @@ -244,7 +244,7 @@ bool VarInfoPython::is_v_wind() const { return(SetAttrIsVWind != 0); } - return ( false ); + return false; } @@ -260,7 +260,7 @@ bool VarInfoPython::is_wind_speed() const { return(SetAttrIsWindSpeed != 0); } - return ( false ); + return false; } @@ -276,7 +276,7 @@ bool VarInfoPython::is_wind_direction() const { return(SetAttrIsWindDirection != 0); } - return ( false ); + return false; } diff --git a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc index cc9f0debc2..25e5f3ef6f 100644 --- a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc +++ b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc @@ -152,7 +152,7 @@ bool MetUGridDataFile::open_metadata(const char * _filename) { (*Dest_Grid) = (*Raw_Grid); //Dest_Grid->set(*_file->grid.info().us); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -417,7 +417,7 @@ LongArray MetUGridDataFile::collect_time_offsets(VarInfo &vinfo) { mlog << Warning << "\n" << method_name << "can't find NetCDF variable \"" << vinfo_nc->req_name() << "\" in file \"" << Filename << "\".\n\n"; - return(time_offsets); + return time_offsets; } int time_dim_slot = info->t_slot; @@ -426,7 +426,7 @@ LongArray MetUGridDataFile::collect_time_offsets(VarInfo &vinfo) { // The time dimension does not exist at the variable and the time // variable exists. Stop time slicing and set the time offset to 0. time_offsets.add(0); - return(time_offsets); + return time_offsets; } double time_lower = bad_data_double; @@ -604,7 +604,7 @@ LongArray MetUGridDataFile::collect_time_offsets(VarInfo &vinfo) { exit(1); } - return(time_offsets); + return time_offsets; } @@ -626,7 +626,7 @@ LongArray MetUGridDataFile::collect_vertical_offsets(VarInfo &vinfo) { mlog << Warning << "\n" << method_name << "can't find NetCDF variable \"" << vinfo_nc->req_name() << "\" in file \"" << Filename << "\".\n\n"; - return(vertical_offsets); + return vertical_offsets; } int z_dim_slot = info->z_slot; @@ -635,7 +635,7 @@ LongArray MetUGridDataFile::collect_vertical_offsets(VarInfo &vinfo) { // The vertical dimension does not exist at the variable and the vertical // variable exists. Stop vertical slicing and set the vertical offset to 0. vertical_offsets.add(0); - return(vertical_offsets); + return vertical_offsets; } double z_lower = bad_data_double; @@ -815,7 +815,7 @@ LongArray MetUGridDataFile::collect_vertical_offsets(VarInfo &vinfo) { exit(1); } - return(vertical_offsets); + return vertical_offsets; } */ diff --git a/src/libcode/vx_data2d_ugrid/var_info_ugrid.cc b/src/libcode/vx_data2d_ugrid/var_info_ugrid.cc index d9784e713c..45c1cbdfbc 100644 --- a/src/libcode/vx_data2d_ugrid/var_info_ugrid.cc +++ b/src/libcode/vx_data2d_ugrid/var_info_ugrid.cc @@ -67,11 +67,11 @@ VarInfoUGrid::VarInfoUGrid(const VarInfoUGrid &f) { VarInfoUGrid & VarInfoUGrid::operator=(const VarInfoUGrid &f) { - if ( this == &f ) return ( *this ); + if ( this == &f ) return *this; assign(f); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -386,9 +386,9 @@ bool VarInfoUGrid::is_precipitation() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any precipitation variables. // - return(has_prefix(grib_precipitation_abbr, + return has_prefix(grib_precipitation_abbr, n_grib_precipitation_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -406,9 +406,9 @@ bool VarInfoUGrid::is_specific_humidity() const { // Check to see if the VarInfo name begins with the GRIB code abbreviation // for any specific humidity variables. // - return(has_prefix(grib_specific_humidity_abbr, + return has_prefix(grib_specific_humidity_abbr, n_grib_specific_humidity_abbr, - Name.c_str())); + Name.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -422,7 +422,7 @@ bool VarInfoUGrid::is_u_wind() const { return(SetAttrIsUWind != 0); } - return(is_grib_code_abbr_match(Name, ugrd_grib_code)); + return is_grib_code_abbr_match(Name, ugrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -436,7 +436,7 @@ bool VarInfoUGrid::is_v_wind() const { return(SetAttrIsVWind != 0); } - return(is_grib_code_abbr_match(Name, vgrd_grib_code)); + return is_grib_code_abbr_match(Name, vgrd_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -450,7 +450,7 @@ bool VarInfoUGrid::is_wind_speed() const { return(SetAttrIsWindSpeed != 0); } - return(is_grib_code_abbr_match(Name, wind_grib_code)); + return is_grib_code_abbr_match(Name, wind_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -464,7 +464,7 @@ bool VarInfoUGrid::is_wind_direction() const { return(SetAttrIsWindDirection != 0); } - return(is_grib_code_abbr_match(Name, wdir_grib_code)); + return is_grib_code_abbr_match(Name, wdir_grib_code); } /////////////////////////////////////////////////////////////////////////////// @@ -477,7 +477,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { ConcatString abbr_str; bool match = false; - if(str.empty()) return(false); + if(str.empty()) return false; // // Use the default GRIB1 parameter table version number 2 @@ -490,7 +490,7 @@ bool is_grib_code_abbr_match(const ConcatString &str, int grib_code) { // if(strncasecmp(str.c_str(), abbr_str.c_str(), abbr_str.length()) == 0) match = true; - return(match); + return match; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_geodesy/spheroid.cc b/src/libcode/vx_geodesy/spheroid.cc index 6f71fcfe76..3f13de75be 100644 --- a/src/libcode/vx_geodesy/spheroid.cc +++ b/src/libcode/vx_geodesy/spheroid.cc @@ -160,11 +160,11 @@ Spheroid & Spheroid::operator=(const Spheroid & g) { -if ( this == &g ) return ( * this ); +if ( this == &g ) return *this; assign(g); -return ( * this ); +return *this; } @@ -435,7 +435,7 @@ q = t1 - t2; q *= 1.0 - E2; -return ( q ); +return q; } @@ -447,7 +447,7 @@ double Spheroid::qp_direct() const { -if ( is_sphere() ) return ( 2.0 ); +if ( is_sphere() ) return 2.0; double Qp; @@ -459,7 +459,7 @@ Qp = log( (1.0 - E)/(1.0 + E) ); Qp = 1.0 - ((1.0 - E*E)*Qp)/(2.0*E); -return ( Qp ); +return Qp; } @@ -471,7 +471,7 @@ double Spheroid::rq_km() const { -if ( is_sphere() ) return ( A_km ); +if ( is_sphere() ) return A_km; double r; @@ -483,7 +483,7 @@ r = sqrt(0.5*qp); r *= A_km; -return ( r ); +return r; } @@ -495,7 +495,7 @@ double Spheroid::beta(double lat) const { -if ( is_sphere() ) return ( lat ); +if ( is_sphere() ) return lat; double q, qp; @@ -507,7 +507,7 @@ q = q_func(lat); qp = qp_direct(); -return ( asind(q/qp) ); +return asind(q/qp); } @@ -529,7 +529,7 @@ m = sqrt( 1.0 - E*E*s*s ); m = c/m; -return ( m ); +return m; } @@ -557,7 +557,7 @@ t = b/a; e = sqrt( 1.0 - t*t ); -return ( e ); +return e; } @@ -577,7 +577,7 @@ t = b/a; f = 1.0 - t; -return ( f ); +return f; } @@ -595,7 +595,7 @@ double u; u = atan2d(b*sind(phi), a*cosd(phi)); -return ( u ); +return u; } @@ -613,7 +613,7 @@ double phi; phi = atan2d(a*sind(u), b*cosd(u)); -return ( phi ); +return phi; } diff --git a/src/libcode/vx_gis/dbf_file.cc b/src/libcode/vx_gis/dbf_file.cc index 66361dd7e4..248b2249a1 100644 --- a/src/libcode/vx_gis/dbf_file.cc +++ b/src/libcode/vx_gis/dbf_file.cc @@ -79,11 +79,11 @@ DbfHeader & DbfHeader::operator=(const DbfHeader & h) { -if ( this == &h ) return ( * this ); +if ( this == &h ) return *this; assign(h); -return ( * this ); +return *this; } @@ -383,7 +383,7 @@ for (j=0; j>(ShpFile &, ShpPointRecord &) -> trouble reading record header from shp file \"" @@ -160,7 +160,7 @@ record.set(xy_buf); // done // -return ( true ); +return true; } diff --git a/src/libcode/vx_gis/shp_poly_record.cc b/src/libcode/vx_gis/shp_poly_record.cc index 5a9c46749e..c86e11010c 100644 --- a/src/libcode/vx_gis/shp_poly_record.cc +++ b/src/libcode/vx_gis/shp_poly_record.cc @@ -249,7 +249,7 @@ if ( (k < 0) || (k >= n_points) ) { } -return ( points[k].y ); +return points[k].y; } @@ -272,7 +272,7 @@ if ( (k < 0) || (k >= n_points) ) { double t = points[k].x; -return ( -t ); +return -t; } @@ -294,7 +294,7 @@ if ( (partno < 0) || (partno >= n_parts) ) { } -return ( parts[partno] ); +return parts[partno]; } @@ -372,7 +372,7 @@ unsigned char rh_buf[shp_record_header_bytes]; if ( ! file.read(rh_buf, shp_record_header_bytes) ) { - if ( file.at_eof() ) return ( false ); + if ( file.at_eof() ) return false; mlog << Error << "\n\n operator>>(ShpFile &, ShpPolyRecord &) -> trouble reading record header from shp file \"" @@ -417,7 +417,7 @@ record.set((unsigned char *) Buf); // done // -return ( true ); +return true; } diff --git a/src/libcode/vx_gnomon/gnomon.cc b/src/libcode/vx_gnomon/gnomon.cc index 7e60ff86d3..5a95ff7e85 100644 --- a/src/libcode/vx_gnomon/gnomon.cc +++ b/src/libcode/vx_gnomon/gnomon.cc @@ -103,11 +103,11 @@ GnomonicProjection & GnomonicProjection::operator=(const GnomonicProjection & g) { -if ( this == &g ) return ( * this ); +if ( this == &g ) return *this; assign(g); -return ( * this ); +return *this; } @@ -215,7 +215,7 @@ pz = sind(lat); p_dot_b3 = px*Ux + py*Uy + pz*Uz; -if ( p_dot_b3 <= 0.0 ) return ( 0 ); +if ( p_dot_b3 <= 0.0 ) return 0; p_dot_b1 = px*Ex + py*Ey + pz*Ez; p_dot_b2 = px*Nx + py*Ny + pz*Nz; @@ -225,7 +225,7 @@ u = p_dot_b1/p_dot_b3; v = p_dot_b2/p_dot_b3; -return ( 1 ); +return 1; } diff --git a/src/libcode/vx_grid/earth_rotation.cc b/src/libcode/vx_grid/earth_rotation.cc index 09badf97d3..1b93c8743c 100644 --- a/src/libcode/vx_grid/earth_rotation.cc +++ b/src/libcode/vx_grid/earth_rotation.cc @@ -205,7 +205,7 @@ SO3::forward(V.x(), V.y(), V.z(), xx, yy, zz); VV.set_xyz(xx, yy, zz); -return ( VV ); +return VV; } */ @@ -225,7 +225,7 @@ SO3::reverse(V.x(), V.y(), V.z(), xx, yy, zz); VV.set_xyz(xx, yy, zz); -return ( VV ); +return VV; } */ diff --git a/src/libcode/vx_grid/find_grid_by_name.cc b/src/libcode/vx_grid/find_grid_by_name.cc index 30fda12c24..3b155585ef 100644 --- a/src/libcode/vx_grid/find_grid_by_name.cc +++ b/src/libcode/vx_grid/find_grid_by_name.cc @@ -51,7 +51,7 @@ bool status = false; status = find_grid_by_name(name, i); -if ( !status || !(i.ok()) ) return ( false ); +if ( !status || !(i.ok()) ) return false; status = false; @@ -69,7 +69,7 @@ if ( i.sl ) { g.set( *(i.sl) ); status = true; } if ( i.us ) { g.set( *(i.us) ); status = true; } #endif -return ( status ); +return status; } @@ -95,7 +95,7 @@ for (j=0; j " << "polar stereographic grid spec should have 10 entries\n\n"; - return ( false ); + return false; } @@ -493,7 +493,7 @@ if ( ToGrid ) { delete ToGrid; ToGrid = (Grid *) 0; } // -return ( true ); +return true; } @@ -573,7 +573,7 @@ if ( ToGrid ) { delete ToGrid; ToGrid = (Grid *) 0; } // -return ( true ); +return true; } @@ -664,7 +664,7 @@ if ( ToGrid ) { delete ToGrid; ToGrid = (Grid *) 0; } // -return ( true ); +return true; } @@ -745,7 +745,7 @@ if ( ToGrid ) { delete ToGrid; ToGrid = (Grid *) 0; } // -return ( true ); +return true; } @@ -814,7 +814,7 @@ if ( ToGrid ) { delete ToGrid; ToGrid = (Grid *) 0; } // -return ( true ); +return true; } diff --git a/src/libcode/vx_grid/gaussian_grid.cc b/src/libcode/vx_grid/gaussian_grid.cc index eccea8d55b..92cd493b41 100644 --- a/src/libcode/vx_grid/gaussian_grid.cc +++ b/src/libcode/vx_grid/gaussian_grid.cc @@ -290,7 +290,7 @@ area *= sind(lat_top) - sind(lat_bot); area *= earth_radius_km*earth_radius_km; -return ( area ); +return area; } @@ -302,7 +302,7 @@ int GaussianGrid::nx() const { -return ( Nx ); +return Nx; } @@ -314,7 +314,7 @@ int GaussianGrid::ny() const { -return ( Ny ); +return Ny; } @@ -326,7 +326,7 @@ ConcatString GaussianGrid::name() const { -return ( Name ); +return Name; } @@ -384,7 +384,7 @@ a << "Ny: " << Ny; // done // -return ( a ); +return a; } @@ -401,7 +401,7 @@ GridInfo i; i.set( Data ); -return ( i ); +return i; } @@ -419,7 +419,7 @@ double GaussianGrid::rot_grid_to_earth(int x, int y) const // need to be changed when support is added for GRIB2. // -return ( 0.0 ); +return 0.0; } @@ -431,7 +431,7 @@ bool GaussianGrid::wrap_lon() const { -return ( true ); +return true; } @@ -461,7 +461,7 @@ GaussianGrid * p = new GaussianGrid (Data); p->Name = Name; -return ( p ); +return p; } diff --git a/src/libcode/vx_grid/goes_grid.cc b/src/libcode/vx_grid/goes_grid.cc index 76c8f5e51d..5ffa5cbd90 100644 --- a/src/libcode/vx_grid/goes_grid.cc +++ b/src/libcode/vx_grid/goes_grid.cc @@ -172,7 +172,7 @@ double sum = 0; mlog << Error << "\n" << method_name << " -> " << "is not implemented.\n\n"; -return ( sum ); +return sum; } @@ -183,7 +183,7 @@ int GoesImagerGrid::nx() const { -return ( Nx ); +return Nx; } @@ -195,7 +195,7 @@ int GoesImagerGrid::ny() const { -return ( Ny ); +return Ny; } @@ -207,7 +207,7 @@ ConcatString GoesImagerGrid::name() const { -return ( Name ); +return Name; } @@ -268,7 +268,7 @@ a << "Ny: " << Ny; // done // -return ( a ); +return a; } @@ -284,7 +284,7 @@ GridInfo i; i.set(Data); -return ( i ); +return i; } @@ -301,7 +301,7 @@ double GoesImagerGrid::rot_grid_to_earth(int x, int y) const // for the Mercator projection in it's standard aspect // -return ( 0.0 ); +return 0.0; } @@ -313,7 +313,7 @@ bool GoesImagerGrid::wrap_lon() const { -return ( false ); +return false; } @@ -346,7 +346,7 @@ GoesImagerGrid * p = new GoesImagerGrid (Data); p->Name = Name; -return ( p ); +return p; } diff --git a/src/libcode/vx_grid/grid_base.cc b/src/libcode/vx_grid/grid_base.cc index d3b0cfee26..5a62372bd3 100644 --- a/src/libcode/vx_grid/grid_base.cc +++ b/src/libcode/vx_grid/grid_base.cc @@ -1042,7 +1042,7 @@ double Grid::calc_area(int x, int y) const { -if ( !rep ) return ( 0.0 ); +if ( !rep ) return 0.0; return rep->calc_area(x, y); @@ -1056,7 +1056,7 @@ int Grid::nx() const { -if ( !rep ) return ( 0 ); +if ( !rep ) return 0; return rep->nx(); @@ -1070,7 +1070,7 @@ int Grid::ny() const { -if ( !rep ) return ( 0 ); +if ( !rep ) return 0; return rep->ny(); diff --git a/src/libcode/vx_grid/latlon_grid.cc b/src/libcode/vx_grid/latlon_grid.cc index 4b9920d5e7..1e42a43963 100644 --- a/src/libcode/vx_grid/latlon_grid.cc +++ b/src/libcode/vx_grid/latlon_grid.cc @@ -207,7 +207,7 @@ area = ( sin(lat_top_rad) - sin(lat_bottom_rad) )*delta_lon_rad; area = fabs(area)*earth_radius_km*earth_radius_km; -return ( area ); +return area; } @@ -219,7 +219,7 @@ int LatLonGrid::nx() const { -return ( Nx ); +return Nx; } @@ -231,7 +231,7 @@ int LatLonGrid::ny() const { -return ( Ny ); +return Ny; } @@ -243,7 +243,7 @@ ConcatString LatLonGrid::name() const { -return ( Name ); +return Name; } @@ -311,7 +311,7 @@ snprintf(junk, sizeof(junk), "wrapLon: %s", bool_to_string(wrapLon)); a << jun // done // -return ( a ); +return a; } @@ -327,7 +327,7 @@ GridInfo i; i.set( Data ); -return ( i ); +return i; } @@ -345,7 +345,7 @@ double LatLonGrid::rot_grid_to_earth(int x, int y) const // need to be changed when support is added for GRIB2. // -return ( 0.0 ); +return 0.0; } @@ -403,7 +403,7 @@ LatLonGrid * p = new LatLonGrid (Data); p->Name = Name; -return ( p ); +return p; } diff --git a/src/libcode/vx_grid/lc_grid.cc b/src/libcode/vx_grid/lc_grid.cc index 7049f60d94..08b45f2510 100644 --- a/src/libcode/vx_grid/lc_grid.cc +++ b/src/libcode/vx_grid/lc_grid.cc @@ -226,7 +226,7 @@ double LambertGrid::f(double lat) const { -return ( lc_func(lat, Cone, IsNorthHemisphere) ); +return lc_func(lat, Cone, IsNorthHemisphere); } @@ -238,7 +238,7 @@ double LambertGrid::df(double lat) const { -return ( lc_der_func(lat, Cone, IsNorthHemisphere) ); +return lc_der_func(lat, Cone, IsNorthHemisphere); } @@ -349,7 +349,7 @@ sum = uv_closedpolyline_area(u, v, 4); sum *= earth_radius_km*earth_radius_km; -return ( sum ); +return sum; } @@ -361,7 +361,7 @@ int LambertGrid::nx() const { -return ( Nx ); +return Nx; } @@ -373,7 +373,7 @@ int LambertGrid::ny() const { -return ( Ny ); +return Ny; } @@ -385,7 +385,7 @@ ConcatString LambertGrid::name() const { -return ( Name ); +return Name; } @@ -413,7 +413,7 @@ for (j=0; jName = Name; -return ( p ); +return p; } @@ -719,7 +719,7 @@ r = tand(45.0 - 0.5*H*lat); r = pow(r, Cone); -return ( r ); +return r; } @@ -738,7 +738,7 @@ lat = 90.0 - 2.0*atand(pow(r, 1.0/Cone)); lat *= H; -return ( lat ); +return lat; } @@ -757,7 +757,7 @@ a = -(Cone/cosd(lat))*lc_func(lat, Cone, is_north); a *= H; -return ( a ); +return a; } @@ -849,7 +849,7 @@ rom = t[i]; rom *= (2.0/c)*(u0*v1 - u1*v0); -return ( rom ); +return rom; } @@ -875,7 +875,7 @@ e_top = e_bot - 1.0; answer = pow(r2, e_top)/(1.0 + pow(r2, e_bot)); -return ( answer ); +return answer; } @@ -938,7 +938,7 @@ if ( fabs(lat1 - lat2) < tol ) { cone = sind(H*lat1); - return ( cone ); + return cone; } @@ -955,7 +955,7 @@ b = tand(45.0 - 0.5*H*lat1)/tand(45.0 - 0.5*H*lat2); cone = log(t)/log(b); -return ( cone ); +return cone; } @@ -1025,7 +1025,7 @@ g_new.set(data); // done // -return ( g_new ); +return g_new; } diff --git a/src/libcode/vx_grid/merc_grid.cc b/src/libcode/vx_grid/merc_grid.cc index 015109db2c..2da8b88491 100644 --- a/src/libcode/vx_grid/merc_grid.cc +++ b/src/libcode/vx_grid/merc_grid.cc @@ -213,7 +213,7 @@ double MercatorGrid::f(double lat) const { -return ( merc_func(lat/deg_per_rad) ); +return merc_func(lat/deg_per_rad); } @@ -225,7 +225,7 @@ double MercatorGrid::df(double lat) const { -return ( merc_der_func(lat/deg_per_rad) ); +return merc_der_func(lat/deg_per_rad); } @@ -302,7 +302,7 @@ sum = uv_closedpolyline_area(u, v, 4); sum *= earth_radius_km*earth_radius_km; -return ( sum ); +return sum; } @@ -314,7 +314,7 @@ int MercatorGrid::nx() const { -return ( Nx ); +return Nx; } @@ -326,7 +326,7 @@ int MercatorGrid::ny() const { -return ( Ny ); +return Ny; } @@ -338,7 +338,7 @@ ConcatString MercatorGrid::name() const { -return ( Name ); +return Name; } @@ -366,7 +366,7 @@ for (j=0; jName = Name; -return ( p ); +return p; } @@ -623,7 +623,7 @@ double v; v = log(tan(piover4 + 0.5*lat_rad)); -return ( v ); +return v; } @@ -639,7 +639,7 @@ double lat_rad; lat_rad = 2.0*atan(exp(v)) - piover2; -return ( lat_rad ); +return lat_rad; } @@ -655,7 +655,7 @@ double a; a = 1.0/(cos(lat_rad)); -return ( a ); +return a; } @@ -688,7 +688,7 @@ if ( fabs(delta_v) < 1.0e-4 ) { answer = delta_u*(1.0 - tanh(v0)); - return ( answer ); + return answer; } @@ -705,7 +705,7 @@ answer = (delta_u/delta_v)*(b1 - b0); // done // -return ( answer ); +return answer; } @@ -723,7 +723,7 @@ lon_rad -= twopi*floor((lon_rad - lon_min)/twopi); u = -lon_rad; -return ( u ); +return u; } @@ -741,7 +741,7 @@ lon_rad = -u; lon_rad -= twopi*floor((lon_rad - lon_min)/twopi); -return ( lon_rad ); +return lon_rad; } diff --git a/src/libcode/vx_grid/rot_latlon_grid.cc b/src/libcode/vx_grid/rot_latlon_grid.cc index a5df5a3bfc..abd4ff0f38 100644 --- a/src/libcode/vx_grid/rot_latlon_grid.cc +++ b/src/libcode/vx_grid/rot_latlon_grid.cc @@ -235,7 +235,7 @@ double RotatedLatLonGrid::calc_area(int x, int y) const double area = LatLonGrid::calc_area(x, y); -return ( area ); +return area; } @@ -248,7 +248,7 @@ int RotatedLatLonGrid::nx() const { -return ( Nx ); +return Nx; } @@ -260,7 +260,7 @@ int RotatedLatLonGrid::ny() const { -return ( Ny ); +return Ny; } @@ -272,7 +272,7 @@ ConcatString RotatedLatLonGrid::name() const { -return ( Name ); +return Name; } @@ -330,7 +330,7 @@ snprintf(junk, sizeof(junk), "aux_rotation: %.3f", RData.aux_rotation); a << j // done // -return ( a ); +return a; } @@ -346,7 +346,7 @@ GridInfo i; i.set( RData ); -return ( i ); +return i; } @@ -364,7 +364,7 @@ double RotatedLatLonGrid::rot_grid_to_earth(int x, int y) const // need to be changed when support is added for GRIB2. // -return ( 0.0 ); +return 0.0; } @@ -397,7 +397,7 @@ RotatedLatLonGrid * p = new RotatedLatLonGrid (RData); p->Name = Name; -return ( p ); +return p; } diff --git a/src/libcode/vx_grid/semilatlon_grid.cc b/src/libcode/vx_grid/semilatlon_grid.cc index c188025882..5722a0a0f1 100644 --- a/src/libcode/vx_grid/semilatlon_grid.cc +++ b/src/libcode/vx_grid/semilatlon_grid.cc @@ -273,7 +273,7 @@ double SemiLatLonGrid::calc_area(int x, int y) const // Grid cell area is not defined for semilatlon grids -return ( bad_data_double ); +return bad_data_double; } @@ -285,7 +285,7 @@ int SemiLatLonGrid::nx() const { -return ( Nx ); +return Nx; } @@ -297,7 +297,7 @@ int SemiLatLonGrid::ny() const { -return ( Ny ); +return Ny; } @@ -309,7 +309,7 @@ ConcatString SemiLatLonGrid::name() const { -return ( Name ); +return Name; } @@ -383,7 +383,7 @@ a << "Times: " << Times.summarize() << sep; // done // -return ( a ); +return a; } @@ -399,7 +399,7 @@ GridInfo i; i.set(Data); -return ( i ); +return i; } @@ -416,7 +416,7 @@ double SemiLatLonGrid::rot_grid_to_earth(int x, int y) const // does not apply to semilatlon grids // -return ( 0.0 ); +return 0.0; } @@ -428,7 +428,7 @@ bool SemiLatLonGrid::wrap_lon() const { -return ( false ); +return false; } @@ -459,7 +459,7 @@ SemiLatLonGrid * p = new SemiLatLonGrid (Data); p->Name = Name; -return ( p ); +return p; } diff --git a/src/libcode/vx_grid/st_grid.cc b/src/libcode/vx_grid/st_grid.cc index c1299471e6..c37e5b48c2 100644 --- a/src/libcode/vx_grid/st_grid.cc +++ b/src/libcode/vx_grid/st_grid.cc @@ -163,7 +163,7 @@ double StereographicGrid::f(double lat) const { -return ( st_func(lat, is_north()) ); +return st_func(lat, is_north()); } @@ -175,7 +175,7 @@ double StereographicGrid::df(double lat) const { -return ( st_der_func(lat, is_north()) ); +return st_der_func(lat, is_north()); } @@ -281,7 +281,7 @@ sum = uv_closedpolyline_area(u, v, 4); sum *= earth_radius_km*earth_radius_km; -return ( sum ); +return sum; } @@ -293,7 +293,7 @@ int StereographicGrid::nx() const { -return ( Nx ); +return Nx; } @@ -305,7 +305,7 @@ int StereographicGrid::ny() const { -return ( Ny ); +return Ny; } @@ -333,7 +333,7 @@ for (j=0; jName = Name; -return ( p ); +return p; } @@ -620,7 +620,7 @@ else r = tand(45.0 + 0.5*lat); if (!is_eq(eccentricity, 0.)) { r *= pow(((1 + eccentricity*sind(lat)) / (1 - eccentricity*sind(lat))),(eccentricity/2)); } -return ( r ); +return r; } @@ -638,7 +638,7 @@ lat = 90.0 - 2.0*atand(r); if ( !is_north_hemisphere ) lat = -lat; -return ( lat ); +return lat; } @@ -655,7 +655,7 @@ double a; if ( is_north_hemisphere ) a = -1.0/(1.0 + sind(lat)); else a = 1.0/(1.0 - sind(lat)); -return ( a ); +return a; } @@ -753,7 +753,7 @@ if (is_eq(semi_minor_axis, bad_data_double)) { } eccentricity = sqrt(semi_major_axis*semi_major_axis - semi_minor_axis*semi_minor_axis) / semi_major_axis; -return ( eccentricity ); +return eccentricity; } @@ -777,7 +777,7 @@ else tF = tan(M_PI/4 + sp_rad/2) / temp2; mF = lat_cos / sqrt(1 - eccentricity*eccentricity * lat_sin*lat_sin); scale_factor = mF * sqrt(pow((1+eccentricity),(1+eccentricity)) * pow((1-eccentricity),(1-eccentricity))) / (2 * tF); -return ( scale_factor ); +return scale_factor; } @@ -794,7 +794,7 @@ double alpha; alpha = (1.0 + sind(fabs(scale_lat)))*((r_km)/(d_km)); -return ( alpha ); +return alpha; } @@ -835,7 +835,7 @@ answer = atan(t1) - atan(t2); answer *= 2.0*b*( u0*v1 - u1*v0 ); -return ( answer ); +return answer; } @@ -960,7 +960,7 @@ data.lon_orient = L; g_new.set(data); -return ( g_new ); +return g_new; } diff --git a/src/libcode/vx_grid/tcrmw_grid.cc b/src/libcode/vx_grid/tcrmw_grid.cc index 031c71c65e..9f80f1a814 100644 --- a/src/libcode/vx_grid/tcrmw_grid.cc +++ b/src/libcode/vx_grid/tcrmw_grid.cc @@ -102,11 +102,11 @@ TcrmwGrid & TcrmwGrid::operator=(const TcrmwGrid & tg) { -if ( this == &tg ) return ( * this ); +if ( this == &tg ) return *this; assign(tg); -return ( * this ); +return *this; } diff --git a/src/libcode/vx_grid/unstructured_grid.cc b/src/libcode/vx_grid/unstructured_grid.cc index 33db3fdcc7..9af740a233 100644 --- a/src/libcode/vx_grid/unstructured_grid.cc +++ b/src/libcode/vx_grid/unstructured_grid.cc @@ -165,7 +165,7 @@ double UnstructuredGrid::calc_area(int x, int y) const { double area = 0.; - return ( area ); + return area; } diff --git a/src/libcode/vx_gsl_prob/gsl_bvn.cc b/src/libcode/vx_gsl_prob/gsl_bvn.cc index 1cbb1b950c..1a2c92d74e 100644 --- a/src/libcode/vx_gsl_prob/gsl_bvn.cc +++ b/src/libcode/vx_gsl_prob/gsl_bvn.cc @@ -72,7 +72,7 @@ ellipse.b = radius*sqrt(fabs(d22)); // done // -return ( ellipse ); +return ellipse; } @@ -95,7 +95,7 @@ r2 = z_1*z_1 + z_2*z_2; q = 1.0 - exp(-0.5*r2); -return ( q ); +return q; } @@ -194,7 +194,7 @@ rho2 = Suv; angle_degrees = cf*0.5*atan2(rho2, rho1); -return ( angle_degrees ); +return angle_degrees; } diff --git a/src/libcode/vx_gsl_prob/gsl_cdf.cc b/src/libcode/vx_gsl_prob/gsl_cdf.cc index efd4a22a1a..beb0b53dec 100644 --- a/src/libcode/vx_gsl_prob/gsl_cdf.cc +++ b/src/libcode/vx_gsl_prob/gsl_cdf.cc @@ -36,7 +36,7 @@ double y; y = ( is_bad_data(x) ? bad_data_double : gsl_cdf_ugaussian_P(x) ); -return ( y ); +return y; } @@ -51,7 +51,7 @@ double x; x = ( is_bad_data(y) ? bad_data_double : gsl_cdf_ugaussian_Pinv(y) ); -return ( x ); +return x; } @@ -66,7 +66,7 @@ double y; y = ( is_bad_data(x) ? bad_data_double : gsl_ran_ugaussian_pdf(x) ); -return ( y ); +return y; } @@ -81,7 +81,7 @@ double y; y = ( is_bad_data(x) || is_bad_data(mu) || is_bad_data(sigma) ? bad_data_double : gsl_cdf_gaussian_P(x - mu, sigma) ); -return ( y ); +return y; } @@ -96,7 +96,7 @@ double x; x = ( is_bad_data(y) || is_bad_data(mu) || is_bad_data(sigma) ? bad_data_double : mu + gsl_cdf_gaussian_Pinv(y, sigma) ); -return ( x ); +return x; } @@ -111,7 +111,7 @@ double y; y = ( is_bad_data(x) || is_bad_data(sigma) ? bad_data_double : gsl_ran_gaussian_pdf(x, sigma) ); -return ( y ); +return y; } @@ -126,7 +126,7 @@ double y; y = ( is_bad_data(x) || is_bad_data(deg_freedom) ? bad_data_double : gsl_cdf_chisq_P(x, deg_freedom) ); -return ( y ); +return y; } @@ -139,7 +139,7 @@ double chi2_cdf_inv(double y, double deg_freedom) double x, cv_normal; double large_n = 50.0; -if(is_bad_data(y) || is_bad_data(deg_freedom)) return ( bad_data_double ); +if(is_bad_data(y) || is_bad_data(deg_freedom)) return bad_data_double; // // The following is a workaround for handling a GSL bug when the @@ -160,7 +160,7 @@ else { x = gsl_cdf_chisq_Pinv(y, deg_freedom); } -return ( x ); +return x; } @@ -175,7 +175,7 @@ double y; y = ( is_bad_data(x) || is_bad_data(deg_freedom) ? bad_data_double : gsl_cdf_tdist_P(x, deg_freedom) ); -return ( y ); +return y; } @@ -190,7 +190,7 @@ double x; x = ( is_bad_data(y) || is_bad_data(deg_freedom) ? bad_data_double : gsl_cdf_tdist_Pinv(y, deg_freedom) ); -return ( x ); +return x; } @@ -205,7 +205,7 @@ double y; y = ( is_bad_data(x) || is_bad_data(deg_freedom_1) || is_bad_data(deg_freedom_2) ? bad_data_double : gsl_cdf_fdist_P(x, deg_freedom_1, deg_freedom_2) ); -return ( y ); +return y; } @@ -219,7 +219,7 @@ double x, x_new, cor; const double tol = 1.0e-10; if(is_bad_data(y) || is_bad_data(deg_freedom_1) || is_bad_data(deg_freedom_2)) - return ( bad_data_double ); + return bad_data_double; x = 1.0; // starting value @@ -234,7 +234,7 @@ do { } while ( cor >= tol ); -return ( x ); +return x; } diff --git a/src/libcode/vx_gsl_prob/gsl_randist.cc b/src/libcode/vx_gsl_prob/gsl_randist.cc index 685fb63973..99a5a00edf 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.cc +++ b/src/libcode/vx_gsl_prob/gsl_randist.cc @@ -250,7 +250,7 @@ double ran_draw(const gsl_rng *r, DistType t, double p1, double p2) { } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -299,7 +299,7 @@ double dist_var(DistType t, double p1, double p2) { break; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -320,7 +320,7 @@ int get_seed() { u[1] = u[2]; u[2] = t; - return(curr_time); + return curr_time; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gsl_prob/gsl_statistics.cc b/src/libcode/vx_gsl_prob/gsl_statistics.cc index 2f1ac4afcc..70a2c1a878 100644 --- a/src/libcode/vx_gsl_prob/gsl_statistics.cc +++ b/src/libcode/vx_gsl_prob/gsl_statistics.cc @@ -38,7 +38,7 @@ double stats_lag1_autocorrelation(const NumArray &na) { if(src) { delete [] src; src = (double *) 0; } - return(corr); + return corr; } //////////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ double sf_lambert_W0(const double x) { w = lw.val; } - return(w); + return w; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc index fe5ad84188..11cf75d247 100644 --- a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc +++ b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc @@ -38,7 +38,7 @@ gsl_wavelet * wavelet_set(gsl_wavelet_type *t, int k) { exit(1); } - return(w); + return w; } //////////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ void wavelet_free(gsl_wavelet *w) { const char *wavelet_name(const gsl_wavelet *w) { - return(gsl_wavelet_name(w)); + return gsl_wavelet_name(w); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nav/nav.cc b/src/libcode/vx_nav/nav.cc index 8b81e679e8..38652e9f2c 100644 --- a/src/libcode/vx_nav/nav.cc +++ b/src/libcode/vx_nav/nav.cc @@ -82,7 +82,7 @@ x = haversine(dp) + cos(lat1_radians)*cos(lat2_radians)*haversine(dl); x = earth_radius_km*ahaversine(x); -return ( x ); +return x; } @@ -132,7 +132,7 @@ double ahaversine(double t) double a = 2.0*asin(sqrt(t)); -return ( a ); +return a; } @@ -164,7 +164,7 @@ if ( fabs(lat1 - lat2) < 0.0001 ) { d = earth_radius_km*cosd(lat1)*(lon1 - lon2) * rad_per_deg; // d = earth_radius_km*cos(lat1/cf)*((lon1 - lon2)/cf); - return ( fabs(d) ); + return fabs(d); } @@ -173,7 +173,7 @@ beta = rl_bearing(lat1, lon1, lat2, lon2); d = earth_radius_km*( rad_per_deg * (lat1 - lat2)/cosd(beta) ); //d = earth_radius_km*( ((lat1 - lat2)/cf)/cos(beta/cf) ); -return ( fabs(d) ); +return fabs(d); } @@ -207,7 +207,7 @@ mp2 = meridional_parts(lat2); beta = atan2d( rad_per_deg * (lon1 - lon2), mp2 - mp1); //beta = cf*atan2((lon1 - lon2)/cf, mp2 - mp1); -return ( beta ); +return beta; } @@ -233,7 +233,7 @@ double meridional_parts(double a) a = a * rad_per_deg; //a /= cf; -return ( log(tan(piover4 + (0.5*a))) ); +return log(tan(piover4 + (0.5*a))); } @@ -276,7 +276,7 @@ y = cosd(lat2)*sind(dl); beta = atan2d(y, x); //beta = cf*atan2(y, x); -return ( beta ); +return beta; } @@ -580,7 +580,7 @@ double gc_dist_to_line(double lat1, double lon1, gc_dist(lat2, lon2, lat3, lon3)); } - return(dist); + return dist; } ////////////////////////////////////////////////////////////////// @@ -592,7 +592,7 @@ Vector3D latlon_to_xyz(double lat, double lon) { v.y = cosd(lat) * sind(lon) * earth_radius_km; v.z = sind(lat) * earth_radius_km; - return(v); + return v; } ////////////////////////////////////////////////////////////////// @@ -621,7 +621,7 @@ Vector3D cross_product(Vector3D v1, Vector3D v2) { v.y = v2.x*v1.z - v1.x*v2.z; v.z = v1.x*v2.y - v1.y*v2.x; - return(v); + return v; } ////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index dcd24b59b1..96441e3909 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -805,7 +805,7 @@ bool get_global_att(const NcFile *nc, const ConcatString& att_name, if (status) att_val = tmp_att_val; } - return (status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -1057,7 +1057,7 @@ ConcatString* get_string_val(NcFile * nc, const char * var_name, const int index const int len, ConcatString &tmp_cs) { NcVar var = get_var(nc, var_name); - return (get_string_val(&var, index, len, tmp_cs)); + return get_string_val(&var, index, len, tmp_cs); } //////////////////////////////////////////////////////////////////////// @@ -1101,7 +1101,7 @@ ConcatString* get_string_val(NcVar *var, const int index, // tmp_cs = tmp_str; - return (&tmp_cs); + return &tmp_cs; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4d23e8e65b..9e53fa7342 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -99,11 +99,11 @@ assign(i); NcVarInfo & NcVarInfo::operator=(const NcVarInfo & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -244,7 +244,7 @@ return; int NcVarInfo::lead_time() const { -return ( (int) (ValidTime - InitTime) ); +return (int) (ValidTime - InitTime); } @@ -374,7 +374,7 @@ bool get_att_str(const NcVarInfo &info, const ConcatString att_name, // done // - return ( found ); + return found; } @@ -407,7 +407,7 @@ bool get_att_int(const NcVarInfo &info, const ConcatString att_name, // done // - return ( found ); + return found; } @@ -448,7 +448,7 @@ bool get_att_unixtime(const NcVar *var, const ConcatString att_name, // done // - return ( found ); + return found; } diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc index a43b33a768..789b4baaae 100644 --- a/src/libcode/vx_pb_util/do_blocking.cc +++ b/src/libcode/vx_pb_util/do_blocking.cc @@ -174,13 +174,13 @@ while ( (n_read = read(fd, tempbuf, sizeof(tempbuf))) > 0 ) { // lseek(fd, pos + 2, SEEK_SET); lseek(fd, pos, SEEK_SET); - return ( pos ); + return pos; } } // for j - if ( n_read < 10 ) return ( -1 ); + if ( n_read < 10 ) return -1; pos += n_read - 5; @@ -188,7 +188,7 @@ while ( (n_read = read(fd, tempbuf, sizeof(tempbuf))) > 0 ) { } // while -if ( n_read == 0 ) return ( -1 ); +if ( n_read == 0 ) return -1; if ( n_read < 0 ) { @@ -199,7 +199,7 @@ if ( n_read < 0 ) { } -return ( pos ); +return pos; } @@ -295,7 +295,7 @@ if ( lseek(fd, pos, SEEK_SET) < 0 ) { // done // -return ( rec_size ); +return rec_size; } diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc index 31e07e2631..bdb5396d62 100644 --- a/src/libcode/vx_pb_util/do_unblocking.cc +++ b/src/libcode/vx_pb_util/do_unblocking.cc @@ -105,7 +105,7 @@ switch ( padsize ) { n_read = read(fd, b, bytes); -if ( n_read == 0 ) return ( 0 ); +if ( n_read == 0 ) return 0; if ( (n_read < 0) || ((n_read > 0) && (n_read != bytes)) ) { @@ -138,7 +138,7 @@ switch ( padsize ) { // done // -return ( value ); +return value; } diff --git a/src/libcode/vx_plot_util/map_region.cc b/src/libcode/vx_plot_util/map_region.cc index daa54185e6..5856adc159 100644 --- a/src/libcode/vx_plot_util/map_region.cc +++ b/src/libcode/vx_plot_util/map_region.cc @@ -75,11 +75,11 @@ MapRegion & MapRegion::operator=(const MapRegion & r) { -if ( this == &r ) return ( * this ); +if ( this == &r ) return *this; assign(r); -return ( * this ); +return *this; } @@ -165,7 +165,7 @@ ConcatString line; StringArray a; // read the map region meta data - if(!line.read_line(in)) return (false); + if(!line.read_line(in)) return false; // split up the meta data line a = line.split(" "); @@ -177,7 +177,7 @@ StringArray a; << "found fewer than the expected number of elements (" << a.n_elements() << "<" << min_region_header_elements << ") in map region line:\n" << line << "\n\n"; - return(false); + return false; } // parse the region header line: @@ -203,7 +203,7 @@ StringArray a; // parse the lat/lon data lines for(j=0; j= grid_bb.x_ll()) && (x < grid_bb.x_ur()) && (y >= grid_bb.y_ll()) && (y < grid_bb.y_ur())) - return (true); + return true; } - return (false); + return false; } diff --git a/src/libcode/vx_pointdata_python/pointdata_from_array.cc b/src/libcode/vx_pointdata_python/pointdata_from_array.cc index 8b0ab54894..f3e8a486a1 100644 --- a/src/libcode/vx_pointdata_python/pointdata_from_array.cc +++ b/src/libcode/vx_pointdata_python/pointdata_from_array.cc @@ -113,7 +113,7 @@ else { // done // -return ( true ); +return true; } @@ -211,7 +211,7 @@ else { // done // -return ( true ); +return true; } @@ -310,7 +310,7 @@ else { // done // -return ( true ); +return true; } @@ -409,7 +409,7 @@ else { // done // -return ( true ); +return true; } @@ -433,7 +433,7 @@ data_out->add(a); // done // -return ( true ); +return true; } @@ -447,7 +447,7 @@ bool pointdata_from_python_list(PyObject * data_array, float *data_out) for (int idx=0; idxadd((float)PyFloat_AsDouble(PyList_GetItem(data_array, idx))); } - return ( true ); + return true; } @@ -485,7 +485,7 @@ bool pointdata_from_python_list(PyObject * data_array, int *data_out) // exit by caller with additional log message } - return ( status ); + return status; } //////////////////////////////////////////////////////////////////////// @@ -507,7 +507,7 @@ bool pointdata_from_python_list(PyObject * data_array, IntArray *data_out) // exit by caller with additional log message } - return ( status ); + return status; } diff --git a/src/libcode/vx_pointdata_python/pointdata_python.cc b/src/libcode/vx_pointdata_python/pointdata_python.cc index fdb1cb34a3..b77a0c6438 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.cc +++ b/src/libcode/vx_pointdata_python/pointdata_python.cc @@ -188,7 +188,7 @@ print_met_data(obs_data, hdr_data, method_name); // done // -return ( status ); +return status; } diff --git a/src/libcode/vx_pointdata_python/python_pointdata.cc b/src/libcode/vx_pointdata_python/python_pointdata.cc index c5585a6120..df27f81c9a 100644 --- a/src/libcode/vx_pointdata_python/python_pointdata.cc +++ b/src/libcode/vx_pointdata_python/python_pointdata.cc @@ -183,7 +183,7 @@ else { met_pd_out, filters); } -return ( status ); +return status; } @@ -274,7 +274,7 @@ MetPointHeader *header_data = met_pd_out.get_header_data(); // done // -return ( true ); +return true; } @@ -428,7 +428,7 @@ bool process_point_data_list(PyObject *python_point_data, MetPointDataPython &me // done // - return ( true ); + return true; } @@ -474,7 +474,7 @@ if ( PyErr_Occurred() ) { mlog << Warning << "\n" << method_name << "an error occurred initializing python\n\n"; - return ( false ); + return false; } @@ -602,7 +602,7 @@ if ( PyErr_Occurred() ) { mlog << Warning << "\n" << method_name << "an error occurred initializing python\n\n"; - return ( false ); + return false; } @@ -701,7 +701,7 @@ if ( PyErr_Occurred() ) { << "an error occurred importing module " << '\"' << path << "\"\n\n"; - return ( false ); + return false; } @@ -710,7 +710,7 @@ if ( ! module_obj ) { mlog << Warning << "\n" << method_name << "error running python script\n\n"; - return ( false ); + return false; } @@ -742,7 +742,7 @@ remove_temp_file(tmp_nc_path); // done // -return ( true ); +return true; } diff --git a/src/libcode/vx_ps/documentmedia_to_string.cc b/src/libcode/vx_ps/documentmedia_to_string.cc index d64d6b9123..2a740c866a 100644 --- a/src/libcode/vx_ps/documentmedia_to_string.cc +++ b/src/libcode/vx_ps/documentmedia_to_string.cc @@ -54,7 +54,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/libcode/vx_ps/documentorientation_to_string.cc b/src/libcode/vx_ps/documentorientation_to_string.cc index e98342f078..f4cd73c8d7 100644 --- a/src/libcode/vx_ps/documentorientation_to_string.cc +++ b/src/libcode/vx_ps/documentorientation_to_string.cc @@ -54,7 +54,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/libcode/vx_ps/fontfamily_to_string.cc b/src/libcode/vx_ps/fontfamily_to_string.cc index 4540a5afc9..4611c3523d 100644 --- a/src/libcode/vx_ps/fontfamily_to_string.cc +++ b/src/libcode/vx_ps/fontfamily_to_string.cc @@ -59,7 +59,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/libcode/vx_ps/ps_text.cc b/src/libcode/vx_ps/ps_text.cc index f4438e208b..0e16261336 100644 --- a/src/libcode/vx_ps/ps_text.cc +++ b/src/libcode/vx_ps/ps_text.cc @@ -89,11 +89,11 @@ VxpsTextNode & VxpsTextNode::operator=(const VxpsTextNode & n) { -if ( this == &n ) return ( * this ); +if ( this == &n ) return *this; assign(n); -return ( * this ); +return *this; } @@ -435,7 +435,7 @@ while ( n ) { } -return ( w ); +return w; } @@ -447,7 +447,7 @@ double VxpsTextNode::total_left() const { -return ( Left ); +return Left; } @@ -477,7 +477,7 @@ while ( n->next ) { r += n->Right; -return ( r ); +return r; } @@ -501,7 +501,7 @@ while ( n ) { } -return ( t ); +return t; } @@ -525,7 +525,7 @@ while ( n ) { } -return ( b ); +return b; } diff --git a/src/libcode/vx_ps/table_helper.cc b/src/libcode/vx_ps/table_helper.cc index 9e1eee2f87..8243f019bb 100644 --- a/src/libcode/vx_ps/table_helper.cc +++ b/src/libcode/vx_ps/table_helper.cc @@ -266,7 +266,7 @@ double TableHelper::col_width(int c) const range_check_c(c); -return ( ColWidth[c] ); +return ColWidth[c]; } @@ -280,7 +280,7 @@ double TableHelper::row_height(int r) const range_check_r(r); -return ( RowHeight[r] ); +return RowHeight[r]; } @@ -297,7 +297,7 @@ double w = 0.0; for (j=0; j 126 ) return ( true ); +if ( ascii_code > 126 ) return true; -return ( false ); +return false; } @@ -1931,11 +1931,11 @@ DocumentMedia default_media() ConcatString cs; -if ( !get_env(papersize_env, cs) ) return ( MediaLetter ); +if ( !get_env(papersize_env, cs) ) return MediaLetter; -if ( cs == "Letter" ) return ( MediaLetter ); +if ( cs == "Letter" ) return MediaLetter; -if ( cs == "A4" ) return ( MediaA4 ); +if ( cs == "A4" ) return MediaA4; mlog << Error << "\ndefault_media() -> " << "bad value \"" << cs << "\" for environment variable " @@ -1974,7 +1974,7 @@ switch ( f ) { } // switch -return ( n ); +return n; } @@ -2007,7 +2007,7 @@ switch ( f ) { } // switch -return ( n ); +return n; } @@ -2040,7 +2040,7 @@ switch ( f ) { } // switch -return ( n ); +return n; } @@ -2073,7 +2073,7 @@ switch ( f ) { } // switch -return ( n ); +return n; } diff --git a/src/libcode/vx_pxm/pbm.cc b/src/libcode/vx_pxm/pbm.cc index 8931af17b3..fb00e786a1 100644 --- a/src/libcode/vx_pxm/pbm.cc +++ b/src/libcode/vx_pxm/pbm.cc @@ -102,11 +102,11 @@ Pbm & Pbm::operator=(const Pbm & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -196,7 +196,7 @@ j = ( (u & mask) ? 0 : 1 ); if ( j ) color.set_gray(255); else color.set_gray(0); -return ( color ); +return color; } @@ -218,7 +218,7 @@ r = Nrows - 1 - y; color = getrc(r, c); -return ( color ); +return color; } @@ -323,7 +323,7 @@ if ( !in ) { mlog << Warning << "\n" << method_name << "unable to read image file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -345,7 +345,7 @@ if ( !in ) { clear(); - return ( 0 ); + return 0; } @@ -355,7 +355,7 @@ if ( (c1 != 'P') || (c2 != '4') ) { clear(); - return ( 0 ); + return 0; } @@ -396,7 +396,7 @@ if ( !(data = new unsigned char [n]) ) { clear(); - return ( 0 ); + return 0; } @@ -406,7 +406,7 @@ if ( !in.read((char *) data, n) ) { clear(); - return ( 0 ); + return 0; } @@ -416,7 +416,7 @@ in.close(); // Done // -return ( 1 ); +return 1; } @@ -442,7 +442,7 @@ if ( !out ) { mlog << Warning << "\nPbm::write() -> unable to open output file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -472,7 +472,7 @@ if ( !out ) { mlog << Warning << "\nPbm::write() -> trouble writing header\n\n"; - return ( 0 ); + return 0; } @@ -488,7 +488,7 @@ if ( !out ) { mlog << Warning << "\nPbm::write() -> trouble writing data\n\n"; - return ( 0 ); + return 0; } @@ -498,7 +498,7 @@ if ( !out ) { out.close(); -return ( 1 ); +return 1; } diff --git a/src/libcode/vx_pxm/pcm.cc b/src/libcode/vx_pxm/pcm.cc index f1107ccf20..e11f5f7dca 100644 --- a/src/libcode/vx_pxm/pcm.cc +++ b/src/libcode/vx_pxm/pcm.cc @@ -104,11 +104,11 @@ Pcm & Pcm::operator=(const Pcm & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -218,7 +218,7 @@ c = x; r = Nrows - 1 - y; -return ( data_getrc(r, c) ); +return data_getrc(r, c); } @@ -234,7 +234,7 @@ int n; n = rc_to_n(r, c); -return ( data[n] ); +return data[n]; } @@ -252,7 +252,7 @@ n = rc_to_n(r, c); k = (int) (data[n]); -return ( Colormap[k] ); +return Colormap[k]; } @@ -270,7 +270,7 @@ c = x; r = Nrows - 1 - y; -return ( getrc(r, c) ); +return getrc(r, c); } @@ -391,7 +391,7 @@ if ( !in ) { mlog << Warning << "\nPcm::read() -> unable to read image file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -407,7 +407,7 @@ if ( !Name ) { clear(); - return ( 0 ); + return 0; } @@ -426,7 +426,7 @@ if ( !in ) { clear(); - return ( 0 ); + return 0; } @@ -436,7 +436,7 @@ if ( (c1 != 'P') || (c2 != '9') ) { clear(); - return ( 0 ); + return 0; } @@ -475,7 +475,7 @@ if ( maxval != 255 ) { clear(); - return ( 0 ); + return 0; } */ @@ -492,7 +492,7 @@ if ( !Colormap ) { clear(); - return ( 0 ); + return 0; } @@ -512,7 +512,7 @@ for (j=0; j unable to open output file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -609,7 +609,7 @@ if ( !out ) { mlog << Warning << "\nPcm::write() -> trouble writing header\n\n"; - return ( 0 ); + return 0; } @@ -637,7 +637,7 @@ if ( !out ) { mlog << Warning << "\nPcm::write() -> trouble writing data\n\n"; - return ( 0 ); + return 0; } @@ -647,7 +647,7 @@ if ( !out ) { out.close(); -return ( 1 ); +return 1; } @@ -833,12 +833,12 @@ int j; for (j=0; j= Ncolors) ) { } -return ( Colormap[n] ); +return Colormap[n]; } diff --git a/src/libcode/vx_pxm/pgm.cc b/src/libcode/vx_pxm/pgm.cc index a38d4fd4e1..4695400a75 100644 --- a/src/libcode/vx_pxm/pgm.cc +++ b/src/libcode/vx_pxm/pgm.cc @@ -111,11 +111,11 @@ Pgm & Pgm::operator=(const Pgm & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -181,7 +181,7 @@ u = data[n]; color.set_rgb(u, u, u); -return ( color ); +return color; } @@ -199,7 +199,7 @@ c = x; r = Nrows - 1 - y; -return ( getrc(r, c) ); +return getrc(r, c); } @@ -271,7 +271,7 @@ if ( !in ) { mlog << Warning << "\nPgm::read() -> unable to read image file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -287,7 +287,7 @@ if ( !Name ) { clear(); - return ( 0 ); + return 0; } @@ -306,7 +306,7 @@ if ( !in ) { clear(); - return ( 0 ); + return 0; } @@ -316,7 +316,7 @@ if ( (c1 != 'P') || (c2 != '5') ) { clear(); - return ( 0 ); + return 0; } @@ -352,7 +352,7 @@ if ( maxval != 255 ) { clear(); - return ( 0 ); + return 0; } @@ -368,7 +368,7 @@ if ( !(data = new unsigned char [n]) ) { clear(); - return ( 0 ); + return 0; } @@ -378,7 +378,7 @@ if ( !in.read((char *) data, n) ) { clear(); - return ( 0 ); + return 0; } @@ -388,7 +388,7 @@ in.close(); // Done // -return ( 1 ); +return 1; } @@ -414,7 +414,7 @@ if ( !out ) { mlog << Warning << "\nPgm::write() -> unable to open output file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -444,7 +444,7 @@ if ( !out ) { mlog << Warning << "\nPgm::write() -> trouble writing header\n\n"; - return ( 0 ); + return 0; } @@ -460,7 +460,7 @@ if ( !out ) { mlog << Warning << "\nPgm::write() -> trouble writing data\n\n"; - return ( 0 ); + return 0; } @@ -470,7 +470,7 @@ if ( !out ) { out.close(); -return ( 1 ); +return 1; } @@ -885,12 +885,12 @@ for (col=1; col unable to read image file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -287,7 +287,7 @@ if ( !Name ) { clear(); - return ( 0 ); + return 0; } @@ -306,7 +306,7 @@ if ( !in ) { clear(); - return ( 0 ); + return 0; } @@ -316,7 +316,7 @@ if ( (c1 != 'P') || (c2 != '6') ) { clear(); - return ( 0 ); + return 0; } @@ -353,7 +353,7 @@ if ( maxval != 255 ) { clear(); - return ( 0 ); + return 0; } @@ -369,7 +369,7 @@ if ( !(data = new unsigned char [n]) ) { clear(); - return ( 0 ); + return 0; } @@ -379,7 +379,7 @@ if ( !in.read((char *) data, n) ) { clear(); - return ( 0 ); + return 0; } @@ -389,7 +389,7 @@ in.close(); // Done // -return ( 1 ); +return 1; } @@ -415,7 +415,7 @@ if ( !out ) { mlog << Warning << "\nPpm::write() -> unable to open output file \"" << filename << "\"\n\n"; - return ( 0 ); + return 0; } @@ -448,7 +448,7 @@ if ( !out ) { << strerror(errno) << "\n\n"; - return ( 0 ); + return 0; } @@ -464,7 +464,7 @@ if ( !out ) { mlog << Warning << "\nPpm::write() -> trouble writing data\n\n"; - return ( 0 ); + return 0; } @@ -474,7 +474,7 @@ if ( !out ) { out.close(); -return ( 1 ); +return 1; } diff --git a/src/libcode/vx_pxm/pxm_base.cc b/src/libcode/vx_pxm/pxm_base.cc index bc52724b35..825cb47801 100644 --- a/src/libcode/vx_pxm/pxm_base.cc +++ b/src/libcode/vx_pxm/pxm_base.cc @@ -178,7 +178,7 @@ int n; n = r*Ncols + c; -return ( n ); +return n; } @@ -214,7 +214,7 @@ const char * PxmBase::short_name() const { -if ( !Name ) return ( (const char *) 0 ); +if ( !Name ) return (const char *) 0; int j; @@ -246,7 +246,7 @@ if ( (n < 0) || (n >= Ncomments) ) { } -return ( Comment[n] ); +return Comment[n]; } diff --git a/src/libcode/vx_pxm/pxm_utils.cc b/src/libcode/vx_pxm/pxm_utils.cc index 8d496b8082..f68873333a 100644 --- a/src/libcode/vx_pxm/pxm_utils.cc +++ b/src/libcode/vx_pxm/pxm_utils.cc @@ -40,7 +40,7 @@ j = 0; while ( isdigit(c = in.get()) ) j = 10*j + (c - '0'); -return ( j ); +return j; } diff --git a/src/libcode/vx_python3_utils/python3_dict.cc b/src/libcode/vx_python3_utils/python3_dict.cc index f623166a14..9a2aaa4f93 100644 --- a/src/libcode/vx_python3_utils/python3_dict.cc +++ b/src/libcode/vx_python3_utils/python3_dict.cc @@ -179,7 +179,7 @@ if ( ! PyLong_Check(a) ) { k = (int) PyLong_AS_LONG(a); -return ( k ); +return k; } @@ -216,7 +216,7 @@ if ( ! PyFloat_Check(a) ) { t = PyFloat_AS_DOUBLE(a); -return ( t ); +return t; } @@ -262,7 +262,7 @@ else { } -return ( s ); +return s; } @@ -287,7 +287,7 @@ if ( ! a ) { } -return ( a ); +return a; } @@ -322,7 +322,7 @@ if ( ! PyDict_Check(a) ) { } -return ( a ); +return a; } @@ -360,7 +360,7 @@ if ( ! PyList_Check(a) ) { } -return ( a ); +return a; } diff --git a/src/libcode/vx_python3_utils/python3_list.cc b/src/libcode/vx_python3_utils/python3_list.cc index 51b9c3078a..e90a195e95 100644 --- a/src/libcode/vx_python3_utils/python3_list.cc +++ b/src/libcode/vx_python3_utils/python3_list.cc @@ -182,7 +182,7 @@ if ( (n < 0) || (n >= Size) ) { a = PyList_GetItem(Object, n); -return ( a ); +return a; } diff --git a/src/libcode/vx_python3_utils/python3_numpy.cc b/src/libcode/vx_python3_utils/python3_numpy.cc index 961bcd0bfb..e779c0504f 100644 --- a/src/libcode/vx_python3_utils/python3_numpy.cc +++ b/src/libcode/vx_python3_utils/python3_numpy.cc @@ -164,7 +164,7 @@ if ( (k < 0) || (k >= N_Dims) ) { } -return ( Dim[k] ); +return Dim[k]; } diff --git a/src/libcode/vx_python3_utils/python3_script.cc b/src/libcode/vx_python3_utils/python3_script.cc index 34fc038d71..850646649c 100644 --- a/src/libcode/vx_python3_utils/python3_script.cc +++ b/src/libcode/vx_python3_utils/python3_script.cc @@ -160,7 +160,7 @@ PyObject * var = 0; var = PyDict_GetItemString (Dict, name); -return ( var ); +return var; } @@ -195,7 +195,7 @@ if ( ! PyList_Check(var) ) { } -return ( var ); +return var; } diff --git a/src/libcode/vx_python3_utils/python3_util.cc b/src/libcode/vx_python3_utils/python3_util.cc index 7c648edc88..94e9a25bb9 100644 --- a/src/libcode/vx_python3_utils/python3_util.cc +++ b/src/libcode/vx_python3_utils/python3_util.cc @@ -69,7 +69,7 @@ if ( buf ) { free(buf); buf = 0; } // done // -return ( out ); +return out; } @@ -81,11 +81,11 @@ PyObject * get_attribute(PyObject * obj, const char * attribute_name) { -if ( PyObject_HasAttrString(obj, attribute_name) == 0 ) return ( (PyObject *) 0 ); +if ( PyObject_HasAttrString(obj, attribute_name) == 0 ) return (PyObject *) 0; PyObject * att = PyObject_GetAttrString(obj, attribute_name); -return ( att ); +return att; } @@ -121,7 +121,7 @@ if ( PyLong_Check(obj) ) { // long? } -return ( k ); +return k; } @@ -169,7 +169,7 @@ if ( PyLong_Check(obj) ) { // long? } -return ( x ); +return x; } @@ -196,7 +196,7 @@ if ( PyUnicode_Check(obj) ) { // string? } -return ( s ); +return s; } @@ -223,7 +223,7 @@ if ( PyUnicode_Check(obj) ) { // string? } -return ( s ); +return s; } diff --git a/src/libcode/vx_regrid/vx_regrid.cc b/src/libcode/vx_regrid/vx_regrid.cc index 95063ac17c..4377f37c73 100644 --- a/src/libcode/vx_regrid/vx_regrid.cc +++ b/src/libcode/vx_regrid/vx_regrid.cc @@ -83,7 +83,7 @@ out.censor(info.censor_thresh, info.censor_val); // done // -return ( out ); +return out; } @@ -101,7 +101,7 @@ ri.method = InterpMthd_Nearest; ri.width = 1; ri.shape = GridTemplateFactory::GridTemplate_Square; -return ( met_regrid_generic(from_data, from_grid, to_grid, ri) ); +return met_regrid_generic(from_data, from_grid, to_grid, ri); } @@ -165,7 +165,7 @@ for (xt=0; xt<(to_grid.nx()); ++xt) { // done // -return ( to_data ); +return to_data; } @@ -268,7 +268,7 @@ for (xt=0; xt<(to_grid.nx()); ++xt) { // done // -return ( to_data ); +return to_data; } @@ -296,7 +296,7 @@ if ( from_grid.nx() != to_grid.nx() || from_grid.ny() != to_grid.ny() ) { } -return ( from_data ); +return from_data; } @@ -358,7 +358,7 @@ for (xt=0; xt<(to_grid.nx()); ++xt) { interp_gaussian_dp(to_data, info.gaussian, info.vld_thresh); -return ( to_data ); +return to_data; } diff --git a/src/libcode/vx_regrid/vx_regrid_budget.cc b/src/libcode/vx_regrid/vx_regrid_budget.cc index 425f989fdb..9fbedcfc81 100644 --- a/src/libcode/vx_regrid/vx_regrid_budget.cc +++ b/src/libcode/vx_regrid/vx_regrid_budget.cc @@ -101,7 +101,7 @@ for (ixt=0; ixt<(to_grid.nx()); ++ixt) { // done // -return ( to_data ); +return to_data; } diff --git a/src/libcode/vx_render/ps_filter.cc b/src/libcode/vx_render/ps_filter.cc index bfaade4aa9..bdae71846d 100644 --- a/src/libcode/vx_render/ps_filter.cc +++ b/src/libcode/vx_render/ps_filter.cc @@ -150,7 +150,7 @@ snprintf(junk, sizeof(junk), "%d", k); (*this) << junk; -return ( *this ); +return *this; } @@ -180,7 +180,7 @@ while ( *s ) { } -return ( *this ); +return *this; } @@ -194,7 +194,7 @@ PSFilter & PSFilter::operator<<(const ConcatString & s) operator<<(s.text()); -return ( *this ); +return *this; } @@ -212,7 +212,7 @@ PSFilter & PSFilter::operator<<(const double x) operator<<(junk); - return ( * this ); + return *this; } diff --git a/src/libcode/vx_render/renderinfo.cc b/src/libcode/vx_render/renderinfo.cc index 58912de6f6..940116190f 100644 --- a/src/libcode/vx_render/renderinfo.cc +++ b/src/libcode/vx_render/renderinfo.cc @@ -76,11 +76,11 @@ RenderInfo & RenderInfo::operator=(const RenderInfo & r) { -if ( this == &r ) return ( * this ); +if ( this == &r ) return *this; assign(r); -return ( * this ); +return *this; } @@ -256,7 +256,7 @@ if ( (n < 0) || (n >= Nfilters) ) { } -return ( Filter[n] ); +return Filter[n]; } diff --git a/src/libcode/vx_render/uc_queue.cc b/src/libcode/vx_render/uc_queue.cc index ef6fadfaf5..02d7fa1b82 100644 --- a/src/libcode/vx_render/uc_queue.cc +++ b/src/libcode/vx_render/uc_queue.cc @@ -74,11 +74,11 @@ UCQueue & UCQueue::operator=(const UCQueue &Q) { -if ( this == &Q ) return ( *this ); +if ( this == &Q ) return *this; assign(Q); -return ( *this ); +return *this; } @@ -136,7 +136,7 @@ int UCQueue::n_elements() const { -return ( NElements ); +return NElements; } @@ -148,9 +148,9 @@ int UCQueue::last_char() const { -if ( NElements == 0 ) return ( -1 ); +if ( NElements == 0 ) return -1; -return ( (int) (data[0]) ); +return (int) (data[0]); } @@ -162,7 +162,7 @@ int UCQueue::run_count() const { -return ( calc_run_count() ); +return calc_run_count(); } @@ -220,7 +220,7 @@ u = data[NElements - 1]; --NElements; -return ( u ); +return u; } @@ -234,7 +234,7 @@ int UCQueue::calc_run_count() const int j, count; -if ( NElements <= 1 ) return ( NElements ); +if ( NElements <= 1 ) return NElements; count = 1; @@ -247,7 +247,7 @@ for (j=1; j Date: Wed, 28 Feb 2024 01:34:39 +0000 Subject: [PATCH 11/72] #2673 Removed the redundant parentheses with return --- src/tools/core/ensemble_stat/ensemble_stat.cc | 8 +++---- .../ensemble_stat/ensemble_stat_conf_info.cc | 18 +++++++-------- src/tools/core/grid_stat/grid_stat.cc | 4 ++-- .../core/grid_stat/grid_stat_conf_info.cc | 22 +++++++++---------- src/tools/core/mode/mode.cc | 2 +- src/tools/core/mode/mode_frontend.cc | 2 +- src/tools/core/mode/mode_ps_file.cc | 2 +- src/tools/core/mode/multivar_frontend.cc | 4 ++-- src/tools/core/mode_analysis/mode_analysis.cc | 2 +- src/tools/core/pcp_combine/pcp_combine.cc | 10 ++++----- .../core/series_analysis/series_analysis.cc | 8 +++---- .../core/stat_analysis/aggr_stat_line.cc | 8 +++---- .../stat_analysis/skill_score_index_job.cc | 12 +++++----- src/tools/core/stat_analysis/stat_analysis.cc | 2 +- src/tools/core/wavelet_stat/wavelet_stat.cc | 12 +++++----- .../wavelet_stat/wavelet_stat_conf_info.cc | 6 ++--- src/tools/dev_utils/chk4copyright.cc | 4 ++-- src/tools/dev_utils/gen_climo_bin.cc | 2 +- src/tools/dev_utils/gribtab.dat_to_flat.cc | 2 +- src/tools/dev_utils/nceptab_to_flat.cc | 14 ++++++------ src/tools/dev_utils/pbtime.cc | 2 +- src/tools/dev_utils/reformat_county_data.cc | 2 +- src/tools/dev_utils/reformat_map_data.cc | 2 +- .../dev_utils/shapefiles/make_mapfiles.cc | 4 ++-- 24 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 8b86abcec5..1ff34d29e5 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -187,7 +187,7 @@ int met_main(int argc, char *argv[]) { // Close the text files and deallocate memory clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -681,7 +681,7 @@ bool get_data_plane(const char *infile, GrdFileType ftype, // Deallocate the data file pointer, if necessary if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -741,7 +741,7 @@ bool get_data_plane_array(const char *infile, GrdFileType ftype, // Deallocate the data file pointer, if necessary if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) nullptr; } - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -1116,7 +1116,7 @@ bool process_point_ens(int i_vx, int i_ens, DataPlaneArray &fcst_dpa) { mlog << Debug(2) << "For " << info->magic_str() << " found " << fcst_dpa.n_planes() << " forecast levels.\n"; - return(status); + return status; } //////////////////////////////////////////////////////////////////////// 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 8da7df73c6..edc0c1b132 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -494,7 +494,7 @@ int EnsembleStatConfInfo::n_txt_row(int i_txt_row) const { // Loop over the tasks and sum the line counts for this line type for(i=0, n=0; ip_flag()) rescale_probability(dp); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// 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 399913036f..076e35cb37 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -439,7 +439,7 @@ int GridStatConfInfo::n_txt_row(int i_txt_row) const { // Loop over the tasks and sum the line counts for this line type for(int i=0; iclear(); if ( dumpfile ) { delete dumpfile; dumpfile = (ofstream *) 0; } if ( outfile ) { delete outfile; outfile = (ofstream *) 0; } -return ( 0 ); +return 0; } diff --git a/src/tools/core/pcp_combine/pcp_combine.cc b/src/tools/core/pcp_combine/pcp_combine.cc index 67bf2f50bc..7adf584e07 100644 --- a/src/tools/core/pcp_combine/pcp_combine.cc +++ b/src/tools/core/pcp_combine/pcp_combine.cc @@ -816,7 +816,7 @@ int search_pcp_dir(const char *cur_dir, const unixtime cur_ut, if(dp) met_closedir(dp); - return(i_rec); + return i_rec; } //////////////////////////////////////////////////////////////////////// @@ -1488,17 +1488,17 @@ ConcatString parse_config_str(const char *s) { config_str = s; } - return(config_str); + return config_str; } //////////////////////////////////////////////////////////////////////// bool is_timestring(const char * text) { - if(is_hh(text)) return(true); - if(is_hhmmss(text)) return(true); + if(is_hh(text)) return true; + if(is_hhmmss(text)) return true; - return(false); + return false; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 223ce9ad65..3df79a1595 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -135,7 +135,7 @@ int met_main(int argc, char *argv[]) { // Close the text files and deallocate memory clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ Met2dDataFile *get_mtddf(const StringArray &file_list, exit(1); } - return(mtddf); + return mtddf; } //////////////////////////////////////////////////////////////////////// @@ -655,7 +655,7 @@ bool read_single_entry(VarInfo *info, const ConcatString &cur_file, if(!file_is_ok(cur_file, type)) { mlog << Warning << "\nread_single_entry() -> " << "File does not exist: " << cur_file << "\n\n"; - return(false); + return false; } // Open the data file @@ -670,7 +670,7 @@ bool read_single_entry(VarInfo *info, const ConcatString &cur_file, // Close the data file delete mtddf; mtddf = (Met2dDataFile *) 0; - return(found); + return found; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 99b5906429..cb2d637e69 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -525,7 +525,7 @@ StatHdrColumns StatHdrInfo::get_shc(const ConcatString &cur_case, // LINE_TYPE shc.set_line_type(statlinetype_to_string(lt)); - return(shc); + return shc; } //////////////////////////////////////////////////////////////////////// @@ -576,7 +576,7 @@ ConcatString StatHdrInfo::get_shc_str(const ConcatString &cur_case, shc_str = css; } - return(shc_str); + return shc_str; } //////////////////////////////////////////////////////////////////////// @@ -4203,7 +4203,7 @@ double compute_vif(NumArray &na) { // Compute the variance inflation factor vif = 1 + 2.0*fabs(corr) - 2.0*fabs(corr)/na.n(); - return(vif); + return vif; } //////////////////////////////////////////////////////////////////////// @@ -4215,7 +4215,7 @@ bool is_precip_var_name(const ConcatString &s) { has_prefix(grib_precipitation_abbr, n_grib_precipitation_abbr, s.c_str()); - return(match); + return match; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/skill_score_index_job.cc b/src/tools/core/stat_analysis/skill_score_index_job.cc index a023cd8dfc..2595886c19 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.cc +++ b/src/tools/core/stat_analysis/skill_score_index_job.cc @@ -61,11 +61,11 @@ SSIndexJobInfo::SSIndexJobInfo(const SSIndexJobInfo &c) { SSIndexJobInfo & SSIndexJobInfo::operator=(const SSIndexJobInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -168,7 +168,7 @@ bool SSIndexJobInfo::is_keeper(const STATLine &line) { } } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -224,7 +224,7 @@ bool SSIndexJobInfo::add(STATLine &line) { init_time.add(line.fcst_init_beg()); } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -345,7 +345,7 @@ SSIDXData SSIndexJobInfo::compute_ss_index() { << " since the ratio of valid terms " << n_vld << "/" << n_term << " < " << ss_index_vld_thresh << "!\n\n"; data.n_vld = 0; - return(data); + return data; } // Compute the weighted average of the skill scores @@ -370,7 +370,7 @@ SSIDXData SSIndexJobInfo::compute_ss_index() { << ss_index_name << " Weighted Average = " << ss_avg << "\n" << ss_index_name << " Skill Score Value = " << data.ss_index << "\n"; - return(data); + return data; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index 912617a213..4e7fbea4e3 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -240,7 +240,7 @@ int met_main(int argc, char * argv []) { // clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index b182a4538d..ffbaf108ae 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -151,7 +151,7 @@ int met_main(int argc, char *argv[]) { // Close the text files and deallocate memory clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -798,7 +798,7 @@ double get_fill_value(const DataPlane &dp, int i_vx) { else fill_val = 0.0; } - return(fill_val); + return fill_val; } //////////////////////////////////////////////////////////////////////// @@ -942,7 +942,7 @@ int get_tile_tot_count() { } // end for y } // end for x - return(count); + return count; } //////////////////////////////////////////////////////////////////////// @@ -1920,7 +1920,7 @@ double sum_array(double *d, int n) { for(i=0, sum=0.0; i 1) n += (n_scale + 2) * fcat_ta[i].n(); } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// int WaveletStatConfInfo::n_stat_row() { - return(n_isc_row()); + return n_isc_row(); } //////////////////////////////////////////////////////////////////////// @@ -693,7 +693,7 @@ int get_pow2(double n) { if(fabs(nint(a) - a) > 10E-5) p = -1; else p = nint(a); - return(p); + return p; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/chk4copyright.cc b/src/tools/dev_utils/chk4copyright.cc index e145909d31..0171fb000c 100644 --- a/src/tools/dev_utils/chk4copyright.cc +++ b/src/tools/dev_utils/chk4copyright.cc @@ -437,7 +437,7 @@ int get_line(int & fd, ConcatString & s) while (read(fd, buf, n_bytes_to_read) > 0) { if (buf[0] == '\n') - return (1); + return 1; s.add(buf); @@ -446,7 +446,7 @@ int get_line(int & fd, ConcatString & s) // // end of file // - return (0); + return 0; } diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index fea08a5d9d..3f7ca5d68e 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -129,7 +129,7 @@ int met_main(int argc, char *argv[]) { delete nc_out; nc_out = (NcFile *) 0; - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/gribtab.dat_to_flat.cc b/src/tools/dev_utils/gribtab.dat_to_flat.cc index fbf84434e1..077eefd6c9 100644 --- a/src/tools/dev_utils/gribtab.dat_to_flat.cc +++ b/src/tools/dev_utils/gribtab.dat_to_flat.cc @@ -72,7 +72,7 @@ while ( in.getline(line, sizeof(line)) ) { in.close(); -return ( 0 ); +return 0; } diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index ab05cb7698..78e45b82e7 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -99,7 +99,7 @@ for (j=0; j<(cline.n()); ++j) { // j starts at one, here // done // -return ( 0 ); +return 0; } @@ -252,7 +252,7 @@ m_strncpy(line2, line, sizeof(line2), method_name); // check to make sure it's got a double quote in it // -if ( ! strchr(line, '\"') ) return ( false ); +if ( ! strchr(line, '\"') ) return false; // // index and table number @@ -262,7 +262,7 @@ c = strtok(s, " /*"); s = (char *) 0; -if ( !c ) return ( false ); +if ( !c ) return false; n = atoi(c); @@ -274,7 +274,7 @@ cout << n << ' ' << table_number << ' '; c = strtok(s, " /*{\""); -if ( !c ) return ( false ); +if ( !c ) return false; cout << '\"' << c << "\" "; @@ -289,7 +289,7 @@ k = m_strlen(c) - 1; if ( c[k] == ' ' ) c[k] = (char) 0; -if ( !c ) return ( false ); +if ( !c ) return false; cout << '\"' << c << "\" "; @@ -305,7 +305,7 @@ if ( strcmp(c, "undefined") == 0 ) { c = strtok(s, "]\""); - if ( !c ) return ( false ); + if ( !c ) return false; if ( c[0] == '}' ) cout << "\"\" "; else cout << '\"' << c << "\" "; @@ -318,7 +318,7 @@ if ( strcmp(c, "undefined") == 0 ) { cout << '\n' << flush; -return ( true ); +return true; } diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index c7d30bc638..53f08387f8 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -92,7 +92,7 @@ int met_main(int argc, char *argv[]) { // Delete the temporary blocked file remove_temp_file(blk_file); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/reformat_county_data.cc b/src/tools/dev_utils/reformat_county_data.cc index 28ce0be968..6451534de6 100644 --- a/src/tools/dev_utils/reformat_county_data.cc +++ b/src/tools/dev_utils/reformat_county_data.cc @@ -56,7 +56,7 @@ reformat(input_filename, output_filename); // done // -return ( 0 ); +return 0; } diff --git a/src/tools/dev_utils/reformat_map_data.cc b/src/tools/dev_utils/reformat_map_data.cc index b1cdcde109..3f82abc4b2 100644 --- a/src/tools/dev_utils/reformat_map_data.cc +++ b/src/tools/dev_utils/reformat_map_data.cc @@ -56,7 +56,7 @@ if ( argc != 3 ) usage(); // done // -return ( 0 ); +return 0; } diff --git a/src/tools/dev_utils/shapefiles/make_mapfiles.cc b/src/tools/dev_utils/shapefiles/make_mapfiles.cc index 8a6fa87225..23d84caf31 100644 --- a/src/tools/dev_utils/shapefiles/make_mapfiles.cc +++ b/src/tools/dev_utils/shapefiles/make_mapfiles.cc @@ -180,7 +180,7 @@ if ( do_separate_files ) { // done // -return ( 0 ); +return 0; } @@ -550,7 +550,7 @@ if ( r.admin.nonempty() ) { } -return ( s ); +return s; } From 55f5d3ed8d6d0c3316d84c16c3b9dfceaa9e95e5 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 01:34:47 +0000 Subject: [PATCH 12/72] #2673 Removed the redundant parentheses with return --- src/tools/other/ascii2nc/ascii2nc.cc | 48 ++++++++-------- src/tools/other/ascii2nc/ismn_handler.cc | 22 ++++---- src/tools/other/ascii2nc/met_handler.cc | 2 +- src/tools/other/ascii2nc/python_handler.cc | 8 +-- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 4 +- .../gen_ens_prod/gen_ens_prod_conf_info.cc | 4 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 18 +++--- src/tools/other/gis_utils/gis_dump_dbf.cc | 2 +- src/tools/other/gis_utils/gis_dump_shp.cc | 4 +- src/tools/other/gis_utils/gis_dump_shx.cc | 2 +- src/tools/other/grid_diag/grid_diag.cc | 4 +- src/tools/other/gsi_tools/conv_record.cc | 16 +++--- src/tools/other/gsi_tools/gsi_record.cc | 2 +- src/tools/other/gsi_tools/gsi_util.cc | 14 ++--- src/tools/other/gsi_tools/gsid2mpr.cc | 4 +- src/tools/other/gsi_tools/gsidens2orank.cc | 6 +- src/tools/other/gsi_tools/rad_config.cc | 4 +- src/tools/other/gsi_tools/rad_record.cc | 18 +++--- src/tools/other/ioda2nc/ioda2nc.cc | 6 +- src/tools/other/lidar2nc/calipso_5km.cc | 16 +++--- src/tools/other/lidar2nc/hdf_utils.cc | 2 +- src/tools/other/lidar2nc/lidar2nc.cc | 4 +- src/tools/other/madis2nc/madis2nc.cc | 4 +- src/tools/other/mode_graphics/cgraph_font.cc | 26 ++++----- src/tools/other/mode_graphics/cgraph_main.cc | 14 ++--- .../cgraphbase_plottype_to_string.cc | 2 +- src/tools/other/mode_graphics/color_stack.cc | 8 +-- .../mode_graphics/mode_nc_output_file.cc | 56 +++++++++---------- .../other/mode_graphics/plot_mode_field.cc | 14 ++--- src/tools/other/mode_time_domain/2d_att.cc | 8 +-- .../other/mode_time_domain/2d_att_array.cc | 12 ++-- .../other/mode_time_domain/2d_moments.cc | 6 +- src/tools/other/mode_time_domain/3d_att.cc | 20 +++---- .../mode_time_domain/3d_att_pair_array.cc | 16 +++--- .../mode_time_domain/3d_att_single_array.cc | 4 +- src/tools/other/mode_time_domain/3d_conv.cc | 4 +- .../other/mode_time_domain/3d_moments.cc | 6 +- src/tools/other/mode_time_domain/fo_graph.cc | 12 ++-- src/tools/other/mode_time_domain/fo_node.cc | 4 +- .../other/mode_time_domain/fo_node_array.cc | 6 +- .../other/mode_time_domain/interest_calc.cc | 6 +- src/tools/other/mode_time_domain/mm_engine.cc | 24 ++++---- src/tools/other/mode_time_domain/mtd.cc | 6 +- .../other/mode_time_domain/mtd_config_info.cc | 2 +- .../other/mode_time_domain/mtd_file_base.cc | 8 +-- .../other/mode_time_domain/mtd_file_float.cc | 14 ++--- .../other/mode_time_domain/mtd_file_int.cc | 36 ++++++------ .../other/mode_time_domain/mtd_partition.cc | 32 +++++------ .../mode_time_domain/mtdfiletype_to_string.cc | 14 ++--- src/tools/other/mode_time_domain/nc_grid.cc | 12 ++-- .../other/mode_time_domain/nc_utils_local.cc | 12 ++-- .../other/modis_regrid/cloudsat_swath_file.cc | 38 ++++++------- src/tools/other/modis_regrid/data_averager.cc | 6 +- src/tools/other/modis_regrid/modis_file.cc | 56 +++++++++---------- src/tools/other/modis_regrid/modis_regrid.cc | 2 +- src/tools/other/modis_regrid/sat_utils.cc | 2 +- src/tools/other/pb2nc/pb2nc.cc | 14 ++--- .../other/plot_point_obs/plot_point_obs.cc | 2 +- .../plot_point_obs_conf_info.cc | 24 ++++---- src/tools/other/point2grid/point2grid.cc | 4 +- .../regrid_data_plane/regrid_data_plane.cc | 2 +- .../shift_data_plane/shift_data_plane.cc | 2 +- src/tools/other/wwmca_tool/af_cp_file.cc | 12 ++-- src/tools/other/wwmca_tool/af_file.cc | 14 ++--- src/tools/other/wwmca_tool/af_pt_file.cc | 12 ++-- src/tools/other/wwmca_tool/ave_interp.cc | 8 +-- src/tools/other/wwmca_tool/interp_base.cc | 12 ++-- src/tools/other/wwmca_tool/max_interp.cc | 8 +-- src/tools/other/wwmca_tool/min_interp.cc | 8 +-- src/tools/other/wwmca_tool/nearest_interp.cc | 8 +-- src/tools/other/wwmca_tool/wwmca_plot.cc | 6 +- src/tools/other/wwmca_tool/wwmca_regrid.cc | 4 +- .../tc_utils/rmw_analysis/rmw_analysis.cc | 2 +- src/tools/tc_utils/tc_diag/python_tc_diag.cc | 28 +++++----- src/tools/tc_utils/tc_diag/tc_diag.cc | 18 +++--- .../tc_utils/tc_diag/tc_diag_conf_info.cc | 2 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 2 +- src/tools/tc_utils/tc_dland/tc_poly.cc | 22 ++++---- src/tools/tc_utils/tc_gen/tc_gen.cc | 2 +- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 24 ++++---- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 18 +++--- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 6 +- src/tools/tc_utils/tc_stat/tc_stat.cc | 2 +- src/tools/tc_utils/tc_stat/tc_stat_files.cc | 16 +++--- 84 files changed, 492 insertions(+), 492 deletions(-) diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index 3eb9135c1d..4d1a9bb7d9 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -217,7 +217,7 @@ int met_main(int argc, char *argv[]) { // FileHandler *file_handler = create_file_handler(ascii_format, asfile_list[0]); - if(file_handler == 0) return(0); + if(file_handler == 0) return 0; int deflate_level = compress_level; if(deflate_level < 0) deflate_level = config_info.get_compression_level(); @@ -259,9 +259,9 @@ int met_main(int argc, char *argv[]) { int status = file_handler->writeNetcdfFile(ncfile.text()); delete file_handler; - if(!status) return(1); + if(!status) return 1; - return(0); + return 0; } @@ -286,70 +286,70 @@ FileHandler *create_file_handler(const ASCIIFormat format, const ConcatString &a // switch(format) { case ASCIIFormat_MET: { - return((FileHandler *) new MetHandler(program_name)); + return (FileHandler *) new MetHandler(program_name); } case ASCIIFormat_Little_R: { - return((FileHandler *) new LittleRHandler(program_name)); + return (FileHandler *) new LittleRHandler(program_name); } case ASCIIFormat_SurfRad: { - return((FileHandler *) new SurfradHandler(program_name)); + return (FileHandler *) new SurfradHandler(program_name); } case ASCIIFormat_WWSIS: { - return((FileHandler *) new WwsisHandler(program_name)); + return (FileHandler *) new WwsisHandler(program_name); } case ASCIIFormat_Airnow_dailyv2: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_DAILYV2); - return((FileHandler *) handler); + return (FileHandler *) handler; } case ASCIIFormat_Airnow_hourlyaqobs: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_HOURLYAQOBS); - return((FileHandler *) handler); + return (FileHandler *) handler; } case ASCIIFormat_Airnow_hourly: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_HOURLY); - return((FileHandler *) handler); + return (FileHandler *) handler; } case ASCIIFormat_NDBC_standard: { NdbcHandler *handler = new NdbcHandler(program_name); handler->setFormatVersion(NdbcHandler::NDBC_FORMAT_VERSION_STANDARD); - return((FileHandler *) handler); + return (FileHandler *) handler; } case ASCIIFormat_ISMN: { - return((FileHandler *) new IsmnHandler(program_name)); + return (FileHandler *) new IsmnHandler(program_name); } case ASCIIFormat_Aeronet_v2: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(2); - return((FileHandler *) handler); + return (FileHandler *) handler; } case ASCIIFormat_Aeronet_v3: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(3); - return((FileHandler *) handler); + return (FileHandler *) handler; } #ifdef ENABLE_PYTHON case ASCIIFormat_Python: { setup_wrapper_path(); ph = new PythonHandler(program_name, ascii_filename.text()); - return((FileHandler *) ph); + return (FileHandler *) ph; } #endif default: { - return(determine_ascii_format(ascii_filename)); + return determine_ascii_format(ascii_filename); } } } @@ -382,7 +382,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if (met_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) met_file); + return (FileHandler *) met_file; } delete met_file; @@ -395,7 +395,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if (little_r_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) little_r_file); + return (FileHandler *) little_r_file; } delete little_r_file; @@ -408,7 +408,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if (surfrad_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) surfrad_file); + return (FileHandler *) surfrad_file; } delete surfrad_file; @@ -421,7 +421,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if(wwsis_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) wwsis_file); + return (FileHandler *) wwsis_file; } delete wwsis_file; @@ -434,7 +434,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if(aeronet_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) aeronet_file); + return (FileHandler *) aeronet_file; } delete aeronet_file; @@ -447,7 +447,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if(airnow_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) airnow_file); + return (FileHandler *) airnow_file; } delete airnow_file; @@ -460,7 +460,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if(ndbc_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) ndbc_file); + return (FileHandler *) ndbc_file; } delete ndbc_file; @@ -473,7 +473,7 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { if(ismn_file->isFileType(f_in)) { f_in.close(); - return((FileHandler *) ismn_file); + return (FileHandler *) ismn_file; } delete ismn_file; diff --git a/src/tools/other/ascii2nc/ismn_handler.cc b/src/tools/other/ascii2nc/ismn_handler.cc index e1b2e45759..729decb0a8 100644 --- a/src/tools/other/ascii2nc/ismn_handler.cc +++ b/src/tools/other/ascii2nc/ismn_handler.cc @@ -83,7 +83,7 @@ bool IsmnHandler::isFileType(LineDataFile &ascii_file) const { ascii_file >> dl; if(dl.n_items() != NUM_OBS_COLS) is_file_type = false; - return(is_file_type); + return is_file_type; } //////////////////////////////////////////////////////////////////////// @@ -93,11 +93,11 @@ bool IsmnHandler::isFileType(LineDataFile &ascii_file) const { bool IsmnHandler::_readObservations(LineDataFile &ascii_file) { // Read and save the header information - if(!_readHeaderInfo(ascii_file)) return(false); + if(!_readHeaderInfo(ascii_file)) return false; // Get the var_id to use int var_id = bad_data_int; - if(!_varNames.has(_obsVarInfo._varName, var_id)) return(false); + if(!_varNames.has(_obsVarInfo._varName, var_id)) return false; // Process the observation lines DataLine dl; @@ -110,12 +110,12 @@ bool IsmnHandler::_readObservations(LineDataFile &ascii_file) { << " != " << NUM_OBS_COLS << ") on line number " << dl.line_number() << " of ISMN file \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Extract the valid time from the data line time_t valid_time = _getValidTime(dl); - if(valid_time == 0) return(false); + if(valid_time == 0) return false; // Store the observation value double obs_value = atof(dl[2]); @@ -153,7 +153,7 @@ bool IsmnHandler::_readObservations(LineDataFile &ascii_file) { } // end while - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -184,7 +184,7 @@ time_t IsmnHandler::_getValidTime(const DataLine &dl) const { time_struct.tm_min = stoi( hm_str.substr(3, 2)); } - return(timegm(&time_struct)); + return timegm(&time_struct); } //////////////////////////////////////////////////////////////////////// @@ -201,7 +201,7 @@ bool IsmnHandler::_readHeaderInfo(LineDataFile &ascii_file) { mlog << Error << "\nIsmnHandler::_readHeaderInfo() -> " << "unexpected ISMN file name \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Validate the variable name @@ -210,7 +210,7 @@ bool IsmnHandler::_readHeaderInfo(LineDataFile &ascii_file) { << "unexpected variable name (" << sa[3] << ") found in ISMN file name \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Store the observation variable info @@ -230,7 +230,7 @@ bool IsmnHandler::_readHeaderInfo(LineDataFile &ascii_file) { << dl.n_items() << " < " << MIN_NUM_HDR_COLS << ") in ISMN file \"" << ascii_file.filename() << "\"!\n\n"; - return(false); + return false; } // Store the header information @@ -249,7 +249,7 @@ bool IsmnHandler::_readHeaderInfo(LineDataFile &ascii_file) { _depth = (atof(dl[6]) + atof(dl[7]))/2.0; } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/ascii2nc/met_handler.cc b/src/tools/other/ascii2nc/met_handler.cc index 5b19b8b0f6..f6c52fc671 100644 --- a/src/tools/other/ascii2nc/met_handler.cc +++ b/src/tools/other/ascii2nc/met_handler.cc @@ -184,7 +184,7 @@ bool MetHandler::_readObservations(LineDataFile &ascii_file) double parse_num(const char *s) { - if(!s) return(bad_data_double); + if(!s) return bad_data_double; return( (strcasecmp(s, na_str) == 0 ? bad_data_double : atof(s)) ); } diff --git a/src/tools/other/ascii2nc/python_handler.cc b/src/tools/other/ascii2nc/python_handler.cc index 28107fb1c7..f2a24d6db1 100644 --- a/src/tools/other/ascii2nc/python_handler.cc +++ b/src/tools/other/ascii2nc/python_handler.cc @@ -228,7 +228,7 @@ bool status = false; if ( use_tmp_ascii ) status = do_tmp_ascii (); else status = do_straight (); -return ( status ); +return status; } @@ -278,7 +278,7 @@ if ( PyErr_Occurred() ) { << "an error occurred importing module " << '\"' << user_base.text() << "\"\n\n"; - return ( false ); + return false; } @@ -303,7 +303,7 @@ PyObject * obj = md.lookup_list(list_name); load_python_obs(obj); -return ( true ); +return true; } @@ -403,7 +403,7 @@ remove_temp_file(tmp_ascii_path); // done // -return ( true ); +return true; } diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index dd6d003289..0b9375a274 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -104,7 +104,7 @@ int met_main(int argc, char *argv[]) { // Close output files and deallocate memory clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -670,7 +670,7 @@ bool get_data_plane(const char *infile, GrdFileType ftype, // Deallocate the data file pointer, if necessary if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - return(found); + return found; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc index cce3912742..b237c13fa8 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc @@ -377,7 +377,7 @@ GenEnsProdNcOutInfo GenEnsProdConfInfo::parse_nc_info(Dictionary *dict) { cur.do_climo_cdp = d->lookup_bool(conf_key_climo_cdp_flag); } - return(cur); + return cur; } //////////////////////////////////////////////////////////////////////// @@ -408,7 +408,7 @@ bool GenEnsProdNcOutInfo::all_false() const { do_vld || do_freq || do_nep || do_nmep || do_climo || do_climo_cdp; - return(!status); + return !status; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 3a2bf0224f..23cf43cf8e 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -96,7 +96,7 @@ int met_main(int argc, char *argv[]) { // Write out the mask file to NetCDF write_netcdf(dp_out); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -502,13 +502,13 @@ bool get_gen_vx_mask_config_str(MetNcMetDataFile *mnmdf_ptr, int i; // Check for null pointer - if(!mnmdf_ptr) return(status); + if(!mnmdf_ptr) ; // Check for the MET_tool global attribute - if(!get_global_att(mnmdf_ptr->MetNc->Nc, (string) "MET_tool", tool)) return(status); + if(!get_global_att(mnmdf_ptr->MetNc->Nc, (string) "MET_tool", tool)) return status; // Check for gen_vx_mask output - if(tool != program_name) return(status); + if(tool != program_name) return status; // Loop through the NetCDF variables for(i=0; iMetNc->Nvars; i++) { @@ -525,7 +525,7 @@ bool get_gen_vx_mask_config_str(MetNcMetDataFile *mnmdf_ptr, break; } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -689,7 +689,7 @@ bool is_shape_str_match(const int i_shape, const StringArray &names, const Strin } - return(match); + return match; } //////////////////////////////////////////////////////////////////////// @@ -1386,7 +1386,7 @@ DataPlane combine(const DataPlane &dp_data, const DataPlane &dp_mask, << " points inside\n"; } - return(dp); + return dp; } //////////////////////////////////////////////////////////////////////// @@ -1519,7 +1519,7 @@ MaskType string_to_masktype(const char *s) { exit(1); } - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -1544,7 +1544,7 @@ const char * masktype_to_string(const MaskType t) { default: s = (const char *) 0; break; } - return(s); + return s; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gis_utils/gis_dump_dbf.cc b/src/tools/other/gis_utils/gis_dump_dbf.cc index c9aab98c9f..6fd541baf3 100644 --- a/src/tools/other/gis_utils/gis_dump_dbf.cc +++ b/src/tools/other/gis_utils/gis_dump_dbf.cc @@ -151,7 +151,7 @@ for (j=0; j<(h.n_records); ++j) { close(fd); -return ( 0 ); +return 0; } diff --git a/src/tools/other/gis_utils/gis_dump_shp.cc b/src/tools/other/gis_utils/gis_dump_shp.cc index 5e95bacced..a4f86d68f5 100644 --- a/src/tools/other/gis_utils/gis_dump_shp.cc +++ b/src/tools/other/gis_utils/gis_dump_shp.cc @@ -116,7 +116,7 @@ f.header()->dump(cout, 1); cout << '\n' << flush; -if ( header_only ) return ( 0 ); +if ( header_only ) return 0; // // records @@ -150,7 +150,7 @@ switch ( shape_type ) { f.close(); -return ( 0 ); +return 0; } diff --git a/src/tools/other/gis_utils/gis_dump_shx.cc b/src/tools/other/gis_utils/gis_dump_shx.cc index 7fdda4be1f..593583c6bd 100644 --- a/src/tools/other/gis_utils/gis_dump_shx.cc +++ b/src/tools/other/gis_utils/gis_dump_shx.cc @@ -126,7 +126,7 @@ cout << "\n\n Read " << count << " records\n\n"; close(fd); -return ( 0 ); +return 0; } diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index 4a54b42ee2..b8a81261d2 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -100,7 +100,7 @@ int met_main(int argc, char *argv[]) { // Close files and deallocate memory clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -784,7 +784,7 @@ Met2dDataFile *get_mtddf(const StringArray &file_list, exit(1); } - return(mtddf); + return mtddf; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/conv_record.cc b/src/tools/other/gsi_tools/conv_record.cc index 92d5cb8904..81be4cad98 100644 --- a/src/tools/other/gsi_tools/conv_record.cc +++ b/src/tools/other/gsi_tools/conv_record.cc @@ -114,7 +114,7 @@ const int n = fortran_two_to_one(nreal, data_index, station); double value = (double) (rdiag[n]); -return ( value ); +return value; } @@ -152,7 +152,7 @@ for (j=7; j>=0; --j) { } -return ( ConcatString(localbuf) ); +return ConcatString(localbuf); } @@ -171,7 +171,7 @@ unix_to_mdyhms(date, month, day, year, hour, minute, second); snprintf(junk, sizeof(junk), "%04d%02d%02d_%02d0000", year, month, day, hour); -return ( ConcatString(junk) ); +return ConcatString(junk); } @@ -296,7 +296,7 @@ if ( (Fd = met_open(path, O_RDONLY)) < 0 ) { Fd = -1; - return ( false ); + return false; } @@ -320,7 +320,7 @@ if ( s <= 0 ) { mlog << Warning << "\nConvFile::open() -> " << "unable to read date from input file: " << Filename << "\n\n"; - return ( false ); + return false; } @@ -363,7 +363,7 @@ ::lseek(Fd, cur_pos, SEEK_SET); // done // -return ( true ); +return true; } @@ -393,7 +393,7 @@ r.extend(512); long long s = read_fortran_binary(f.Fd, r.Buf, 23, f.RecPadSize, f.SwapEndian); -if ( s == 0 ) return ( false ); +if ( s == 0 ) return false; if ( s != 19 && s != 23 ) { @@ -454,7 +454,7 @@ if ( f.SwapEndian ) { // done // -return ( true ); +return true; } diff --git a/src/tools/other/gsi_tools/gsi_record.cc b/src/tools/other/gsi_tools/gsi_record.cc index 0f9bf88897..7eb8fec34c 100644 --- a/src/tools/other/gsi_tools/gsi_record.cc +++ b/src/tools/other/gsi_tools/gsi_record.cc @@ -77,7 +77,7 @@ GsiRecord & GsiRecord::operator=(const GsiRecord & g) { -if ( this == &g ) return ( * this ); +if ( this == &g ) return *this; gsi_assign(g); diff --git a/src/tools/other/gsi_tools/gsi_util.cc b/src/tools/other/gsi_tools/gsi_util.cc index d56da8a71c..d9144c0c53 100644 --- a/src/tools/other/gsi_tools/gsi_util.cc +++ b/src/tools/other/gsi_tools/gsi_util.cc @@ -153,7 +153,7 @@ ConvData parse_conv_data(const ConvRecord &r, const int i) { d.n_use = 0; - return(d); + return d; } //////////////////////////////////////////////////////////////////////// @@ -223,7 +223,7 @@ RadData parse_rad_data(const RadRecord &r, const int i, d.n_use = 0; - return(d); + return d; } @@ -239,7 +239,7 @@ ConcatString get_conv_key(const ConvData &d) { << unix_to_yyyymmdd_hhmmss(d.obs_ut) << key_sep << d.obs; - return(key); + return key; } //////////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ ConcatString get_rad_key(const RadData &d) { << unix_to_yyyymmdd_hhmmss(d.obs_ut) << key_sep << d.obs; - return(key); + return key; } //////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ int key_to_integer(const char * key) { int_key += ((int)key[idx]) << (idx%3)*8; //int_key += (int)key[idx]; } - return(int_key); + return int_key; } //////////////////////////////////////////////////////////////////////// @@ -285,13 +285,13 @@ bool is_micro(const char *s) { } } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// bool is_retr(const char *s) { - return(false); + return false; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsid2mpr.cc b/src/tools/other/gsi_tools/gsid2mpr.cc index b12c853171..7fffb59004 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.cc +++ b/src/tools/other/gsi_tools/gsid2mpr.cc @@ -114,7 +114,7 @@ int met_main(int argc, char * argv []) { else process_rad (cline[i].c_str(), output_filename.c_str()); } - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -513,7 +513,7 @@ bool is_dup(const char *key) { key_array.add(key); obs_key_map[int_key] = key_array; } - return(dup); + return dup; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsidens2orank.cc b/src/tools/other/gsi_tools/gsidens2orank.cc index 91c1ce0671..c821d03bdc 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.cc +++ b/src/tools/other/gsi_tools/gsidens2orank.cc @@ -176,7 +176,7 @@ int met_main(int argc, char * argv []) { // Write the output write_orank(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -775,7 +775,7 @@ bool has_key(const ConcatString &key) { found_key = true; } } - return(found_key); + return found_key; } //////////////////////////////////////////////////////////////////////// @@ -796,7 +796,7 @@ bool has_key(const ConcatString &key, int & index) { } } } - return(found_key); + return found_key; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/rad_config.cc b/src/tools/other/gsi_tools/rad_config.cc index 86bb3af627..5ec7d33680 100644 --- a/src/tools/other/gsi_tools/rad_config.cc +++ b/src/tools/other/gsi_tools/rad_config.cc @@ -128,11 +128,11 @@ clear(); const bool status = Config.read(filename); -if ( ! status ) return ( status ); +if ( ! status ) return status; get_config_data(); -return ( status ); +return status; } diff --git a/src/tools/other/gsi_tools/rad_record.cc b/src/tools/other/gsi_tools/rad_record.cc index eac2a3bd68..fb872b3a7f 100644 --- a/src/tools/other/gsi_tools/rad_record.cc +++ b/src/tools/other/gsi_tools/rad_record.cc @@ -226,7 +226,7 @@ if ( (index < 0) || (index >= Ndiag) ) { } -return ( (double) (diag[index]) ); +return (double) (diag[index]); } @@ -258,7 +258,7 @@ if ( (channel < 0) || (channel >= N2) ) { const int n = fortran_two_to_one(N1, index, channel); -return ( (double) (diagchan[n]) ); +return (double) (diagchan[n]); } @@ -290,7 +290,7 @@ if ( (i < 0) || (i >= iextra) || (j < 0) || (j >= jextra) ) { const int n = fortran_two_to_one(iextra, i, j); -return ( (double) (extra[n]) ); +return (double) (extra[n]); } @@ -531,7 +531,7 @@ if ( (n < 0) || (n >= Nchannels) ) { } -return ( C_params[n].nuchan ); +return C_params[n].nuchan; } @@ -553,7 +553,7 @@ if ( (n < 0) || (n >= Nchannels) ) { } -return ( C_params[n].iuse ); +return C_params[n].iuse; } @@ -571,7 +571,7 @@ if ( (Fd = met_open(path, O_RDONLY)) < 0 ) { Fd = -1; - return ( false ); + return false; } @@ -651,7 +651,7 @@ ::lseek(Fd, cur_pos, SEEK_SET); // done // -return ( true ); +return true; } @@ -705,7 +705,7 @@ r.extend(s); n_read = read_fortran_binary(f.Fd, r.Buf, r.Nalloc, f.get_rec_pad_size(), f.get_swap_endian()); -if ( n_read == 0 ) return ( false ); +if ( n_read == 0 ) return false; if ( n_read != bytes ) { @@ -748,7 +748,7 @@ if ( f.get_swap_endian() ) { // done // -return ( true ); +return true; } diff --git a/src/tools/other/ioda2nc/ioda2nc.cc b/src/tools/other/ioda2nc/ioda2nc.cc index 552df4bde7..9c4233ded4 100644 --- a/src/tools/other/ioda2nc/ioda2nc.cc +++ b/src/tools/other/ioda2nc/ioda2nc.cc @@ -1164,7 +1164,7 @@ bool keep_message_type(const char *mt_str) { mlog << Debug(REJECT_DEBUG_LEVEL) << "The message type [" << mt_str << "] is rejected\n"; } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -1178,7 +1178,7 @@ bool keep_station_id(const char *sid_str) { mlog << Debug(REJECT_DEBUG_LEVEL) << "The station ID [" << sid_str << "] is rejected\n"; } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -1205,7 +1205,7 @@ bool keep_valid_time(const unixtime ut, << unix_to_yyyymmdd_hhmmss(ut) << "] is rejected\n"; } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/lidar2nc/calipso_5km.cc b/src/tools/other/lidar2nc/calipso_5km.cc index a169627fa7..6ac6859350 100644 --- a/src/tools/other/lidar2nc/calipso_5km.cc +++ b/src/tools/other/lidar2nc/calipso_5km.cc @@ -38,7 +38,7 @@ static float ff[2]; inline float km_to_meters(float km) { - if ( km == FILL_VALUE ) return ( FILL_VALUE ); + if ( km == FILL_VALUE ) return FILL_VALUE; return ( km*1000.f ); @@ -336,7 +336,7 @@ t = k + jan_1_1993; // done // -return ( t ); +return t; } @@ -846,13 +846,13 @@ int Calipso_5km_Obs::get_feature_type_qa_value(int layer) { -if ( n_layers == 0 ) return ( -1 ); +if ( n_layers == 0 ) return -1; int k; k = extract_bits(fclass[layer], type_qa_mask, type_qa_shift); -return ( k ); +return k; } @@ -908,13 +908,13 @@ int Calipso_5km_Obs::get_ice_water_qa_value(int layer) { -if ( n_layers == 0 ) return ( -1 ); +if ( n_layers == 0 ) return -1; int k; k = extract_bits(fclass[layer], ice_water_qa_mask, ice_water_qa_shift); -return ( k ); +return k; } @@ -970,13 +970,13 @@ int Calipso_5km_Obs::get_cloud_aerosol_qa_value(int layer) { -if ( n_layers == 0 ) return ( -1 ); +if ( n_layers == 0 ) return -1; int k; k = extract_bits(fclass[layer], cloud_aerosol_qa_mask, cloud_aerosol_qa_shift); -return ( k ); +return k; } diff --git a/src/tools/other/lidar2nc/hdf_utils.cc b/src/tools/other/lidar2nc/hdf_utils.cc index fd5e66530e..df8c82f309 100644 --- a/src/tools/other/lidar2nc/hdf_utils.cc +++ b/src/tools/other/lidar2nc/hdf_utils.cc @@ -157,7 +157,7 @@ switch ( type ) { -return ( k ); +return k; } diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index b2e6573f44..7bbaa72351 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -148,7 +148,7 @@ nc_point_obs.close(); // done // -return ( 0 ); +return 0; } @@ -256,7 +256,7 @@ switch ( hdf_type ) { } // switch -return ( t ); +return t; } diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index 3a77ce8d72..3bb21b32ec 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -176,7 +176,7 @@ int met_main(int argc, char *argv[]) { // clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -673,7 +673,7 @@ MadisType get_madis_type(NcFile *&f_in) { else if (get_global_att(f_in, (string)"title", attr_value)) { if (attr_value.contents("MADIS ACARS") != "") madis_type = madis_acarsProfiles; } - return(madis_type); + return madis_type; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/cgraph_font.cc b/src/tools/other/mode_graphics/cgraph_font.cc index 451b6f9c90..8883eee633 100644 --- a/src/tools/other/mode_graphics/cgraph_font.cc +++ b/src/tools/other/mode_graphics/cgraph_font.cc @@ -92,11 +92,11 @@ CgFont & CgFont::operator=(const CgFont & p) { -if ( this == &p ) return ( * this ); +if ( this == &p ) return *this; assign(p); -return ( * this ); +return *this; } @@ -361,11 +361,11 @@ CgFontCollection & CgFontCollection::operator=(const CgFontCollection & c) { -if ( this == &c ) return ( * this ); +if ( this == &c ) return *this; assign(c); -return ( * this ); +return *this; } @@ -563,11 +563,11 @@ int j; for (j=0; j= Nelements) ) { } -return ( & e[k] ); +return &e[k]; } @@ -650,9 +650,9 @@ bool same_font(const CgFont & a, const CgFont & b) { -if ( a.ps_name == b.ps_name ) return ( true ); +if ( a.ps_name == b.ps_name ) return true; -return ( false ); +return false; } diff --git a/src/tools/other/mode_graphics/cgraph_main.cc b/src/tools/other/mode_graphics/cgraph_main.cc index baa2b3be01..81344815ce 100644 --- a/src/tools/other/mode_graphics/cgraph_main.cc +++ b/src/tools/other/mode_graphics/cgraph_main.cc @@ -377,7 +377,7 @@ if ( error ) { // done // -// return ( true ); +// return true; return; } @@ -657,7 +657,7 @@ if ( !CurrentFont ) { } -return ( CurrentFont->scaled_ps_size ); +return CurrentFont->scaled_ps_size; } @@ -732,7 +732,7 @@ if ( error ) { // done // -return ( face ); +return face; } @@ -1500,7 +1500,7 @@ Color c(0, 0, 0); if ( CS.depth() > 0 ) c = CS.peek(); -return ( c ); +return c; } @@ -2164,7 +2164,7 @@ info->cgraph->moveto(x, y); info->have_path = true; -return ( 0 ); +return 0; } @@ -2187,7 +2187,7 @@ info->cgraph->lineto(x, y); info->have_path = true; -return ( 0 ); +return 0; } @@ -2230,7 +2230,7 @@ info->cgraph->curveto(x1, y1, x2, y2, x3, y3); info->have_path = true; -return ( 0 ); +return 0; } diff --git a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc index 313b169ca4..0d8983ff96 100644 --- a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc +++ b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc @@ -58,7 +58,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/tools/other/mode_graphics/color_stack.cc b/src/tools/other/mode_graphics/color_stack.cc index fb9d750364..cafaad3ded 100644 --- a/src/tools/other/mode_graphics/color_stack.cc +++ b/src/tools/other/mode_graphics/color_stack.cc @@ -77,11 +77,11 @@ ColorStack & ColorStack::operator=(const ColorStack & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -307,7 +307,7 @@ Color _t = *(e[Nelements - 1]); --Nelements; -return ( _t ); +return _t; } @@ -329,7 +329,7 @@ if ( Nelements <= 0 ) { Color _t = *(e[Nelements - 1]); -return ( _t ); +return _t; } diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.cc b/src/tools/other/mode_graphics/mode_nc_output_file.cc index b958f30d6d..5d9c0dc2f7 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.cc +++ b/src/tools/other/mode_graphics/mode_nc_output_file.cc @@ -84,7 +84,7 @@ ModeNcOutputFile & ModeNcOutputFile::operator=(const ModeNcOutputFile &) { -// if ( this == &m ) return ( * this ); +// if ( this == &m ) return *this; // // assign(m); @@ -183,7 +183,7 @@ if ( IS_INVALID_NC_P(f) ) { close(); - return ( false ); + return false; } @@ -279,7 +279,7 @@ for (x=0; x= Nx) ) return ( false ); +if ( (x < 0) || (x >= Nx) ) return false; int y; double v; @@ -839,11 +839,11 @@ for (y=0; y tol ) return ( true ); + if ( fabs(v - bad) > tol ) return true; } -return ( false ); +return false; } @@ -855,7 +855,7 @@ bool ModeNcOutputFile::y_line_valid (const int y) const { -if ( (y < 0) || (y >= Ny) ) return ( false ); +if ( (y < 0) || (y >= Ny) ) return false; int x; double v; @@ -866,11 +866,11 @@ for (x=0; x tol ) return ( true ); + if ( fabs(v - bad) > tol ) return true; } -return ( false ); +return false; } @@ -1012,7 +1012,7 @@ ConcatString s; s = get_short_name(Filename.c_str()); -return ( s ); +return s; } diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index e15bb31c7a..49cee17d08 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -252,7 +252,7 @@ for (j=0; j<(cline.n()); ++j) { } -return ( 0 ); +return 0; } @@ -1114,7 +1114,7 @@ if ( e->type() != StringType ) { s = e->string_value(); -return ( s ); +return s; } @@ -1144,7 +1144,7 @@ if ( !e ) { tf = e->b_value(); -return ( tf ); +return tf; } @@ -1174,7 +1174,7 @@ if ( !e ) { k = e->i_value(); -return ( k ); +return k; } @@ -1215,7 +1215,7 @@ else{ } -return ( t ); +return t; } @@ -1258,7 +1258,7 @@ for (j=0; j<3; ++j) { c.set_rgb(rgb[0], rgb[1], rgb[2]); -return ( c ); +return c; } @@ -1442,7 +1442,7 @@ s = target_width/(plot.LastTextWidth); if ( s > 1.0 ) s = 1.0; -return ( s ); +return s; } diff --git a/src/tools/other/mode_time_domain/2d_att.cc b/src/tools/other/mode_time_domain/2d_att.cc index 09533c9311..dda02837c0 100644 --- a/src/tools/other/mode_time_domain/2d_att.cc +++ b/src/tools/other/mode_time_domain/2d_att.cc @@ -90,11 +90,11 @@ SingleAtt2D & SingleAtt2D::operator=(const SingleAtt2D & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -405,7 +405,7 @@ if ( moments.N == 0 ) { // exit ( 1 ); - return ( a ); + return a; } @@ -472,7 +472,7 @@ a.Ptile_User = percentile_f(values, n, (double) (a.Ptile_Value/100.0)); if ( values ) { delete [] values; values = 0; } -return ( a ); +return a; } diff --git a/src/tools/other/mode_time_domain/2d_att_array.cc b/src/tools/other/mode_time_domain/2d_att_array.cc index 04b5310414..e402cced6f 100644 --- a/src/tools/other/mode_time_domain/2d_att_array.cc +++ b/src/tools/other/mode_time_domain/2d_att_array.cc @@ -91,11 +91,11 @@ SingleAtt2DArray & SingleAtt2DArray::operator=(const SingleAtt2DArray & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -305,7 +305,7 @@ if ( (N < 0) || (N >= Nelements) ) { exit ( 1 ); } -return ( e[N] ); +return e[N]; } @@ -352,7 +352,7 @@ if ( (index < 0) || (index >= Nelements) ) { } -return ( e[index].valid_time() ); +return e[index].valid_time(); } @@ -373,7 +373,7 @@ if ( (index < 0) || (index >= Nelements) ) { } -return ( e[index].lead_time() ); +return e[index].lead_time(); } @@ -394,7 +394,7 @@ if ( (index < 0) || (index >= Nelements) ) { } -return ( e[index].time_index() ); +return e[index].time_index(); } diff --git a/src/tools/other/mode_time_domain/2d_moments.cc b/src/tools/other/mode_time_domain/2d_moments.cc index 8e4e2a972b..7b10db6b59 100644 --- a/src/tools/other/mode_time_domain/2d_moments.cc +++ b/src/tools/other/mode_time_domain/2d_moments.cc @@ -76,11 +76,11 @@ Mtd_2D_Moments & Mtd_2D_Moments::operator=(const Mtd_2D_Moments & m) { -if ( this == &m ) return ( * this ); +if ( this == &m ) return *this; assign(m); -return ( * this ); +return *this; } @@ -234,7 +234,7 @@ rho_2 = Sxy; angle = 0.5*atan2d(rho_2, rho_1); -return ( angle ); +return angle; } diff --git a/src/tools/other/mode_time_domain/3d_att.cc b/src/tools/other/mode_time_domain/3d_att.cc index b35b4d6116..dac46a7997 100644 --- a/src/tools/other/mode_time_domain/3d_att.cc +++ b/src/tools/other/mode_time_domain/3d_att.cc @@ -99,11 +99,11 @@ SingleAtt3D & SingleAtt3D::operator=(const SingleAtt3D & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -436,7 +436,7 @@ double s; s = sqrt( Xvelocity*Xvelocity + Yvelocity*Yvelocity ); -return ( s ); +return s; } @@ -452,7 +452,7 @@ int n; n = Tmax - Tmin + 1; -return ( n ); +return n; } @@ -745,11 +745,11 @@ PairAtt3D & PairAtt3D::operator=(const PairAtt3D & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -1398,7 +1398,7 @@ a.Ptile_User = percentile_f(values, n, (double) (a.Ptile_Value/100.0)); if ( values ) { delete [] values; values = 0; } -return ( a ); +return a; } @@ -1541,7 +1541,7 @@ p.set_duration_difference(t); // done // -return ( p ); +return p; } @@ -1723,7 +1723,7 @@ t = num/den; // done // -return ( t ); +return t; } */ @@ -1763,7 +1763,7 @@ dist = gc_dist(lat1, lon1, lat2, lon2); // done // -return ( dist ); +return dist; } diff --git a/src/tools/other/mode_time_domain/3d_att_pair_array.cc b/src/tools/other/mode_time_domain/3d_att_pair_array.cc index 6e2278889c..8010289812 100644 --- a/src/tools/other/mode_time_domain/3d_att_pair_array.cc +++ b/src/tools/other/mode_time_domain/3d_att_pair_array.cc @@ -78,11 +78,11 @@ PairAtt3DArray & PairAtt3DArray::operator=(const PairAtt3DArray & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -292,7 +292,7 @@ if ( (N < 0) || (N >= Nelements) ) { exit ( 1 ); } -return ( e[N] ); +return e[N]; } @@ -312,7 +312,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( e[k].fcst_obj_number() ); +return e[k].fcst_obj_number(); } @@ -332,7 +332,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( e[k].obs_obj_number() ); +return e[k].obs_obj_number(); } @@ -352,7 +352,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( e[k].fcst_cluster_number() ); +return e[k].fcst_cluster_number(); } @@ -372,7 +372,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( e[k].obs_cluster_number() ); +return e[k].obs_cluster_number(); } @@ -392,7 +392,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( e[k].total_interest() ); +return e[k].total_interest(); } diff --git a/src/tools/other/mode_time_domain/3d_att_single_array.cc b/src/tools/other/mode_time_domain/3d_att_single_array.cc index 120747e92f..16630fc06f 100644 --- a/src/tools/other/mode_time_domain/3d_att_single_array.cc +++ b/src/tools/other/mode_time_domain/3d_att_single_array.cc @@ -78,11 +78,11 @@ SingleAtt3DArray & SingleAtt3DArray::operator=(const SingleAtt3DArray & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } diff --git a/src/tools/other/mode_time_domain/3d_conv.cc b/src/tools/other/mode_time_domain/3d_conv.cc index a0ad85c12a..ae3069c0e1 100644 --- a/src/tools/other/mode_time_domain/3d_conv.cc +++ b/src/tools/other/mode_time_domain/3d_conv.cc @@ -76,7 +76,7 @@ struct DataHandle { } - return ( k ); + return k; } @@ -439,7 +439,7 @@ if ( conv_data ) { delete [] conv_data; conv_data = (double *) nullptr; } if ( sum_plane_buf ) { delete [] sum_plane_buf; sum_plane_buf = nullptr; } if ( ok_sum_plane_buf ) { delete [] ok_sum_plane_buf; ok_sum_plane_buf = nullptr; } -return ( out ); +return out; } diff --git a/src/tools/other/mode_time_domain/3d_moments.cc b/src/tools/other/mode_time_domain/3d_moments.cc index 2f58298bc0..1a8349395b 100644 --- a/src/tools/other/mode_time_domain/3d_moments.cc +++ b/src/tools/other/mode_time_domain/3d_moments.cc @@ -76,11 +76,11 @@ Mtd_3D_Moments & Mtd_3D_Moments::operator=(const Mtd_3D_Moments & m) { -if ( this == &m ) return ( * this ); +if ( this == &m ) return *this; assign(m); -return ( * this ); +return *this; } @@ -280,7 +280,7 @@ bot = (Sxx - Syy)*Stt + Syt*Syt - Sxt*Sxt; angle = 0.5*atan2d(top, bot); -return ( angle ); +return angle; } diff --git a/src/tools/other/mode_time_domain/fo_graph.cc b/src/tools/other/mode_time_domain/fo_graph.cc index eebc762c26..be5124718c 100644 --- a/src/tools/other/mode_time_domain/fo_graph.cc +++ b/src/tools/other/mode_time_domain/fo_graph.cc @@ -78,11 +78,11 @@ FO_Graph & FO_Graph::operator=(const FO_Graph & g) { -if ( this == &g ) return ( * this ); +if ( this == &g ) return *this; assign(g); -return ( * this ); +return *this; } @@ -174,7 +174,7 @@ if ( (f_num < 0) || (f_num >= N_fcst) ) { } -return ( f_num ); +return f_num; } @@ -253,7 +253,7 @@ const int i_o = o_index(n_o); const int n = two_to_one(i_f, i_o); -return ( TheGraph[n].has_edge() ); +return TheGraph[n].has_edge(); } @@ -270,7 +270,7 @@ const int i_f_2 = f_index(n_f_2); const int n = two_to_one(i_f_1, i_f_2); -return ( TheGraph[n].has_edge() ); +return TheGraph[n].has_edge(); } @@ -287,7 +287,7 @@ const int i_o_2 = o_index(n_o_2); const int n = two_to_one(i_o_1, i_o_2); -return ( TheGraph[n].has_edge() ); +return TheGraph[n].has_edge(); } diff --git a/src/tools/other/mode_time_domain/fo_node.cc b/src/tools/other/mode_time_domain/fo_node.cc index bcad38ee9b..701580249b 100644 --- a/src/tools/other/mode_time_domain/fo_node.cc +++ b/src/tools/other/mode_time_domain/fo_node.cc @@ -76,11 +76,11 @@ FO_Node & FO_Node::operator=(const FO_Node & n) { -if ( this == &n ) return ( * this ); +if ( this == &n ) return *this; assign(n); -return ( * this ); +return *this; } diff --git a/src/tools/other/mode_time_domain/fo_node_array.cc b/src/tools/other/mode_time_domain/fo_node_array.cc index 045daaa0ba..2ad499ca94 100644 --- a/src/tools/other/mode_time_domain/fo_node_array.cc +++ b/src/tools/other/mode_time_domain/fo_node_array.cc @@ -78,11 +78,11 @@ FO_Node_Array & FO_Node_Array::operator=(const FO_Node_Array & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -292,7 +292,7 @@ if ( (N < 0) || (N >= Nelements) ) { exit ( 1 ); } -return ( e[N] ); +return e[N]; } diff --git a/src/tools/other/mode_time_domain/interest_calc.cc b/src/tools/other/mode_time_domain/interest_calc.cc index 9567f78caa..63263a853f 100644 --- a/src/tools/other/mode_time_domain/interest_calc.cc +++ b/src/tools/other/mode_time_domain/interest_calc.cc @@ -82,11 +82,11 @@ InterestCalculator & InterestCalculator::operator=(const InterestCalculator & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -353,7 +353,7 @@ for (j=0; jhas(fcst_num) ) return ( j ); + if ( eq->has(fcst_num) ) return j; } -return ( -1 ); +return -1; } @@ -360,11 +360,11 @@ for (j=0; jhas(obs_num) ) return ( j ); + if ( eq->has(obs_num) ) return j; } -return ( -1 ); +return -1; } @@ -388,7 +388,7 @@ for (j=0; j<(eq->n_elements()); ++j) { } -return ( a ); +return a; } @@ -412,7 +412,7 @@ for (j=0; j<(eq->n_elements()); ++j) { } -return ( a ); +return a; } @@ -433,12 +433,12 @@ j = part.which_class(k); for (m=0; m 0 ) { do_single_field(config); - return ( 0 ); + return 0; } @@ -913,7 +913,7 @@ do_mtd_nc_output(config.nc_info, engine, fcst_raw, obs_raw, fcst_obj, obs_obj, c // done // -return ( 0 ); +return 0; } @@ -1076,7 +1076,7 @@ prefix << junk; -return ( prefix ); +return prefix; } diff --git a/src/tools/other/mode_time_domain/mtd_config_info.cc b/src/tools/other/mode_time_domain/mtd_config_info.cc index ff6c6e0a9e..3468b38735 100644 --- a/src/tools/other/mode_time_domain/mtd_config_info.cc +++ b/src/tools/other/mode_time_domain/mtd_config_info.cc @@ -852,7 +852,7 @@ bool MtdNcOutInfo::all_false() const // bool status = do_latlon || do_raw || do_object_raw || do_object_id || do_cluster_id || do_polylines; bool status = do_latlon || do_raw || do_object_id || do_cluster_id; -return ( !status ); +return !status; } diff --git a/src/tools/other/mode_time_domain/mtd_file_base.cc b/src/tools/other/mode_time_domain/mtd_file_base.cc index fbd98dcf71..7381fed61d 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.cc +++ b/src/tools/other/mode_time_domain/mtd_file_base.cc @@ -245,7 +245,7 @@ if ( !G ) { } -return ( *G ); +return *G; } @@ -257,7 +257,7 @@ const Grid * MtdFileBase::grid_p() const { -return ( G ); +return G; } @@ -381,7 +381,7 @@ if ( (t < 0) || ( t >= (int)ActualValidTimes.size()) ) { } -return ( ActualValidTimes[t] ); +return ActualValidTimes[t]; } @@ -401,7 +401,7 @@ if ( (index < 0) || ( index >= Nt) ) { } -return ( Lead_Times[index] ); +return Lead_Times[index]; } diff --git a/src/tools/other/mode_time_domain/mtd_file_float.cc b/src/tools/other/mode_time_domain/mtd_file_float.cc index 0f0d3d6f7e..105dd23b2c 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.cc +++ b/src/tools/other/mode_time_domain/mtd_file_float.cc @@ -85,11 +85,11 @@ MtdFloatFile & MtdFloatFile::operator=(const MtdFloatFile & f) { -if ( this == &f ) return ( * this ); +if ( this == &f ) return *this; float_assign(f); -return ( * this ); +return *this; } @@ -439,7 +439,7 @@ MtdIntFile out; threshold(T, out); -return ( out ); +return out; } @@ -455,7 +455,7 @@ MtdIntFile out; threshold(t, out); -return ( out ); +return out; } @@ -611,13 +611,13 @@ bool MtdFloatFile::read(const char * _filename) NcFile f(_filename, NcFile::read); -if ( IS_INVALID_NC(f) ) return ( false ); +if ( IS_INVALID_NC(f) ) return false; Filename = _filename; MtdFloatFile::read(f); -return ( true ); +return true; } @@ -907,7 +907,7 @@ f.DataMax = fmax; // done // -return ( f ); +return f; } diff --git a/src/tools/other/mode_time_domain/mtd_file_int.cc b/src/tools/other/mode_time_domain/mtd_file_int.cc index 5964e4c5e2..dd68c47bbd 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.cc +++ b/src/tools/other/mode_time_domain/mtd_file_int.cc @@ -95,11 +95,11 @@ MtdIntFile & MtdIntFile::operator=(const MtdIntFile & f) { -if ( this == &f ) return ( * this ); +if ( this == &f ) return *this; int_assign(f); -return ( * this ); +return *this; } @@ -403,13 +403,13 @@ bool MtdIntFile::read(const char * _filename) NcFile f(_filename, NcFile::read); -if ( IS_INVALID_NC(f) ) return ( false ); +if ( IS_INVALID_NC(f) ) return false; Filename = _filename; MtdIntFile::read(f); -return ( true ); +return true; } @@ -736,7 +736,7 @@ f.DataMax = fmax; // done // -return ( f ); +return f; } @@ -813,7 +813,7 @@ f.set_volumes(1, &vol); // done // -return ( f ); +return f; } @@ -1195,7 +1195,7 @@ n_shapes = p.n_elements(); // done // -return ( q ); +return q; } @@ -1276,7 +1276,7 @@ if ( (k < 0) || (k >= Nobjects) ) { } -return ( ObjVolume[k] ); +return ObjVolume[k]; } @@ -1301,7 +1301,7 @@ int sum = 0; for (j=0; j=0; --x) { - if ( Data[mtd_three_to_one(Nx, Ny, Nt, x, y, 0)] ) return ( x ); + if ( Data[mtd_three_to_one(Nx, Ny, Nt, x, y, 0)] ) return x; } -return ( -1 ); +return -1; } @@ -1861,7 +1861,7 @@ for (t=0; t= Nelements) ) { } -return ( E[k] ); +return E[k]; } @@ -307,7 +307,7 @@ int EquivalenceClass::n_max() const { -if ( Nelements == 0 ) return ( 0 ); +if ( Nelements == 0 ) return 0; int j, n; @@ -319,7 +319,7 @@ for (j=1; jhas(k) ) return ( true ); + if ( (*c)->has(k) ) return true; } -return ( false ); +return false; } */ @@ -567,7 +567,7 @@ if ( (index < 0) || (index >= Nelements) ) { } -return ( C[index]->has(k) ); +return C[index]->has(k); } @@ -583,12 +583,12 @@ int j; for (j=0; jhas(k) ) return ( j ); + if ( C[j]->has(k) ) return j; } -return ( -1 ); +return -1; } @@ -718,7 +718,7 @@ if ( (k < 0) || (k >= Nelements) ) { } -return ( C[k] ); +return C[k]; } @@ -780,7 +780,7 @@ for (j=0; j haven't written code to parse \"" << proj << "\" grids yet!\n\n"; - return ( false ); + return false; } @@ -80,7 +80,7 @@ bool read_nc_grid(NcFile & f, Grid & g) // done // -return ( status ); +return status; } @@ -117,7 +117,7 @@ else { // done // -return ( false ); +return false; } @@ -203,7 +203,7 @@ data.dy_km = data.d_km; g.set(data); -return ( true ); +return true; } @@ -281,7 +281,7 @@ data.so2_angle = 0.0; g.set(data); -return ( true ); +return true; } @@ -333,7 +333,7 @@ data.Nlon = string_att_as_int(f, "Nlon"); g.set(data); -return ( true ); +return true; } diff --git a/src/tools/other/mode_time_domain/nc_utils_local.cc b/src/tools/other/mode_time_domain/nc_utils_local.cc index d80d335f1b..d7cb55dbd8 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.cc +++ b/src/tools/other/mode_time_domain/nc_utils_local.cc @@ -67,7 +67,7 @@ if (att) { delete att; att = 0; } // done // -return ( cbuf ); +return cbuf; } @@ -83,7 +83,7 @@ const char * c = string_att(Nc, name); double value = atof(c); -return ( value ); +return value; } @@ -99,7 +99,7 @@ const char * c = string_att(Nc, name); int k = atoi(c); -return ( k ); +return k; } @@ -115,7 +115,7 @@ const char * c = string_att(Nc, name); long long k = atoll(c); -return ( k ); +return k; } @@ -162,7 +162,7 @@ t = mdyhms_to_unix(month, day, year, hour, minute, second); // done // -return ( t ); +return t; } @@ -181,7 +181,7 @@ unix_to_mdyhms(t, month, day, year, hour, minute, second); snprintf(junk, sizeof(junk), "%04d%02d%02d_%02d%02d%02d", year, month, day, hour, minute, second); -return ( ConcatString(junk) ); +return ConcatString(junk); } diff --git a/src/tools/other/modis_regrid/cloudsat_swath_file.cc b/src/tools/other/modis_regrid/cloudsat_swath_file.cc index 233cdea2b0..4344f4c9ea 100644 --- a/src/tools/other/modis_regrid/cloudsat_swath_file.cc +++ b/src/tools/other/modis_regrid/cloudsat_swath_file.cc @@ -96,11 +96,11 @@ SatDimension & SatDimension::operator=(const SatDimension & d) { -if ( this == &d ) return ( * this ); +if ( this == &d ) return *this; assign(d); -return ( * this ); +return *this; } @@ -266,11 +266,11 @@ SatAttribute & SatAttribute::operator=(const SatAttribute & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -641,11 +641,11 @@ SwathDataField & SwathDataField::operator=(const SwathDataField & df) { -if ( this == &df ) return ( * this ); +if ( this == &df ) return *this; assign(df); -return ( * this ); +return *this; } @@ -891,7 +891,7 @@ if ( (k < 0) || (k >= Ndimensions) ) { int m = Dimensions[k]->size(); -return ( m ); +return m; } @@ -949,11 +949,11 @@ CloudsatSwath & CloudsatSwath::operator=(const CloudsatSwath & s) { -if ( this == &s ) return ( * this ); +if ( this == &s ) return *this; assign(s); -return ( * this ); +return *this; } @@ -1709,7 +1709,7 @@ for (j=0; j 1 ) { close(); - return ( false ); + return false; } @@ -301,7 +301,7 @@ if ( (k = SWattach(FileId, (char *) a[0].c_str())) < 0 ) { close(); - return ( false ); + return false; } @@ -326,7 +326,7 @@ if ( ! dim ) { close(); - return ( false ); + return false; } @@ -341,7 +341,7 @@ if ( ! dim ) { close(); - return ( false ); + return false; } @@ -375,7 +375,7 @@ if ( !status || (dt < 0.0) ) { close(); - return ( false ); + return false; } @@ -386,7 +386,7 @@ ScanStartTime = ut_modis_start + nint(dt); // done // -return ( true ); +return true; } @@ -597,7 +597,7 @@ if ( (n0 < 0) || (n0 >= Dim0) || (n1 < 0) || (n1 >= Dim1) ) { mlog << Error << "\n\n ModisFile::get_float_data() -> range check error ... " << n0 << ", " << n1 << "\n\n"; - return ( false ); + return false; } @@ -617,7 +617,7 @@ if ( status < 0 ) { // exit ( 1 ); - return ( false ); + return false; } @@ -627,7 +627,7 @@ value = d[0]; // done // -return ( true ); +return true; } @@ -650,7 +650,7 @@ if ( (n0 < 0) || (n0 >= Dim0) || (n1 < 0) || (n1 >= Dim1) ) { // exit ( 1 ); - return ( false ); + return false; } @@ -668,7 +668,7 @@ if ( status < 0 ) { mlog << Error << "\n\n CloudsatSwath::get_float_data(int, int) const -> bad SWreadfield status\n\n"; - return ( false ); + return false; } @@ -678,7 +678,7 @@ if ( status < 0 ) { value = f[0]; -return ( true ); +return true; } @@ -699,7 +699,7 @@ if ( (n0 < 0) || (n0 >= Dim0) || (n1 < 0) || (n1 >= Dim1) ) { mlog << Error << "\n\n ModisFile::get_int16_data() -> range check error\n\n"; - return ( false ); + return false; } @@ -719,7 +719,7 @@ if ( status < 0 ) { // exit ( 1 ); - return ( false ); + return false; } @@ -729,7 +729,7 @@ if ( status < 0 ) { value = s[0]; -return ( true ); +return true; } @@ -752,7 +752,7 @@ if ( (n0 < 0) || (n0 >= Dim0) || (n1 < 0) || (n1 >= Dim1) ) { // exit ( 1 ); - return ( false ); + return false; } @@ -772,7 +772,7 @@ if ( status < 0 ) { // exit ( 1 ); - return ( false ); + return false; } @@ -782,7 +782,7 @@ if ( status < 0 ) { value = c[0]; -return ( true ); +return true; } @@ -799,7 +799,7 @@ float f[2]; if (get_float_data(Latitude, n0, n1, f[0])) v = f[0]; -return ( v ); +return v; } @@ -822,7 +822,7 @@ if (get_float_data(Longitude, n0, n1, f[0])) { } -return ( v ); +return v; } @@ -910,9 +910,9 @@ switch ( NumberType ) { } // switch -if ( !status ) return ( false ); +if ( !status ) return false; -if ( value == DataFillValue ) return ( false ); +if ( value == DataFillValue ) return false; value = DataScale*(value - DataOffset); @@ -920,7 +920,7 @@ value = DataScale*(value - DataOffset); // done // -return ( true ); +return true; } @@ -936,7 +936,7 @@ ConcatString s; if ( Filename.nonempty() ) s = get_short_name(Filename.c_str()); -return ( s ); +return s; } @@ -948,7 +948,7 @@ CloudsatSwath * ModisFile::swath() const { -return ( Swath ); +return Swath; } @@ -960,7 +960,7 @@ unixtime ModisFile::scan_start_time() const { -return ( ScanStartTime ); +return ScanStartTime; } diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 788898b60f..774ff1a6c3 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -152,7 +152,7 @@ process(modis_filename.c_str()); // done // -return ( 0 ); +return 0; } diff --git a/src/tools/other/modis_regrid/sat_utils.cc b/src/tools/other/modis_regrid/sat_utils.cc index 55402459b9..de7963d5ce 100644 --- a/src/tools/other/modis_regrid/sat_utils.cc +++ b/src/tools/other/modis_regrid/sat_utils.cc @@ -115,7 +115,7 @@ switch ( nt ) { } // switch -return ( s ); +return s; } diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 2922c23d0a..4d10508d50 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -2649,7 +2649,7 @@ int get_event_index(int flag, int i_var, int i_lvl) { if(ev < 0) ev = 0; } - return(ev); + return ev; } //////////////////////////////////////////////////////////////////////// @@ -2687,7 +2687,7 @@ int get_event_index_temp(int flag, int i_var, int i_lvl) { if(is_eq(evns[i_var][i][i_lvl][2], virtmp_prog_code)) { // Skip this observation if the reason code is 3 - if(is_eq(evns[i_var][i][i_lvl][3], 3.0)) return(bad_data_int); + if(is_eq(evns[i_var][i][i_lvl][3], 3.0)) return bad_data_int; // Use the next entry in the event stack but keep searching ev = i+1; @@ -2702,10 +2702,10 @@ int get_event_index_temp(int flag, int i_var, int i_lvl) { ev = get_event_index(flag, i_var, i_lvl); // Check for the VIRTMP program code - if(is_eq(evns[i_var][ev][i_lvl][2], virtmp_prog_code)) return(bad_data_int); + if(is_eq(evns[i_var][ev][i_lvl][2], virtmp_prog_code)) return bad_data_int; } - return(ev); + return ev; } //////////////////////////////////////////////////////////////////////// @@ -2743,7 +2743,7 @@ bool keep_message_type(const char *mt_str) { keep = conf_info.message_type.n_elements() == 0 || conf_info.message_type.has(mt_str, false); - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -2773,7 +2773,7 @@ bool keep_valid_time(const unixtime ut, if(ut > max_ut) keep = false; } - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -2884,7 +2884,7 @@ float derive_grib_code(int gc, float *pqtzuv, float *pqtzuv_qty, break; } // end switch - return(result); + return result; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/plot_point_obs/plot_point_obs.cc b/src/tools/other/plot_point_obs/plot_point_obs.cc index 66eb91ee0d..16a4728c84 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs.cc @@ -128,7 +128,7 @@ int met_main(int argc, char *argv[]) { // Plot the result create_plot(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc index 04b798e71a..e5fa1457bb 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc @@ -231,48 +231,48 @@ bool PlotPointObsOpt::add(const Observation &obs) { // message type if(msg_typ.n() > 0 && !msg_typ.has(obs.getHeaderType())) { - return(false); + return false; } // station id if((sid_inc.n() > 0 && !sid_inc.has(obs.getStationId())) || (sid_exc.n() > 0 && sid_exc.has(obs.getStationId()))) { - return(false); + return false; } // observation variable if(obs_var.n() > 0 && !obs_var.has(obs.getVarName())) { - return(false); + return false; } // observation GRIB code if(obs_gc.n() > 0 && !obs_gc.has(obs.getGribCode())) { - return(false); + return false; } // quality control string if(obs_qty.n() > 0 && !obs_qty.has(obs.getQualityFlag())) { - return(false); + return false; } // valid time unixtime ut = obs.getValidTime(); if((valid_beg > 0 && ut < valid_beg) || (valid_end > 0 && ut > valid_end)) { - return(false); + return false; } // lat, lon if(!lat_thresh.check(obs.getLatitude()) || !lon_thresh.check(obs.getLongitude())) { - return(false); + return false; } // elevation, height, pressure if(!elv_thresh.check(obs.getElevation()) || !hgt_thresh.check(obs.getHeight()) || !prs_thresh.check(obs.getPressureLevel())) { - return(false); + return false; } // store the current observation value @@ -293,7 +293,7 @@ bool PlotPointObsOpt::add(const Observation &obs) { // observation value if(!obs_thresh.check(cur_val)) { - return(false); + return false; } // Store this matching point location @@ -308,7 +308,7 @@ bool PlotPointObsOpt::add(const Observation &obs) { n_obs++; if(!has(cur_loc)) locations.push_back(cur_loc); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -324,7 +324,7 @@ bool PlotPointObsOpt::has(const LocationInfo &loc) { } } - return(match); + return match; } //////////////////////////////////////////////////////////////////////// @@ -608,7 +608,7 @@ bool PlotPointObsConfInfo::add(const Observation &obs) { if((match = it->add(obs))) break; } - return(match); + return match; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 2737e125c9..cbb2187de1 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -219,7 +219,7 @@ int met_main(int argc, char *argv[]) { // Process the input data file process_data_file(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -2740,7 +2740,7 @@ bool keep_message_type(const int mt_index) { keep = message_type_list.n() == 0 || message_type_list.has(mt_index); - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 309aaf3d6a..7f153ce572 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -116,7 +116,7 @@ int met_main(int argc, char *argv[]) { // Process the input data file process_data_file(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 411f5dd10f..18785a395a 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -105,7 +105,7 @@ int met_main(int argc, char *argv[]) { // Process the input data file process_data_file(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/af_cp_file.cc b/src/tools/other/wwmca_tool/af_cp_file.cc index 70acdb4941..e0426d8b44 100644 --- a/src/tools/other/wwmca_tool/af_cp_file.cc +++ b/src/tools/other/wwmca_tool/af_cp_file.cc @@ -93,11 +93,11 @@ AFCloudPctFile & AFCloudPctFile::operator=(const AFCloudPctFile & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -177,7 +177,7 @@ if ( (fd = met_open(filename, O_RDONLY)) < 0 ) { mlog << Error << "\nAFCloudPctFile::read(const char *) -> " << "can't open file \"" << filename << "\"\n\n"; - return ( false ); + return false; } @@ -192,7 +192,7 @@ if ( ::read(fd, Buf, bytes) != bytes ) { ::close(fd); - return ( false ); + return false; } @@ -204,7 +204,7 @@ Filename = get_short_name(filename); ::close(fd); -return ( true ); +return true; } @@ -222,7 +222,7 @@ n = two_to_one(x, y); // this function does range checking on x and y for us k = (int) (Buf[n]); -return ( k ); +return k; } diff --git a/src/tools/other/wwmca_tool/af_file.cc b/src/tools/other/wwmca_tool/af_file.cc index e0618a2b41..6af9876d84 100644 --- a/src/tools/other/wwmca_tool/af_file.cc +++ b/src/tools/other/wwmca_tool/af_file.cc @@ -86,11 +86,11 @@ AFDataFile & AFDataFile::operator=(const AFDataFile & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -228,7 +228,7 @@ if ( Valid == (unixtime) 0 ) { if ( Hemisphere == 'N' ) grid = new Grid(wwmca_north_data); else grid = new Grid(wwmca_south_data); -return ( true ); +return true; } @@ -243,10 +243,10 @@ double lat, lon; grid->xy_to_latlon((double) x, (double) y, lat, lon); -if ( (Hemisphere == 'N') && (lat < 0.0) ) return ( false ); -if ( (Hemisphere == 'S') && (lat > 0.0) ) return ( false ); +if ( (Hemisphere == 'N') && (lat < 0.0) ) return false; +if ( (Hemisphere == 'S') && (lat > 0.0) ) return false; -return ( true ); +return true; } @@ -272,7 +272,7 @@ yy = af_ny - 1 - y; n = yy*af_nx + x; -return ( n ); +return n; } diff --git a/src/tools/other/wwmca_tool/af_pt_file.cc b/src/tools/other/wwmca_tool/af_pt_file.cc index 4b875257d4..ee61fc4e1c 100644 --- a/src/tools/other/wwmca_tool/af_pt_file.cc +++ b/src/tools/other/wwmca_tool/af_pt_file.cc @@ -96,11 +96,11 @@ AFPixelTimeFile & AFPixelTimeFile::operator=(const AFPixelTimeFile & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -184,7 +184,7 @@ if ( (fd = met_open(filename, O_RDONLY)) < 0 ) { mlog << Error << "\nAFPixelTimeFile::read(const char *) -> " << "can't open file \"" << filename << "\"\n\n"; - return ( false ); + return false; } @@ -199,7 +199,7 @@ if ( ::read(fd, Buf, bytes) != bytes ) { ::close(fd); - return ( false ); + return false; } @@ -212,7 +212,7 @@ Filename = get_short_name(filename); ::close(fd); -return ( true ); +return true; } @@ -246,7 +246,7 @@ else { } -return ( k ); +return k; } diff --git a/src/tools/other/wwmca_tool/ave_interp.cc b/src/tools/other/wwmca_tool/ave_interp.cc index a9a2cbcf32..0b78a70027 100644 --- a/src/tools/other/wwmca_tool/ave_interp.cc +++ b/src/tools/other/wwmca_tool/ave_interp.cc @@ -75,11 +75,11 @@ Ave_Interp & Ave_Interp::operator=(const Ave_Interp & a) { -if ( this == &a ) return ( * this ); +if ( this == &a ) return *this; assign(a); -return ( * this ); +return *this; } @@ -139,7 +139,7 @@ Interpolator * i = (Interpolator *) 0; i = new Ave_Interp (*this); -return ( i ); +return i; } @@ -217,7 +217,7 @@ if ( (good_count > 0) && (good_count >= NgoodNeeded) ) { // -return ( I ); +return I; } diff --git a/src/tools/other/wwmca_tool/interp_base.cc b/src/tools/other/wwmca_tool/interp_base.cc index 0b7dd9f182..ecfb648ea1 100644 --- a/src/tools/other/wwmca_tool/interp_base.cc +++ b/src/tools/other/wwmca_tool/interp_base.cc @@ -75,11 +75,11 @@ InterpolationValue & InterpolationValue::operator=(const InterpolationValue & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -314,7 +314,7 @@ int n; n = y*Width + x; -return ( n ); +return n; } @@ -444,7 +444,7 @@ for (j=0; j= NgoodNeeded ) { // -return ( I ); +return I; } diff --git a/src/tools/other/wwmca_tool/min_interp.cc b/src/tools/other/wwmca_tool/min_interp.cc index 536aa90211..1023d20c0b 100644 --- a/src/tools/other/wwmca_tool/min_interp.cc +++ b/src/tools/other/wwmca_tool/min_interp.cc @@ -76,11 +76,11 @@ Min_Interp & Min_Interp::operator=(const Min_Interp & m) { -if ( this == &m ) return ( * this ); +if ( this == &m ) return *this; assign(m); -return ( * this ); +return *this; } @@ -140,7 +140,7 @@ Interpolator * i = (Interpolator *) 0; i = new Min_Interp (*this); -return ( i ); +return i; } @@ -226,7 +226,7 @@ if ( good_count >= NgoodNeeded ) { // -return ( I ); +return I; } diff --git a/src/tools/other/wwmca_tool/nearest_interp.cc b/src/tools/other/wwmca_tool/nearest_interp.cc index 2951fdd635..e3cc25b568 100644 --- a/src/tools/other/wwmca_tool/nearest_interp.cc +++ b/src/tools/other/wwmca_tool/nearest_interp.cc @@ -75,11 +75,11 @@ Nearest_Interp & Nearest_Interp::operator=(const Nearest_Interp & n) { -if ( this == &n ) return ( * this ); +if ( this == &n ) return *this; assign(n); -return ( * this ); +return *this; } @@ -139,7 +139,7 @@ Interpolator * i = (Interpolator *) 0; i = new Nearest_Interp (*this); -return ( i ); +return i; } @@ -196,7 +196,7 @@ I = Data[n]; // -return ( I ); +return I; } diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index b960362156..7bf810e4b1 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -162,7 +162,7 @@ for (j=0; j<(cline.n()); ++j) { // done // -return ( 0 ); +return 0; } @@ -472,7 +472,7 @@ k = ((gray_max - gray_min)*value)/100 + gray_min; c.set_gray(k); -return ( c ); +return c; } @@ -505,7 +505,7 @@ bool region_ok(const MapRegion & r, const char hemisphere) { -return ( true ); +return true; } diff --git a/src/tools/other/wwmca_tool/wwmca_regrid.cc b/src/tools/other/wwmca_tool/wwmca_regrid.cc index e25929420b..e66dbe1564 100644 --- a/src/tools/other/wwmca_tool/wwmca_regrid.cc +++ b/src/tools/other/wwmca_tool/wwmca_regrid.cc @@ -167,7 +167,7 @@ regridder.do_output(output_filename.c_str()); // done // -return ( 0 ); +return 0; } @@ -294,7 +294,7 @@ int get_compress() { -return ( compress_level ); +return compress_level; } diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index f2d2b3b5cf..11d5b0e9fd 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -66,7 +66,7 @@ int met_main(int argc, char *argv[]) { clean_up(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_diag/python_tc_diag.cc b/src/tools/tc_utils/tc_diag/python_tc_diag.cc index 2a6f5b5ce2..991295370f 100644 --- a/src/tools/tc_utils/tc_diag/python_tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/python_tc_diag.cc @@ -173,7 +173,7 @@ bool straight_python_tc_diag(const ConcatString &diag_script, } // Parse the diagnostics from python - return(parse_python_diag_data(module_obj, tmp_info)); + return parse_python_diag_data(module_obj, tmp_info); } //////////////////////////////////////////////////////////////////////// @@ -233,7 +233,7 @@ bool user_python_tc_diag(const ConcatString &diag_script, PyErr_Print(); mlog << Warning << "\n" << method_name << "an error occurred initializing python\n\n"; - return(false); + return false; } run_python_string("import sys"); @@ -270,13 +270,13 @@ bool user_python_tc_diag(const ConcatString &diag_script, mlog << Warning << "\n" << method_name << "an error occurred importing module " << "\"" << path << "\"\n\n"; - return(false); + return false; } if(!module_obj) { mlog << Warning << "\n" << method_name << "error running python script\n\n"; - return(false); + return false; } // Parse the diagnostics from python @@ -285,7 +285,7 @@ bool user_python_tc_diag(const ConcatString &diag_script, // Cleanup remove_temp_file(tmp_file_name); - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -301,7 +301,7 @@ bool parse_python_diag_data(PyObject *module_obj, if(!module_dict_obj || !PyDict_Check(module_dict_obj)) { mlog << Warning << "\n" << method_name << "python module is not a dictionary.\n\n"; - return(false); + return false; } // Get the diag_data item @@ -312,7 +312,7 @@ bool parse_python_diag_data(PyObject *module_obj, mlog << Warning << "\n" << method_name << "trouble parsing the \"" << diag_data_dict_name << "\" python dictionary.\n\n"; - return(false); + return false; } // Storm data @@ -365,7 +365,7 @@ bool parse_python_diag_data(PyObject *module_obj, } } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -390,7 +390,7 @@ bool parse_python_string_value_map(PyObject *dict, mlog << Warning << "\n" << method_name << "trouble parsing the \"" << name << "\" python dictionary.\n\n"; - return(false); + return false; } // Initialize @@ -436,7 +436,7 @@ bool parse_python_string_value_map(PyObject *dict, } } // end while - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -458,7 +458,7 @@ bool parse_python_string_string_map(PyObject *dict, mlog << Warning << "\n" << method_name << "trouble parsing the \"" << name << "\" python dictionary.\n\n"; - return(false); + return false; } // Initialize @@ -492,7 +492,7 @@ bool parse_python_string_string_map(PyObject *dict, } } // end while - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -509,13 +509,13 @@ bool parse_python_string(PyObject *dict, mlog << Warning << "\n" << method_name << "trouble parsing the \"" << name << "\" python string.\n\n"; - return(false); + return false; } // Store the string s = PyUnicode_AsUTF8(data_obj); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 332587b9eb..c60aa5df6a 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -133,7 +133,7 @@ int met_main(int argc, char *argv[]) { // Process the output files process_out_files(tracks); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -521,7 +521,7 @@ bool is_keeper(const ATCFLineBase * line) { } // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -670,7 +670,7 @@ ConcatString get_out_key(const TrackInfo &track) { << track.technique() << "_" << unix_to_yyyymmddhh(track.init()); - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// @@ -686,7 +686,7 @@ ConcatString get_tmp_key(const TrackInfo &track, << point.lead() /sec_per_hour << "_" << domain; - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// @@ -703,7 +703,7 @@ ConcatString build_tmp_file_name(const TrackInfo *trk_ptr, << "/tmp_" << program_name << "_" << get_tmp_key(*trk_ptr, *pnt_ptr, domain); - return(make_temp_file_name(cs.text(), ".nc")); + return make_temp_file_name(cs.text(), ".nc"); } //////////////////////////////////////////////////////////////////////// @@ -774,7 +774,7 @@ ConcatString build_out_file_name(const TrackInfo *trk_ptr, } // end while - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// @@ -1429,7 +1429,7 @@ void OutFileInfo::clear() { NcFile *OutFileInfo::setup_nc_file(const string &out_file) { - if(!trk_ptr) return(nullptr); + if(!trk_ptr) return nullptr; // Open the output NetCDF file NcFile *nc_out = open_ncfile(out_file.c_str(), true); @@ -1458,7 +1458,7 @@ NcFile *OutFileInfo::setup_nc_file(const string &out_file) { write_tc_times(nc_out, vld_dim, trk_ptr, nullptr); - return(nc_out); + return nc_out; } //////////////////////////////////////////////////////////////////////// @@ -2061,7 +2061,7 @@ string OutFileInfo::get_diag_units(const string &s) { units = na_str; } - return(units); + return units; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc index 7684308b81..0e588f68af 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc @@ -43,7 +43,7 @@ DataOptInfo & DataOptInfo::operator+=(const DataOptInfo &info) { tech_ids.add(info.tech_ids); data_files.add(info.data_files); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index dbdc7d976a..4e9ed02bd3 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -113,7 +113,7 @@ int met_main(int argc, char *argv[]) { // Process the MODE file process_distances(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_dland/tc_poly.cc b/src/tools/tc_utils/tc_dland/tc_poly.cc index 9f3f892097..961b2b6864 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.cc +++ b/src/tools/tc_utils/tc_dland/tc_poly.cc @@ -51,11 +51,11 @@ TCPoly::TCPoly(const TCPoly & p) { TCPoly & TCPoly::operator=(const TCPoly & p) { - if(this == &p) return(*this); + if(this == &p) return *this; assign(p); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -125,7 +125,7 @@ double TCPoly::min_dist(double lat, double lon) const { if(GnomonXY.is_inside(x, y)) dmin *= -1.0; } - return(dmin); + return dmin; } //////////////////////////////////////////////////////////////////////// @@ -157,11 +157,11 @@ TCPolyArray::TCPolyArray(const TCPolyArray & a) { TCPolyArray & TCPolyArray::operator=(const TCPolyArray & a) { - if(this == &a) return(*this); + if(this == &a) return *this; assign(a); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -254,7 +254,7 @@ TCPoly TCPolyArray::operator[](int n) const { exit(1); } - return(Poly[n]); + return Poly[n]; } //////////////////////////////////////////////////////////////////////// @@ -292,7 +292,7 @@ bool TCPolyArray::add_file(const char *filename) { << "Read " << n << " TC land regions from file: " << filename << "\n"; - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -341,7 +341,7 @@ double TCPolyArray::min_dist(double lat, double lon, int &imin) const { if(dcur < dmin) { dmin = dcur; imin = i; } } - return(dmin); + return dmin; } //////////////////////////////////////////////////////////////////////// @@ -362,7 +362,7 @@ bool operator>>(istream & in, TCPoly & p) { char name[9]; // Read the map region meta data - if(!line.read_line(in)) return (false); + if(!line.read_line(in)) return false; // Split up the meta data line a = line.split(" "); @@ -383,7 +383,7 @@ bool operator>>(istream & in, TCPoly & p) { // Parse the lat/lon data lines for(i=0; i>(istream & in, TCPoly & p) { p.GnomonXY.add_point(x, y); } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index 27190434ca..9afc59a3d9 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -2588,7 +2588,7 @@ ConcatString string_to_basin_abbr(ConcatString cs) { else if(cs == "Central Pacific") abbr = "CP"; else abbr = cs; - return(abbr); + return abbr; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index 9c0dd74890..60c3170c02 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -50,7 +50,7 @@ TCGenNcOutInfo & TCGenNcOutInfo::operator+=(const TCGenNcOutInfo &t) { if(t.do_best_fn_oy) do_best_fn_oy = true; - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -72,7 +72,7 @@ bool TCGenNcOutInfo::all_false() const { do_best_genesis || do_best_tracks || do_best_fy_oy || do_best_fn_oy; - return(!status); + return !status; } //////////////////////////////////////////////////////////////////////// @@ -458,7 +458,7 @@ bool TCGenVxOpt::is_keeper(const GenesisInfo &gi) const { keep = false; } - if(!keep) return(keep); + if(!keep) return keep; // Only check intialization and lead times for forecast and // operational tracks. @@ -481,7 +481,7 @@ bool TCGenVxOpt::is_keeper(const GenesisInfo &gi) const { keep = false; } - if(!keep) return(keep); + if(!keep) return keep; // Valid time window if((ValidBeg > 0 && ValidBeg > gi.valid_min()) || @@ -512,7 +512,7 @@ bool TCGenVxOpt::is_keeper(const GenesisInfo &gi) const { keep = false; // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -568,7 +568,7 @@ bool TCGenVxOpt::is_keeper(const ProbGenInfo &gi) const { keep = false; // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -622,13 +622,13 @@ bool TCGenVxOpt::is_keeper(const GenShapeInfo &gsi) const { // Distance to land does not apply // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// STATOutputType TCGenVxOpt::output_map(STATLineType t) const { - return(OutputMap.at(t)); + return OutputMap.at(t); } //////////////////////////////////////////////////////////////////////// @@ -896,7 +896,7 @@ double TCGenConfInfo::compute_dland(double lat, double lon) { y < 0 || y >= DLandGrid.ny()) dist = bad_data_double; else dist = DLandData.get(x, y); - return(dist); + return dist; } //////////////////////////////////////////////////////////////////////// @@ -933,13 +933,13 @@ ConcatString TCGenConfInfo::compute_basin(double lat, double lon) { exit(1); } - return(BasinAbbr[i]); + return BasinAbbr[i]; } //////////////////////////////////////////////////////////////////////// STATOutputType TCGenConfInfo::output_map(STATLineType t) const { - return(OutputMap.at(t)); + return OutputMap.at(t); } //////////////////////////////////////////////////////////////////////// @@ -951,7 +951,7 @@ int TCGenConfInfo::get_max_n_prob_thresh() const { n = max(n, VxOpt[i].ProbGenThresh.n()); } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index e25c43f64d..a3c3f4a6d5 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -182,7 +182,7 @@ int met_main(int argc, char *argv[]) { << "Output file: " << out_files[i] << "\n"; } - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -814,7 +814,7 @@ bool is_keeper(const ATCFLineBase * line) { keep = false; // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -1267,7 +1267,7 @@ int derive_consensus(TrackInfoArray &tracks) { int n_add = 0; // If no consensus models are defined, nothing to do - if(conf_info.NConsensus == 0) return(0); + if(conf_info.NConsensus == 0) return 0; // Loop through the tracks to build a list of cases for(i=0; i= dland_grid.ny()) dist = bad_data_double; else dist = dland_dp.get(x, y); - return(dist); + return dist; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 4520b1d5ca..74e4b275b8 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -100,7 +100,7 @@ int met_main(int argc, char *argv[]) { // Process gridded and track data process_rmw(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// @@ -241,7 +241,7 @@ GrdFileType get_file_type(const StringArray &file_list, // Clean up if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - return(out_ftype); + return out_ftype; } //////////////////////////////////////////////////////////////////////// @@ -486,7 +486,7 @@ bool is_keeper(const ATCFLineBase * line) { } // Return the keep status - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_stat/tc_stat.cc b/src/tools/tc_utils/tc_stat/tc_stat.cc index d1e85b0855..77f104b5c6 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -73,7 +73,7 @@ int met_main(int argc, char *argv[]) { // Process the jobs in the config file process_jobs(); - return(0); + return 0; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_stat/tc_stat_files.cc b/src/tools/tc_utils/tc_stat/tc_stat_files.cc index 61a2ed8681..676830ec40 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_files.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_files.cc @@ -58,11 +58,11 @@ TCStatFiles::TCStatFiles(const TCStatFiles &j) { TCStatFiles & TCStatFiles::operator=(const TCStatFiles &j) { - if(this == &j) return(*this); + if(this == &j) return *this; assign(j); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -137,7 +137,7 @@ bool TCStatFiles::operator>>(TrackPairInfo &pair) { CurFile++; // Check for the last file - if(CurFile == FileList.n()) return(false); + if(CurFile == FileList.n()) return false; else { // Open the next file for reading @@ -185,7 +185,7 @@ bool TCStatFiles::operator>>(TrackPairInfo &pair) { } } // end while - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -204,7 +204,7 @@ bool TCStatFiles::operator>>(ProbRIRWPairInfo &pair) { CurFile++; // Check for the last file - if(CurFile == FileList.n()) return(false); + if(CurFile == FileList.n()) return false; else { // Open the next file for reading @@ -238,7 +238,7 @@ bool TCStatFiles::operator>>(ProbRIRWPairInfo &pair) { } // end while - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ bool TCStatFiles::operator>>(TCStatLine &line) { CurFile++; // Check for the last file - if(CurFile == FileList.n()) return(false); + if(CurFile == FileList.n()) return false; else { // Open the next file for reading @@ -284,7 +284,7 @@ bool TCStatFiles::operator>>(TCStatLine &line) { } // end while - return(status); + return status; } //////////////////////////////////////////////////////////////////////// From 6bb41bc2f602abb5770119f03517e8ccbb694446 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 01:35:14 +0000 Subject: [PATCH 13/72] #2673 Removed the redundant parentheses with return --- src/libcode/vx_seeps/seeps.cc | 4 +- src/libcode/vx_series_data/series_data.cc | 12 +- src/libcode/vx_shapedata/engine.cc | 26 ++-- src/libcode/vx_shapedata/ihull.cc | 10 +- src/libcode/vx_shapedata/interest.cc | 12 +- src/libcode/vx_shapedata/mode_conf_info.cc | 10 +- src/libcode/vx_shapedata/mode_field_info.cc | 6 +- src/libcode/vx_shapedata/moments.cc | 8 +- src/libcode/vx_shapedata/node.cc | 22 +-- src/libcode/vx_shapedata/set.cc | 44 +++--- src/libcode/vx_solar/siderial.cc | 4 +- src/libcode/vx_stat_out/stat_columns.cc | 4 +- src/libcode/vx_stat_out/stat_hdr_columns.cc | 2 +- src/libcode/vx_statistics/apply_mask.cc | 6 +- src/libcode/vx_statistics/contable.cc | 132 +++++++++--------- src/libcode/vx_statistics/contable_nx2.cc | 58 ++++---- src/libcode/vx_statistics/contable_stats.cc | 116 +++++++-------- src/libcode/vx_statistics/ens_stats.cc | 16 +-- src/libcode/vx_statistics/grid_closed_poly.cc | 20 +-- src/libcode/vx_statistics/met_stats.cc | 100 ++++++------- src/libcode/vx_statistics/obs_error.cc | 60 ++++---- src/libcode/vx_statistics/pair_base.cc | 24 ++-- .../vx_statistics/pair_data_ensemble.cc | 28 ++-- src/libcode/vx_statistics/pair_data_point.cc | 34 ++--- src/libcode/vx_statistics/read_climo.cc | 14 +- src/libcode/vx_tc_util/atcf_line_base.cc | 60 ++++---- src/libcode/vx_tc_util/atcf_prob_line.cc | 12 +- src/libcode/vx_tc_util/atcf_track_line.cc | 52 +++---- src/libcode/vx_tc_util/diag_file.cc | 10 +- src/libcode/vx_tc_util/gen_shape_info.cc | 32 ++--- src/libcode/vx_tc_util/genesis_info.cc | 46 +++--- src/libcode/vx_tc_util/pair_data_genesis.cc | 26 ++-- src/libcode/vx_tc_util/prob_gen_info.cc | 16 +-- src/libcode/vx_tc_util/prob_info_array.cc | 20 +-- src/libcode/vx_tc_util/prob_info_base.cc | 20 +-- src/libcode/vx_tc_util/prob_rirw_info.cc | 16 +-- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 28 ++-- src/libcode/vx_tc_util/tc_stat_line.cc | 64 ++++----- src/libcode/vx_tc_util/track_info.cc | 62 ++++---- src/libcode/vx_tc_util/track_pair_info.cc | 42 +++--- src/libcode/vx_tc_util/track_point.cc | 32 ++--- .../vx_time_series/time_series_util.cc | 14 +- 42 files changed, 662 insertions(+), 662 deletions(-) diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index 103bb6e172..a9fca9c71d 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -121,7 +121,7 @@ void SeepsAggScore::clear() { SeepsAggScore & SeepsAggScore::operator+=(const SeepsAggScore &c) { // Check for degenerate case - if(n_obs == 0 && c.n_obs == 0) return(*this); + if(n_obs == 0 && c.n_obs == 0) return *this; // Compute weights double w1 = (double) n_obs / (n_obs + c.n_obs); @@ -160,7 +160,7 @@ SeepsAggScore & SeepsAggScore::operator+=(const SeepsAggScore &c) { score = weighted_average(score, w1, c.score, w2); weighted_score = weighted_average(weighted_score, w1, c.weighted_score, w2); - return(*this); + return *this; } diff --git a/src/libcode/vx_series_data/series_data.cc b/src/libcode/vx_series_data/series_data.cc index 03b227b0f2..a37fec2bdb 100644 --- a/src/libcode/vx_series_data/series_data.cc +++ b/src/libcode/vx_series_data/series_data.cc @@ -74,7 +74,7 @@ bool get_series_entry(int i_series, VarInfo* data_info, // Restore warnings to their original state mlog.set_print_warning(save_print_warning_state); - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -89,7 +89,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, if(!file_exists(filename.c_str())) { mlog << Warning << "\nread_single_entry() -> " << "File does not exist: " << filename << "\n\n"; - return(false); + return false; } // Open data file @@ -104,7 +104,7 @@ bool read_single_entry(VarInfo* info, const ConcatString& filename, // Cleanup if(mtddf) { delete mtddf; mtddf = (Met2dDataFile *) 0; } - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -117,7 +117,7 @@ bool get_series_entries(int i_series, vector &vi_list, bool found; // Check for at least one field requested - if(vi_list.size() <= 0) return(false); + if(vi_list.size() <= 0) return false; // Save the log print warning state bool save_print_warning_state = mlog.print_warning(); @@ -156,7 +156,7 @@ bool get_series_entries(int i_series, vector &vi_list, // Restore warnings to their original state mlog.set_print_warning(save_print_warning_state); - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -171,7 +171,7 @@ bool read_all_entries(vector &vi_list, const ConcatString &filename, if(!file_exists(filename.c_str())) { mlog << Warning << "\nread_all_entries() -> " << "File does not exist: " << filename << "\n\n"; - return(false); + return false; } // Open data file diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index c393610c2f..c267c7b87f 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -29,7 +29,7 @@ static const int print_interest_log_level = 5; /////////////////////////////////////////////////////////////////////// -static inline double area_ratio_conf(double t) { return(t); } +static inline double area_ratio_conf(double t) { return t; } /////////////////////////////////////////////////////////////////////// // @@ -588,7 +588,7 @@ int ModeFuzzyEngine::two_to_one(int n_f, int n_o) const { n = n_o*n_fcst + n_f; - return(n); + return n; } @@ -2508,11 +2508,11 @@ int ModeFuzzyEngine::get_info_index(int pair_n) const { for(i=0; i<(info_singles.n()); i++) { - if(info_singles[i].pair_number == pair_n) return(i); + if(info_singles[i].pair_number == pair_n) return i; } - return(-1); + return -1; } /////////////////////////////////////////////////////////////////////// @@ -2530,7 +2530,7 @@ int ModeFuzzyEngine::get_matched_fcst(int area) const { } } - return(count); + return count; } /////////////////////////////////////////////////////////////////////// @@ -2548,7 +2548,7 @@ int ModeFuzzyEngine::get_unmatched_fcst(int area) const { } } - return(count); + return count; } /////////////////////////////////////////////////////////////////////// @@ -2566,7 +2566,7 @@ int ModeFuzzyEngine::get_matched_obs(int area) const { } } - return(count); + return count; } /////////////////////////////////////////////////////////////////////// @@ -2584,7 +2584,7 @@ int ModeFuzzyEngine::get_unmatched_obs(int area) const { } } - return(count); + return count; } /////////////////////////////////////////////////////////////////////// @@ -2631,7 +2631,7 @@ double total_interest(ModeConfInfo &mc, const PairFeature &p, << ") > Max Centroid Distance (" << mc.max_centroid_dist << ")\n"; } - return(total); + return total; } sum = 0.0; @@ -2917,7 +2917,7 @@ double total_interest(ModeConfInfo &mc, const PairFeature &p, << " = " << total << "\n\n"; } - return(total); + return total; } /////////////////////////////////////////////////////////////////////// @@ -2930,7 +2930,7 @@ double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) if(eng.conf_info.match_flag == 0 || eng.n_fcst == 0 || - eng.n_obs == 0) return(0.0); + eng.n_obs == 0) return 0.0; // // Initialize the maximum interest value for each object to zero. @@ -2995,7 +2995,7 @@ double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) if(v) { delete [] v; v = (double *) 0; } - return(ptile); + return ptile; } /////////////////////////////////////////////////////////////////////// @@ -4144,7 +4144,7 @@ double aspect_ratio_conf(double t) const double tm1 = t - 1.0; const double ratio = (tm1*tm1)/(t*t + 1.0); -return( pow(ratio, 0.3) ); +return pow(ratio, 0.3); } diff --git a/src/libcode/vx_shapedata/ihull.cc b/src/libcode/vx_shapedata/ihull.cc index 59208964ed..1898fdd9e4 100644 --- a/src/libcode/vx_shapedata/ihull.cc +++ b/src/libcode/vx_shapedata/ihull.cc @@ -147,22 +147,22 @@ int lex_compare(const void * _a, const void * _b) const IntPoint & a = *((const IntPoint *) _a); const IntPoint & b = *((const IntPoint *) _b); -if ( a.x < b.x ) return ( -1 ); -if ( a.x > b.x ) return ( 1 ); +if ( a.x < b.x ) return -1; +if ( a.x > b.x ) return 1; // // now we know that a.x = b.x // -if ( a.y < b.y ) return ( -1 ); -if ( a.y > b.y ) return ( 1 ); +if ( a.y < b.y ) return -1; +if ( a.y > b.y ) return 1; // // done // -return ( 0 ); +return 0; } diff --git a/src/libcode/vx_shapedata/interest.cc b/src/libcode/vx_shapedata/interest.cc index d33d32e426..7538233443 100644 --- a/src/libcode/vx_shapedata/interest.cc +++ b/src/libcode/vx_shapedata/interest.cc @@ -78,11 +78,11 @@ assign(s); SingleFeature & SingleFeature::operator=(const SingleFeature &s) { - if(this == &s) return(*this); + if(this == &s) return *this; assign(s); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -316,11 +316,11 @@ PairFeature & PairFeature::operator=(const PairFeature &p) { - if(this == &p) return(*this); + if(this == &p) return *this; assign(p); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -560,7 +560,7 @@ ostream & operator<<(ostream & out, const SingleFeature & s) out << "Intensity Sum = " << (s.intensity_ptile.sum) << "\n"; out.flush(); - return(out); + return out; } //////////////////////////////////////////////////////////////////////// @@ -588,7 +588,7 @@ ostream & operator<<(ostream & out, const PairFeature & p) out << "Percentile Intensity Ratio = " << (p.percentile_intensity_ratio) << "\n"; out.flush(); - return(out); + return out; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index 5852d9f51e..05321f071f 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -54,12 +54,12 @@ ModeConfInfo::~ModeConfInfo() ModeConfInfo & ModeConfInfo::operator=(const ModeConfInfo &s) { - if(this == &s) return(*this); + if(this == &s) return *this; clear(); assign(s); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1087,7 +1087,7 @@ for (int j=0; jn_points(); ++j) { } // for j -return ( pwl_if ); +return pwl_if; } @@ -1670,7 +1670,7 @@ switch ( e2->type() ) { } -return ( status ); +return status; } @@ -1860,7 +1860,7 @@ bool ModeNcOutInfo::all_false() const bool status = do_latlon || do_raw || do_object_raw || do_object_id || do_cluster_id || do_polylines; -return ( !status ); +return !status; } diff --git a/src/libcode/vx_shapedata/mode_field_info.cc b/src/libcode/vx_shapedata/mode_field_info.cc index 3068d38016..b49a805681 100644 --- a/src/libcode/vx_shapedata/mode_field_info.cc +++ b/src/libcode/vx_shapedata/mode_field_info.cc @@ -76,11 +76,11 @@ Mode_Field_Info & Mode_Field_Info::operator=(const Mode_Field_Info & i) { -if ( this == &i ) return ( * this ); +if ( this == &i ) return *this; assign(i); -return ( * this ); +return *this; } @@ -405,7 +405,7 @@ bool Mode_Field_Info::need_merge_thresh () const bool status = (merge_flag == MergeType_Both) || (merge_flag == MergeType_Thresh); -return ( status ); +return status; } diff --git a/src/libcode/vx_shapedata/moments.cc b/src/libcode/vx_shapedata/moments.cc index d744871929..ab7425d75f 100644 --- a/src/libcode/vx_shapedata/moments.cc +++ b/src/libcode/vx_shapedata/moments.cc @@ -58,11 +58,11 @@ Moments::Moments(const Moments &m) { Moments & Moments::operator=(const Moments &m) { if ( this == &m ) { - return ( *this ); + return *this; } assign(m); - return ( *this ); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -277,7 +277,7 @@ double Moments::angle_degrees() const { // Compute axis angle using 2nd order moments deg = 0.5*deg_per_rad*atan2(2.0*(m.sxy), m.sxx - m.syy); - return(deg); + return deg; } /////////////////////////////////////////////////////////////////////////////// @@ -310,7 +310,7 @@ double Moments::curvature(double &xcurv, double &ycurv) const { xcurv = xcenter + xbar; ycurv = ycenter + ybar; - return(radius); + return radius; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/node.cc b/src/libcode/vx_shapedata/node.cc index d344322bd5..d9ff8c1568 100644 --- a/src/libcode/vx_shapedata/node.cc +++ b/src/libcode/vx_shapedata/node.cc @@ -63,11 +63,11 @@ Node::Node(const Node &c) { Node & Node::operator=(const Node &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } /////////////////////////////////////////////////////////////////////////////// @@ -196,7 +196,7 @@ int Node::n_children() const { n_ptr = n_ptr->sibling; } - return(count); + return count; } /////////////////////////////////////////////////////////////////////////////// @@ -222,7 +222,7 @@ Node *Node::get_child(int n) const { for(i=0; isibling; - return(n_ptr); + return n_ptr; } /////////////////////////////////////////////////////////////////////////////// @@ -243,7 +243,7 @@ int Node::is_closed() const { n_ptr = n_ptr->sibling; } - return(closed); + return closed; } /////////////////////////////////////////////////////////////////////////////// @@ -321,7 +321,7 @@ double Node::angle() const { a = 0.5*deg_per_rad*atan2( 2.0*Ixy, Ixx - Iyy ); - return(a); + return a; } /////////////////////////////////////////////////////////////////////////////// @@ -372,7 +372,7 @@ double Node::uv_signed_area() const { n_ptr = n_ptr->sibling; } - return(sum); + return sum; } /////////////////////////////////////////////////////////////////////////////// @@ -404,7 +404,7 @@ int Node::is_inside(double u_test, double v_test) const { n_ptr = n_ptr->sibling; } - return(count); + return count; } /////////////////////////////////////////////////////////////////////////////// @@ -425,7 +425,7 @@ int Node::is_polyline_point(double u_test, double v_test) const { n_ptr = n_ptr->sibling; } - return(poly_point); + return poly_point; } /////////////////////////////////////////////////////////////////////////////// @@ -530,7 +530,7 @@ double node_dist(const Node &a, const Node &b) { } // end for i_b } // end for i_a - return(min_dist); + return min_dist; } /////////////////////////////////////////////////////////////////////////////// @@ -562,7 +562,7 @@ double node_polyline_dist(const Node &a, const Polyline &b) { } // end for i_a - return(min_dist); + return min_dist; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/set.cc b/src/libcode/vx_shapedata/set.cc index c62637c69e..84a36f36ab 100644 --- a/src/libcode/vx_shapedata/set.cc +++ b/src/libcode/vx_shapedata/set.cc @@ -78,11 +78,11 @@ FcstObsSet & FcstObsSet::operator=(const FcstObsSet & s) { -if ( this == &s ) return ( * this ); +if ( this == &s ) return *this; assign(s); -return ( * this ); +return *this; } @@ -261,10 +261,10 @@ int FcstObsSet::has_fcst(int k) const int j; for(j=0; j 0) matched = 1; } - return(matched); + return matched; } /////////////////////////////////////////////////////////////////////////////// @@ -682,7 +682,7 @@ int SetCollection::is_obs_matched(int obs_number) const { if(set[j].n_fcst > 0) matched = 1; } - return(matched); + return matched; } /////////////////////////////////////////////////////////////////////////////// @@ -730,21 +730,21 @@ int fcst_obs_sets_overlap(const FcstObsSet &a, const FcstObsSet &b) { // check fcst's // for(j=0; j<(a.n_fcst); j++) { - if( b.has_fcst(a.fcst_number[j]) ) return(1); + if( b.has_fcst(a.fcst_number[j]) ) return 1; } // // check obs's // for(j=0; j<(a.n_obs); j++) { - if( b.has_obs(a.obs_number[j]) ) return(1); + if( b.has_obs(a.obs_number[j]) ) return 1; } // // // - return(0); + return 0; } /////////////////////////////////////////////////////////////////////////////// @@ -769,7 +769,7 @@ FcstObsSet union_fcst_obs_sets(const FcstObsSet &a, const FcstObsSet &b) { c.add_obs(b.obs_number[j]); } - return(c); + return c; } /////////////////////////////////////////////////////////////////////////////// @@ -815,7 +815,7 @@ ostream & operator<<(ostream &out, const FcstObsSet &set) { // // - return(out); + return out; } /////////////////////////////////////////////////////////////////////////////// @@ -828,7 +828,7 @@ ostream & operator<<(ostream &out, const SetCollection &c) { out << (c.set[j]); } - return(out); + return out; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_solar/siderial.cc b/src/libcode/vx_solar/siderial.cc index 9424772245..bb9434c7da 100644 --- a/src/libcode/vx_solar/siderial.cc +++ b/src/libcode/vx_solar/siderial.cc @@ -70,7 +70,7 @@ theta -= 360.0*floor(theta/360.0); // done // -return ( theta ); +return theta; } @@ -105,7 +105,7 @@ lst -= 360.0*floor(lst/360.0); // done // -return ( lst ); +return lst; } diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 034c3c1961..3cad89b397 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -86,7 +86,7 @@ void close_txt_file(ofstream *&out, const char *file_name) { ConcatString append_climo_bin(const ConcatString &mask_name, int i_bin, int n_bin) { - if(n_bin == 1) return(mask_name); + if(n_bin == 1) return mask_name; // Append the climo CDF bin number. ConcatString cs; @@ -94,7 +94,7 @@ ConcatString append_climo_bin(const ConcatString &mask_name, if(i_bin == -1) cs << "MEAN"; else cs << i_bin+1; - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_hdr_columns.cc b/src/libcode/vx_stat_out/stat_hdr_columns.cc index 4304e87e9f..c21dcaec93 100644 --- a/src/libcode/vx_stat_out/stat_hdr_columns.cc +++ b/src/libcode/vx_stat_out/stat_hdr_columns.cc @@ -353,7 +353,7 @@ ConcatString StatHdrColumns::get_fcst_thresh_str() const { cs << setlogic_to_symbol(thresh_logic); } } - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/apply_mask.cc b/src/libcode/vx_statistics/apply_mask.cc index 010c091825..b2b6a7c5bc 100644 --- a/src/libcode/vx_statistics/apply_mask.cc +++ b/src/libcode/vx_statistics/apply_mask.cc @@ -80,7 +80,7 @@ Grid parse_vx_grid(const RegridInfo info, const Grid *fgrid, const Grid *ogrid) mlog << Debug(3) << "Grid Definition: " << vx_grid.serialize() << "\n"; - return(vx_grid); + return vx_grid; } //////////////////////////////////////////////////////////////////////// @@ -125,7 +125,7 @@ Grid parse_grid_string(const char *grid_str) { if(met_ptr) { delete met_ptr; met_ptr = 0; } } - return(grid); + return grid; } //////////////////////////////////////////////////////////////////////// @@ -683,7 +683,7 @@ DataPlane parse_geog_data(Dictionary *dict, const Grid &vx_grid, exit(1); } - return(dp); + return dp; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/contable.cc b/src/libcode/vx_statistics/contable.cc index d01c264fb3..5dc7120bc8 100644 --- a/src/libcode/vx_statistics/contable.cc +++ b/src/libcode/vx_statistics/contable.cc @@ -85,11 +85,11 @@ ContingencyTable & ContingencyTable::operator=(const ContingencyTable & t) { -if ( this == &t ) return ( * this ); +if ( this == &t ) return *this; assign(t); -return ( * this ); +return *this; } @@ -125,7 +125,7 @@ if ( E ) { for ( int i=0; isize(); ++i ) (*E)[i] += (*t.E)[i]; } -return ( * this ); +return *this; } @@ -562,7 +562,7 @@ n = r*Ncols + c; -return ( n ); +return n; } @@ -615,7 +615,7 @@ int ContingencyTable::total() const const int n = Nrows*Ncols; -if ( n == 0 ) return ( 0 ); +if ( n == 0 ) return 0; int j, sum; @@ -625,7 +625,7 @@ for (j=0; j Thresholds[Nrows] && !is_eq(t, Thresholds[Nrows]) ) return ( -1 ); +if ( t > Thresholds[Nrows] && !is_eq(t, Thresholds[Nrows]) ) return -1; // Thresholds array is of size Nrows + 1, so // the last element has index Nrows, not Nrows - 1 @@ -227,13 +227,13 @@ int j; for (j=0; j Thresholds[j ] || is_eq(t, Thresholds[j ]) ) && - ( t < Thresholds[j + 1] && !is_eq(t, Thresholds[j + 1]) ) ) return ( j ); + ( t < Thresholds[j + 1] && !is_eq(t, Thresholds[j + 1]) ) ) return j; } if ( is_eq(t, Thresholds[Nrows]) ) return ( Nrows - 1 ); -return ( -1 ); +return -1; } @@ -287,7 +287,7 @@ if ( (k < 0) || (k > Nrows) ) { // there are Nrows + 1 thresholds } -return ( Thresholds[k] ); +return Thresholds[k]; } @@ -367,7 +367,7 @@ int k; k = entry(r, nx2_event_column); -return ( k ); +return k; } @@ -395,7 +395,7 @@ int k; k = entry(r, nx2_nonevent_column); -return ( k ); +return k; } @@ -414,7 +414,7 @@ double x; if(Ni == 0) x = bad_data_double; else x = ((double) obs_count)/((double) Ni); -return ( x ); +return x; } @@ -433,7 +433,7 @@ double x; if (N == 0) x = bad_data_double; else x = ((double) obs_count)/((double) N); -return ( x ); +return x; } @@ -458,7 +458,7 @@ double x; if ( use_center ) x = 0.5*(Thresholds[row] + Thresholds[row + 1]); else x = Thresholds[row]; -return ( x ); +return x; } @@ -468,7 +468,7 @@ return ( x ); double Nx2ContingencyTable::baser() const { - return ( (double) event_col_total()/n() ); + return (double) event_col_total()/n(); } @@ -483,7 +483,7 @@ double Nx2ContingencyTable::baser_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return ( v ); + return v; } @@ -527,7 +527,7 @@ for (row=0; row 1 so that degf > 0 in the call to gsl_cdf_tdist_Pinv() -if(is_bad_data(bs = brier_score()) || N <= 1) return ( bad_data_double ); +if(is_bad_data(bs = brier_score()) || N <= 1) return bad_data_double; degf = N - 1.0; @@ -963,7 +963,7 @@ var = ( af4 + ob*term - bs*bs )*Ninv; halfwidth = t*sqrt(var); -return ( halfwidth ); +return halfwidth; } diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index f103284ee0..15cfc21688 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -31,7 +31,7 @@ using namespace std; double TTContingencyTable::baser() const { - return(oy_tp()); + return oy_tp(); } //////////////////////////////////////////////////////////////////////// @@ -44,14 +44,14 @@ double TTContingencyTable::baser_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// double TTContingencyTable::fmean() const { - return(fy_tp()); + return fy_tp(); } //////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ double TTContingencyTable::fmean_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ double TTContingencyTable::accuracy() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ double TTContingencyTable::accuracy_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -109,7 +109,7 @@ double TTContingencyTable::fbias() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -127,7 +127,7 @@ double TTContingencyTable::pod_yes() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -140,7 +140,7 @@ double TTContingencyTable::pod_yes_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -154,7 +154,7 @@ double TTContingencyTable::pod_no() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -167,7 +167,7 @@ double TTContingencyTable::pod_no_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -180,7 +180,7 @@ double TTContingencyTable::pofd() const { if(is_bad_data(d)) v = bad_data_double; else v = 1.0 - d; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -193,7 +193,7 @@ double TTContingencyTable::pofd_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -211,7 +211,7 @@ double TTContingencyTable::far() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -224,7 +224,7 @@ double TTContingencyTable::far_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -242,7 +242,7 @@ double TTContingencyTable::csi() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -255,7 +255,7 @@ double TTContingencyTable::csi_ci(double alpha, compute_proportion_ci(v, n(), alpha, 1.0, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -272,7 +272,7 @@ double TTContingencyTable::gss() const { b = (long long) fy_on(); c = (long long) fn_oy(); - if(n() == 0) return(bad_data_double); + if(n() == 0) return bad_data_double; q = (double) (a + b)*(a + c)/(n()); num = (double) (a - q); @@ -281,7 +281,7 @@ double TTContingencyTable::gss() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -296,14 +296,14 @@ double TTContingencyTable::bagss() const { double lf, lw, ha, num, den, v; if(n() == 0 || oy() == 0 || fn_oy() == 0 || fy_on() == 0) { - return(bad_data_double); + return bad_data_double; } lf = log((double) oy() / fn_oy()); lw = sf_lambert_W0((double) oy() / fy_on() * lf); if(is_bad_data(lw) || is_bad_data(lf) || is_eq(lf, 0.0)) { - return(bad_data_double); + return bad_data_double; } else { ha = (double) oy() - (fy_on() / lf) * lw; @@ -315,7 +315,7 @@ double TTContingencyTable::bagss() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -340,7 +340,7 @@ double TTContingencyTable::hk() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = (double) num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -354,7 +354,7 @@ double TTContingencyTable::hk_ci(double alpha, compute_hk_ci(v, alpha, 1.0, fy_oy(), fy_on(), fn_oy(), fn_on(), cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -379,7 +379,7 @@ double TTContingencyTable::hss() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = (double) num/den; - return(v); + return v; } @@ -396,7 +396,7 @@ double TTContingencyTable::odds() const { pn = pofd(); if(is_eq(py, 1.0) || is_bad_data(py) || - is_eq(pn, 1.0) || is_bad_data(pn)) return(bad_data_double); + is_eq(pn, 1.0) || is_bad_data(pn)) return bad_data_double; num = py/(1 - py); den = pn/(1 - pn); @@ -404,7 +404,7 @@ double TTContingencyTable::odds() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -418,7 +418,7 @@ double TTContingencyTable::odds_ci(double alpha, compute_woolf_ci(v, alpha, fy_oy(), fy_on(), fn_oy(), fn_on(), cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -434,7 +434,7 @@ double TTContingencyTable::lodds() const { log((double) fy_on()) - log((double) fn_oy()); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -450,7 +450,7 @@ double TTContingencyTable::slor2() const { v = 1.0/df; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -464,7 +464,7 @@ double TTContingencyTable::lodds_ci(double alpha, if(is_bad_data(v) || is_bad_data(s)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -474,7 +474,7 @@ double TTContingencyTable::lodds_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -488,7 +488,7 @@ double TTContingencyTable::orss() const { if(den == 0) v = bad_data_double; else v = (double) num / den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -503,7 +503,7 @@ double TTContingencyTable::orss_ci(double alpha, if(is_bad_data(v) || is_bad_data(r) || is_bad_data(s)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -513,7 +513,7 @@ double TTContingencyTable::orss_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -539,7 +539,7 @@ double TTContingencyTable::eds() const { else v = 2.0 * num / den - 1.0; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -555,7 +555,7 @@ double TTContingencyTable::eds_ci(double alpha, if(is_bad_data(v) || is_bad_data(b) || is_bad_data(h) || is_eq(b, 0.0) || is_eq(h, 0.0)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -567,7 +567,7 @@ double TTContingencyTable::eds_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -588,7 +588,7 @@ double TTContingencyTable::seds() const { else v = num / den - 1.0; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -604,7 +604,7 @@ double TTContingencyTable::seds_ci(double alpha, if(is_bad_data(v) || is_bad_data(b) || is_bad_data(h) || is_eq(b, 0.0) || is_eq(h, 0.0)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -616,7 +616,7 @@ double TTContingencyTable::seds_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -637,7 +637,7 @@ double TTContingencyTable::edi() const { else v = num/den; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -654,7 +654,7 @@ double TTContingencyTable::edi_ci(double alpha, if(is_bad_data(f) || is_bad_data(h) || is_bad_data(b) || is_eq(f, 0.0) || is_eq(h, 0.0) || is_eq(h, 1.0)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -666,7 +666,7 @@ double TTContingencyTable::edi_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -689,7 +689,7 @@ double TTContingencyTable::sedi() const { else v = num/den; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -707,7 +707,7 @@ double TTContingencyTable::sedi_ci(double alpha, is_eq(f, 0.0) || is_eq(h, 0.0) || is_eq(f, 1.0) || is_eq(h, 1.0)) { cl = cu = bad_data_double; - return(v); + return v; } // @@ -724,7 +724,7 @@ double TTContingencyTable::sedi_ci(double alpha, compute_normal_ci(v, alpha, se, cl, cu); - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -755,7 +755,7 @@ double TTContingencyTable::cost_loss(double r) const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -789,7 +789,7 @@ double ContingencyTable::gaccuracy() const { if(is_eq(den, 0.0)) v = bad_data_double; else v = num/den; - return(v); + return v; } @@ -815,7 +815,7 @@ const int N = total(); // MET #2542: return bad data for empty tables rather than erroring out // -if ( N == 0 ) return ( bad_data_double ); +if ( N == 0 ) return bad_data_double; const double DN = (double) N; int j, k, m, n; @@ -870,7 +870,7 @@ else ans = num/denom; // done // -return ( ans ); +return ans; } @@ -913,7 +913,7 @@ const int N = total(); // MET #2542: return bad data for empty tables rather than erroring out // -if ( N == 0 ) return ( bad_data_double ); +if ( N == 0 ) return bad_data_double; int j, sum; double num, denom, ans; @@ -948,7 +948,7 @@ else ans = num/denom; // done // -return ( ans ); +return ans; } @@ -975,7 +975,7 @@ const int N = total(); // MET #2542: return bad data for empty tables rather than erroring out // -if ( N == 0 ) return ( bad_data_double ); +if ( N == 0 ) return bad_data_double; const double DN = (double) N; int j, k, m, n; @@ -1044,7 +1044,7 @@ else ans = num/denom; // done // -return ( ans ); +return ans; } @@ -1072,7 +1072,7 @@ const int N = total(); // MET #2542: return bad data for empty tables rather than erroring out // -if ( N == 0 ) return ( bad_data_double ); +if ( N == 0 ) return bad_data_double; int j, k, m, n; const double DN = (double) N; @@ -1084,7 +1084,7 @@ double * s = (double *) 0; // can't compute gerrity when the first column contains all zeros // -if ( col_total(0) == 0 ) return ( bad_data_double ); +if ( col_total(0) == 0 ) return bad_data_double; p = new double [Nrows]; @@ -1143,7 +1143,7 @@ for (j=0; j u_max) return(0); + if(u_test < u_min) return 0; + if(u_test > u_max) return 0; - if(v_test < v_min) return(0); - if(v_test > v_max) return(0); + if(v_test < v_min) return 0; + if(v_test > v_max) return 0; // // test polyline @@ -145,7 +145,7 @@ int GridClosedPoly::is_inside(double u_test, double v_test) const { const int status = Polyline::is_inside(u_test, v_test); - return(status); + return status; } /////////////////////////////////////////////////////////////////////////////// @@ -156,7 +156,7 @@ int GridClosedPoly::is_inside(double u_test, double v_test) const { bool GridClosedPolyArray::is_inside(double u_test, double v_test) const { - if(Nelements == 0) return(false); + if(Nelements == 0) return false; int j, status; @@ -167,10 +167,10 @@ bool GridClosedPolyArray::is_inside(double u_test, double v_test) const { status = e[j]->is_inside(u_test, v_test); - if(status != 0) return(true); + if(status != 0) return true; } - return(false); + return false; } diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index a33f1adc73..f9a3534375 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -53,11 +53,11 @@ CIInfo::CIInfo(const CIInfo &c) { CIInfo & CIInfo::operator=(const CIInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -190,11 +190,11 @@ CTSInfo::CTSInfo(const CTSInfo &c) { CTSInfo & CTSInfo::operator=(const CTSInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -470,7 +470,7 @@ double CTSInfo::get_stat(const char *stat_name) { v = bad_data_double; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -502,11 +502,11 @@ MCTSInfo::MCTSInfo(const MCTSInfo &c) { MCTSInfo & MCTSInfo::operator=(const MCTSInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -696,11 +696,11 @@ CNTInfo::CNTInfo(const CNTInfo &c) { CNTInfo & CNTInfo::operator=(const CNTInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1085,7 +1085,7 @@ double CNTInfo::get_stat(const char *stat_name) { v = bad_data_double; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -1117,11 +1117,11 @@ SL1L2Info::SL1L2Info(const SL1L2Info &c) { SL1L2Info & SL1L2Info::operator=(const SL1L2Info &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1165,7 +1165,7 @@ SL1L2Info & SL1L2Info::operator+=(const SL1L2Info &c) { assign(s_info); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1346,11 +1346,11 @@ VL1L2Info::VL1L2Info(const VL1L2Info &c) { VL1L2Info & VL1L2Info::operator=(const VL1L2Info &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1400,7 +1400,7 @@ VL1L2Info & VL1L2Info::operator+=(const VL1L2Info &c) { assign(v_info); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2027,7 +2027,7 @@ double VL1L2Info::get_stat(const char *stat_name) { exit(1); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2059,11 +2059,11 @@ NBRCTSInfo::NBRCTSInfo(const NBRCTSInfo &c) { NBRCTSInfo & NBRCTSInfo::operator=(const NBRCTSInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2141,11 +2141,11 @@ NBRCNTInfo::NBRCNTInfo(const NBRCNTInfo &c) { NBRCNTInfo & NBRCNTInfo::operator=(const NBRCNTInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2214,7 +2214,7 @@ NBRCNTInfo & NBRCNTInfo::operator+=(const NBRCNTInfo &c) { assign(n_info); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2354,11 +2354,11 @@ ISCInfo::ISCInfo(const ISCInfo &c) { ISCInfo & ISCInfo::operator=(const ISCInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2596,11 +2596,11 @@ PCTInfo::PCTInfo(const PCTInfo &c) { PCTInfo & PCTInfo::operator=(const PCTInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2808,11 +2808,11 @@ GRADInfo::GRADInfo(const GRADInfo &c) { GRADInfo & GRADInfo::operator=(const GRADInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2841,7 +2841,7 @@ GRADInfo & GRADInfo::operator+=(const GRADInfo &c) { assign(g_info); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -2897,7 +2897,7 @@ double GRADInfo::s1() const { v = 100.0 * egbar / mgbar; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2912,7 +2912,7 @@ double GRADInfo::s1_og() const { v = 100.0 * egbar / ogbar; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2927,7 +2927,7 @@ double GRADInfo::fgog_ratio() const { v = fgbar / ogbar; } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -3023,11 +3023,11 @@ DMAPInfo::DMAPInfo(const DMAPInfo &c) { DMAPInfo & DMAPInfo::operator=(const DMAPInfo &c) { - if(this == &c) return(*this); + if(this == &c) return *this; assign(c); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -3124,7 +3124,7 @@ double DMAPInfo::fbias() const { if(oy == 0) v = bad_data_double; else v = (double) fy / oy; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -3356,7 +3356,7 @@ int parse_message_type(const char *msg_typ_str, char **&msg_typ_arr) { n = num_tokens(msg_typ_str, " "); // Check for no tokens in string - if(n == 0) return(0); + if(n == 0) return 0; // Allocate space for the list of tokens msg_typ_arr = new char * [n]; @@ -3373,7 +3373,7 @@ int parse_message_type(const char *msg_typ_str, char **&msg_typ_arr) { msg_typ_arr[i] = m_strcpy2(c, method_name, a_var_name); } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// @@ -3389,7 +3389,7 @@ int parse_dbl_list(const char *dbl_str, double *&dbl_arr) { n = num_tokens(dbl_str, " "); // Check for no tokens in string - if(n == 0) return(0); + if(n == 0) return 0; // Allocate space for the list of tokens dbl_arr = new double [n]; @@ -3400,7 +3400,7 @@ int parse_dbl_list(const char *dbl_str, double *&dbl_arr) { // Tokenize the string and store the double values for(int i=0; i v_max) v_max = v_int[i]; - return(v_max); + return v_max; } //////////////////////////////////////////////////////////////////////// @@ -3448,12 +3448,12 @@ int max_int(const int *v_int, int n) { int min_int(const int *v_int, int n) { int i, v_min; - if(n <= 0) return(0); + if(n <= 0) return 0; v_min = v_int[0]; for(i=1; i 0) { - if(strcasecmp(dl[0], "OBS_VAR") == 0) return(true); + if(strcasecmp(dl[0], "OBS_VAR") == 0) return true; } - return(false); + return false; } //////////////////////////////////////////////////////////////////////// @@ -283,28 +283,28 @@ bool ObsErrorEntry::is_match(const char *cur_var_name, double cur_val) { // Check array filters - if(var_name.n() > 0 && !var_name.reg_exp_match(cur_var_name)) return(false); - if(msg_type.n() > 0 && !msg_type.has(cur_msg_type)) return(false); - if(sid.n() > 0 && !sid.has(cur_sid)) return(false); - if(pb_rpt_type.n() > 0 && !pb_rpt_type.has(cur_pb_rpt)) return(false); - if(in_rpt_type.n() > 0 && !in_rpt_type.has(cur_in_rpt)) return(false); - if(inst_type.n() > 0 && !inst_type.has(cur_inst)) return(false); + if(var_name.n() > 0 && !var_name.reg_exp_match(cur_var_name)) return false; + if(msg_type.n() > 0 && !msg_type.has(cur_msg_type)) return false; + if(sid.n() > 0 && !sid.has(cur_sid)) return false; + if(pb_rpt_type.n() > 0 && !pb_rpt_type.has(cur_pb_rpt)) return false; + if(in_rpt_type.n() > 0 && !in_rpt_type.has(cur_in_rpt)) return false; + if(inst_type.n() > 0 && !inst_type.has(cur_inst)) return false; // Check ranges if(!is_bad_data(cur_hgt) && hgt_range.n() == 2) { if((cur_hgt < hgt_range[0] && !is_eq(cur_hgt, hgt_range[0])) || - (cur_hgt > hgt_range[1] && !is_eq(cur_hgt, hgt_range[1]))) return(false); + (cur_hgt > hgt_range[1] && !is_eq(cur_hgt, hgt_range[1]))) return false; } if(!is_bad_data(cur_prs) && prs_range.n() == 2) { if((cur_prs < prs_range[0] && !is_eq(cur_prs, prs_range[0])) || - (cur_prs > prs_range[1] && !is_eq(cur_prs, prs_range[1]))) return(false); + (cur_prs > prs_range[1] && !is_eq(cur_prs, prs_range[1]))) return false; } if(!is_bad_data(cur_val) && val_range.n() == 2) { if((cur_val < val_range[0] && !is_eq(cur_val, val_range[0])) || - (cur_val > val_range[1] && !is_eq(cur_val, val_range[1]))) return(false); + (cur_val > val_range[1] && !is_eq(cur_val, val_range[1]))) return false; } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -495,7 +495,7 @@ bool ObsErrorTable::read(const char * file_name) { if(!f.open(file_name)) { mlog << Warning << "ObsErrorTable::read() -> " << "unable to open input file \"" << file_name << "\"\n\n"; - return(false); + return false; } // @@ -515,7 +515,7 @@ bool ObsErrorTable::read(const char * file_name) { f.close(); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -552,7 +552,7 @@ ObsErrorEntry *ObsErrorTable::lookup( << ", val = " << cur_val << "\n\n"; } - return(e_match); + return e_match; } //////////////////////////////////////////////////////////////////////// @@ -581,7 +581,7 @@ ObsErrorEntry *ObsErrorTable::lookup( << "\", val = " << cur_val << "\n\n"; } - return(e_match); + return e_match; } //////////////////////////////////////////////////////////////////////// @@ -591,10 +591,10 @@ bool ObsErrorTable::has(const char *cur_var_name, for(int i=0; ilookup_bool(conf_key_flag); // If set to NONE, no work to do - if(!info.flag) return(info); + if(!info.flag) return info; // Conf: dist_type - optional i = err_dict->lookup_int(conf_key_dist_type, false); @@ -693,7 +693,7 @@ ObsErrorInfo parse_conf_obs_error(Dictionary *dict, gsl_rng *rng_ptr) { info.entry.validate(); - return(info); + return info; } //////////////////////////////////////////////////////////////////////// @@ -704,7 +704,7 @@ double add_obs_error_inc(const gsl_rng *r, FieldType t, double v_new = v; // Check for null pointer or bad input value - if(!e || is_bad_data(v)) return(v); + if(!e || is_bad_data(v)) return v; // Apply the specified random perturbation if(e->dist_type != DistType_None) { @@ -737,7 +737,7 @@ double add_obs_error_inc(const gsl_rng *r, FieldType t, } } - return(v_new); + return v_new; } //////////////////////////////////////////////////////////////////////// @@ -780,7 +780,7 @@ DataPlane add_obs_error_inc(const gsl_rng *r, FieldType t, } } - return(out_dp); + return out_dp; } //////////////////////////////////////////////////////////////////////// @@ -790,7 +790,7 @@ double add_obs_error_bc(const gsl_rng *r, FieldType t, double v_new = v; // Check for null pointer or bad input value - if(!e || is_bad_data(v)) return(v); + if(!e || is_bad_data(v)) return v; // Apply instrument bias correction if(!is_bad_data(e->bias_scale)) v_new *= e->bias_scale; @@ -820,7 +820,7 @@ double add_obs_error_bc(const gsl_rng *r, FieldType t, } } - return(v_new); + return v_new; } //////////////////////////////////////////////////////////////////////// @@ -861,7 +861,7 @@ DataPlane add_obs_error_bc(const gsl_rng *r, FieldType t, } } - return(out_dp); + return out_dp; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_base.cc b/src/libcode/vx_statistics/pair_base.cc index 339861ac9b..cf5c1455c7 100644 --- a/src/libcode/vx_statistics/pair_base.cc +++ b/src/libcode/vx_statistics/pair_base.cc @@ -325,7 +325,7 @@ int PairBase::has_obs_rec(const char *sid, double lat, double lon, // // Only valid for point data // - if(!IsPointVx) return(false); + if(!IsPointVx) return false; // // Check for an existing record of this observation @@ -343,7 +343,7 @@ int PairBase::has_obs_rec(const char *sid, double lat, double lon, } } // end for - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -784,7 +784,7 @@ void PairBase::add_grid_obs(double x, double y, double PairBase::process_obs(VarInfo *vinfo, double v) { - if(!vinfo) return(v); + if(!vinfo) return v; double new_v = v; @@ -803,7 +803,7 @@ double PairBase::process_obs(VarInfo *vinfo, double v) { } } - return(new_v); + return new_v; } //////////////////////////////////////////////////////////////////////// @@ -885,7 +885,7 @@ double compute_interp(const DataPlaneArray &dpa, double v, v_blw, v_abv, t; // Check for no data - if(dpa.n_planes() == 0) return(bad_data_double); + if(dpa.n_planes() == 0) return bad_data_double; v_blw = compute_horz_interp(dpa[i_blw], obs_x, obs_y, obs_v, cmn, csd, method, width, shape, wrap_lon, @@ -901,7 +901,7 @@ double compute_interp(const DataPlaneArray &dpa, // Check for bad data prior to vertical interpolation if(is_bad_data(v_blw) || is_bad_data(v_abv)) { - return(bad_data_double); + return bad_data_double; } // If verifying specific humidity, do vertical interpolation in @@ -926,7 +926,7 @@ double compute_interp(const DataPlaneArray &dpa, } } - return(v); + return v; } @@ -1019,10 +1019,10 @@ bool set_climo_flag(const NumArray &f_na, const NumArray &c_na) { // The climo values must have non-zero, consistent length and // cannot all be bad data if(c_na.n() != f_na.n() || c_na.n() < 1 || is_bad_data(c_na.max())) { - return(false); + return false; } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -1094,7 +1094,7 @@ NumArray derive_climo_prob(const ClimoCDFInfo *cdf_info_ptr, else if(n_mn > 0 && n_sd > 0) { // Need cdf_info_ptr set to proceed - if(!cdf_info_ptr) return(climo_prob); + if(!cdf_info_ptr) return climo_prob; // Derive climatological probabilities directly if(cdf_info_ptr->direct_prob) { @@ -1183,7 +1183,7 @@ NumArray derive_climo_prob(const ClimoCDFInfo *cdf_info_ptr, climo_prob = mn_na; } - return(climo_prob); + return climo_prob; } //////////////////////////////////////////////////////////////////////// @@ -1202,7 +1202,7 @@ double derive_prob(const NumArray &na, const SingleThresh &st) { if(n_vld == 0) prob = bad_data_double; else prob = (double) n_event / n_vld; - return(prob); + return prob; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index 41f527351b..485c8546ce 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -62,11 +62,11 @@ PairDataEnsemble::PairDataEnsemble(const PairDataEnsemble &pd) { PairDataEnsemble & PairDataEnsemble::operator=(const PairDataEnsemble &pd) { - if(this == &pd) return(*this); + if(this == &pd) return *this; assign(pd); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -304,7 +304,7 @@ void PairDataEnsemble::assign(const PairDataEnsemble &pd) { //////////////////////////////////////////////////////////////////////// bool PairDataEnsemble::has_obs_error() const { - return(obs_error_flag); + return obs_error_flag; } //////////////////////////////////////////////////////////////////////// @@ -830,7 +830,7 @@ void PairDataEnsemble::compute_ssvar() { PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &ot) const { // Check for no work to be done - if(ot.get_type() == thresh_na) return(*this); + if(ot.get_type() == thresh_na) return *this; int i, j; PairDataEnsemble pd; @@ -912,7 +912,7 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o << " ensemble pairs for observation filtering threshold " << ot.get_str() << ".\n"; - return(pd); + return pd; } //////////////////////////////////////////////////////////////////////// @@ -944,11 +944,11 @@ VxPairDataEnsemble::VxPairDataEnsemble(const VxPairDataEnsemble &vx_pd) { VxPairDataEnsemble & VxPairDataEnsemble::operator=(const VxPairDataEnsemble &vx_pd) { - if(this == &vx_pd) return(*this); + if(this == &vx_pd) return *this; assign(vx_pd); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1843,7 +1843,7 @@ int VxPairDataEnsemble::get_n_pair() const { } } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// @@ -1970,7 +1970,7 @@ double compute_crps_emp(double obs, const NumArray &ens_na) { evals.sort_array(); // Check for bad or no data - if(is_bad_data(obs) || evals.n() == 0) return(bad_data_double); + if(is_bad_data(obs) || evals.n() == 0) return bad_data_double; // Initialize double obs_cdf = 0.0; @@ -1997,7 +1997,7 @@ double compute_crps_emp(double obs, const NumArray &ens_na) { // Handle obs being >= all ensemble members if(is_eq(obs_cdf, 0.0)) integral += (obs - fcst); - return(integral); + return integral; } //////////////////////////////////////////////////////////////////////// @@ -2017,7 +2017,7 @@ double compute_crps_gaus(double obs, double m, double s) { v = s*(z*(2.0*znorm(z) - 1) + 2.0*dnorm(z) - 1.0/sqrt(pi)); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2036,7 +2036,7 @@ double compute_ens_ign(double obs, double m, double s) { v = 0.5*log(2.0*pi*s*s) + (obs - m)*(obs - m)/(2.0*s*s); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2055,7 +2055,7 @@ double compute_ens_pit(double obs, double m, double s) { v = normal_cdf(obs, m, s); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -2109,7 +2109,7 @@ double compute_bias_ratio(double me_ge_obs, double me_lt_obs) { v = me_ge_obs / abs(me_lt_obs); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 15aa9133f0..da960f2870 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -57,11 +57,11 @@ PairDataPoint::PairDataPoint(const PairDataPoint &pd) { PairDataPoint & PairDataPoint::operator=(const PairDataPoint &pd) { - if(this == &pd) return(*this); + if(this == &pd) return *this; assign(pd); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -170,12 +170,12 @@ bool PairDataPoint::add_point_pair(const char *sid, double lat, double lon, double cmn, double csd, double wgt) { if(!add_point_obs(sid, lat, lon, x, y, ut, lvl, elv, o, qc, - cmn, csd, wgt)) return(false); + cmn, csd, wgt)) return false; f_na.add(f); seeps_mpr.push_back((SeepsScore *)nullptr); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -252,7 +252,7 @@ bool PairDataPoint::add_grid_pair(double f, double o, f_na.add(f); seeps_mpr.push_back(nullptr); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -285,7 +285,7 @@ bool PairDataPoint::add_grid_pair(const NumArray &f_in, const NumArray &o_in, // Increment the number of pairs n_obs += o_in.n(); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -321,7 +321,7 @@ PairDataPoint PairDataPoint::subset_pairs_cnt_thresh( // Check for no work to be done if(ft.get_type() == thresh_na && ot.get_type() == thresh_na) { - return(*this); + return *this; } int i; @@ -373,7 +373,7 @@ PairDataPoint PairDataPoint::subset_pairs_cnt_thresh( << ", observation filtering threshold " << ot.get_str() << ", and field logic " << setlogic_to_string(type) << ".\n"; - return(out_pd); + return out_pd; } //////////////////////////////////////////////////////////////////////// @@ -405,11 +405,11 @@ VxPairDataPoint::VxPairDataPoint(const VxPairDataPoint &vx_pd) { VxPairDataPoint & VxPairDataPoint::operator=(const VxPairDataPoint &vx_pd) { - if(this == &vx_pd) return(*this); + if(this == &vx_pd) return *this; assign(vx_pd); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -1414,7 +1414,7 @@ int VxPairDataPoint::get_n_pair() const { } } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// @@ -1626,7 +1626,7 @@ bool check_mpr_thresh(double f, double o, double cmn, double csd, if(reason_ptr) reason_ptr->erase(); // Check arrays - if(col_sa.n() == 0 || col_ta.n() == 0) return(true); + if(col_sa.n() == 0 || col_ta.n() == 0) return true; bool keep = true; bool absv = false; @@ -1684,7 +1684,7 @@ bool check_mpr_thresh(double f, double o, double cmn, double csd, } } // end for i - return(keep); + return keep; } //////////////////////////////////////////////////////////////////////// @@ -1712,7 +1712,7 @@ double get_mpr_column_value(double f, double o, double cmn, double csd, exit(1); } - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -1879,7 +1879,7 @@ PairDataPoint subset_climo_cdf_bin(const PairDataPoint &pd, const ThreshArray &ta, int i_bin) { // Check for no work to be done - if(ta.n() == 0) return(pd); + if(ta.n() == 0) return pd; int i; PairDataPoint out_pd; @@ -1926,7 +1926,7 @@ PairDataPoint subset_climo_cdf_bin(const PairDataPoint &pd, << "Using " << out_pd.n_obs << " of " << pd.n_obs << " pairs for climatology bin number " << i_bin+1 << ".\n"; - return(out_pd); + return out_pd; } //////////////////////////////////////////////////////////////////////// @@ -1956,7 +1956,7 @@ ConcatString point_obs_to_string(float *hdr_arr, const char *hdr_typ_str, << obs_arr[2] << " " << obs_arr[3] << " " << obs_qty << " " << obs_arr[4]; - return(obs_cs); + return obs_cs; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/read_climo.cc b/src/libcode/vx_statistics/read_climo.cc index 27fe9e5eae..db64d44a52 100644 --- a/src/libcode/vx_statistics/read_climo.cc +++ b/src/libcode/vx_statistics/read_climo.cc @@ -45,7 +45,7 @@ DataPlane read_climo_data_plane(Dictionary *dict, int i_vx, DataPlaneArray dpa; // Check for null - if(!dict) return(dp); + if(!dict) return dp; // Read array of climatology fields dpa = read_climo_data_plane_array(dict, i_vx, vld_ut, vx_grid); @@ -60,7 +60,7 @@ DataPlane read_climo_data_plane(Dictionary *dict, int i_vx, // Store the first match found if(dpa.n_planes() > 0) dp = dpa[0]; - return(dp); + return dp; } //////////////////////////////////////////////////////////////////////// @@ -77,7 +77,7 @@ DataPlaneArray read_climo_data_plane_array(Dictionary *dict, int i_vx, int i, day_ts, hour_ts; // Check for null - if(!dict) return(dpa); + if(!dict) return dpa; // Get the i-th array entry Dictionary i_dict = parse_conf_i_vx_dict(dict, i_vx); @@ -86,7 +86,7 @@ DataPlaneArray read_climo_data_plane_array(Dictionary *dict, int i_vx, climo_files = i_dict.lookup_string_array(conf_key_file_name, false); // Check for at least one file - if(climo_files.n() == 0) return(dpa); + if(climo_files.n() == 0) return dpa; // Regrid info regrid_info = parse_conf_regrid(&i_dict); @@ -140,7 +140,7 @@ DataPlaneArray read_climo_data_plane_array(Dictionary *dict, int i_vx, mlog << Debug(3) << "Found " << dpa.n_planes() << " climatology fields.\n"; - return(dpa); + return dpa; } //////////////////////////////////////////////////////////////////////// @@ -400,7 +400,7 @@ DataPlaneArray climo_time_interp(const DataPlaneArray &dpa, int day_ts, } // end else } // end for it - return(interp_dpa); + return interp_dpa; } //////////////////////////////////////////////////////////////////////// @@ -439,7 +439,7 @@ DataPlane climo_hms_interp(const DataPlaneArray &dpa, << unix_to_yyyymmdd_hhmmss(vld_ut) << " using the " << interpmthd_to_string(mthd) << " interpolation method.\n"; - return(valid_time_interp(dpa[i_prv], dpa[i_nxt], vld_ut, mthd)); + return valid_time_interp(dpa[i_prv], dpa[i_nxt], vld_ut, mthd); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/atcf_line_base.cc b/src/libcode/vx_tc_util/atcf_line_base.cc index 6db2d00651..e696bb6ee9 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.cc +++ b/src/libcode/vx_tc_util/atcf_line_base.cc @@ -56,11 +56,11 @@ ATCFLineBase::ATCFLineBase(const ATCFLineBase &l) { ATCFLineBase & ATCFLineBase::operator=(const ATCFLineBase &l) { - if(this == &l) return(*this); + if(this == &l) return *this; assign(l); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -167,7 +167,7 @@ int ATCFLineBase::read_line(LineDataFile * ldf) { // Check for bad return status or blank line if(!status || n_items() == 0) { clear(); - return(0); + return 0; } // Set the line type from the technique number column @@ -194,14 +194,14 @@ int ATCFLineBase::read_line(LineDataFile * ldf) { } } - return(1); + return 1; } //////////////////////////////////////////////////////////////////////// bool ATCFLineBase::is_header() const { - if(basin().comparecase(0, 5, "BASIN") == 0) return(true); - else return(false); + if(basin().comparecase(0, 5, "BASIN") == 0) return true; + else return false; } //////////////////////////////////////////////////////////////////////// @@ -224,7 +224,7 @@ ConcatString ATCFLineBase::get_item(int i) const { // Strip off any whitespace cs.ws_strip(); - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// @@ -232,42 +232,42 @@ ConcatString ATCFLineBase::get_item(int i) const { ConcatString ATCFLineBase::get_line() const { ConcatString cs; - if(N_items == 0) return(cs); + if(N_items == 0) return cs; for(int i=0; i 90.0) v = bad_data_double; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -449,7 +449,7 @@ double parse_lon(const char *s) { // Range check if(is_bad_data(v) || v < -360.0 || v > 360.0) v = bad_data_double; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -463,7 +463,7 @@ int parse_int(const char *s, const int bad_data) { // Check bad data value if(v == bad_data) v = bad_data_int; - return(v); + return v; } //////////////////////////////////////////////////////////////////////// @@ -473,7 +473,7 @@ int parse_int(const char *s, const int bad_data) { //////////////////////////////////////////////////////////////////////// int parse_int_check_zero(const char *s) { - return(parse_int(s, 0)); + return parse_int(s, 0); } //////////////////////////////////////////////////////////////////////// @@ -497,7 +497,7 @@ ATCFLineType string_to_atcflinetype(const char *s) { else if(strcasecmp(s, "ER") == 0) t = ATCFLineType_ProbER; else t = NoATCFLineType; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -521,7 +521,7 @@ ConcatString atcflinetype_to_string(const ATCFLineType t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// @@ -548,7 +548,7 @@ ConcatString define_storm_id(unixtime init_ut, unixtime min_valid_ut, storm_id << basin << cyclone << year; } - return(storm_id); + return storm_id; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/atcf_prob_line.cc b/src/libcode/vx_tc_util/atcf_prob_line.cc index 9cc97c4728..c8a3ee18f4 100644 --- a/src/libcode/vx_tc_util/atcf_prob_line.cc +++ b/src/libcode/vx_tc_util/atcf_prob_line.cc @@ -50,11 +50,11 @@ ATCFProbLine::ATCFProbLine(const ATCFProbLine &l) { ATCFProbLine & ATCFProbLine::operator=(const ATCFProbLine &l) { - if(this == &l) return(*this); + if(this == &l) return *this; assign(l); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -116,7 +116,7 @@ int ATCFProbLine::read_line(LineDataFile * ldf) { clear(); // Return bad status from the base class - if(!(status = ATCFLineBase::read_line(ldf))) return(0); + if(!(status = ATCFLineBase::read_line(ldf))) return 0; // Check the line type switch(Type) { @@ -150,19 +150,19 @@ int ATCFProbLine::read_line(LineDataFile * ldf) { } } - return(1); + return 1; } //////////////////////////////////////////////////////////////////////// int ATCFProbLine::prob() const { - return(parse_int(get_item(ProbOffset).c_str())); + return parse_int(get_item(ProbOffset).c_str()); } //////////////////////////////////////////////////////////////////////// int ATCFProbLine::prob_item() const { - return(parse_int(get_item(ProbItemOffset).c_str())); + return parse_int(get_item(ProbItemOffset).c_str()); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index 106a646f88..ffc47dfacf 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -50,11 +50,11 @@ ATCFTrackLine::ATCFTrackLine(const ATCFTrackLine &l) { ATCFTrackLine & ATCFTrackLine::operator=(const ATCFTrackLine &l) { - if(this == &l) return(*this); + if(this == &l) return *this; assign(l); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -140,7 +140,7 @@ int ATCFTrackLine::read_line(LineDataFile * ldf) { status = ATCFLineBase::read_line(ldf); // Check for bad return status or blank line - if(!status) return(0); + if(!status) return 0; // Check the line type if(Type != ATCFLineType_Track && @@ -149,7 +149,7 @@ int ATCFTrackLine::read_line(LineDataFile * ldf) { << "\nint ATCFTrackLine::read_line(LineDataFile * ldf) -> " << "unexpected ATCF line type (" << atcflinetype_to_string(Type) << ")\n\n"; - return(0); + return 0; } // Check for the minumum number of track line elements @@ -162,10 +162,10 @@ int ATCFTrackLine::read_line(LineDataFile * ldf) { << "found fewer than the expected number of elements (" << n_items() << ") in ATCF track line:\n" << DataLine::get_line() << "\n\n"; - return(0); + return 0; } - return(1); + return 1; } //////////////////////////////////////////////////////////////////////// @@ -269,13 +269,13 @@ int ATCFTrackLine::max_wind_radius() const { int ATCFTrackLine::storm_direction() const { if(Type == ATCFLineType_Track && StormDirectionOffset < N_items) { - return(parse_int(get_item(StormDirectionOffset).c_str())); + return parse_int(get_item(StormDirectionOffset).c_str()); } else if(Type == ATCFLineType_GenTrack && StormDirectionOffset < N_items) { - return(parse_int(get_item(GenStormDirectionOffset).c_str())); + return parse_int(get_item(GenStormDirectionOffset).c_str()); } - return(bad_data_int); + return bad_data_int; } //////////////////////////////////////////////////////////////////////// @@ -283,13 +283,13 @@ int ATCFTrackLine::storm_direction() const { int ATCFTrackLine::storm_speed() const { if(Type == ATCFLineType_Track && StormSpeedOffset < N_items) { - return(parse_int(get_item(StormSpeedOffset).c_str())); + return parse_int(get_item(StormSpeedOffset).c_str()); } else if(Type == ATCFLineType_GenTrack && StormSpeedOffset < N_items) { - return(parse_int(get_item(GenStormSpeedOffset).c_str())); + return parse_int(get_item(GenStormSpeedOffset).c_str()); } - return(bad_data_int); + return bad_data_int; } //////////////////////////////////////////////////////////////////////// @@ -309,7 +309,7 @@ bool ATCFTrackLine::warm_core() const { GenWarmCoreOffset < N_items) { return(get_item(GenWarmCoreOffset).comparecase("Y") == 0); } - return(false); + return false; } //////////////////////////////////////////////////////////////////////// @@ -514,7 +514,7 @@ WatchWarnType ww_max(const WatchWarnType t1, const WatchWarnType t2) { t2 == StormWarn ) t = StormWarn; else t = NoWatchWarnType; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -530,7 +530,7 @@ WatchWarnType int_to_watchwarntype(int i) { else if(i == 6) t = HurricaneWarn; else t = NoWatchWarnType; - return(t); + return t; } @@ -547,7 +547,7 @@ WatchWarnType string_to_watchwarntype(const char *s) { else if(strcasecmp(s, "HUWARN") == 0) t = HurricaneWarn; else t = NoWatchWarnType; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -566,7 +566,7 @@ ConcatString watchwarntype_to_string(const WatchWarnType t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// @@ -591,7 +591,7 @@ CycloneLevel string_to_cyclonelevel(const char *s) { else if(strcmp(s, "ET") == 0) l = Extrapolated; else /* "XX" */ l = NoCycloneLevel; - return(l); + return l; } //////////////////////////////////////////////////////////////////////// @@ -619,7 +619,7 @@ ConcatString cyclonelevel_to_string(const CycloneLevel t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// @@ -632,7 +632,7 @@ CycloneLevel wind_speed_to_cyclonelevel(int s) { else if(s <= 63) l = TropicalStorm; else l = Hurricane; - return(l); + return l; } //////////////////////////////////////////////////////////////////////// @@ -651,7 +651,7 @@ QuadrantType string_to_quadranttype(const char *s) { else if(strcmp(s, "NWQ") == 0) t = NW_Quadrant; else t = NoQuadrantType; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -673,7 +673,7 @@ ConcatString quadranttype_to_string(const QuadrantType t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// @@ -692,7 +692,7 @@ SubregionCode string_to_subregioncode(const char *s) { else if(strcmp(s, "W") == 0) c = Western_Pacific; else c = NoSubregionCode; - return(c); + return c; } //////////////////////////////////////////////////////////////////////// @@ -714,7 +714,7 @@ ConcatString subregioncode_to_string(const SubregionCode t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// @@ -727,7 +727,7 @@ SystemsDepth string_to_systemsdepth(const char *s) { else if(strcmp(s, "S") == 0) d = ShallowDepth; else d = NoSystemsDepth; - return(d); + return d; } //////////////////////////////////////////////////////////////////////// @@ -743,7 +743,7 @@ ConcatString systemsdepth_to_string(const SystemsDepth t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 95336c7765..96b85b7a35 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -66,7 +66,7 @@ int DiagFile::lead(int i) const { exit(1); } - return(LeadTime[i]); + return LeadTime[i]; } //////////////////////////////////////////////////////////////////////// @@ -95,7 +95,7 @@ double DiagFile::lat(int i) const { exit(1); } - return(Lat[i]); + return Lat[i]; } //////////////////////////////////////////////////////////////////////// @@ -109,13 +109,13 @@ double DiagFile::lon(int i) const { exit(1); } - return(Lon[i]); + return Lon[i]; } //////////////////////////////////////////////////////////////////////// bool DiagFile::has_diag(const string &str) const { - return(DiagName.has(str)); + return DiagName.has(str); } //////////////////////////////////////////////////////////////////////// @@ -130,7 +130,7 @@ const NumArray & DiagFile::diag_val(const string &str) const { exit(1); } - return(DiagVal[i]); + return DiagVal[i]; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/gen_shape_info.cc b/src/libcode/vx_tc_util/gen_shape_info.cc index cb8698c20e..1c258b2c78 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.cc +++ b/src/libcode/vx_tc_util/gen_shape_info.cc @@ -46,11 +46,11 @@ GenShapeInfo::GenShapeInfo(const GenShapeInfo &g) { GenShapeInfo & GenShapeInfo::operator=(const GenShapeInfo &g) { - if(this == &g) return(*this); + if(this == &g) return *this; assign(g); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -85,7 +85,7 @@ ConcatString GenShapeInfo::serialize() const { << ", Lon = " << Poly.x_min() << " to " << Poly.x_max() << ", NProb = " << ProbVal.n(); - return(s); + return s; } @@ -157,7 +157,7 @@ void GenShapeInfo::add_prob(int sec, double prob) { //////////////////////////////////////////////////////////////////////// const ShpPolyRecord &GenShapeInfo::poly() const { - return(Poly); + return Poly; } //////////////////////////////////////////////////////////////////////// @@ -175,7 +175,7 @@ double GenShapeInfo::center_lon() const { //////////////////////////////////////////////////////////////////////// int GenShapeInfo::n_prob() const { - return(ProbVal.n()); + return ProbVal.n(); } //////////////////////////////////////////////////////////////////////// @@ -189,7 +189,7 @@ int GenShapeInfo::lead_sec(int i) const { exit(1); } - return(LeadSec[i]); + return LeadSec[i]; } //////////////////////////////////////////////////////////////////////// @@ -203,7 +203,7 @@ double GenShapeInfo::prob_val(int i) const { exit(1); } - return(ProbVal[i]); + return ProbVal[i]; } //////////////////////////////////////////////////////////////////////// @@ -237,11 +237,11 @@ GenShapeInfoArray::GenShapeInfoArray(const GenShapeInfoArray & t) { GenShapeInfoArray & GenShapeInfoArray::operator=(const GenShapeInfoArray & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -315,7 +315,7 @@ const GenShapeInfo & GenShapeInfoArray::operator[](int n) const { exit(1); } - return(GenShape[n]); + return GenShape[n]; } //////////////////////////////////////////////////////////////////////// @@ -338,7 +338,7 @@ bool GenShapeInfoArray::add(const GenShapeInfo &gsi, bool check_dup) { if(GenShape[i].file_time() == gsi.file_time()) { mlog << Debug(5) << "Skip exact duplicate " << gsi.serialize() << "\n"; - return(false); + return false; } // Replace older duplicates with more recent file time stamps else if(GenShape[i].file_time() < gsi.file_time()) { @@ -347,12 +347,12 @@ bool GenShapeInfoArray::add(const GenShapeInfo &gsi, bool check_dup) { << unix_to_yyyymmdd_hhmmss(GenShape[i].file_time()) << "\") with newer " << gsi.serialize() << "\n"; GenShape[i] = gsi; - return(false); + return false; } else { mlog << Debug(5) << "Skip older duplicate " << gsi.serialize() << "\n"; - return(false); + return false; } } } @@ -361,7 +361,7 @@ bool GenShapeInfoArray::add(const GenShapeInfo &gsi, bool check_dup) { // Store the genesis shape object GenShape.push_back(gsi); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -369,10 +369,10 @@ bool GenShapeInfoArray::add(const GenShapeInfo &gsi, bool check_dup) { bool GenShapeInfoArray::has(const GenShapeInfo &gsi) const { for(int i=0; ilookup_thresh(conf_key_mslp_thresh); - return(info); + return info; } //////////////////////////////////////////////////////////////////////// @@ -132,11 +132,11 @@ GenesisInfo::GenesisInfo(const GenesisInfo &g) { GenesisInfo & GenesisInfo::operator=(const GenesisInfo &g) { - if(this == &g) return(*this); + if(this == &g) return *this; assign(g); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -245,7 +245,7 @@ ConcatString GenesisInfo::serialize() const { << ", Lon = " << Lon << ", DLand = " << DLand; - return(s); + return s; } @@ -257,7 +257,7 @@ ConcatString GenesisInfo::serialize_r(int n, int indent_depth) const { s << prefix << "[" << n << "] " << serialize(); - return(s); + return s; } @@ -285,7 +285,7 @@ bool GenesisInfo::set(const TrackInfo &ti, } // Return bad status if genesis was not found - if(is_bad_data(GenesisIndex)) return(false); + if(is_bad_data(GenesisIndex)) return false; // Store the TrackInfo TrackInfo::assign(ti); @@ -299,7 +299,7 @@ bool GenesisInfo::set(const TrackInfo &ti, if(IsAnlyTrack) GenesisLead = 0; else GenesisLead = ti[GenesisIndex].lead(); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -369,11 +369,11 @@ GenesisInfoArray::GenesisInfoArray(const GenesisInfoArray & t) { GenesisInfoArray & GenesisInfoArray::operator=(const GenesisInfoArray & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -421,7 +421,7 @@ ConcatString GenesisInfoArray::serialize() const { s << "GenesisInfoArray: " << "NGenesis = " << (int) Genesis.size(); - return(s); + return s; } @@ -438,7 +438,7 @@ ConcatString GenesisInfoArray::serialize_r(int indent_depth) const { s << Genesis[i].serialize_r(i+1, indent_depth+1) << "\n"; } - return(s); + return s; } @@ -468,7 +468,7 @@ const GenesisInfo & GenesisInfoArray::operator[](int n) const { exit(1); } - return(Genesis[n]); + return Genesis[n]; } //////////////////////////////////////////////////////////////////////// @@ -480,13 +480,13 @@ bool GenesisInfoArray::add(const GenesisInfo &gi) { mlog << Warning << "\nGenesisInfoArray::add() -> " << "Skipping duplicate genesis event:\n" << gi.serialize() << "\n\n"; - return(false); + return false; } // Store the genesis object Genesis.push_back(gi); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -494,10 +494,10 @@ bool GenesisInfoArray::add(const GenesisInfo &gi) { bool GenesisInfoArray::has(const GenesisInfo &g) const { for(int i=0; i& gi_list, const GenesisInfo *gi, int &i) const { - if(!gi) return(false); + if(!gi) return false; // Search for a match for(i=0; i " << "skipping duplicate ATCF line:\n" << l.get_line() << "\n\n"; - return(false); + return false; } } @@ -203,7 +203,7 @@ bool ProbGenInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { if(Type == NoATCFLineType) initialize(l, dland); // Check for matching header information - if(!is_match(l)) return(false); + if(!is_match(l)) return false; // Add probability information NProb++; @@ -213,7 +213,7 @@ bool ProbGenInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { // Store the ATCFProbLine that was just added if(check_dup) ProbLines.add(l.get_line()); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_info_array.cc b/src/libcode/vx_tc_util/prob_info_array.cc index c162876567..f6db7d179b 100644 --- a/src/libcode/vx_tc_util/prob_info_array.cc +++ b/src/libcode/vx_tc_util/prob_info_array.cc @@ -52,11 +52,11 @@ ProbInfoArray::ProbInfoArray(const ProbInfoArray & t) { ProbInfoArray & ProbInfoArray::operator=(const ProbInfoArray & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -114,7 +114,7 @@ ConcatString ProbInfoArray::serialize() const { << "NProbRIRW = " << n_prob_rirw() << ", NProbGen = " << n_prob_gen(); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -139,7 +139,7 @@ ConcatString ProbInfoArray::serialize_r(int indent_depth) const { s << ProbGen[i].serialize_r(i+1, indent_depth+1); } - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -176,7 +176,7 @@ const ProbInfoBase * ProbInfoArray::operator[](int n) const { ptr = &ProbGen[n]; } - return(ptr); + return ptr; } //////////////////////////////////////////////////////////////////////// @@ -190,7 +190,7 @@ ProbRIRWInfo & ProbInfoArray::prob_rirw(int n) { exit(1); } - return(ProbRIRW[n]); + return ProbRIRW[n]; } //////////////////////////////////////////////////////////////////////// @@ -204,7 +204,7 @@ ProbGenInfo & ProbInfoArray::prob_gen(int n) { exit(1); } - return(ProbGen[n]); + return ProbGen[n]; } //////////////////////////////////////////////////////////////////////// @@ -224,7 +224,7 @@ int ProbInfoArray::n_technique() const { } } - return(sa.n()); + return sa.n(); } //////////////////////////////////////////////////////////////////////// @@ -238,7 +238,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { << "bool ProbInfoArray::add() -> " << "skipping probability value (" << l.prob() << ") outside of range (0, 100).\n"; - return(false); + return false; } // Store based on the input line type @@ -300,7 +300,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { status = false; } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_info_base.cc b/src/libcode/vx_tc_util/prob_info_base.cc index dc9a6cfc76..d341bb43a3 100644 --- a/src/libcode/vx_tc_util/prob_info_base.cc +++ b/src/libcode/vx_tc_util/prob_info_base.cc @@ -50,11 +50,11 @@ ProbInfoBase::ProbInfoBase(const ProbInfoBase & t) { ProbInfoBase & ProbInfoBase::operator=(const ProbInfoBase & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ ConcatString ProbInfoBase::serialize() const { << ", DLand = " << DLand << ", NProb = " << NProb; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -153,7 +153,7 @@ ConcatString ProbInfoBase::serialize_r(int n, int indent_depth) const { << "% probability for " << ProbItem[i] << "\n"; } - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -237,7 +237,7 @@ bool ProbInfoBase::is_match(const TrackInfo &t) const { match = false; // Check that technique is defined - if(Technique == "" || t.technique() == "") return(false); + if(Technique == "" || t.technique() == "") return false; // Check that init times match for non-BEST, non-analysis tracks if(!t.is_best_track() && @@ -246,7 +246,7 @@ bool ProbInfoBase::is_match(const TrackInfo &t) const { match = false; } - return(match); + return match; } //////////////////////////////////////////////////////////////////////// @@ -260,7 +260,7 @@ bool ProbInfoBase::add(const ATCFProbLine &l, double dland, bool check_dup) { << "\nProbInfoBase::add(const ATCFProbLine &l, bool check_dup) -> " << "skipping duplicate ATCFProbLine:\n" << l.get_line() << "\n\n"; - return(false); + return false; } } @@ -268,7 +268,7 @@ bool ProbInfoBase::add(const ATCFProbLine &l, double dland, bool check_dup) { if(Type == NoATCFLineType) initialize(l, dland); // Check for matching header information - if(!is_match(l)) return(false); + if(!is_match(l)) return false; // Add probability information NProb++; @@ -278,7 +278,7 @@ bool ProbInfoBase::add(const ATCFProbLine &l, double dland, bool check_dup) { // Store the ATCFProbLine that was just added if(check_dup) ProbLines.add(l.get_line()); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -324,7 +324,7 @@ void ProbInfoBase::set(const TCStatLine &l) { //////////////////////////////////////////////////////////////////////// bool ProbInfoBase::has(const ATCFProbLine &l) const { - return(ProbLines.has(l.get_line())); + return ProbLines.has(l.get_line()); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_rirw_info.cc b/src/libcode/vx_tc_util/prob_rirw_info.cc index 4745f18913..4b12925388 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_info.cc @@ -51,11 +51,11 @@ ProbRIRWInfo::ProbRIRWInfo(const ProbRIRWInfo & t) { ProbRIRWInfo & ProbRIRWInfo::operator=(const ProbRIRWInfo & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ ConcatString ProbRIRWInfo::serialize() const { << ", RIRWBeg = " << RIRWBeg << ", RIRWEnd = " << RIRWEnd; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -121,7 +121,7 @@ ConcatString ProbRIRWInfo::serialize_r(int n, int indent_depth) const { s << ProbInfoBase::serialize_r(n, indent_depth); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -167,7 +167,7 @@ void ProbRIRWInfo::initialize(const ATCFProbLine &l, double dland) { bool ProbRIRWInfo::is_match(const ATCFProbLine &l) const { - if(!ProbInfoBase::is_match(l)) return(false); + if(!ProbInfoBase::is_match(l)) return false; return(ValidTime == l.valid() && Value == parse_int(l.get_item(ProbRIRWValueOffset).c_str()) && @@ -186,7 +186,7 @@ bool ProbRIRWInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { << "\nProbRIRWInfo::add(const ATCFProbLine &l, bool check_dup) -> " << "skipping duplicate ATCF line:\n" << l.get_line() << "\n\n"; - return(false); + return false; } } @@ -194,7 +194,7 @@ bool ProbRIRWInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { if(Type == NoATCFLineType) initialize(l, dland); // Check for matching header information - if(!is_match(l)) return(false); + if(!is_match(l)) return false; // Add probability information NProb++; @@ -204,7 +204,7 @@ bool ProbRIRWInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { // Store the ATCFProbLine that was just added if(check_dup) ProbLines.add(l.get_line()); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 364e754035..d5d52d14d1 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -50,11 +50,11 @@ ProbRIRWPairInfo::ProbRIRWPairInfo(const ProbRIRWPairInfo & t) { ProbRIRWPairInfo & ProbRIRWPairInfo::operator=(const ProbRIRWPairInfo & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -132,7 +132,7 @@ ConcatString ProbRIRWPairInfo::case_info() const { << ", RIRW_BEG = " << ProbRIRW.rirw_beg() << ", RIRW_END = " << ProbRIRW.rirw_end(); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -157,7 +157,7 @@ ConcatString ProbRIRWPairInfo::serialize() const { << ", BMinV = " << BMinV << ", BMaxV = " << BMaxV; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -172,7 +172,7 @@ ConcatString ProbRIRWPairInfo::serialize_r(int n, int indent_depth) const { << prefix2 << "BDeck = " << (BDeck ? BDeck->serialize().text() : "(nul)") << "\n"; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ bool ProbRIRWPairInfo::set(const ProbRIRWInfo &prob_rirw_info, // Check for bad data if(prob_rirw_info.init() == (unixtime) 0 || is_bad_data(prob_rirw_info.rirw_beg()) || - is_bad_data(prob_rirw_info.rirw_end())) return(false); + is_bad_data(prob_rirw_info.rirw_end())) return false; // Define begin and end times unixtime beg_ut = prob_rirw_info.init() + (prob_rirw_info.rirw_beg() * sec_per_hour); @@ -227,7 +227,7 @@ bool ProbRIRWPairInfo::set(const ProbRIRWInfo &prob_rirw_info, } // Check for matching points - if(i_beg < 0 || i_end < 0) return(false); + if(i_beg < 0 || i_end < 0) return false; // Store the paired information ProbRIRW = prob_rirw_info; @@ -257,7 +257,7 @@ bool ProbRIRWPairInfo::set(const ProbRIRWInfo &prob_rirw_info, latlon_to_xytk_err(prob_rirw_info.lat(), prob_rirw_info.lon(), BLat, BLon, XErr, YErr, TrackErr); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -330,11 +330,11 @@ ProbRIRWPairInfoArray::ProbRIRWPairInfoArray(const ProbRIRWPairInfoArray & t) { ProbRIRWPairInfoArray & ProbRIRWPairInfoArray::operator=(const ProbRIRWPairInfoArray & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -382,7 +382,7 @@ ConcatString ProbRIRWPairInfoArray::serialize() const { s << "ProbRIRWPairInfoArray: " << "NPairs = " << n_pairs(); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -397,7 +397,7 @@ ConcatString ProbRIRWPairInfoArray::serialize_r(int indent_depth) const { s << Pairs[i].serialize_r(i+1, indent_depth+1); } - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -444,11 +444,11 @@ bool ProbRIRWPairInfoArray::add(const ProbRIRWInfo &p, const TrackInfo &t) { ProbRIRWPairInfo pair; // Attempt to set a new pair - if(!pair.set(p, t)) return(false); + if(!pair.set(p, t)) return false; Pairs.push_back(pair); - return(true); + return true; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/tc_stat_line.cc b/src/libcode/vx_tc_util/tc_stat_line.cc index 78bd215196..0598a36c5f 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.cc +++ b/src/libcode/vx_tc_util/tc_stat_line.cc @@ -62,11 +62,11 @@ TCStatLine::TCStatLine(const TCStatLine & L) { TCStatLine & TCStatLine::operator=(const TCStatLine & L) { - if(this == &L) return(*this); + if(this == &L) return *this; assign(L); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -119,7 +119,7 @@ int TCStatLine::read_line(LineDataFile * ldf) { // if(!status || n_items() == 0) { clear(); - return(0); + return 0; } // @@ -127,7 +127,7 @@ int TCStatLine::read_line(LineDataFile * ldf) { // if(strcmp(get_item(0), "VERSION") == 0) { Type = TCStatLineType_Header; - return(1); + return 1; } // @@ -137,7 +137,7 @@ int TCStatLine::read_line(LineDataFile * ldf) { if(is_bad_data(offset) || n_items() < (offset + 1)) { Type = NoTCStatLineType; - return(0); + return 0; } // @@ -147,13 +147,13 @@ int TCStatLine::read_line(LineDataFile * ldf) { Type = string_to_tcstatlinetype(get_item(offset)); - return(1); + return 1; } //////////////////////////////////////////////////////////////////////// bool TCStatLine::is_ok() const { - return(DataLine::is_ok()); + return DataLine::is_ok(); } //////////////////////////////////////////////////////////////////////// @@ -179,7 +179,7 @@ ConcatString TCStatLine::get(const char *col_str, bool check_na) const { cs = sec_to_hhmmss(valid_hour()); } - return(cs); + return cs; } //////////////////////////////////////////////////////////////////////// @@ -210,8 +210,8 @@ const char * TCStatLine::get_item(const char *col_str, bool check_na) const { // // Return bad data string for no match // - if(is_bad_data(offset)) return(bad_data_str); - else return(get_item(offset, check_na)); + if(is_bad_data(offset)) return bad_data_str; + else return get_item(offset, check_na); } //////////////////////////////////////////////////////////////////////// @@ -219,61 +219,61 @@ const char * TCStatLine::get_item(const char *col_str, bool check_na) const { const char * TCStatLine::get_item(int offset, bool check_na) const { // Range check - if(offset < 0 || offset >= N_items) return(bad_data_str); + if(offset < 0 || offset >= N_items) return bad_data_str; const char * c = DataLine::get_item(offset); // Check for the NA string and interpret it as bad data - if(check_na && strcmp(c, na_str) == 0) return(bad_data_str); - else return(c); + if(check_na && strcmp(c, na_str) == 0) return bad_data_str; + else return c; } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::version() const { - return(get_item("VERSION", false)); + return get_item("VERSION", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::amodel() const { - return(get_item("AMODEL", false)); + return get_item("AMODEL", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::bmodel() const { - return(get_item("BMODEL", false)); + return get_item("BMODEL", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::desc() const { - return(get_item("DESC", false)); + return get_item("DESC", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::storm_id() const { - return(get_item("STORM_ID", false)); + return get_item("STORM_ID", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::basin() const { - return(get_item("BASIN", false)); + return get_item("BASIN", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::cyclone() const { - return(get_item("CYCLONE", false)); + return get_item("CYCLONE", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::storm_name() const { - return(get_item("STORM_NAME", false)); + return get_item("STORM_NAME", false); } //////////////////////////////////////////////////////////////////////// @@ -284,13 +284,13 @@ unixtime TCStatLine::init() const { t = timestring_to_unix(c); - return(t); + return t; } //////////////////////////////////////////////////////////////////////// int TCStatLine::init_hour() const { - return(init()%sec_per_day); + return init()%sec_per_day; } //////////////////////////////////////////////////////////////////////// @@ -301,7 +301,7 @@ int TCStatLine::lead() const { s = timestring_to_sec(c); - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -312,7 +312,7 @@ unixtime TCStatLine::valid() const { t = timestring_to_unix(c); - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -324,25 +324,25 @@ int TCStatLine::valid_hour() const { //////////////////////////////////////////////////////////////////////// const char * TCStatLine::init_mask() const { - return(get_item("INIT_MASK", false)); + return get_item("INIT_MASK", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::valid_mask() const { - return(get_item("VALID_MASK", false)); + return get_item("VALID_MASK", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::initials() const { - return(get_item("INITIALS", false)); + return get_item("INITIALS", false); } //////////////////////////////////////////////////////////////////////// const char * TCStatLine::line_type() const { - return(get_item("LINE_TYPE", false)); + return get_item("LINE_TYPE", false); } //////////////////////////////////////////////////////////////////////// @@ -358,7 +358,7 @@ ConcatString TCStatLine::header() const { << (!is_bad_data(lead()) ? sec_to_hhmmss(lead()).text() : na_str) << sep << (valid() > 0 ? unix_to_yyyymmdd_hhmmss(valid()).text() : na_str); - return(hdr); + return hdr; } //////////////////////////////////////////////////////////////////////// @@ -376,7 +376,7 @@ TCStatLineType string_to_tcstatlinetype(const char *s) { else if(strcmp(s, TCStatLineType_Header_Str) == 0) t = TCStatLineType_Header; else t = NoTCStatLineType; - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -392,7 +392,7 @@ ConcatString tcstatlinetype_to_string(const TCStatLineType t) { default: s = na_str; break; } - return(ConcatString(s)); + return ConcatString(s); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index 379d60faa1..d07b35aa0b 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -51,11 +51,11 @@ TrackInfo::TrackInfo(const TrackInfo & t) { TrackInfo & TrackInfo::operator=(const TrackInfo & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ ConcatString TrackInfo::serialize() const { << ", NAlloc = " << NAlloc << ", NTrackLines = " << TrackLines.n(); - return(s); + return s; } @@ -199,7 +199,7 @@ ConcatString TrackInfo::serialize_r(int n, int indent_depth) const { for(i=0; i " << "skipping duplicate ATCFTrackLine:\n" << l.get_line() << "\n\n"; - return(false); + return false; } } @@ -913,7 +913,7 @@ bool TrackInfoArray::add(const ATCFTrackLine &l, bool check_dup, bool check_anly status = true; } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -931,7 +931,7 @@ bool TrackInfoArray::has(const ATCFTrackLine &l) const { } // Return whether the TrackInfo matches - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -949,7 +949,7 @@ bool TrackInfoArray::erase_storm_id(const ConcatString &s) { } } - return(status); + return status; } //////////////////////////////////////////////////////////////////////// @@ -962,7 +962,7 @@ int TrackInfoArray::add_diag_data(DiagFile &diag_file, const StringArray &diag_n if(Track[i].add_diag_data(diag_file, diag_name)) n_match++; } - return(n_match); + return n_match; } //////////////////////////////////////////////////////////////////////// @@ -1228,7 +1228,7 @@ TrackInfo consensus(const TrackInfoArray &tracks, } // end loop over lead times // Return the consensus track - return(tavg); + return tavg; } //////////////////////////////////////////////////////////////////////// @@ -1310,7 +1310,7 @@ bool has_storm_id(const StringArray &storm_id, break; } - return(match); + return match; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index dd58b42e5f..ac5352febb 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -52,11 +52,11 @@ TrackPairInfo::TrackPairInfo(const TrackPairInfo & t) { TrackPairInfo & TrackPairInfo::operator=(const TrackPairInfo & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -146,7 +146,7 @@ ConcatString TrackPairInfo::case_info() const { << ", INIT = " << unix_to_yyyymmdd_hhmmss(ADeck.init()) << ", NPoints = " << NPoints; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -157,7 +157,7 @@ ConcatString TrackPairInfo::serialize() const { s << "TrackPairInfo: " << "NPoints = " << NPoints; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -185,7 +185,7 @@ ConcatString TrackPairInfo::serialize_r(int n, int indent_depth) const { << "\n"; } - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -545,7 +545,7 @@ unixtime TrackPairInfo::valid(int i) const { // Use the ADeck valid time, if defined. t = (ADeck[i].valid() > 0 ? ADeck[i].valid() : BDeck[i].valid()); - return(t); + return t; } //////////////////////////////////////////////////////////////////////// @@ -561,7 +561,7 @@ int TrackPairInfo::i_init() const { if(i < NPoints) i_match = i; - return(i_match); + return i_match; } //////////////////////////////////////////////////////////////////////// @@ -575,7 +575,7 @@ WatchWarnType TrackPairInfo::watch_warn(int i) const { ww_type = ww_max(ADeck[i].watch_warn(), BDeck[i].watch_warn()); } - return(ww_type); + return ww_type; } //////////////////////////////////////////////////////////////////////// @@ -621,7 +621,7 @@ int TrackPairInfo::check_water_only() { } } // end for i - return(n_rej); + return n_rej; } //////////////////////////////////////////////////////////////////////// @@ -642,7 +642,7 @@ int TrackPairInfo::check_rirw(const TrackType track_type, int acur, aprv, bcur, bprv; // Nothing to do. - if(track_type == TrackType_None) return(0); + if(track_type == TrackType_None) return 0; // Check threshold type for non-exact intensity differences. if(!exact_adeck && @@ -785,7 +785,7 @@ int TrackPairInfo::check_rirw(const TrackType track_type, } } // end for i - return(n_rej); + return n_rej; } //////////////////////////////////////////////////////////////////////// @@ -820,7 +820,7 @@ int TrackPairInfo::check_landfall(const int landfall_beg, } } - return(n_rej); + return n_rej; } //////////////////////////////////////////////////////////////////////// @@ -853,7 +853,7 @@ bool TrackPairInfo::landfall_window(unixtime beg_ut, unixtime end_ut) const { } } - return(found); + return found; } //////////////////////////////////////////////////////////////////////// @@ -888,7 +888,7 @@ TrackPairInfo TrackPairInfo::keep_subset() const { } } - return(tpi); + return tpi; } //////////////////////////////////////////////////////////////////////// @@ -922,11 +922,11 @@ TrackPairInfoArray::TrackPairInfoArray(const TrackPairInfoArray & t) { TrackPairInfoArray & TrackPairInfoArray::operator=(const TrackPairInfoArray & t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -979,7 +979,7 @@ ConcatString TrackPairInfoArray::serialize() const { << "NPairs = " << NPairs << ", NAlloc = " << NAlloc; - return(s); + return s; } @@ -995,7 +995,7 @@ ConcatString TrackPairInfoArray::serialize_r(int indent_depth) const { for(i=0; i n) n = Pair[i].adeck().n_diag(); } - return(n); + return n; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_point.cc b/src/libcode/vx_tc_util/track_point.cc index 1db936322e..a2c2b6adc1 100644 --- a/src/libcode/vx_tc_util/track_point.cc +++ b/src/libcode/vx_tc_util/track_point.cc @@ -52,11 +52,11 @@ QuadInfo::QuadInfo(const QuadInfo &t) { QuadInfo & QuadInfo::operator=(const QuadInfo &t) { - if(this == &t) return(*this); + if(this == &t) return *this; assign(t); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ QuadInfo & QuadInfo::operator+=(const QuadInfo &t) { if(is_bad_data(NWVal) || is_bad_data(t.NWVal)) NWVal = bad_data_double; else NWVal += t.NWVal; - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -151,7 +151,7 @@ ConcatString QuadInfo::serialize() const { << ", SWVal = " << SWVal << ", NWVal = " << NWVal; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ ConcatString QuadInfo::serialize_r(int n, int indent_depth) const { s << prefix << "[" << n << "] " << serialize() << "\n"; - return(s); + return s; } //////////////////////////////////////////////////////////////////////// @@ -307,7 +307,7 @@ bool QuadInfo::is_match_wind(const ATCFTrackLine &l) const { // Parse the line into a QuadInfo object qi.set_wind(l); - return(*this == qi); + return (*this == qi); } //////////////////////////////////////////////////////////////////////// @@ -318,7 +318,7 @@ bool QuadInfo::is_match_seas(const ATCFTrackLine &l) const { // Parse the line into a QuadInfo object qi.set_seas(l); - return(*this == qi); + return (*this == qi); } //////////////////////////////////////////////////////////////////////// @@ -352,11 +352,11 @@ TrackPoint::TrackPoint(const TrackPoint &p) { TrackPoint & TrackPoint::operator=(const TrackPoint &p) { - if(this == &p) return(*this); + if(this == &p) return *this; assign(p); - return(*this); + return *this; } //////////////////////////////////////////////////////////////////////// @@ -416,7 +416,7 @@ TrackPoint & TrackPoint::operator+=(const TrackPoint &p) { // Increment wind quadrants for(i=0; i " << "for non-exact differences the ramp threshold (" << thresh.get_str() << ") must be of type <, <=, >, or >=.\n\n"; - return(false); + return false; } // Loop over the times @@ -137,7 +137,7 @@ bool compute_dydt_ramps(const char *name, } } // end for i - return(true); + return true; } //////////////////////////////////////////////////////////////////////// @@ -165,14 +165,14 @@ bool compute_swing_ramps(const char *name, ramps.add(bad_data_double); slopes.add(bad_data_double); } - return(true); + return true; } mlog << Debug(4) << "Applying the swinging door algorithm.\n"; if(!compute_swinging_door_slopes(times, vals, width, slopes)) { - return(false); + return false; } // Apply the slope threshold to define ramps @@ -194,7 +194,7 @@ bool compute_swing_ramps(const char *name, } - return(true); + return true; } //////////////////////////////////////////////////////////////////////// From 481bb156949de2dd63a9f3c3254cec9203d5d29f Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 05:33:48 +0000 Subject: [PATCH 14/72] #2673 restored return statement --- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 6523846ea8..c6fbde206e 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -502,7 +502,7 @@ bool get_gen_vx_mask_config_str(MetNcMetDataFile *mnmdf_ptr, int i; // Check for null pointer - if(!mnmdf_ptr) ; + if(!mnmdf_ptr) return status; // Check for the MET_tool global attribute if(!get_global_att(mnmdf_ptr->MetNc->Nc, (string) "MET_tool", tool)) return status; From bc7af9929de9466617cf6f5b7e5b7836c05f52d7 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 20:59:07 +0000 Subject: [PATCH 15/72] #2673 Added std namespace --- src/libcode/vx_bool_calc/bool_calc.h | 4 ++-- src/libcode/vx_bool_calc/token.h | 4 ++-- src/libcode/vx_data2d_grib2/data2d_grib2.h | 12 ++++++------ src/libcode/vx_pxm/pxm_utils.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libcode/vx_bool_calc/bool_calc.h b/src/libcode/vx_bool_calc/bool_calc.h index a8604a6eed..2143d8e982 100644 --- a/src/libcode/vx_bool_calc/bool_calc.h +++ b/src/libcode/vx_bool_calc/bool_calc.h @@ -26,7 +26,7 @@ class BoolCalc { void init_from_scratch(); - stack * s; // allocated + std::stack * s; // allocated Program * program; // allocated @@ -52,7 +52,7 @@ class BoolCalc { void set(const char *); // algebraic boolean expression - bool run(const vector); + bool run(const std::vector); // return true if one of the operations is a union (or) bool has_union() const; diff --git a/src/libcode/vx_bool_calc/token.h b/src/libcode/vx_bool_calc/token.h index a63cce075c..717207160d 100644 --- a/src/libcode/vx_bool_calc/token.h +++ b/src/libcode/vx_bool_calc/token.h @@ -165,7 +165,7 @@ extern std::ostream & operator<<(std::ostream &, const Token &); //////////////////////////////////////////////////////////////////////// -inline int Token::prec () const { return ( out_prec ); } +inline int Token::prec () const { return out_prec; } inline bool Token::is_mark () const { return ( type == tok_mark ); } inline bool Token::is_unmark () const { return ( type == tok_unmark ); } @@ -178,7 +178,7 @@ inline bool Token::is_operand () const { return ( type == tok_local_var ); } //////////////////////////////////////////////////////////////////////// -typedef vector Program; +typedef std::vector Program; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib2/data2d_grib2.h b/src/libcode/vx_data2d_grib2/data2d_grib2.h index a37561fb03..46c50ee2f5 100644 --- a/src/libcode/vx_data2d_grib2/data2d_grib2.h +++ b/src/libcode/vx_data2d_grib2/data2d_grib2.h @@ -39,7 +39,7 @@ typedef struct { int FieldNum; int Discipline; int PdsTmpl; - string ParmName; + std::string ParmName; int ParmCat; int Parm; int Process; @@ -84,10 +84,10 @@ class MetGrib2DataFile : public Met2dDataFile { FILE *FileGrib2; - vector RecList; + std::vector RecList; - map PairMap; - map NameRecMap; + std::map PairMap; + std::map NameRecMap; int ScanMode; @@ -98,8 +98,8 @@ class MetGrib2DataFile : public Met2dDataFile { void find_record_matches( VarInfoGrib2* vinfo, - vector &listMatchExact, - vector &listMatchRange + std::vector &listMatchExact, + std::vector &listMatchRange ); bool read_grib2_record_data_plane(Grib2Record *rec, DataPlane &plane); diff --git a/src/libcode/vx_pxm/pxm_utils.h b/src/libcode/vx_pxm/pxm_utils.h index d0717043dd..f5f764ba88 100644 --- a/src/libcode/vx_pxm/pxm_utils.h +++ b/src/libcode/vx_pxm/pxm_utils.h @@ -24,11 +24,11 @@ //////////////////////////////////////////////////////////////////////// -extern int parse_number (istream &); +extern int parse_number (std::istream &); -extern void skip_whitespace (istream &); +extern void skip_whitespace (std::istream &); -extern void get_comment (istream &, char *); +extern void get_comment (std::istream &, char *); //////////////////////////////////////////////////////////////////////// From e872917e8a561aa43fc8d233687d0392507036bd Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 28 Feb 2024 21:06:08 +0000 Subject: [PATCH 16/72] #2673 Moved down 'using namespace' statement. Removed trailing spaces --- src/tools/other/mode_time_domain/3d_conv.cc | 36 +++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/tools/other/mode_time_domain/3d_conv.cc b/src/tools/other/mode_time_domain/3d_conv.cc index a0ad85c12a..8bb11c7e3c 100644 --- a/src/tools/other/mode_time_domain/3d_conv.cc +++ b/src/tools/other/mode_time_domain/3d_conv.cc @@ -10,14 +10,6 @@ //////////////////////////////////////////////////////////////////////// -static const bool verbose = false; - -static const bool do_ppms = false; - - -//////////////////////////////////////////////////////////////////////// - - #include #include #include @@ -42,6 +34,10 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// +static const bool verbose = false; + +static const bool do_ppms = false; + static int spatial_conv_radius = -1; static double * sum_plane_buf = nullptr; @@ -205,9 +201,9 @@ struct DataHandle { static void get_data_plane(const MtdFloatFile &, const int t, double * data_plane, bool * ok_plane); -static void calc_sum_plane(const int nx, const int ny, - const double * data_plane_in, const bool * ok_plane_in, - double * sum_plane_out, bool * ok_sum_plane_out); +static void calc_sum_plane(const int nx, const int ny, + const double * data_plane_in, const bool * ok_plane_in, + double * sum_plane_out, bool * ok_sum_plane_out); static void load_handle(DataHandle &, const MtdFloatFile & in, const int t, const int time_beg, const int time_end); @@ -245,8 +241,8 @@ const int trp1 = 2*spatial_R + 1; const double scale = 1.0/(trp1*trp1); -file_id = 1; // This is declared static in the netCDF library header file ncGroup.h, - // so we have to do **something** with this or the compiler complains +file_id = 1; // This is declared static in the netCDF library header file ncGroup.h, + // so we have to do **something** with this or the compiler complains // about an unused variable spatial_conv_radius = spatial_R; @@ -305,16 +301,16 @@ for (t=0; t Date: Fri, 1 Mar 2024 15:45:33 +0000 Subject: [PATCH 17/72] #2673 Moved down 'using namespace' statement. --- src/libcode/vx_afm/afm.cc | 6 ++--- src/libcode/vx_afm/afm_keywords.cc | 6 ++--- src/libcode/vx_afm/afm_token.cc | 6 ++--- src/libcode/vx_afm/afmkeyword_to_string.cc | 6 ++--- src/libcode/vx_afm/afmtokentype_to_string.cc | 6 ++--- .../vx_analysis_util/analysis_utils.cc | 4 +-- src/libcode/vx_analysis_util/by_case_info.cc | 5 ++-- src/libcode/vx_analysis_util/mode_atts.cc | 6 ++--- src/libcode/vx_analysis_util/mode_job.cc | 4 +-- src/libcode/vx_analysis_util/mode_line.cc | 4 +-- src/libcode/vx_analysis_util/stat_job.cc | 4 +-- src/libcode/vx_analysis_util/stat_line.cc | 4 +-- src/libcode/vx_analysis_util/time_series.cc | 4 +-- src/libcode/vx_bool_calc/bool_calc.cc | 11 ++++++-- src/libcode/vx_bool_calc/make_program.cc | 11 ++++++-- src/libcode/vx_bool_calc/token.cc | 15 ++++++----- src/libcode/vx_bool_calc/token_stack.cc | 8 +++--- src/libcode/vx_bool_calc/tokenizer.cc | 11 ++++++-- src/libcode/vx_color/color.cc | 4 +-- src/libcode/vx_color/color_list.cc | 4 +-- src/libcode/vx_color/color_table.cc | 6 ++--- src/libcode/vx_color/my_color_scanner.cc | 13 +++++++--- src/libcode/vx_data2d/data2d_utils.cc | 4 +-- src/libcode/vx_data2d/data_class.cc | 5 ++-- src/libcode/vx_data2d/level_info.cc | 4 +-- src/libcode/vx_data2d/leveltype_to_string.cc | 5 ++-- src/libcode/vx_data2d/mask_filters.cc | 4 +-- src/libcode/vx_data2d/table_lookup.cc | 4 +-- src/libcode/vx_data2d/var_info.cc | 4 +-- .../vx_data2d_factory/data2d_factory.cc | 4 +-- .../vx_data2d_factory/data2d_factory_utils.cc | 4 +-- src/libcode/vx_data2d_factory/is_bufr_file.cc | 4 +-- src/libcode/vx_data2d_factory/is_grib_file.cc | 6 ++--- .../vx_data2d_factory/is_netcdf_file.cc | 8 +++--- .../vx_data2d_factory/parse_file_list.cc | 4 +-- .../vx_data2d_factory/var_info_factory.cc | 5 ++-- src/libcode/vx_data2d_grib/data2d_grib.cc | 4 +-- .../vx_data2d_grib/data2d_grib_utils.cc | 4 +-- src/libcode/vx_data2d_grib/grib_classes.cc | 4 +-- src/libcode/vx_data2d_grib/grib_strings.cc | 4 +-- src/libcode/vx_data2d_grib/grib_utils.cc | 4 +-- src/libcode/vx_data2d_grib/var_info_grib.cc | 4 +-- src/libcode/vx_data2d_grib2/data2d_grib2.cc | 2 -- src/libcode/vx_data2d_grib2/var_info_grib2.cc | 4 +-- src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc | 4 +-- src/libcode/vx_data2d_nc_met/data2d_nc_met.cc | 5 ++-- src/libcode/vx_data2d_nc_met/get_met_grid.cc | 6 +++-- src/libcode/vx_data2d_nc_met/met_file.cc | 6 ++--- .../vx_data2d_nc_met/var_info_nc_met.cc | 4 +-- src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc | 5 ++-- src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc | 6 ++--- .../vx_data2d_nc_wrf/var_info_nc_wrf.cc | 4 +-- src/libcode/vx_data2d_nc_wrf/wrf_file.cc | 6 ++--- src/libcode/vx_data2d_python/data2d_python.cc | 4 +-- .../vx_data2d_python/var_info_python.cc | 4 +-- src/libcode/vx_geodesy/spheroid.cc | 6 ++--- src/libcode/vx_gis/dbf_file.cc | 4 +-- src/libcode/vx_gis/shapetype_to_string.cc | 6 ++--- src/libcode/vx_gis/shp_file.cc | 4 +-- src/libcode/vx_gis/shp_point_record.cc | 6 ++--- src/libcode/vx_gis/shp_poly_record.cc | 6 ++--- src/libcode/vx_gis/shx_file.cc | 4 +-- src/libcode/vx_gnomon/gnomon.cc | 26 +++++++++---------- src/libcode/vx_grid/earth_rotation.cc | 6 ++--- src/libcode/vx_grid/find_grid_by_name.cc | 4 +-- src/libcode/vx_grid/gaussian_grid.cc | 6 ++--- src/libcode/vx_grid/goes_grid.cc | 6 ++--- src/libcode/vx_grid/grid_base.cc | 6 ++--- src/libcode/vx_grid/latlon_grid.cc | 6 ++--- src/libcode/vx_grid/latlon_xyz.cc | 6 ++--- src/libcode/vx_grid/lc_grid.cc | 6 ++--- src/libcode/vx_grid/merc_grid.cc | 6 ++--- src/libcode/vx_grid/rot_latlon_grid.cc | 6 ++--- src/libcode/vx_grid/semilatlon_grid.cc | 6 ++--- src/libcode/vx_grid/st_grid.cc | 6 ++--- src/libcode/vx_grid/tcrmw_grid.cc | 4 +-- src/libcode/vx_gsl_prob/gsl_bvn.cc | 4 +-- src/libcode/vx_gsl_prob/gsl_cdf.cc | 4 +-- src/libcode/vx_gsl_prob/gsl_randist.cc | 4 +-- src/libcode/vx_gsl_prob/gsl_statistics.cc | 4 +-- src/libcode/vx_gsl_prob/gsl_wavelet2d.cc | 4 +-- src/libcode/vx_nav/nav.cc | 6 ++--- src/libcode/vx_nc_obs/met_point_data.cc | 6 ++--- src/libcode/vx_nc_obs/nc_obs_util.cc | 6 +++-- src/libcode/vx_nc_obs/nc_point_obs.cc | 7 ++--- src/libcode/vx_nc_obs/nc_point_obs_in.cc | 5 ++-- src/libcode/vx_nc_obs/nc_point_obs_out.cc | 5 ++-- src/libcode/vx_nc_obs/nc_summary.cc | 6 +++-- src/libcode/vx_nc_util/grid_output.cc | 6 ++--- src/libcode/vx_nc_util/load_tc_data.cc | 4 +-- src/libcode/vx_nc_util/nc_var_info.cc | 7 ++--- src/libcode/vx_pb_util/do_blocking.cc | 4 +-- src/libcode/vx_pb_util/do_unblocking.cc | 4 +-- src/libcode/vx_pb_util/pblock.cc | 5 ++-- src/libcode/vx_plot_util/data_plane_plot.cc | 25 +++++++++--------- src/libcode/vx_plot_util/map_region.cc | 4 +-- src/libcode/vx_plot_util/vx_plot_util.cc | 5 ++-- .../vx_pointdata_python/pointdata_python.cc | 4 +-- src/libcode/vx_ps/documentmedia_to_string.cc | 5 ++-- .../vx_ps/documentorientation_to_string.cc | 5 ++-- src/libcode/vx_ps/fontfamily_to_string.cc | 5 ++-- src/libcode/vx_ps/ps_text.cc | 4 +-- src/libcode/vx_ps/table_helper.cc | 4 +-- src/libcode/vx_ps/vx_ps.cc | 5 ++-- 104 files changed, 309 insertions(+), 281 deletions(-) diff --git a/src/libcode/vx_afm/afm.cc b/src/libcode/vx_afm/afm.cc index e40ac65256..c89cc617e4 100644 --- a/src/libcode/vx_afm/afm.cc +++ b/src/libcode/vx_afm/afm.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afm_keywords.cc b/src/libcode/vx_afm/afm_keywords.cc index 534d8ef6dd..8117af52a2 100644 --- a/src/libcode/vx_afm/afm_keywords.cc +++ b/src/libcode/vx_afm/afm_keywords.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -23,6 +20,9 @@ using namespace std; #include "afm_keywords.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afm_token.cc b/src/libcode/vx_afm/afm_token.cc index 123e82bdda..bb623f2075 100644 --- a/src/libcode/vx_afm/afm_token.cc +++ b/src/libcode/vx_afm/afm_token.cc @@ -11,9 +11,6 @@ ///////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -27,6 +24,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afmkeyword_to_string.cc b/src/libcode/vx_afm/afmkeyword_to_string.cc index 2f0bc4ebeb..6030b29fe4 100644 --- a/src/libcode/vx_afm/afmkeyword_to_string.cc +++ b/src/libcode/vx_afm/afmkeyword_to_string.cc @@ -24,14 +24,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "afmkeyword_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afmtokentype_to_string.cc b/src/libcode/vx_afm/afmtokentype_to_string.cc index c08fb62f19..eb218009a8 100644 --- a/src/libcode/vx_afm/afmtokentype_to_string.cc +++ b/src/libcode/vx_afm/afmtokentype_to_string.cc @@ -24,14 +24,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "afmtokentype_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/analysis_utils.cc b/src/libcode/vx_analysis_util/analysis_utils.cc index c0c079cec3..1786b9b1c6 100644 --- a/src/libcode/vx_analysis_util/analysis_utils.cc +++ b/src/libcode/vx_analysis_util/analysis_utils.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "analysis_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/by_case_info.cc b/src/libcode/vx_analysis_util/by_case_info.cc index 1b8718bf89..493c4d9ab7 100644 --- a/src/libcode/vx_analysis_util/by_case_info.cc +++ b/src/libcode/vx_analysis_util/by_case_info.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/mode_atts.cc b/src/libcode/vx_analysis_util/mode_atts.cc index e63d661549..2774e818a7 100644 --- a/src/libcode/vx_analysis_util/mode_atts.cc +++ b/src/libcode/vx_analysis_util/mode_atts.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/mode_job.cc b/src/libcode/vx_analysis_util/mode_job.cc index b2e0b1339f..8c89cd38c5 100644 --- a/src/libcode/vx_analysis_util/mode_job.cc +++ b/src/libcode/vx_analysis_util/mode_job.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -31,6 +29,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/mode_line.cc b/src/libcode/vx_analysis_util/mode_line.cc index 5a7319565f..b021db9d5b 100644 --- a/src/libcode/vx_analysis_util/mode_line.cc +++ b/src/libcode/vx_analysis_util/mode_line.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 963271d905..470907c1be 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static ConcatString timestring(const unixtime t); diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index faf5c409f3..cd119e15ad 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -33,6 +31,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/time_series.cc b/src/libcode/vx_analysis_util/time_series.cc index a07c07debd..9ac89f4d93 100644 --- a/src/libcode/vx_analysis_util/time_series.cc +++ b/src/libcode/vx_analysis_util/time_series.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/bool_calc.cc b/src/libcode/vx_bool_calc/bool_calc.cc index 21ccd83921..47701cbe74 100644 --- a/src/libcode/vx_bool_calc/bool_calc.cc +++ b/src/libcode/vx_bool_calc/bool_calc.cc @@ -1,10 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -15,6 +20,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/make_program.cc b/src/libcode/vx_bool_calc/make_program.cc index 0072a3f658..c18b20835a 100644 --- a/src/libcode/vx_bool_calc/make_program.cc +++ b/src/libcode/vx_bool_calc/make_program.cc @@ -1,10 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +25,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/token.cc b/src/libcode/vx_bool_calc/token.cc index d2bff4c067..e9d6b66df1 100644 --- a/src/libcode/vx_bool_calc/token.cc +++ b/src/libcode/vx_bool_calc/token.cc @@ -1,9 +1,10 @@ - - -//////////////////////////////////////////////////////////////////////// - - -using namespace std; +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// @@ -14,6 +15,8 @@ using namespace std; #include "token.h" #include "tokentype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/token_stack.cc b/src/libcode/vx_bool_calc/token_stack.cc index cdcdb2f039..eeee263c68 100644 --- a/src/libcode/vx_bool_calc/token_stack.cc +++ b/src/libcode/vx_bool_calc/token_stack.cc @@ -1,5 +1,3 @@ - - //////////////////////////////////////////////////////////////////////// @@ -16,9 +14,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -30,6 +25,9 @@ using namespace std; #include "token_stack.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/tokenizer.cc b/src/libcode/vx_bool_calc/tokenizer.cc index 7b676f452e..48ecad1ed4 100644 --- a/src/libcode/vx_bool_calc/tokenizer.cc +++ b/src/libcode/vx_bool_calc/tokenizer.cc @@ -1,10 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -17,6 +22,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/color.cc b/src/libcode/vx_color/color.cc index 715968ecab..3edbbd3ebd 100644 --- a/src/libcode/vx_color/color.cc +++ b/src/libcode/vx_color/color.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -20,6 +18,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/color_list.cc b/src/libcode/vx_color/color_list.cc index eb3c8cad18..a82b73a069 100644 --- a/src/libcode/vx_color/color_list.cc +++ b/src/libcode/vx_color/color_list.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/color_table.cc b/src/libcode/vx_color/color_table.cc index 341a5f00d2..4af38cee43 100644 --- a/src/libcode/vx_color/color_table.cc +++ b/src/libcode/vx_color/color_table.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,9 @@ using namespace std; #include "vx_math.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_color/my_color_scanner.cc b/src/libcode/vx_color/my_color_scanner.cc index 96500f4d37..28ddf453ec 100644 --- a/src/libcode/vx_color/my_color_scanner.cc +++ b/src/libcode/vx_color/my_color_scanner.cc @@ -1,12 +1,15 @@ - +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +27,8 @@ using namespace std; #include "color_parser_yacc.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/data2d_utils.cc b/src/libcode/vx_data2d/data2d_utils.cc index 8080480214..e1098d0b0d 100644 --- a/src/libcode/vx_data2d/data2d_utils.cc +++ b/src/libcode/vx_data2d/data2d_utils.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// bool derive_wdir(const DataPlane &u2d, const DataPlane &v2d, diff --git a/src/libcode/vx_data2d/data_class.cc b/src/libcode/vx_data2d/data_class.cc index 1d95284e38..1a2c838ec7 100644 --- a/src/libcode/vx_data2d/data_class.cc +++ b/src/libcode/vx_data2d/data_class.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,9 @@ using namespace std; #include "data2d_utils.h" #include "apply_mask.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/level_info.cc b/src/libcode/vx_data2d/level_info.cc index a02966fb95..58f22f7987 100644 --- a/src/libcode/vx_data2d/level_info.cc +++ b/src/libcode/vx_data2d/level_info.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "is_bad_data.h" @@ -26,6 +24,8 @@ using namespace std; #include "level_info.h" #include "leveltype_to_string.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class LevelInfo diff --git a/src/libcode/vx_data2d/leveltype_to_string.cc b/src/libcode/vx_data2d/leveltype_to_string.cc index 1c7d52b24e..445a18aca7 100644 --- a/src/libcode/vx_data2d/leveltype_to_string.cc +++ b/src/libcode/vx_data2d/leveltype_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "leveltype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/mask_filters.cc b/src/libcode/vx_data2d/mask_filters.cc index b0b6e4e6fa..15e0a4e7b0 100644 --- a/src/libcode/vx_data2d/mask_filters.cc +++ b/src/libcode/vx_data2d/mask_filters.cc @@ -9,10 +9,10 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "mask_filters.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/table_lookup.cc b/src/libcode/vx_data2d/table_lookup.cc index 0fba08a268..2a18417a6e 100644 --- a/src/libcode/vx_data2d/table_lookup.cc +++ b/src/libcode/vx_data2d/table_lookup.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include #include +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d/var_info.cc b/src/libcode/vx_data2d/var_info.cc index 6ee74c08e7..620b7d1fff 100644 --- a/src/libcode/vx_data2d/var_info.cc +++ b/src/libcode/vx_data2d/var_info.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +27,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// ConcatString parse_set_attr_string(Dictionary &dict, const char *key, bool check_ws=false); diff --git a/src/libcode/vx_data2d_factory/data2d_factory.cc b/src/libcode/vx_data2d_factory/data2d_factory.cc index 7d188c2080..bcc7a98b76 100644 --- a/src/libcode/vx_data2d_factory/data2d_factory.cc +++ b/src/libcode/vx_data2d_factory/data2d_factory.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -38,6 +36,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class Met2dDataFileFactory diff --git a/src/libcode/vx_data2d_factory/data2d_factory_utils.cc b/src/libcode/vx_data2d_factory/data2d_factory_utils.cc index 83a2ed7ce1..e975c5ddb8 100644 --- a/src/libcode/vx_data2d_factory/data2d_factory_utils.cc +++ b/src/libcode/vx_data2d_factory/data2d_factory_utils.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_factory/is_bufr_file.cc b/src/libcode/vx_data2d_factory/is_bufr_file.cc index 946a5f544d..821cdee32a 100644 --- a/src/libcode/vx_data2d_factory/is_bufr_file.cc +++ b/src/libcode/vx_data2d_factory/is_bufr_file.cc @@ -12,8 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include "is_bufr_file.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_factory/is_grib_file.cc b/src/libcode/vx_data2d_factory/is_grib_file.cc index ae803eff0b..734d9e49d7 100644 --- a/src/libcode/vx_data2d_factory/is_grib_file.cc +++ b/src/libcode/vx_data2d_factory/is_grib_file.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2024 // ** University Corporation for Atmospheric Research (UCAR) @@ -14,8 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +25,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_factory/is_netcdf_file.cc b/src/libcode/vx_data2d_factory/is_netcdf_file.cc index d59b9cb6e3..5155e2e2ff 100644 --- a/src/libcode/vx_data2d_factory/is_netcdf_file.cc +++ b/src/libcode/vx_data2d_factory/is_netcdf_file.cc @@ -1,5 +1,3 @@ - - // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ** Copyright UCAR (c) 1992 - 2024 // ** University Corporation for Atmospheric Research (UCAR) @@ -14,8 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,12 +22,14 @@ using namespace std; #include #include -using namespace netCDF; #include "is_netcdf_file.h" #include "vx_nc_util.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_factory/parse_file_list.cc b/src/libcode/vx_data2d_factory/parse_file_list.cc index 5c11d753e7..57d357a314 100644 --- a/src/libcode/vx_data2d_factory/parse_file_list.cc +++ b/src/libcode/vx_data2d_factory/parse_file_list.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -31,6 +29,8 @@ using namespace std; #include "parse_file_list.h" #include "data2d_factory_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_factory/var_info_factory.cc b/src/libcode/vx_data2d_factory/var_info_factory.cc index f270164ad1..252fb5bd3d 100644 --- a/src/libcode/vx_data2d_factory/var_info_factory.cc +++ b/src/libcode/vx_data2d_factory/var_info_factory.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -42,6 +40,9 @@ using namespace std; #include "vx_cal.h" #include "vx_log.h" +using namespace std; + + /////////////////////////////////////////////////////////////////////////////// // // Code for class VarInfoFactory diff --git a/src/libcode/vx_data2d_grib/data2d_grib.cc b/src/libcode/vx_data2d_grib/data2d_grib.cc index 09dc80815a..a3c7bc3001 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc index 2f1f66385b..de590d3274 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib_utils.cc +++ b/src/libcode/vx_data2d_grib/data2d_grib_utils.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_classes.cc b/src/libcode/vx_data2d_grib/grib_classes.cc index 5954a6ed7d..efb1d330fe 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.cc +++ b/src/libcode/vx_data2d_grib/grib_classes.cc @@ -6,8 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; - //////////////////////////////////////////////////////////////////////// @@ -29,6 +27,8 @@ using namespace std; #include "grib_classes.h" #include "grib_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_strings.cc b/src/libcode/vx_data2d_grib/grib_strings.cc index f9b3edcdac..a2de02ee91 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.cc +++ b/src/libcode/vx_data2d_grib/grib_strings.cc @@ -6,8 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; - /////////////////////////////////////////////////////////////////////////////// #include @@ -29,6 +27,8 @@ using namespace std; #include "vx_log.h" #include "vx_data2d.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// ConcatString get_grib_code_list_str(int k, int grib_code, int ptv) diff --git a/src/libcode/vx_data2d_grib/grib_utils.cc b/src/libcode/vx_data2d_grib/grib_utils.cc index 095be46d0a..68a4bc766e 100644 --- a/src/libcode/vx_data2d_grib/grib_utils.cc +++ b/src/libcode/vx_data2d_grib/grib_utils.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "angles.h" #include "is_bad_data.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/var_info_grib.cc b/src/libcode/vx_data2d_grib/var_info_grib.cc index 32f841c32b..0c62fd5502 100644 --- a/src/libcode/vx_data2d_grib/var_info_grib.cc +++ b/src/libcode/vx_data2d_grib/var_info_grib.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -35,6 +33,8 @@ using namespace std; #include "vx_log.h" #include "vx_data2d.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class VarInfoGrib diff --git a/src/libcode/vx_data2d_grib2/data2d_grib2.cc b/src/libcode/vx_data2d_grib2/data2d_grib2.cc index 5ea279fb96..006c56d7df 100644 --- a/src/libcode/vx_data2d_grib2/data2d_grib2.cc +++ b/src/libcode/vx_data2d_grib2/data2d_grib2.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/libcode/vx_data2d_grib2/var_info_grib2.cc b/src/libcode/vx_data2d_grib2/var_info_grib2.cc index 9d67ab1929..d49910937d 100644 --- a/src/libcode/vx_data2d_grib2/var_info_grib2.cc +++ b/src/libcode/vx_data2d_grib2/var_info_grib2.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -36,6 +34,8 @@ using namespace std; #include "vx_data2d.h" #include "vx_config.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc index 00695d8da5..79594dccd5 100644 --- a/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc +++ b/src/libcode/vx_data2d_nc_cf/var_info_nc_cf.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "vx_log.h" #include "grib_strings.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// static bool is_grib_code_abbr_match(const ConcatString &, int); diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc index 40caecba95..fc4bf79169 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,9 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class MetNcMetDataFile diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index 7ae924bd34..8b8da3d1a3 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -8,7 +8,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -17,13 +16,16 @@ using namespace std; #include #include -using namespace netCDF; #include "get_met_grid.h" #include "nc_utils.h" #include "vx_log.h" +using namespace std; +using namespace netCDF; + + /////////////////////////////////////////////////////////////////////////////// static void read_netcdf_grid_v3 (NcFile *, Grid &); diff --git a/src/libcode/vx_data2d_nc_met/met_file.cc b/src/libcode/vx_data2d_nc_met/met_file.cc index 443fe6ff60..afd0db7171 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.cc +++ b/src/libcode/vx_data2d_nc_met/met_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,7 +19,6 @@ using namespace std; #include #include -using namespace netCDF; #include "vx_math.h" #include "vx_cal.h" @@ -31,6 +28,9 @@ using namespace netCDF; #include "get_met_grid.h" #include "nc_utils.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc index 338d83e8f4..535f69a19c 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "vx_log.h" #include "grib_strings.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// static bool is_grib_code_abbr_match(const ConcatString &, int); diff --git a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc index e249856a7a..b777e04f80 100644 --- a/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/data2d_nc_wrf.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,9 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class MetNcWrfDataFile 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 7f32821921..6519f9583d 100644 --- a/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc +++ b/src/libcode/vx_data2d_nc_wrf/get_wrf_grid.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -18,7 +16,6 @@ using namespace std; #include #include -using namespace netCDF; #include "vx_log.h" #include "vx_math.h" @@ -26,6 +23,9 @@ using namespace netCDF; #include "get_wrf_grid.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc index 62c1d9c834..9827271d7c 100644 --- a/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc +++ b/src/libcode/vx_data2d_nc_wrf/var_info_nc_wrf.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class VarInfoNcWrf diff --git a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc index 19c99b6de8..324c3be6ac 100644 --- a/src/libcode/vx_data2d_nc_wrf/wrf_file.cc +++ b/src/libcode/vx_data2d_nc_wrf/wrf_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,7 +18,6 @@ using namespace std; #include #include -using namespace netCDF; #include "vx_math.h" #include "vx_cal.h" @@ -30,6 +27,9 @@ using namespace netCDF; #include "wrf_file.h" #include "get_wrf_grid.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_python/data2d_python.cc b/src/libcode/vx_data2d_python/data2d_python.cc index 3b146f45f7..42715c9983 100644 --- a/src/libcode/vx_data2d_python/data2d_python.cc +++ b/src/libcode/vx_data2d_python/data2d_python.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_python/var_info_python.cc b/src/libcode/vx_data2d_python/var_info_python.cc index 62bbdcd7aa..6d71569a6a 100644 --- a/src/libcode/vx_data2d_python/var_info_python.cc +++ b/src/libcode/vx_data2d_python/var_info_python.cc @@ -17,8 +17,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -35,6 +33,8 @@ using namespace std; #include "vx_data2d.h" #include "grdfiletype_to_string.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class VarInfoPython diff --git a/src/libcode/vx_geodesy/spheroid.cc b/src/libcode/vx_geodesy/spheroid.cc index 6f71fcfe76..da22aae5fa 100644 --- a/src/libcode/vx_geodesy/spheroid.cc +++ b/src/libcode/vx_geodesy/spheroid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,9 @@ using namespace std; #include "vx_math.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/dbf_file.cc b/src/libcode/vx_gis/dbf_file.cc index 66361dd7e4..e5d3ce5081 100644 --- a/src/libcode/vx_gis/dbf_file.cc +++ b/src/libcode/vx_gis/dbf_file.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "dbf_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shapetype_to_string.cc b/src/libcode/vx_gis/shapetype_to_string.cc index b59df8e274..63a7f2cd47 100644 --- a/src/libcode/vx_gis/shapetype_to_string.cc +++ b/src/libcode/vx_gis/shapetype_to_string.cc @@ -24,14 +24,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "shapetype_to_string.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shp_file.cc b/src/libcode/vx_gis/shp_file.cc index 76086acf0c..8eded0f2e1 100644 --- a/src/libcode/vx_gis/shp_file.cc +++ b/src/libcode/vx_gis/shp_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +27,8 @@ using namespace std; #include "shp_file.h" #include "shapetype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shp_point_record.cc b/src/libcode/vx_gis/shp_point_record.cc index c3cc3f126c..9ce7c93ad6 100644 --- a/src/libcode/vx_gis/shp_point_record.cc +++ b/src/libcode/vx_gis/shp_point_record.cc @@ -1,5 +1,3 @@ - - //////////////////////////////////////////////////////////////////////// @@ -15,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -31,6 +27,8 @@ using namespace std; #include "shp_point_record.h" #include "shapetype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shp_poly_record.cc b/src/libcode/vx_gis/shp_poly_record.cc index 5a9c46749e..23ca89d738 100644 --- a/src/libcode/vx_gis/shp_poly_record.cc +++ b/src/libcode/vx_gis/shp_poly_record.cc @@ -1,5 +1,3 @@ - - //////////////////////////////////////////////////////////////////////// @@ -15,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +28,8 @@ using namespace std; #include "shp_poly_record.h" #include "shapetype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shx_file.cc b/src/libcode/vx_gis/shx_file.cc index 1126168467..1692616415 100644 --- a/src/libcode/vx_gis/shx_file.cc +++ b/src/libcode/vx_gis/shx_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "shx_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gnomon/gnomon.cc b/src/libcode/vx_gnomon/gnomon.cc index 7e60ff86d3..48dd9eb7b7 100644 --- a/src/libcode/vx_gnomon/gnomon.cc +++ b/src/libcode/vx_gnomon/gnomon.cc @@ -7,6 +7,19 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +//////////////////////////////////////////////////////////////////////// + + +#include +#include +#include +#include + +#include "vx_log.h" +#include "trig.h" +#include "gnomon.h" + + using namespace std; @@ -26,19 +39,6 @@ static const double cf = 57.2957795130823208768; //////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include - -#include "vx_log.h" -#include "trig.h" -#include "gnomon.h" - - -//////////////////////////////////////////////////////////////////////// - - static double e1x, e1y, e1z, e2x, e2y, e2z, e3x, e3y, e3z; static int initialized = 0; diff --git a/src/libcode/vx_grid/earth_rotation.cc b/src/libcode/vx_grid/earth_rotation.cc index 09badf97d3..ebef0b5ed9 100644 --- a/src/libcode/vx_grid/earth_rotation.cc +++ b/src/libcode/vx_grid/earth_rotation.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,9 @@ using namespace std; #include "latlon_xyz.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/find_grid_by_name.cc b/src/libcode/vx_grid/find_grid_by_name.cc index 30fda12c24..7486ac5257 100644 --- a/src/libcode/vx_grid/find_grid_by_name.cc +++ b/src/libcode/vx_grid/find_grid_by_name.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "find_grid_by_name.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/gaussian_grid.cc b/src/libcode/vx_grid/gaussian_grid.cc index eccea8d55b..03ac5bddf7 100644 --- a/src/libcode/vx_grid/gaussian_grid.cc +++ b/src/libcode/vx_grid/gaussian_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "gaussian_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/goes_grid.cc b/src/libcode/vx_grid/goes_grid.cc index 76c8f5e51d..01e172c5de 100644 --- a/src/libcode/vx_grid/goes_grid.cc +++ b/src/libcode/vx_grid/goes_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "goes_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/grid_base.cc b/src/libcode/vx_grid/grid_base.cc index d3b0cfee26..cb9ef2d296 100644 --- a/src/libcode/vx_grid/grid_base.cc +++ b/src/libcode/vx_grid/grid_base.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +22,9 @@ using namespace std; #include "find_grid_by_name.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/latlon_grid.cc b/src/libcode/vx_grid/latlon_grid.cc index 4b9920d5e7..f04c375aa3 100644 --- a/src/libcode/vx_grid/latlon_grid.cc +++ b/src/libcode/vx_grid/latlon_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "latlon_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/latlon_xyz.cc b/src/libcode/vx_grid/latlon_xyz.cc index 768955f24e..5c173db80c 100644 --- a/src/libcode/vx_grid/latlon_xyz.cc +++ b/src/libcode/vx_grid/latlon_xyz.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +22,9 @@ using namespace std; #include "latlon_xyz.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/lc_grid.cc b/src/libcode/vx_grid/lc_grid.cc index 7049f60d94..10fd4502b4 100644 --- a/src/libcode/vx_grid/lc_grid.cc +++ b/src/libcode/vx_grid/lc_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "lc_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/merc_grid.cc b/src/libcode/vx_grid/merc_grid.cc index 015109db2c..b740c124ab 100644 --- a/src/libcode/vx_grid/merc_grid.cc +++ b/src/libcode/vx_grid/merc_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "merc_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/rot_latlon_grid.cc b/src/libcode/vx_grid/rot_latlon_grid.cc index a5df5a3bfc..5756cef893 100644 --- a/src/libcode/vx_grid/rot_latlon_grid.cc +++ b/src/libcode/vx_grid/rot_latlon_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,9 @@ using namespace std; #include "latlon_xyz.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/semilatlon_grid.cc b/src/libcode/vx_grid/semilatlon_grid.cc index c188025882..86503235f0 100644 --- a/src/libcode/vx_grid/semilatlon_grid.cc +++ b/src/libcode/vx_grid/semilatlon_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "semilatlon_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/st_grid.cc b/src/libcode/vx_grid/st_grid.cc index c1299471e6..533ac1e755 100644 --- a/src/libcode/vx_grid/st_grid.cc +++ b/src/libcode/vx_grid/st_grid.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -26,6 +23,9 @@ using namespace std; #include "st_grid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_grid/tcrmw_grid.cc b/src/libcode/vx_grid/tcrmw_grid.cc index 031c71c65e..e40572bc7d 100644 --- a/src/libcode/vx_grid/tcrmw_grid.cc +++ b/src/libcode/vx_grid/tcrmw_grid.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "trig.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gsl_prob/gsl_bvn.cc b/src/libcode/vx_gsl_prob/gsl_bvn.cc index 1cbb1b950c..988c169b4f 100644 --- a/src/libcode/vx_gsl_prob/gsl_bvn.cc +++ b/src/libcode/vx_gsl_prob/gsl_bvn.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -18,6 +16,8 @@ using namespace std; #include "gsl_bvn.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static const double cf = 45.0/atan(1.0); diff --git a/src/libcode/vx_gsl_prob/gsl_cdf.cc b/src/libcode/vx_gsl_prob/gsl_cdf.cc index efd4a22a1a..79459b5c11 100644 --- a/src/libcode/vx_gsl_prob/gsl_cdf.cc +++ b/src/libcode/vx_gsl_prob/gsl_cdf.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "gsl/gsl_randist.h" #include "is_bad_data.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static double F_newton(double x, double y, double deg_freedom_1, double deg_freedom_2); diff --git a/src/libcode/vx_gsl_prob/gsl_randist.cc b/src/libcode/vx_gsl_prob/gsl_randist.cc index 685fb63973..e8a528a598 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.cc +++ b/src/libcode/vx_gsl_prob/gsl_randist.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "gsl_randist.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static int get_seed(); diff --git a/src/libcode/vx_gsl_prob/gsl_statistics.cc b/src/libcode/vx_gsl_prob/gsl_statistics.cc index 2f1ac4afcc..20d5136cbc 100644 --- a/src/libcode/vx_gsl_prob/gsl_statistics.cc +++ b/src/libcode/vx_gsl_prob/gsl_statistics.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "gsl_statistics.h" #include "gsl/gsl_errno.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// double stats_lag1_autocorrelation(const NumArray &na) { diff --git a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc index fe5ad84188..c1b0a1dcc9 100644 --- a/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc +++ b/src/libcode/vx_gsl_prob/gsl_wavelet2d.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "vx_log.h" #include "gsl_wavelet2d.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Allocate a wavelet of the type specified using the wavelet member diff --git a/src/libcode/vx_nav/nav.cc b/src/libcode/vx_nav/nav.cc index 8b81e679e8..9a48b7eae5 100644 --- a/src/libcode/vx_nav/nav.cc +++ b/src/libcode/vx_nav/nav.cc @@ -7,9 +7,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; - - ////////////////////////////////////////////////////////////////// @@ -20,6 +17,9 @@ using namespace std; #include "nav.h" +using namespace std; + + ////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_obs/met_point_data.cc b/src/libcode/vx_nc_obs/met_point_data.cc index 0312f97800..cc4f15fd7e 100644 --- a/src/libcode/vx_nc_obs/met_point_data.cc +++ b/src/libcode/vx_nc_obs/met_point_data.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,7 +22,9 @@ using namespace std; #include "is_bad_data.h" #include "met_point_data.h" -//#include "nc_point_obs.h" + +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index 18153beaeb..0b6fa731e3 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -14,17 +14,19 @@ // Common routines for time summary (into NetCDF). // -using namespace std; #include #include -using namespace netCDF; #include "vx_nc_util.h" #include "nc_obs_util.h" +using namespace std; +using namespace netCDF; + + /////////////////////////////////////////////////////////////////////////////// float hdr_arr_block[NC_BUFFER_SIZE_32K][HDR_ARRAY_LEN]; diff --git a/src/libcode/vx_nc_obs/nc_point_obs.cc b/src/libcode/vx_nc_obs/nc_point_obs.cc index 33e1dfa85b..3584ef88fa 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,13 +19,16 @@ using namespace std; #include #include -using namespace netCDF; #include "vx_log.h" #include "is_bad_data.h" #include "nc_point_obs.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_obs/nc_point_obs_in.cc b/src/libcode/vx_nc_obs/nc_point_obs_in.cc index e669fd6427..57b5d3eea4 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs_in.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs_in.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,9 @@ using namespace std; #include "nc_point_obs_in.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_obs/nc_point_obs_out.cc b/src/libcode/vx_nc_obs/nc_point_obs_out.cc index 5ae87e971b..8835665721 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs_out.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs_out.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,9 @@ using namespace std; #include "nc_summary.h" #include "write_netcdf.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_obs/nc_summary.cc b/src/libcode/vx_nc_obs/nc_summary.cc index b022226958..ced5365427 100644 --- a/src/libcode/vx_nc_obs/nc_summary.cc +++ b/src/libcode/vx_nc_obs/nc_summary.cc @@ -14,18 +14,20 @@ // Common routines for time summary (into NetCDF). // -using namespace std; #include #include -using namespace netCDF; #include "write_netcdf.h" #include "nc_obs_util.h" #include "vx_summary.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// string seconds_to_time_string(const int secs) diff --git a/src/libcode/vx_nc_util/grid_output.cc b/src/libcode/vx_nc_util/grid_output.cc index 079d376844..4a9889f677 100644 --- a/src/libcode/vx_nc_util/grid_output.cc +++ b/src/libcode/vx_nc_util/grid_output.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,12 +18,14 @@ using namespace std; #include #include -using namespace netCDF; #include "grid_output.h" #include "vx_log.h" #include "nc_utils.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/load_tc_data.cc b/src/libcode/vx_nc_util/load_tc_data.cc index 91eff09214..572e5e1c4e 100644 --- a/src/libcode/vx_nc_util/load_tc_data.cc +++ b/src/libcode/vx_nc_util/load_tc_data.cc @@ -8,14 +8,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_data2d_nc_met.h" #include "vx_nc_util.h" #include "load_tc_data.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// void load_tc_dland(const ConcatString &dland_file, Grid &grid, diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4d23e8e65b..0c1dfde6ee 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -10,10 +10,7 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include -using namespace netCDF; #include #include @@ -26,6 +23,10 @@ using namespace netCDF; #include "vx_log.h" #include "vx_cal.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// unixtime get_att_value_unixtime(const NcAtt *att) { diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc index a43b33a768..02c81c5dfe 100644 --- a/src/libcode/vx_pb_util/do_blocking.cc +++ b/src/libcode/vx_pb_util/do_blocking.cc @@ -11,8 +11,6 @@ ////////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include "copy_bytes.h" #include "do_blocking.h" +using namespace std; + ////////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc index 31e07e2631..9822693d73 100644 --- a/src/libcode/vx_pb_util/do_unblocking.cc +++ b/src/libcode/vx_pb_util/do_unblocking.cc @@ -11,8 +11,6 @@ ////////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "copy_bytes.h" #include "do_unblocking.h" +using namespace std; + ////////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pb_util/pblock.cc b/src/libcode/vx_pb_util/pblock.cc index 5ddf837fdd..0626c0ac39 100644 --- a/src/libcode/vx_pb_util/pblock.cc +++ b/src/libcode/vx_pb_util/pblock.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,9 @@ using namespace std; #include "do_blocking.h" #include "do_unblocking.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// void pblock(const char *infile, const char *outfile, Action action) { diff --git a/src/libcode/vx_plot_util/data_plane_plot.cc b/src/libcode/vx_plot_util/data_plane_plot.cc index 7849c93031..4a03211289 100644 --- a/src/libcode/vx_plot_util/data_plane_plot.cc +++ b/src/libcode/vx_plot_util/data_plane_plot.cc @@ -9,19 +9,6 @@ /////////////////////////////////////////////////////////////////////////////// -static const int num_cbar_vals = 300; - -static const double one_inch = 72.0; - -static const int num_ticks = 9; - -static const bool use_flate = true; - - -/////////////////////////////////////////////////////////////////////////////// - -using namespace std; - /////////////////////////////////////////////////////////////////////////////// // // Filename: data_plane_plot.cc @@ -48,8 +35,20 @@ using namespace std; #include "vx_log.h" #include "data_plane_plot.h" +using namespace std; + //////////////////////////////////////////////////////////////////////////////// +static const int num_cbar_vals = 300; + +static const double one_inch = 72.0; + +static const int num_ticks = 9; + +static const bool use_flate = true; + +/////////////////////////////////////////////////////////////////////////////// + void data_plane_plot(const ConcatString & inname, const ConcatString & outname, const Grid & grid, const ConcatString & title, const ColorTable & colortable, MetConfig *conf, diff --git a/src/libcode/vx_plot_util/map_region.cc b/src/libcode/vx_plot_util/map_region.cc index daa54185e6..23fb3758b5 100644 --- a/src/libcode/vx_plot_util/map_region.cc +++ b/src/libcode/vx_plot_util/map_region.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "vx_log.h" #include "map_region.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_plot_util/vx_plot_util.cc b/src/libcode/vx_plot_util/vx_plot_util.cc index abf4e4be7c..e156134a51 100644 --- a/src/libcode/vx_plot_util/vx_plot_util.cc +++ b/src/libcode/vx_plot_util/vx_plot_util.cc @@ -8,8 +8,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - // // ach_plotting_pkg.cc // @@ -28,6 +26,9 @@ using namespace std; #include "vx_log.h" #include "vx_plot_util.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////////////// // // Draw a map in a PostScript file. diff --git a/src/libcode/vx_pointdata_python/pointdata_python.cc b/src/libcode/vx_pointdata_python/pointdata_python.cc index fdb1cb34a3..82562d7583 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.cc +++ b/src/libcode/vx_pointdata_python/pointdata_python.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/documentmedia_to_string.cc b/src/libcode/vx_ps/documentmedia_to_string.cc index d64d6b9123..351376cd72 100644 --- a/src/libcode/vx_ps/documentmedia_to_string.cc +++ b/src/libcode/vx_ps/documentmedia_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "documentmedia_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/documentorientation_to_string.cc b/src/libcode/vx_ps/documentorientation_to_string.cc index e98342f078..dc04b5b7f0 100644 --- a/src/libcode/vx_ps/documentorientation_to_string.cc +++ b/src/libcode/vx_ps/documentorientation_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "documentorientation_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/fontfamily_to_string.cc b/src/libcode/vx_ps/fontfamily_to_string.cc index 4540a5afc9..d38489c800 100644 --- a/src/libcode/vx_ps/fontfamily_to_string.cc +++ b/src/libcode/vx_ps/fontfamily_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "fontfamily_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/ps_text.cc b/src/libcode/vx_ps/ps_text.cc index f4438e208b..5459a41add 100644 --- a/src/libcode/vx_ps/ps_text.cc +++ b/src/libcode/vx_ps/ps_text.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "ps_text.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/table_helper.cc b/src/libcode/vx_ps/table_helper.cc index 9e1eee2f87..4862b9c9dd 100644 --- a/src/libcode/vx_ps/table_helper.cc +++ b/src/libcode/vx_ps/table_helper.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "table_helper.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_ps/vx_ps.cc b/src/libcode/vx_ps/vx_ps.cc index 5462b63737..5e202631df 100644 --- a/src/libcode/vx_ps/vx_ps.cc +++ b/src/libcode/vx_ps/vx_ps.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -36,6 +33,8 @@ using namespace std; #include "ascii85_filter.h" #include "psout_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// From 3f92f6a81ff5a13c456bf817b1d7533b13eaac1d Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 1 Mar 2024 15:45:56 +0000 Subject: [PATCH 18/72] #2673 Moved down 'using namespace' statement. --- src/libcode/vx_pxm/pbm.cc | 5 ++-- src/libcode/vx_pxm/pcm.cc | 4 ++-- src/libcode/vx_pxm/pgm.cc | 4 ++-- src/libcode/vx_pxm/ppm.cc | 4 ++-- src/libcode/vx_pxm/pxm_base.cc | 5 ++-- src/libcode/vx_pxm/pxm_utils.cc | 5 ++-- src/libcode/vx_python3_utils/python3_dict.cc | 8 ++----- src/libcode/vx_python3_utils/python3_list.cc | 8 ++----- src/libcode/vx_python3_utils/python3_numpy.cc | 12 +++++++--- .../vx_python3_utils/python3_script.cc | 12 +++++++--- src/libcode/vx_python3_utils/python3_util.cc | 5 ++-- src/libcode/vx_python3_utils/wchar_argv.cc | 4 ++-- src/libcode/vx_regrid/vx_regrid.cc | 4 ++-- src/libcode/vx_render/ascii85_filter.cc | 4 ++-- src/libcode/vx_render/bit_filter.cc | 4 ++-- src/libcode/vx_render/flate_filter.cc | 4 ++-- src/libcode/vx_render/ps_filter.cc | 4 ++-- src/libcode/vx_render/psout_filter.cc | 4 ++-- src/libcode/vx_render/render_pbm.cc | 4 ++-- src/libcode/vx_render/render_pcm.cc | 4 ++-- src/libcode/vx_render/render_pgm.cc | 4 ++-- src/libcode/vx_render/render_ppm.cc | 4 ++-- src/libcode/vx_render/renderinfo.cc | 4 ++-- src/libcode/vx_render/rle_filter.cc | 4 ++-- src/libcode/vx_render/uc_queue.cc | 4 ++-- src/libcode/vx_seeps/seeps.cc | 14 ++++++++--- src/libcode/vx_series_data/series_data.cc | 4 ++-- src/libcode/vx_series_data/series_pdf.cc | 6 +++-- src/libcode/vx_shapedata/engine.cc | 4 ++-- src/libcode/vx_shapedata/ihull.cc | 11 +++++++-- src/libcode/vx_shapedata/interest.cc | 4 ++-- src/libcode/vx_shapedata/mode_conf_info.cc | 4 ++-- src/libcode/vx_shapedata/moments.cc | 4 ++-- src/libcode/vx_shapedata/set.cc | 4 ++-- src/libcode/vx_shapedata/shapedata.cc | 23 ++++++++++--------- src/libcode/vx_solar/siderial.cc | 5 ++-- src/libcode/vx_solar/solar.cc | 5 ++-- src/libcode/vx_stat_out/stat_columns.cc | 4 ++-- src/libcode/vx_stat_out/stat_hdr_columns.cc | 4 ++-- src/libcode/vx_statistics/apply_mask.cc | 4 ++-- src/libcode/vx_statistics/compute_ci.cc | 4 ++-- src/libcode/vx_statistics/compute_stats.cc | 4 ++-- src/libcode/vx_statistics/contable.cc | 5 ++-- src/libcode/vx_statistics/contable_nx2.cc | 17 +++++++------- src/libcode/vx_statistics/contable_stats.cc | 4 ++-- src/libcode/vx_statistics/ens_stats.cc | 4 ++-- src/libcode/vx_statistics/grid_closed_poly.cc | 4 ++-- src/libcode/vx_statistics/met_stats.cc | 4 ++-- src/libcode/vx_statistics/obs_error.cc | 4 ++-- src/libcode/vx_statistics/pair_base.cc | 4 ++-- .../vx_statistics/pair_data_ensemble.cc | 2 +- src/libcode/vx_statistics/pair_data_point.cc | 4 ++-- src/libcode/vx_statistics/read_climo.cc | 4 ++-- src/libcode/vx_tc_util/atcf_line_base.cc | 4 ++-- src/libcode/vx_tc_util/atcf_prob_line.cc | 4 ++-- src/libcode/vx_tc_util/atcf_track_line.cc | 4 ++-- src/libcode/vx_tc_util/diag_file.cc | 4 ++-- src/libcode/vx_tc_util/gen_shape_info.cc | 4 ++-- src/libcode/vx_tc_util/genesis_info.cc | 4 ++-- src/libcode/vx_tc_util/pair_data_genesis.cc | 4 ++-- src/libcode/vx_tc_util/prob_gen_info.cc | 4 ++-- src/libcode/vx_tc_util/prob_info_array.cc | 4 ++-- src/libcode/vx_tc_util/prob_info_base.cc | 5 ++-- src/libcode/vx_tc_util/prob_rirw_info.cc | 4 ++-- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 4 ++-- src/libcode/vx_tc_util/tc_columns.cc | 4 ++-- src/libcode/vx_tc_util/tc_hdr_columns.cc | 4 ++-- src/libcode/vx_tc_util/tc_stat_line.cc | 4 ++-- src/libcode/vx_tc_util/track_info.cc | 4 ++-- src/libcode/vx_tc_util/track_pair_info.cc | 4 ++-- src/libcode/vx_tc_util/track_point.cc | 4 ++-- src/libcode/vx_tc_util/vx_tc_nc_util.cc | 5 ++-- .../vx_time_series/compute_swinging_door.cc | 4 ++-- .../vx_time_series/time_series_util.cc | 4 ++-- 74 files changed, 197 insertions(+), 181 deletions(-) diff --git a/src/libcode/vx_pxm/pbm.cc b/src/libcode/vx_pxm/pbm.cc index 8931af17b3..1b81a1203f 100644 --- a/src/libcode/vx_pxm/pbm.cc +++ b/src/libcode/vx_pxm/pbm.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -28,6 +25,8 @@ using namespace std; #include "pbm.h" #include "pxm_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pcm.cc b/src/libcode/vx_pxm/pcm.cc index f1107ccf20..cf3b4b8f3f 100644 --- a/src/libcode/vx_pxm/pcm.cc +++ b/src/libcode/vx_pxm/pcm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pgm.cc b/src/libcode/vx_pxm/pgm.cc index a38d4fd4e1..d7d67a9095 100644 --- a/src/libcode/vx_pxm/pgm.cc +++ b/src/libcode/vx_pxm/pgm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +27,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/ppm.cc b/src/libcode/vx_pxm/ppm.cc index 27cf265eb3..6bc0219e2a 100644 --- a/src/libcode/vx_pxm/ppm.cc +++ b/src/libcode/vx_pxm/ppm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pxm_base.cc b/src/libcode/vx_pxm/pxm_base.cc index bc52724b35..507dd54806 100644 --- a/src/libcode/vx_pxm/pxm_base.cc +++ b/src/libcode/vx_pxm/pxm_base.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +22,8 @@ using namespace std; #include "vx_log.h" #include "check_endian.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pxm/pxm_utils.cc b/src/libcode/vx_pxm/pxm_utils.cc index 8d496b8082..bcea27eeda 100644 --- a/src/libcode/vx_pxm/pxm_utils.cc +++ b/src/libcode/vx_pxm/pxm_utils.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -23,6 +20,8 @@ using namespace std; #include "pxm_base.h" #include "pxm_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_dict.cc b/src/libcode/vx_python3_utils/python3_dict.cc index f623166a14..dc7a6f4272 100644 --- a/src/libcode/vx_python3_utils/python3_dict.cc +++ b/src/libcode/vx_python3_utils/python3_dict.cc @@ -9,12 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - -//////////////////////////////////////////////////////////////////////// - - #include #include "vx_log.h" @@ -22,6 +16,8 @@ using namespace std; #include "python3_dict.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_list.cc b/src/libcode/vx_python3_utils/python3_list.cc index 51b9c3078a..780ac1f08d 100644 --- a/src/libcode/vx_python3_utils/python3_list.cc +++ b/src/libcode/vx_python3_utils/python3_list.cc @@ -9,12 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - -//////////////////////////////////////////////////////////////////////// - - #include #include "vx_log.h" @@ -22,6 +16,8 @@ using namespace std; #include "python3_list.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_numpy.cc b/src/libcode/vx_python3_utils/python3_numpy.cc index 961bcd0bfb..7a2b27869a 100644 --- a/src/libcode/vx_python3_utils/python3_numpy.cc +++ b/src/libcode/vx_python3_utils/python3_numpy.cc @@ -1,11 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -17,6 +21,8 @@ using namespace std; #include "python3_numpy.h" #include "python3_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_script.cc b/src/libcode/vx_python3_utils/python3_script.cc index 34fc038d71..6369354e68 100644 --- a/src/libcode/vx_python3_utils/python3_script.cc +++ b/src/libcode/vx_python3_utils/python3_script.cc @@ -1,11 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -20,6 +24,8 @@ using namespace std; #include "global_python.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/python3_util.cc b/src/libcode/vx_python3_utils/python3_util.cc index 7c648edc88..2227eb8ffc 100644 --- a/src/libcode/vx_python3_utils/python3_util.cc +++ b/src/libcode/vx_python3_utils/python3_util.cc @@ -3,9 +3,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -17,6 +14,8 @@ using namespace std; #include "python3_util.h" #include "global_python.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_python3_utils/wchar_argv.cc b/src/libcode/vx_python3_utils/wchar_argv.cc index 46c5999106..a51eea0675 100644 --- a/src/libcode/vx_python3_utils/wchar_argv.cc +++ b/src/libcode/vx_python3_utils/wchar_argv.cc @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -26,6 +24,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_regrid/vx_regrid.cc b/src/libcode/vx_regrid/vx_regrid.cc index 95063ac17c..2a22fe38ae 100644 --- a/src/libcode/vx_regrid/vx_regrid.cc +++ b/src/libcode/vx_regrid/vx_regrid.cc @@ -11,14 +11,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_regrid.h" #include "interp_mthd.h" #include "GridTemplate.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/ascii85_filter.cc b/src/libcode/vx_render/ascii85_filter.cc index a0d42aadc6..6947aa92fb 100644 --- a/src/libcode/vx_render/ascii85_filter.cc +++ b/src/libcode/vx_render/ascii85_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "ascii85_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/bit_filter.cc b/src/libcode/vx_render/bit_filter.cc index a9e260ddb4..6436a6d1f7 100644 --- a/src/libcode/vx_render/bit_filter.cc +++ b/src/libcode/vx_render/bit_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "bit_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/flate_filter.cc b/src/libcode/vx_render/flate_filter.cc index b9298bc00a..9bf27bc536 100644 --- a/src/libcode/vx_render/flate_filter.cc +++ b/src/libcode/vx_render/flate_filter.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "vx_log.h" #include "flate_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/ps_filter.cc b/src/libcode/vx_render/ps_filter.cc index bfaade4aa9..ef84f22d3c 100644 --- a/src/libcode/vx_render/ps_filter.cc +++ b/src/libcode/vx_render/ps_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "empty_string.h" #include "ps_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/psout_filter.cc b/src/libcode/vx_render/psout_filter.cc index 02e2693fc6..d9702a133e 100644 --- a/src/libcode/vx_render/psout_filter.cc +++ b/src/libcode/vx_render/psout_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "psout_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/render_pbm.cc b/src/libcode/vx_render/render_pbm.cc index 988fa1d3ce..0321a4a6e2 100644 --- a/src/libcode/vx_render/render_pbm.cc +++ b/src/libcode/vx_render/render_pbm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "vx_render.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/render_pcm.cc b/src/libcode/vx_render/render_pcm.cc index 04e99f0414..1727ea965b 100644 --- a/src/libcode/vx_render/render_pcm.cc +++ b/src/libcode/vx_render/render_pcm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "vx_render.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/render_pgm.cc b/src/libcode/vx_render/render_pgm.cc index 11d0d6801e..b4c4128741 100644 --- a/src/libcode/vx_render/render_pgm.cc +++ b/src/libcode/vx_render/render_pgm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "vx_render.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/render_ppm.cc b/src/libcode/vx_render/render_ppm.cc index 15d4c2200f..17c602b4be 100644 --- a/src/libcode/vx_render/render_ppm.cc +++ b/src/libcode/vx_render/render_ppm.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "vx_render.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/renderinfo.cc b/src/libcode/vx_render/renderinfo.cc index 58912de6f6..5a9dc52963 100644 --- a/src/libcode/vx_render/renderinfo.cc +++ b/src/libcode/vx_render/renderinfo.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "renderinfo.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/rle_filter.cc b/src/libcode/vx_render/rle_filter.cc index 93cd826c4b..bb4cb3f876 100644 --- a/src/libcode/vx_render/rle_filter.cc +++ b/src/libcode/vx_render/rle_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "rle_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/uc_queue.cc b/src/libcode/vx_render/uc_queue.cc index ef6fadfaf5..0eb1aab7a7 100644 --- a/src/libcode/vx_render/uc_queue.cc +++ b/src/libcode/vx_render/uc_queue.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "uc_queue.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index 103bb6e172..7df9d82cf9 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -1,10 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -14,7 +19,6 @@ using namespace std; #include #include -using namespace netCDF; #include "file_exists.h" @@ -23,6 +27,10 @@ using namespace netCDF; #include "nc_utils.h" #include "seeps.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// bool standalone_debug_seeps = false; diff --git a/src/libcode/vx_series_data/series_data.cc b/src/libcode/vx_series_data/series_data.cc index 03b227b0f2..204b10f06e 100644 --- a/src/libcode/vx_series_data/series_data.cc +++ b/src/libcode/vx_series_data/series_data.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "series_data.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static bool read_single_entry(VarInfo*, const ConcatString&, const GrdFileType, diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index 2bce87efdf..f9d9765a35 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -19,10 +18,13 @@ using namespace std; #include #include -using namespace netCDF; #include "series_pdf.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// void init_pdf( diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index c393610c2f..e5da257536 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -8,8 +8,6 @@ /////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "mode_columns.h" #include "vx_util.h" +using namespace std; + /////////////////////////////////////////////////////////////////////// static const int print_interest_log_level = 5; diff --git a/src/libcode/vx_shapedata/ihull.cc b/src/libcode/vx_shapedata/ihull.cc index 59208964ed..74700ddcc6 100644 --- a/src/libcode/vx_shapedata/ihull.cc +++ b/src/libcode/vx_shapedata/ihull.cc @@ -1,10 +1,15 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -13,6 +18,8 @@ using namespace std; #include "ihull.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/interest.cc b/src/libcode/vx_shapedata/interest.cc index d33d32e426..fcb39f2042 100644 --- a/src/libcode/vx_shapedata/interest.cc +++ b/src/libcode/vx_shapedata/interest.cc @@ -21,8 +21,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "interest.h" #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static void get_percentiles(DistributionPercentiles &, diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index 5852d9f51e..6e9ed75e26 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static const char default_multivar_name[] = "Super"; diff --git a/src/libcode/vx_shapedata/moments.cc b/src/libcode/vx_shapedata/moments.cc index d744871929..48ad425c2b 100644 --- a/src/libcode/vx_shapedata/moments.cc +++ b/src/libcode/vx_shapedata/moments.cc @@ -21,8 +21,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -31,6 +29,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_shapedata/set.cc b/src/libcode/vx_shapedata/set.cc index c62637c69e..ed4d7b1604 100644 --- a/src/libcode/vx_shapedata/set.cc +++ b/src/libcode/vx_shapedata/set.cc @@ -19,8 +19,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "set.h" #include "vx_log.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class FcstObsSet diff --git a/src/libcode/vx_shapedata/shapedata.cc b/src/libcode/vx_shapedata/shapedata.cc index bc7332bc94..c968c51f34 100644 --- a/src/libcode/vx_shapedata/shapedata.cc +++ b/src/libcode/vx_shapedata/shapedata.cc @@ -22,17 +22,6 @@ /////////////////////////////////////////////////////////////////////////////// -static const bool use_new = true; - -static const int split_enlarge = 4; // used for ShapeData shrink and expand - -static const bool do_split_fatten = true; - - -/////////////////////////////////////////////////////////////////////////////// - -using namespace std; - #include #include #include @@ -52,6 +41,18 @@ using namespace std; #include "ihull.h" +using namespace std; + + +/////////////////////////////////////////////////////////////////////////////// + + +static const bool use_new = true; + +static const int split_enlarge = 4; // used for ShapeData shrink and expand + +static const bool do_split_fatten = true; + /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_solar/siderial.cc b/src/libcode/vx_solar/siderial.cc index 9424772245..fd2f4fcb95 100644 --- a/src/libcode/vx_solar/siderial.cc +++ b/src/libcode/vx_solar/siderial.cc @@ -9,9 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -20,6 +17,8 @@ using namespace std; #include "siderial.h" #include "astro_constants.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_solar/solar.cc b/src/libcode/vx_solar/solar.cc index 4b8568b4fc..2d6f6a5280 100644 --- a/src/libcode/vx_solar/solar.cc +++ b/src/libcode/vx_solar/solar.cc @@ -9,9 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -21,6 +18,8 @@ using namespace std; #include "solar.h" #include "astro_constants.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 034c3c1961..5df2b6191b 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// const bool use_weighted_seeps = false; diff --git a/src/libcode/vx_stat_out/stat_hdr_columns.cc b/src/libcode/vx_stat_out/stat_hdr_columns.cc index 4304e87e9f..f832b20c02 100644 --- a/src/libcode/vx_stat_out/stat_hdr_columns.cc +++ b/src/libcode/vx_stat_out/stat_hdr_columns.cc @@ -8,13 +8,13 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include "stat_hdr_columns.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // diff --git a/src/libcode/vx_statistics/apply_mask.cc b/src/libcode/vx_statistics/apply_mask.cc index 010c091825..a69f3ff2e5 100644 --- a/src/libcode/vx_statistics/apply_mask.cc +++ b/src/libcode/vx_statistics/apply_mask.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static void process_poly_mask(const ConcatString &, const Grid &, diff --git a/src/libcode/vx_statistics/compute_ci.cc b/src/libcode/vx_statistics/compute_ci.cc index e4a9aabae7..a02fcf6e5a 100644 --- a/src/libcode/vx_statistics/compute_ci.cc +++ b/src/libcode/vx_statistics/compute_ci.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static void write_cntinfo(ofstream &, const CNTInfo &); diff --git a/src/libcode/vx_statistics/compute_stats.cc b/src/libcode/vx_statistics/compute_stats.cc index 3c95557c80..e4fe518558 100644 --- a/src/libcode/vx_statistics/compute_stats.cc +++ b/src/libcode/vx_statistics/compute_stats.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// const int detailed_debug_level = 5; diff --git a/src/libcode/vx_statistics/contable.cc b/src/libcode/vx_statistics/contable.cc index d01c264fb3..d70405d74a 100644 --- a/src/libcode/vx_statistics/contable.cc +++ b/src/libcode/vx_statistics/contable.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -27,6 +24,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/contable_nx2.cc b/src/libcode/vx_statistics/contable_nx2.cc index 5bb9e1cbae..8611a2d346 100644 --- a/src/libcode/vx_statistics/contable_nx2.cc +++ b/src/libcode/vx_statistics/contable_nx2.cc @@ -11,15 +11,6 @@ //////////////////////////////////////////////////////////////////////// -static const int use_center = 1; - - -//////////////////////////////////////////////////////////////////////// - - -using namespace std; - - #include #include #include @@ -33,6 +24,14 @@ using namespace std; #include "vx_log.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + + +static const int use_center = 1; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/contable_stats.cc b/src/libcode/vx_statistics/contable_stats.cc index f103284ee0..177824c454 100644 --- a/src/libcode/vx_statistics/contable_stats.cc +++ b/src/libcode/vx_statistics/contable_stats.cc @@ -6,8 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "vx_gsl_prob.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for stats for 2x2 contingency tables diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 4aae9e7471..c3cfe46add 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class SSVARInfo diff --git a/src/libcode/vx_statistics/grid_closed_poly.cc b/src/libcode/vx_statistics/grid_closed_poly.cc index f26c93820e..043a79df09 100644 --- a/src/libcode/vx_statistics/grid_closed_poly.cc +++ b/src/libcode/vx_statistics/grid_closed_poly.cc @@ -19,8 +19,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -34,6 +32,8 @@ using namespace std; #include "vx_util.h" #include "grid_closed_poly.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class GridClosedPoly diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index a33f1adc73..fb9b280c9b 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class CIInfo diff --git a/src/libcode/vx_statistics/obs_error.cc b/src/libcode/vx_statistics/obs_error.cc index 6ccb4a30f5..662fc8d920 100644 --- a/src/libcode/vx_statistics/obs_error.cc +++ b/src/libcode/vx_statistics/obs_error.cc @@ -7,8 +7,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "obs_error.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // Default observation error table file name diff --git a/src/libcode/vx_statistics/pair_base.cc b/src/libcode/vx_statistics/pair_base.cc index 339861ac9b..63be2df330 100644 --- a/src/libcode/vx_statistics/pair_base.cc +++ b/src/libcode/vx_statistics/pair_base.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static bool sort_obs(ob_val_t a, ob_val_t b) { return a.val #include @@ -33,6 +32,7 @@ using namespace std; using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class PairDataEnsemble diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 15aa9133f0..c4a086d407 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "vx_math.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class PairDataPoint diff --git a/src/libcode/vx_statistics/read_climo.cc b/src/libcode/vx_statistics/read_climo.cc index 27fe9e5eae..f5ffb53036 100644 --- a/src/libcode/vx_statistics/read_climo.cc +++ b/src/libcode/vx_statistics/read_climo.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_data2d.h" #include "vx_regrid.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static void read_climo_file( diff --git a/src/libcode/vx_tc_util/atcf_line_base.cc b/src/libcode/vx_tc_util/atcf_line_base.cc index 6db2d00651..9136bc5df1 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.cc +++ b/src/libcode/vx_tc_util/atcf_line_base.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "atcf_line_base.h" #include "atcf_offsets.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // Only print the AVN to GFS conversion message once diff --git a/src/libcode/vx_tc_util/atcf_prob_line.cc b/src/libcode/vx_tc_util/atcf_prob_line.cc index 9cc97c4728..f07c0e57ad 100644 --- a/src/libcode/vx_tc_util/atcf_prob_line.cc +++ b/src/libcode/vx_tc_util/atcf_prob_line.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "atcf_prob_line.h" #include "atcf_offsets.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ATCFProbLine diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index 106a646f88..bd3ad2a5e2 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "atcf_track_line.h" #include "atcf_offsets.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ATCFTrackLine diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 95336c7765..e75db11773 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "diag_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static const int ships_wdth[] = { diff --git a/src/libcode/vx_tc_util/gen_shape_info.cc b/src/libcode/vx_tc_util/gen_shape_info.cc index cb8698c20e..60f4ccf561 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.cc +++ b/src/libcode/vx_tc_util/gen_shape_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "gen_shape_info.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class GenShapeInfo diff --git a/src/libcode/vx_tc_util/genesis_info.cc b/src/libcode/vx_tc_util/genesis_info.cc index 1382710dde..85da3d3e34 100644 --- a/src/libcode/vx_tc_util/genesis_info.cc +++ b/src/libcode/vx_tc_util/genesis_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "genesis_info.h" #include "vx_config.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for struct GenesisEventInfo diff --git a/src/libcode/vx_tc_util/pair_data_genesis.cc b/src/libcode/vx_tc_util/pair_data_genesis.cc index c5665e318f..103b84a45e 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.cc +++ b/src/libcode/vx_tc_util/pair_data_genesis.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "pair_data_genesis.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for enum GenesisPairCategory diff --git a/src/libcode/vx_tc_util/prob_gen_info.cc b/src/libcode/vx_tc_util/prob_gen_info.cc index c751e3195f..4dbc55a281 100644 --- a/src/libcode/vx_tc_util/prob_gen_info.cc +++ b/src/libcode/vx_tc_util/prob_gen_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "prob_gen_info.h" #include "atcf_offsets.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ProbGenInfo diff --git a/src/libcode/vx_tc_util/prob_info_array.cc b/src/libcode/vx_tc_util/prob_info_array.cc index c162876567..51f574e6a3 100644 --- a/src/libcode/vx_tc_util/prob_info_array.cc +++ b/src/libcode/vx_tc_util/prob_info_array.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "prob_rirw_info.h" #include "prob_info_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ProbInfoArray diff --git a/src/libcode/vx_tc_util/prob_info_base.cc b/src/libcode/vx_tc_util/prob_info_base.cc index dc9a6cfc76..e967db4ca5 100644 --- a/src/libcode/vx_tc_util/prob_info_base.cc +++ b/src/libcode/vx_tc_util/prob_info_base.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,9 @@ using namespace std; #include "prob_info_base.h" +using namespace std; + +//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // // Code for class ProbInfoBase diff --git a/src/libcode/vx_tc_util/prob_rirw_info.cc b/src/libcode/vx_tc_util/prob_rirw_info.cc index 4745f18913..8c117063dc 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "prob_rirw_info.h" #include "atcf_offsets.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ProbRIRWInfo diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 364e754035..dfb293b535 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "prob_rirw_pair_info.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class ProbRIRWPairInfo diff --git a/src/libcode/vx_tc_util/tc_columns.cc b/src/libcode/vx_tc_util/tc_columns.cc index 3e38075aa7..a50397374c 100644 --- a/src/libcode/vx_tc_util/tc_columns.cc +++ b/src/libcode/vx_tc_util/tc_columns.cc @@ -8,8 +8,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +25,8 @@ using namespace std; #include "vx_util.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// void open_tc_txt_file(ofstream *&out, const char *file_name) { diff --git a/src/libcode/vx_tc_util/tc_hdr_columns.cc b/src/libcode/vx_tc_util/tc_hdr_columns.cc index 1cd1ce26ff..3708417560 100644 --- a/src/libcode/vx_tc_util/tc_hdr_columns.cc +++ b/src/libcode/vx_tc_util/tc_hdr_columns.cc @@ -8,13 +8,13 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include "tc_hdr_columns.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class TcHdrColumns diff --git a/src/libcode/vx_tc_util/tc_stat_line.cc b/src/libcode/vx_tc_util/tc_stat_line.cc index 78bd215196..1542b0e981 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.cc +++ b/src/libcode/vx_tc_util/tc_stat_line.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +25,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class TCStatLine diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index 379d60faa1..28e3c7e71d 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "math_constants.h" #include "track_info.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class TrackInfo diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index dd58b42e5f..4fe226dc1f 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "track_pair_info.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class TrackPairInfo diff --git a/src/libcode/vx_tc_util/track_point.cc b/src/libcode/vx_tc_util/track_point.cc index 1db936322e..6d1232c8c6 100644 --- a/src/libcode/vx_tc_util/track_point.cc +++ b/src/libcode/vx_tc_util/track_point.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "track_point.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class QuadInfo diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.cc b/src/libcode/vx_tc_util/vx_tc_nc_util.cc index ad4d4403b4..7723787369 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.cc +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.cc @@ -8,13 +8,14 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include -using namespace netCDF; #include "vx_tc_nc_util.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// void write_tc_track_lines(NcFile* nc_out, diff --git a/src/libcode/vx_time_series/compute_swinging_door.cc b/src/libcode/vx_time_series/compute_swinging_door.cc index 33565dfd01..5e8d04629f 100644 --- a/src/libcode/vx_time_series/compute_swinging_door.cc +++ b/src/libcode/vx_time_series/compute_swinging_door.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "vx_math.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// bool compute_swinging_door_slopes(const TimeArray &valid_times, diff --git a/src/libcode/vx_time_series/time_series_util.cc b/src/libcode/vx_time_series/time_series_util.cc index 184f236d59..57c84436cb 100644 --- a/src/libcode/vx_time_series/time_series_util.cc +++ b/src/libcode/vx_time_series/time_series_util.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "time_series_util.h" #include "compute_swinging_door.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// TimeSeriesType string_to_timeseriestype(const char *s) { From a00c7beaac4e05b5dde3975b10c83d9b1a59761d Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 1 Mar 2024 15:46:25 +0000 Subject: [PATCH 19/72] #2673 Moved down 'using namespace' statement. --- .../ensemble_stat/ensemble_stat_conf_info.cc | 4 ++-- .../core/grid_stat/grid_stat_conf_info.cc | 4 ++-- src/tools/core/mode/cluster_page.cc | 4 ++-- src/tools/core/mode/combine_boolplanes.cc | 4 ++-- src/tools/core/mode/fcst_enlarge_page.cc | 4 ++-- src/tools/core/mode/mode.cc | 4 ++-- src/tools/core/mode/mode_exec.cc | 6 +++--- src/tools/core/mode/mode_frontend.cc | 8 ++++++-- src/tools/core/mode/mode_ps_file.cc | 4 ++-- src/tools/core/mode/mode_superobject.cc | 16 +++++++++++++++- src/tools/core/mode/mode_usage.cc | 4 ++-- src/tools/core/mode/multivar_data.cc | 5 +++-- src/tools/core/mode/multivar_frontend.cc | 5 +++-- src/tools/core/mode/objects_from_netcdf.cc | 8 +------- src/tools/core/mode/obs_enlarge_page.cc | 4 ++-- src/tools/core/mode/overlap_page.cc | 4 ++-- src/tools/core/mode/page_1.cc | 4 ++-- src/tools/core/mode/plot_engine.cc | 4 ++-- src/tools/core/mode_analysis/config_to_att.cc | 6 +++--- src/tools/core/mode_analysis/mode_analysis.cc | 3 ++- .../core/series_analysis/series_analysis.cc | 6 ++++-- .../series_analysis_conf_info.cc | 4 ++-- src/tools/core/stat_analysis/aggr_stat_line.cc | 4 +++- .../core/stat_analysis/parse_stat_line.cc | 4 ++-- .../stat_analysis/skill_score_index_job.cc | 4 ++-- src/tools/core/stat_analysis/stat_analysis.cc | 4 ++-- .../core/stat_analysis/stat_analysis_job.cc | 4 ++-- src/tools/core/wavelet_stat/wavelet_stat.cc | 6 ++++-- .../wavelet_stat/wavelet_stat_conf_info.cc | 4 ++-- src/tools/dev_utils/chk4copyright.cc | 4 ++-- src/tools/dev_utils/gen_climo_bin.cc | 6 ++++-- src/tools/dev_utils/gribtab.dat_to_flat.cc | 4 ++-- src/tools/dev_utils/insitu_nc_file.cc | 6 +++--- src/tools/dev_utils/insitu_nc_to_ascii.cc | 4 ++-- src/tools/dev_utils/met_nc_file.cc | 8 +++----- src/tools/dev_utils/nceptab_to_flat.cc | 18 ++++++++---------- src/tools/dev_utils/pbtime.cc | 4 +++- src/tools/dev_utils/reformat_county_data.cc | 3 ++- src/tools/dev_utils/reformat_map_data.cc | 3 ++- .../dev_utils/shapefiles/make_mapfiles.cc | 4 ++-- src/tools/dev_utils/swinging_door.cc | 4 +++- 41 files changed, 119 insertions(+), 94 deletions(-) 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 8da7df73c6..565653d41c 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +25,8 @@ using namespace std; #include "GridTemplate.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class EnsembleStatConfInfo 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 399913036f..af91816ea4 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class GridStatConfInfo diff --git a/src/tools/core/mode/cluster_page.cc b/src/tools/core/mode/cluster_page.cc index ae25f4ce00..0cc2b31085 100644 --- a/src/tools/core/mode/cluster_page.cc +++ b/src/tools/core/mode/cluster_page.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "mode_ps_table_defs.h" #include "table_helper.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/combine_boolplanes.cc b/src/tools/core/mode/combine_boolplanes.cc index 874d9c4002..111964c94c 100644 --- a/src/tools/core/mode/combine_boolplanes.cc +++ b/src/tools/core/mode/combine_boolplanes.cc @@ -9,12 +9,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "combine_boolplanes.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/fcst_enlarge_page.cc b/src/tools/core/mode/fcst_enlarge_page.cc index 0199e39abf..225ae1fce0 100644 --- a/src/tools/core/mode/fcst_enlarge_page.cc +++ b/src/tools/core/mode/fcst_enlarge_page.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "mode_ps_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/mode.cc b/src/tools/core/mode/mode.cc index 037d2be1a5..dbdcf5a971 100644 --- a/src/tools/core/mode/mode.cc +++ b/src/tools/core/mode/mode.cc @@ -62,8 +62,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -86,6 +84,8 @@ using namespace std; #include "global_python.h" #endif +using namespace std; + /////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index 9165051a6c..3450bf789f 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -10,20 +10,20 @@ /////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include #include #include #include -using namespace netCDF; #include "mode_exec.h" #include "nc_utils.h" #include "vx_regrid.h" +using namespace std; +using namespace netCDF; + /////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/mode_frontend.cc b/src/tools/core/mode/mode_frontend.cc index 43f461e716..9bd8125ead 100644 --- a/src/tools/core/mode/mode_frontend.cc +++ b/src/tools/core/mode/mode_frontend.cc @@ -10,8 +10,6 @@ /////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,12 @@ using namespace std; #include "global_python.h" #endif +using namespace std; + + +/////////////////////////////////////////////////////////////////////// + + extern const char * const program_name; static ModeExecutive *mode_exec = 0; diff --git a/src/tools/core/mode/mode_ps_file.cc b/src/tools/core/mode/mode_ps_file.cc index 2a9c518599..790372f167 100644 --- a/src/tools/core/mode/mode_ps_file.cc +++ b/src/tools/core/mode/mode_ps_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "mode_ps_file.h" #include "vx_plot_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/mode_superobject.cc b/src/tools/core/mode/mode_superobject.cc index 27d1c3092f..44c0b4f313 100644 --- a/src/tools/core/mode/mode_superobject.cc +++ b/src/tools/core/mode/mode_superobject.cc @@ -1,7 +1,21 @@ -using namespace std; +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + + +//////////////////////////////////////////////////////////////////////// + + #include "mode_superobject.h" #include "multivar_data.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static void _mask_super(const string &name, int nx, int ny, DataPlane &data) { diff --git a/src/tools/core/mode/mode_usage.cc b/src/tools/core/mode/mode_usage.cc index e6caf8cd3f..fb0b8fdd22 100644 --- a/src/tools/core/mode/mode_usage.cc +++ b/src/tools/core/mode/mode_usage.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "mode_usage.h" @@ -20,6 +18,8 @@ using namespace std; #include "util_constants.h" #include "logger.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/multivar_data.cc b/src/tools/core/mode/multivar_data.cc index 4995983668..3bcfa136f7 100644 --- a/src/tools/core/mode/multivar_data.cc +++ b/src/tools/core/mode/multivar_data.cc @@ -10,8 +10,6 @@ /////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,6 +27,9 @@ using namespace std; #include "vx_regrid.h" #include "vx_shapedata.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/multivar_frontend.cc b/src/tools/core/mode/multivar_frontend.cc index 7261d04203..b713d12552 100644 --- a/src/tools/core/mode/multivar_frontend.cc +++ b/src/tools/core/mode/multivar_frontend.cc @@ -9,8 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "multivar_frontend.h" #include "mode_usage.h" @@ -19,6 +17,9 @@ using namespace std; #include "global_python.h" #endif +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/objects_from_netcdf.cc b/src/tools/core/mode/objects_from_netcdf.cc index 0821aa3140..9dc6fb4062 100644 --- a/src/tools/core/mode/objects_from_netcdf.cc +++ b/src/tools/core/mode/objects_from_netcdf.cc @@ -10,17 +10,11 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "objects_from_netcdf.h" - -//////////////////////////////////////////////////////////////////////// - - +using namespace std; using namespace netCDF; diff --git a/src/tools/core/mode/obs_enlarge_page.cc b/src/tools/core/mode/obs_enlarge_page.cc index 85a2be7229..fd7fa38db9 100644 --- a/src/tools/core/mode/obs_enlarge_page.cc +++ b/src/tools/core/mode/obs_enlarge_page.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "mode_ps_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/overlap_page.cc b/src/tools/core/mode/overlap_page.cc index 7d1d37fe8c..95578e8eb5 100644 --- a/src/tools/core/mode/overlap_page.cc +++ b/src/tools/core/mode/overlap_page.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "mode_ps_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/page_1.cc b/src/tools/core/mode/page_1.cc index eb6ceb9d0a..5a87e97424 100644 --- a/src/tools/core/mode/page_1.cc +++ b/src/tools/core/mode/page_1.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "mode_ps_table_defs.h" #include "table_helper.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/plot_engine.cc b/src/tools/core/mode/plot_engine.cc index 78ba1954ee..5a92e5643c 100644 --- a/src/tools/core/mode/plot_engine.cc +++ b/src/tools/core/mode/plot_engine.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -19,6 +17,8 @@ using namespace std; #include "mode_ps_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode_analysis/config_to_att.cc b/src/tools/core/mode_analysis/config_to_att.cc index 696e1ae92d..8508d4c43c 100644 --- a/src/tools/core/mode_analysis/config_to_att.cc +++ b/src/tools/core/mode_analysis/config_to_att.cc @@ -25,8 +25,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -34,10 +32,12 @@ using namespace std; #include #include - #include "config_to_att.h" #include "is_bad_data.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode_analysis/mode_analysis.cc b/src/tools/core/mode_analysis/mode_analysis.cc index 95e1bd43d1..9a4bbf4a28 100644 --- a/src/tools/core/mode_analysis/mode_analysis.cc +++ b/src/tools/core/mode_analysis/mode_analysis.cc @@ -33,7 +33,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -50,6 +49,8 @@ using namespace std; #include "config_to_att.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 223ce9ad65..6282266d78 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -38,7 +38,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -52,7 +51,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "series_analysis.h" @@ -62,6 +60,10 @@ using namespace netCDF; #include "vx_regrid.h" #include "vx_log.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static void process_command_line(int, char **); diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.cc b/src/tools/core/series_analysis/series_analysis_conf_info.cc index 7d22d83643..78eaf2fb19 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class SeriesAnalysisConfInfo diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 99b5906429..3f402e480d 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -42,7 +42,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -59,6 +58,9 @@ using namespace std; #include "aggr_stat_line.h" #include "parse_stat_line.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static bool is_precip_var_name(const ConcatString &s); diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index 57bc92eb46..eceb835d99 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -36,8 +36,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -50,6 +48,8 @@ using namespace std; #include "parse_stat_line.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// void parse_fho_ctable(STATLine &l, TTContingencyTable &ct) { diff --git a/src/tools/core/stat_analysis/skill_score_index_job.cc b/src/tools/core/stat_analysis/skill_score_index_job.cc index a023cd8dfc..8ae32639e6 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.cc +++ b/src/tools/core/stat_analysis/skill_score_index_job.cc @@ -18,8 +18,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "skill_score_index_job.h" #include "parse_stat_line.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class SSIndexJobInfo diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index 912617a213..e5f89feb0f 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -46,8 +46,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -69,6 +67,8 @@ using namespace std; #include "python_line.h" #endif +using namespace std; + //////////////////////////////////////////////////////////////////////// static int using_python = false; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index dce6d0014f..4df7b60ed7 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -48,8 +48,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -66,6 +64,8 @@ using namespace std; #include "parse_stat_line.h" #include "aggr_stat_line.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// extern bool has_line_type(const vector &, diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index b182a4538d..92de80da60 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -43,7 +43,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -59,7 +58,6 @@ using namespace std; #include #include -using namespace netCDF; #include "wavelet_stat.h" @@ -69,6 +67,10 @@ using namespace netCDF; #include "vx_log.h" #include "vx_plot_util.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// 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 8a2a896544..f813499b23 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // // Code for class WaveletStatConfInfo diff --git a/src/tools/dev_utils/chk4copyright.cc b/src/tools/dev_utils/chk4copyright.cc index e145909d31..b4541b4bf6 100644 --- a/src/tools/dev_utils/chk4copyright.cc +++ b/src/tools/dev_utils/chk4copyright.cc @@ -29,8 +29,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -47,6 +45,8 @@ using namespace std; #include "string_fxns.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index fea08a5d9d..07dbcc3362 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -19,7 +19,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -33,7 +32,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "vx_util.h" @@ -43,6 +41,10 @@ using namespace netCDF; #include "vx_data2d.h" #include "vx_data2d_factory.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// // // Variables for command line arguments diff --git a/src/tools/dev_utils/gribtab.dat_to_flat.cc b/src/tools/dev_utils/gribtab.dat_to_flat.cc index fbf84434e1..9dc1c766d6 100644 --- a/src/tools/dev_utils/gribtab.dat_to_flat.cc +++ b/src/tools/dev_utils/gribtab.dat_to_flat.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" #include "vx_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/insitu_nc_file.cc b/src/tools/dev_utils/insitu_nc_file.cc index 7566eb366f..0da4bd7b73 100644 --- a/src/tools/dev_utils/insitu_nc_file.cc +++ b/src/tools/dev_utils/insitu_nc_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,7 +19,6 @@ using namespace std; #include #include -using namespace netCDF; #include "vx_math.h" #include "vx_cal.h" @@ -30,6 +27,9 @@ using namespace netCDF; #include "insitu_nc_file.h" #include "nc_utils.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/insitu_nc_to_ascii.cc b/src/tools/dev_utils/insitu_nc_to_ascii.cc index d959713037..a7d55d6377 100644 --- a/src/tools/dev_utils/insitu_nc_to_ascii.cc +++ b/src/tools/dev_utils/insitu_nc_to_ascii.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "insitu_nc_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 0389f8e883..deb4ae4ea8 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -7,15 +7,10 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - #include -using namespace netCDF; #include "vx_log.h" #include "vx_math.h" @@ -23,6 +18,9 @@ using namespace netCDF; #include "met_nc_file.h" #include "nc_utils.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index ab05cb7698..aeece5178b 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -9,10 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - // // Takes a bunch of C source files from the wgrib code // @@ -25,12 +21,6 @@ using namespace std; //////////////////////////////////////////////////////////////////////// -static const char target_start [] = "const struct"; - - -//////////////////////////////////////////////////////////////////////// - - #include #include #include @@ -41,6 +31,14 @@ static const char target_start [] = "const struct"; #include "vx_log.h" #include "vx_util.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + + +static const char target_start [] = "const struct"; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index c7d30bc638..98465dffc2 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -19,7 +19,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -37,6 +36,9 @@ using namespace std; #include "concat_string.h" #include "temp_file.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/dev_utils/reformat_county_data.cc b/src/tools/dev_utils/reformat_county_data.cc index 28ce0be968..65514c3b69 100644 --- a/src/tools/dev_utils/reformat_county_data.cc +++ b/src/tools/dev_utils/reformat_county_data.cc @@ -9,7 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -20,6 +19,8 @@ using namespace std; #include "main.h" #include "vx_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/reformat_map_data.cc b/src/tools/dev_utils/reformat_map_data.cc index b1cdcde109..3637c5dcee 100644 --- a/src/tools/dev_utils/reformat_map_data.cc +++ b/src/tools/dev_utils/reformat_map_data.cc @@ -9,7 +9,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -20,6 +19,8 @@ using namespace std; #include "main.h" #include "vx_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/shapefiles/make_mapfiles.cc b/src/tools/dev_utils/shapefiles/make_mapfiles.cc index 8a6fa87225..ed83f33a95 100644 --- a/src/tools/dev_utils/shapefiles/make_mapfiles.cc +++ b/src/tools/dev_utils/shapefiles/make_mapfiles.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "shp_poly_record.h" #include "int_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/dev_utils/swinging_door.cc b/src/tools/dev_utils/swinging_door.cc index 5feccd043d..844e4fbdf3 100644 --- a/src/tools/dev_utils/swinging_door.cc +++ b/src/tools/dev_utils/swinging_door.cc @@ -23,7 +23,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -47,6 +46,9 @@ using namespace std; #include "met_nc_file.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // Constants From 5706e9733a46870db596456c2b6cf2a033370f77 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 1 Mar 2024 15:47:05 +0000 Subject: [PATCH 20/72] #2673 Moved down 'using namespace' statement. --- src/tools/other/ascii2nc/ascii2nc.cc | 5 ++- .../other/ascii2nc/ascii2nc_conf_info.cc | 4 +- src/tools/other/ascii2nc/ismn_handler.cc | 5 +++ src/tools/other/ascii2nc/little_r_handler.cc | 7 ++-- src/tools/other/ascii2nc/met_handler.cc | 7 ++-- src/tools/other/ascii2nc/ndbc_handler.cc | 8 ++-- src/tools/other/ascii2nc/ndbc_locations.cc | 7 ++-- src/tools/other/ascii2nc/python_handler.cc | 5 +-- src/tools/other/ascii2nc/surfrad_handler.cc | 7 ++-- src/tools/other/ascii2nc/wwsis_handler.cc | 10 ++--- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 6 ++- .../gen_ens_prod/gen_ens_prod_conf_info.cc | 4 +- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 6 ++- src/tools/other/gis_utils/gis_dump_dbf.cc | 3 +- src/tools/other/gis_utils/gis_dump_shp.cc | 4 +- src/tools/other/gis_utils/gis_dump_shx.cc | 3 +- src/tools/other/grid_diag/grid_diag.cc | 6 ++- .../other/grid_diag/grid_diag_conf_info.cc | 4 +- src/tools/other/gsi_tools/conv_record.cc | 4 +- src/tools/other/gsi_tools/gsi_record.cc | 4 +- src/tools/other/gsi_tools/gsi_util.cc | 4 +- src/tools/other/gsi_tools/gsid2mpr.cc | 4 +- src/tools/other/gsi_tools/rad_config.cc | 4 +- src/tools/other/gsi_tools/rad_record.cc | 4 +- src/tools/other/lidar2nc/calipso_5km.cc | 14 +++---- src/tools/other/lidar2nc/hdf_utils.cc | 5 +-- src/tools/other/lidar2nc/lidar2nc.cc | 16 ++++---- src/tools/other/madis2nc/madis2nc.cc | 6 ++- .../other/madis2nc/madis2nc_conf_info.cc | 3 +- src/tools/other/mode_graphics/cgraph_font.cc | 4 +- src/tools/other/mode_graphics/cgraph_main.cc | 4 +- .../cgraphbase_plottype_to_string.cc | 5 +-- src/tools/other/mode_graphics/color_stack.cc | 5 +-- .../mode_graphics/mode_nc_output_file.cc | 6 +-- .../other/mode_graphics/plot_mode_field.cc | 22 +++++------ src/tools/other/mode_time_domain/2d_att.cc | 4 +- .../other/mode_time_domain/2d_att_array.cc | 5 +-- .../other/mode_time_domain/2d_moments.cc | 4 +- src/tools/other/mode_time_domain/3d_att.cc | 4 +- .../mode_time_domain/3d_att_pair_array.cc | 5 +-- .../mode_time_domain/3d_att_single_array.cc | 5 +-- .../other/mode_time_domain/3d_moments.cc | 4 +- src/tools/other/mode_time_domain/fo_graph.cc | 4 +- src/tools/other/mode_time_domain/fo_node.cc | 4 +- .../other/mode_time_domain/fo_node_array.cc | 5 +-- .../other/mode_time_domain/interest_calc.cc | 4 +- src/tools/other/mode_time_domain/mm_engine.cc | 4 +- src/tools/other/mode_time_domain/mtd.cc | 39 ++++++++++--------- .../other/mode_time_domain/mtd_config_info.cc | 4 +- .../other/mode_time_domain/mtd_file_base.cc | 6 +-- .../other/mode_time_domain/mtd_file_float.cc | 6 +-- .../other/mode_time_domain/mtd_file_int.cc | 6 +-- .../other/mode_time_domain/mtd_nc_output.cc | 6 +-- .../other/mode_time_domain/mtd_partition.cc | 4 +- .../other/mode_time_domain/mtd_read_data.cc | 5 ++- .../other/mode_time_domain/mtd_txt_output.cc | 5 +-- .../mode_time_domain/mtdfiletype_to_string.cc | 5 +-- src/tools/other/mode_time_domain/nc_grid.cc | 6 +-- .../other/mode_time_domain/nc_utils_local.cc | 6 +-- .../other/modis_regrid/cloudsat_swath_file.cc | 4 +- src/tools/other/modis_regrid/data_averager.cc | 4 +- .../modis_regrid/data_plane_to_netcdf.cc | 8 ++-- src/tools/other/modis_regrid/modis_file.cc | 4 +- src/tools/other/modis_regrid/modis_regrid.cc | 15 +++---- src/tools/other/modis_regrid/sat_utils.cc | 4 +- src/tools/other/pb2nc/pb2nc_conf_info.cc | 3 +- .../other/plot_data_plane/plot_data_plane.cc | 4 +- .../other/plot_point_obs/plot_point_obs.cc | 4 +- .../plot_point_obs_conf_info.cc | 4 +- .../other/point2grid/point2grid_conf_info.cc | 4 +- .../regrid_data_plane/regrid_data_plane.cc | 6 ++- .../shift_data_plane/shift_data_plane.cc | 6 ++- src/tools/other/wwmca_tool/af_cp_file.cc | 4 +- src/tools/other/wwmca_tool/af_file.cc | 4 +- src/tools/other/wwmca_tool/af_pt_file.cc | 4 +- src/tools/other/wwmca_tool/ave_interp.cc | 4 +- .../wwmca_tool/gridhemisphere_to_string.cc | 5 +-- src/tools/other/wwmca_tool/interp_base.cc | 5 +-- src/tools/other/wwmca_tool/max_interp.cc | 4 +- src/tools/other/wwmca_tool/min_interp.cc | 4 +- src/tools/other/wwmca_tool/nc_output.cc | 6 +-- src/tools/other/wwmca_tool/nearest_interp.cc | 4 +- src/tools/other/wwmca_tool/wwmca_plot.cc | 26 ++++++------- src/tools/other/wwmca_tool/wwmca_ref.cc | 4 +- src/tools/other/wwmca_tool/wwmca_regrid.cc | 4 +- .../tc_utils/rmw_analysis/rmw_analysis.cc | 5 ++- .../rmw_analysis/rmw_analysis_conf_info.cc | 4 +- src/tools/tc_utils/tc_diag/tc_diag.cc | 6 ++- .../tc_utils/tc_diag/tc_diag_conf_info.cc | 4 +- src/tools/tc_utils/tc_dland/tc_dland.cc | 6 ++- src/tools/tc_utils/tc_dland/tc_poly.cc | 4 +- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 4 +- .../tc_utils/tc_pairs/tc_pairs_conf_info.cc | 4 +- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 6 ++- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 4 +- .../tc_utils/tc_rmw/tc_rmw_wind_converter.cc | 4 +- src/tools/tc_utils/tc_stat/tc_stat.cc | 4 +- .../tc_utils/tc_stat/tc_stat_conf_info.cc | 4 +- src/tools/tc_utils/tc_stat/tc_stat_files.cc | 4 +- 99 files changed, 319 insertions(+), 257 deletions(-) diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index 3eb9135c1d..338cc34098 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -53,8 +53,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -94,6 +92,9 @@ using namespace std; #include "python_handler.h" #endif +using namespace std; + + //////////////////////////////////////////////////////////////////////// // Constants diff --git a/src/tools/other/ascii2nc/ascii2nc_conf_info.cc b/src/tools/other/ascii2nc/ascii2nc_conf_info.cc index 3518b0c68f..fe8c255e83 100644 --- a/src/tools/other/ascii2nc/ascii2nc_conf_info.cc +++ b/src/tools/other/ascii2nc/ascii2nc_conf_info.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/other/ascii2nc/ismn_handler.cc b/src/tools/other/ascii2nc/ismn_handler.cc index e1b2e45759..73faf46c49 100644 --- a/src/tools/other/ascii2nc/ismn_handler.cc +++ b/src/tools/other/ascii2nc/ismn_handler.cc @@ -18,6 +18,11 @@ using namespace std; #include "ismn_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + const int IsmnHandler::MIN_NUM_HDR_COLS = 8; const int IsmnHandler::NUM_OBS_COLS = 5; diff --git a/src/tools/other/ascii2nc/little_r_handler.cc b/src/tools/other/ascii2nc/little_r_handler.cc index a12bcfded4..3de94d81df 100644 --- a/src/tools/other/ascii2nc/little_r_handler.cc +++ b/src/tools/other/ascii2nc/little_r_handler.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include @@ -21,6 +18,10 @@ using namespace std; #include "little_r_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// static const double lr_end_value = -777777.0; static const double lr_missing_value = -888888.0; diff --git a/src/tools/other/ascii2nc/met_handler.cc b/src/tools/other/ascii2nc/met_handler.cc index 5b19b8b0f6..29d37c7d30 100644 --- a/src/tools/other/ascii2nc/met_handler.cc +++ b/src/tools/other/ascii2nc/met_handler.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "vx_log.h" @@ -20,6 +17,10 @@ using namespace std; #include "met_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// static const int n_met_col = 10; static const int n_met_col_qty = 11; diff --git a/src/tools/other/ascii2nc/ndbc_handler.cc b/src/tools/other/ascii2nc/ndbc_handler.cc index 9bd7a78888..1de6c26b9d 100644 --- a/src/tools/other/ascii2nc/ndbc_handler.cc +++ b/src/tools/other/ascii2nc/ndbc_handler.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +22,11 @@ using namespace std; #include "ndbc_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + static const char *stations_env = "MET_NDBC_STATIONS"; const int NdbcHandler::NDBC_FORMAT_VERSION_STANDARD = 1; diff --git a/src/tools/other/ascii2nc/ndbc_locations.cc b/src/tools/other/ascii2nc/ndbc_locations.cc index c4ceb75f60..d766e7e234 100644 --- a/src/tools/other/ascii2nc/ndbc_locations.cc +++ b/src/tools/other/ascii2nc/ndbc_locations.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -25,6 +22,10 @@ using namespace std; #include "ndbc_locations.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// static bool _parseLine(const string &sline, const string &key, string &value); static bool _parseLineForDouble(const string &sline, const string &key, double &value); diff --git a/src/tools/other/ascii2nc/python_handler.cc b/src/tools/other/ascii2nc/python_handler.cc index 28107fb1c7..eb3111cf53 100644 --- a/src/tools/other/ascii2nc/python_handler.cc +++ b/src/tools/other/ascii2nc/python_handler.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include @@ -23,6 +20,8 @@ using namespace std; #include "vx_python3_utils.h" #include "python_handler.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/ascii2nc/surfrad_handler.cc b/src/tools/other/ascii2nc/surfrad_handler.cc index d2f83572e0..47d45bceec 100644 --- a/src/tools/other/ascii2nc/surfrad_handler.cc +++ b/src/tools/other/ascii2nc/surfrad_handler.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "vx_log.h" @@ -21,6 +18,10 @@ using namespace std; #include "surfrad_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// const int SurfradHandler::NUM_HDR_COLS = 6; const int SurfradHandler::NUM_OBS_COLS = 48; diff --git a/src/tools/other/ascii2nc/wwsis_handler.cc b/src/tools/other/ascii2nc/wwsis_handler.cc index 57b9e23921..a12facb2ce 100644 --- a/src/tools/other/ascii2nc/wwsis_handler.cc +++ b/src/tools/other/ascii2nc/wwsis_handler.cc @@ -7,14 +7,9 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "vx_log.h" @@ -23,6 +18,11 @@ using namespace std; #include "wwsis_handler.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + const string WwsisHandler::HEADER_TYPE = (string)"WWSIS"; diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index dd6d003289..99f585aa14 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -23,7 +23,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -37,7 +36,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "gen_ens_prod.h" @@ -52,6 +50,10 @@ using namespace netCDF; #include "handle_openmp.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static void process_command_line(int, char **); diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc index cce3912742..143fea57c8 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -27,6 +26,9 @@ using namespace std; #include "GridTemplate.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class GenEnsProdConfInfo diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 3a2bf0224f..2aed24a706 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -34,7 +34,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -48,7 +47,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "gen_vx_mask.h" @@ -65,6 +63,10 @@ using namespace netCDF; #include "shp_file.h" #include "grid_closed_poly.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// int met_main(int argc, char *argv[]) { diff --git a/src/tools/other/gis_utils/gis_dump_dbf.cc b/src/tools/other/gis_utils/gis_dump_dbf.cc index c9aab98c9f..e7ed17ceb7 100644 --- a/src/tools/other/gis_utils/gis_dump_dbf.cc +++ b/src/tools/other/gis_utils/gis_dump_dbf.cc @@ -12,7 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -28,6 +27,8 @@ using namespace std; #include "dbf_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gis_utils/gis_dump_shp.cc b/src/tools/other/gis_utils/gis_dump_shp.cc index 5e95bacced..bea6615500 100644 --- a/src/tools/other/gis_utils/gis_dump_shp.cc +++ b/src/tools/other/gis_utils/gis_dump_shp.cc @@ -12,7 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -32,12 +31,13 @@ using namespace std; #include "shapetype_to_string.h" - #include "shp_file.h" #include "shp_poly_record.h" #include "shp_point_record.h" #include "shapetype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gis_utils/gis_dump_shx.cc b/src/tools/other/gis_utils/gis_dump_shx.cc index 7fdda4be1f..77455331ca 100644 --- a/src/tools/other/gis_utils/gis_dump_shx.cc +++ b/src/tools/other/gis_utils/gis_dump_shx.cc @@ -12,7 +12,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -28,6 +27,8 @@ using namespace std; #include "shx_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index 4a54b42ee2..b8292e4802 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -24,7 +24,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -38,7 +37,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "grid_diag.h" @@ -50,6 +48,10 @@ using namespace netCDF; #include "vx_regrid.h" #include "vx_log.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static void process_command_line(int, char **); diff --git a/src/tools/other/grid_diag/grid_diag_conf_info.cc b/src/tools/other/grid_diag/grid_diag_conf_info.cc index b463db9081..a8f00d634e 100644 --- a/src/tools/other/grid_diag/grid_diag_conf_info.cc +++ b/src/tools/other/grid_diag/grid_diag_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -23,6 +22,9 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class GridDiagConfInfo diff --git a/src/tools/other/gsi_tools/conv_record.cc b/src/tools/other/gsi_tools/conv_record.cc index 92d5cb8904..5a00487dd8 100644 --- a/src/tools/other/gsi_tools/conv_record.cc +++ b/src/tools/other/gsi_tools/conv_record.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +25,8 @@ using namespace std; #include "conv_offsets.h" #include "ftto.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsi_record.cc b/src/tools/other/gsi_tools/gsi_record.cc index 0f9bf88897..dde50d82e1 100644 --- a/src/tools/other/gsi_tools/gsi_record.cc +++ b/src/tools/other/gsi_tools/gsi_record.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "gsi_record.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsi_util.cc b/src/tools/other/gsi_tools/gsi_util.cc index d56da8a71c..8f88d11c23 100644 --- a/src/tools/other/gsi_tools/gsi_util.cc +++ b/src/tools/other/gsi_tools/gsi_util.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -25,6 +24,9 @@ using namespace std; #include "rad_record.h" #include "gsi_util.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsid2mpr.cc b/src/tools/other/gsi_tools/gsid2mpr.cc index b12c853171..5565452163 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.cc +++ b/src/tools/other/gsi_tools/gsid2mpr.cc @@ -21,7 +21,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -46,6 +45,9 @@ using namespace std; #include "gsi_util.h" #include "gsid2mpr.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static void process_conv(const char *conv_filename, const char *output_filename); diff --git a/src/tools/other/gsi_tools/rad_config.cc b/src/tools/other/gsi_tools/rad_config.cc index 86bb3af627..706b9c7f68 100644 --- a/src/tools/other/gsi_tools/rad_config.cc +++ b/src/tools/other/gsi_tools/rad_config.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "rad_config.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/rad_record.cc b/src/tools/other/gsi_tools/rad_record.cc index eac2a3bd68..04ab4b5052 100644 --- a/src/tools/other/gsi_tools/rad_record.cc +++ b/src/tools/other/gsi_tools/rad_record.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -27,6 +25,8 @@ using namespace std; #include "rad_offsets.h" #include "ftto.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/lidar2nc/calipso_5km.cc b/src/tools/other/lidar2nc/calipso_5km.cc index a169627fa7..d77fdd3ab0 100644 --- a/src/tools/other/lidar2nc/calipso_5km.cc +++ b/src/tools/other/lidar2nc/calipso_5km.cc @@ -11,6 +11,11 @@ //////////////////////////////////////////////////////////////////////// +#include "nint.h" +#include "write_netcdf.h" + +#include "calipso_5km.h" + using namespace std; @@ -27,15 +32,6 @@ static float ff[2]; //////////////////////////////////////////////////////////////////////// -#include "nint.h" -#include "write_netcdf.h" - -#include "calipso_5km.h" - - -//////////////////////////////////////////////////////////////////////// - - inline float km_to_meters(float km) { if ( km == FILL_VALUE ) return ( FILL_VALUE ); diff --git a/src/tools/other/lidar2nc/hdf_utils.cc b/src/tools/other/lidar2nc/hdf_utils.cc index fd5e66530e..bceef11fc5 100644 --- a/src/tools/other/lidar2nc/hdf_utils.cc +++ b/src/tools/other/lidar2nc/hdf_utils.cc @@ -11,13 +11,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; -//////////////////////////////////////////////////////////////////////// +#include "hdf_utils.h" -#include "hdf_utils.h" +using namespace std; //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index b2e6573f44..5f51532653 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -23,13 +23,6 @@ //////////////////////////////////////////////////////////////////////// -static const char hdr_typ_string[] = "calipso"; - - -//////////////////////////////////////////////////////////////////////// - -using namespace std; - #include #include #include @@ -43,7 +36,6 @@ using namespace std; #include #include -using namespace netCDF; #include "hdf.h" #include "mfhdf.h" @@ -62,6 +54,14 @@ using namespace netCDF; #include "nc_obs_util.h" #include "nc_point_obs_out.h" +using namespace std; +using namespace netCDF; + + +//////////////////////////////////////////////////////////////////////// + +static const char hdr_typ_string[] = "calipso"; + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index 3a77ce8d72..8aa7bc886e 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -37,7 +37,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -51,7 +50,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "madis2nc.h" @@ -63,6 +61,10 @@ using namespace netCDF; #include "vx_log.h" #include "nc_point_obs_out.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/madis2nc/madis2nc_conf_info.cc b/src/tools/other/madis2nc/madis2nc_conf_info.cc index 6375d0098c..c4b864ab13 100644 --- a/src/tools/other/madis2nc/madis2nc_conf_info.cc +++ b/src/tools/other/madis2nc/madis2nc_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -22,6 +21,8 @@ using namespace std; #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/other/mode_graphics/cgraph_font.cc b/src/tools/other/mode_graphics/cgraph_font.cc index 451b6f9c90..2e32369a36 100644 --- a/src/tools/other/mode_graphics/cgraph_font.cc +++ b/src/tools/other/mode_graphics/cgraph_font.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "cgraph_font.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/cgraph_main.cc b/src/tools/other/mode_graphics/cgraph_main.cc index baa2b3be01..abf6384160 100644 --- a/src/tools/other/mode_graphics/cgraph_main.cc +++ b/src/tools/other/mode_graphics/cgraph_main.cc @@ -19,8 +19,6 @@ static const int fl_ligature = 175; //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -35,6 +33,8 @@ using namespace std; #include "gs_ps_map.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc index 313b169ca4..772e8e840d 100644 --- a/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc +++ b/src/tools/other/mode_graphics/cgraphbase_plottype_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "cgraphbase_plottype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/color_stack.cc b/src/tools/other/mode_graphics/color_stack.cc index fb9d750364..2f14457888 100644 --- a/src/tools/other/mode_graphics/color_stack.cc +++ b/src/tools/other/mode_graphics/color_stack.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -23,6 +20,8 @@ using namespace std; #include "color_stack.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.cc b/src/tools/other/mode_graphics/mode_nc_output_file.cc index b958f30d6d..cc8b4e0eb0 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.cc +++ b/src/tools/other/mode_graphics/mode_nc_output_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,12 +18,14 @@ using namespace std; #include #include -using namespace netCDF; #include "mode_nc_output_file.h" #include "nc_var_info.h" #include "nc_utils.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index e15bb31c7a..56efe36b26 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -22,17 +22,6 @@ //////////////////////////////////////////////////////////////////////// -static const int anno_height = 100; - -static const int ctable_width = 15; - -static const int ctable_text_width = 30; - - -//////////////////////////////////////////////////////////////////////// - -using namespace std; - #include #include #include @@ -48,10 +37,21 @@ using namespace std; #include "vx_config.h" #include "configobjecttype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// +static const int anno_height = 100; + +static const int ctable_width = 15; + +static const int ctable_text_width = 30; + + +//////////////////////////////////////////////////////////////////////// + static ConcatString program_name; static CommandLine cline; diff --git a/src/tools/other/mode_time_domain/2d_att.cc b/src/tools/other/mode_time_domain/2d_att.cc index 09533c9311..7dc5c842f7 100644 --- a/src/tools/other/mode_time_domain/2d_att.cc +++ b/src/tools/other/mode_time_domain/2d_att.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "3d_txt_header.h" #include "2d_columns.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/2d_att_array.cc b/src/tools/other/mode_time_domain/2d_att_array.cc index 04b5310414..0a30db3f69 100644 --- a/src/tools/other/mode_time_domain/2d_att_array.cc +++ b/src/tools/other/mode_time_domain/2d_att_array.cc @@ -24,9 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -37,6 +34,8 @@ using namespace std; #include "2d_att_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/2d_moments.cc b/src/tools/other/mode_time_domain/2d_moments.cc index 8e4e2a972b..e5eb3313db 100644 --- a/src/tools/other/mode_time_domain/2d_moments.cc +++ b/src/tools/other/mode_time_domain/2d_moments.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "trig.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_att.cc b/src/tools/other/mode_time_domain/3d_att.cc index b35b4d6116..380d49c604 100644 --- a/src/tools/other/mode_time_domain/3d_att.cc +++ b/src/tools/other/mode_time_domain/3d_att.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -28,6 +26,8 @@ using namespace std; #include "3d_txt_header.h" #include "3d_single_columns.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_att_pair_array.cc b/src/tools/other/mode_time_domain/3d_att_pair_array.cc index 6e2278889c..57c7a3b2e3 100644 --- a/src/tools/other/mode_time_domain/3d_att_pair_array.cc +++ b/src/tools/other/mode_time_domain/3d_att_pair_array.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,8 @@ using namespace std; #include "3d_att_pair_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_att_single_array.cc b/src/tools/other/mode_time_domain/3d_att_single_array.cc index 120747e92f..f77301785a 100644 --- a/src/tools/other/mode_time_domain/3d_att_single_array.cc +++ b/src/tools/other/mode_time_domain/3d_att_single_array.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,8 @@ using namespace std; #include "3d_att_single_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/3d_moments.cc b/src/tools/other/mode_time_domain/3d_moments.cc index 2f58298bc0..e7ae40f8c9 100644 --- a/src/tools/other/mode_time_domain/3d_moments.cc +++ b/src/tools/other/mode_time_domain/3d_moments.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "trig.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/fo_graph.cc b/src/tools/other/mode_time_domain/fo_graph.cc index eebc762c26..f088725df2 100644 --- a/src/tools/other/mode_time_domain/fo_graph.cc +++ b/src/tools/other/mode_time_domain/fo_graph.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "fo_graph.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/fo_node.cc b/src/tools/other/mode_time_domain/fo_node.cc index bcad38ee9b..4ea1adf874 100644 --- a/src/tools/other/mode_time_domain/fo_node.cc +++ b/src/tools/other/mode_time_domain/fo_node.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "fo_node.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/fo_node_array.cc b/src/tools/other/mode_time_domain/fo_node_array.cc index 045daaa0ba..4ae86d055a 100644 --- a/src/tools/other/mode_time_domain/fo_node_array.cc +++ b/src/tools/other/mode_time_domain/fo_node_array.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,8 @@ using namespace std; #include "fo_node_array.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/interest_calc.cc b/src/tools/other/mode_time_domain/interest_calc.cc index 9567f78caa..fc55e034b2 100644 --- a/src/tools/other/mode_time_domain/interest_calc.cc +++ b/src/tools/other/mode_time_domain/interest_calc.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "interest_calc.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mm_engine.cc b/src/tools/other/mode_time_domain/mm_engine.cc index 34f7546d48..4351daac7d 100644 --- a/src/tools/other/mode_time_domain/mm_engine.cc +++ b/src/tools/other/mode_time_domain/mm_engine.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "mm_engine.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd.cc b/src/tools/other/mode_time_domain/mtd.cc index 77df84c09f..4ca6ac9f0d 100644 --- a/src/tools/other/mode_time_domain/mtd.cc +++ b/src/tools/other/mode_time_domain/mtd.cc @@ -26,25 +26,6 @@ //////////////////////////////////////////////////////////////////////// -static const char default_config_path [] = "MET_BASE/config/MTDConfig_default"; - -static const char txt_2d_suffix [] = "2d.txt"; - -static const char txt_3d_single_simple_suffix [] = "3d_single_simple.txt"; -static const char txt_3d_pair_simple_suffix [] = "3d_pair_simple.txt"; - -static const char txt_3d_single_cluster_suffix [] = "3d_single_cluster.txt"; -static const char txt_3d_pair_cluster_suffix [] = "3d_pair_cluster.txt"; - -static const char nc_suffix [] = "obj.nc"; - -static const char default_prefix [] = "mtd"; - - -//////////////////////////////////////////////////////////////////////// - -using namespace std; - #include #include #include @@ -61,6 +42,26 @@ using namespace std; #include "mm_engine.h" #include "mtd_nc_output.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + + +static const char default_config_path [] = "MET_BASE/config/MTDConfig_default"; + +static const char txt_2d_suffix [] = "2d.txt"; + +static const char txt_3d_single_simple_suffix [] = "3d_single_simple.txt"; +static const char txt_3d_pair_simple_suffix [] = "3d_pair_simple.txt"; + +static const char txt_3d_single_cluster_suffix [] = "3d_single_cluster.txt"; +static const char txt_3d_pair_cluster_suffix [] = "3d_pair_cluster.txt"; + +static const char nc_suffix [] = "obj.nc"; + +static const char default_prefix [] = "mtd"; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_config_info.cc b/src/tools/other/mode_time_domain/mtd_config_info.cc index ff6c6e0a9e..6842fd5fdd 100644 --- a/src/tools/other/mode_time_domain/mtd_config_info.cc +++ b/src/tools/other/mode_time_domain/mtd_config_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -26,6 +25,9 @@ using namespace std; #include "vx_data2d_factory.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_file_base.cc b/src/tools/other/mode_time_domain/mtd_file_base.cc index fbd98dcf71..3e739ab2bd 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.cc +++ b/src/tools/other/mode_time_domain/mtd_file_base.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,7 +19,6 @@ using namespace std; #include #include -using namespace netCDF; #include "mtd_file.h" #include "mtd_partition.h" @@ -32,6 +29,9 @@ using namespace netCDF; #include "vx_math.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_file_float.cc b/src/tools/other/mode_time_domain/mtd_file_float.cc index 0f0d3d6f7e..b148364db4 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.cc +++ b/src/tools/other/mode_time_domain/mtd_file_float.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,7 +20,6 @@ using namespace std; #include #include -using namespace netCDF; #include "mtd_file.h" #include "mtd_partition.h" @@ -31,6 +28,9 @@ using namespace netCDF; #include "vx_math.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_file_int.cc b/src/tools/other/mode_time_domain/mtd_file_int.cc index 5964e4c5e2..77f72a3755 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.cc +++ b/src/tools/other/mode_time_domain/mtd_file_int.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,7 +20,6 @@ using namespace std; #include #include -using namespace netCDF; #include "mtd_file.h" #include "mtd_partition.h" @@ -31,6 +28,9 @@ using namespace netCDF; #include "vx_math.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_nc_output.cc b/src/tools/other/mode_time_domain/mtd_nc_output.cc index cf5ea008b7..497cacdcd1 100644 --- a/src/tools/other/mode_time_domain/mtd_nc_output.cc +++ b/src/tools/other/mode_time_domain/mtd_nc_output.cc @@ -10,20 +10,20 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include #include #include -using namespace netCDF; #include "mtd_nc_output.h" #include "write_netcdf.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_partition.cc b/src/tools/other/mode_time_domain/mtd_partition.cc index 57db83dde7..ff092c1eba 100644 --- a/src/tools/other/mode_time_domain/mtd_partition.cc +++ b/src/tools/other/mode_time_domain/mtd_partition.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "mtd_partition.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_read_data.cc b/src/tools/other/mode_time_domain/mtd_read_data.cc index 20f28a6aeb..74733a8de6 100644 --- a/src/tools/other/mode_time_domain/mtd_read_data.cc +++ b/src/tools/other/mode_time_domain/mtd_read_data.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,9 @@ using namespace std; #include "num_array.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_txt_output.cc b/src/tools/other/mode_time_domain/mtd_txt_output.cc index dea4ac4f0c..f1ee61aa5d 100644 --- a/src/tools/other/mode_time_domain/mtd_txt_output.cc +++ b/src/tools/other/mode_time_domain/mtd_txt_output.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -29,6 +26,8 @@ using namespace std; #include "3d_single_columns.h" #include "2d_columns.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtdfiletype_to_string.cc b/src/tools/other/mode_time_domain/mtdfiletype_to_string.cc index 8587710e51..7857538909 100644 --- a/src/tools/other/mode_time_domain/mtdfiletype_to_string.cc +++ b/src/tools/other/mode_time_domain/mtdfiletype_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "mtdfiletype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/nc_grid.cc b/src/tools/other/mode_time_domain/nc_grid.cc index 83fb326d07..f8bb76153e 100644 --- a/src/tools/other/mode_time_domain/nc_grid.cc +++ b/src/tools/other/mode_time_domain/nc_grid.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,11 +19,13 @@ using namespace std; #include #include -using namespace netCDF; #include "nc_utils_local.h" #include "nc_grid.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/nc_utils_local.cc b/src/tools/other/mode_time_domain/nc_utils_local.cc index d80d335f1b..b4db4d4e0e 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.cc +++ b/src/tools/other/mode_time_domain/nc_utils_local.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,12 +19,14 @@ using namespace std; #include #include -using namespace netCDF; #include "nc_utils.h" #include "nc_utils_local.h" #include "vx_log.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/cloudsat_swath_file.cc b/src/tools/other/modis_regrid/cloudsat_swath_file.cc index 233cdea2b0..6630c2844b 100644 --- a/src/tools/other/modis_regrid/cloudsat_swath_file.cc +++ b/src/tools/other/modis_regrid/cloudsat_swath_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -23,6 +21,8 @@ using namespace std; #include "cloudsat_swath_file.h" #include "sat_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/data_averager.cc b/src/tools/other/modis_regrid/data_averager.cc index e756a4bf7a..a3e9657037 100644 --- a/src/tools/other/modis_regrid/data_averager.cc +++ b/src/tools/other/modis_regrid/data_averager.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "vx_math.h" #include "vx_cal.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc index af9c50c0ff..e43ea1b0df 100644 --- a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc +++ b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,7 +20,6 @@ using namespace std; #include #include -using namespace netCDF; #include "data_plane_to_netcdf.h" #include "vx_log.h" // mlog @@ -32,6 +29,11 @@ using namespace netCDF; #include "write_netcdf.h" // write_netcdf functions #include "var_info_factory.h" // VarInfoFactory +using namespace std; +using namespace netCDF; + + +//////////////////////////////////////////////////////////////////////// extern int get_compress(); diff --git a/src/tools/other/modis_regrid/modis_file.cc b/src/tools/other/modis_regrid/modis_file.cc index c712f2330f..980f52ff5a 100644 --- a/src/tools/other/modis_regrid/modis_file.cc +++ b/src/tools/other/modis_regrid/modis_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -25,6 +23,8 @@ using namespace std; #include "sat_utils.h" #include "cloudsat_swath_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 788898b60f..f62e654b52 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -10,13 +10,6 @@ //////////////////////////////////////////////////////////////////////// -static const char default_units [] = "none"; - - -//////////////////////////////////////////////////////////////////////// - -using namespace std; - #include #include #include @@ -35,6 +28,14 @@ using namespace std; #include "data_averager.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + + +static const char default_units [] = "none"; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/sat_utils.cc b/src/tools/other/modis_regrid/sat_utils.cc index 55402459b9..adfbc03f06 100644 --- a/src/tools/other/modis_regrid/sat_utils.cc +++ b/src/tools/other/modis_regrid/sat_utils.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -20,6 +18,8 @@ using namespace std; #include "sat_utils.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/pb2nc/pb2nc_conf_info.cc b/src/tools/other/pb2nc/pb2nc_conf_info.cc index 69af15a22d..7c7db4cee5 100644 --- a/src/tools/other/pb2nc/pb2nc_conf_info.cc +++ b/src/tools/other/pb2nc/pb2nc_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -25,6 +24,8 @@ using namespace std; #include "grib_strings.h" #include "vx_log.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/plot_data_plane/plot_data_plane.cc b/src/tools/other/plot_data_plane/plot_data_plane.cc index 89f7c8c8ca..ecab619d02 100644 --- a/src/tools/other/plot_data_plane/plot_data_plane.cc +++ b/src/tools/other/plot_data_plane/plot_data_plane.cc @@ -30,7 +30,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -61,6 +60,9 @@ using namespace std; #include "data2d_python.h" #endif +using namespace std; + + //////////////////////////////////////////////////////////////////////// static ConcatString program_name = (string)"plot_data_plane"; diff --git a/src/tools/other/plot_point_obs/plot_point_obs.cc b/src/tools/other/plot_point_obs/plot_point_obs.cc index 66eb91ee0d..b5f012c575 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs.cc @@ -30,7 +30,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -53,6 +52,9 @@ using namespace std; #include "vx_plot_util.h" #include "nc_point_obs_in.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static void usage(); diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc index 04b798e71a..254cc232c3 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include "vx_log.h" #include "vx_util.h" @@ -20,6 +19,9 @@ using namespace std; #include "plot_point_obs_conf_info.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// bool LocationInfo::operator==(const LocationInfo &x) { diff --git a/src/tools/other/point2grid/point2grid_conf_info.cc b/src/tools/other/point2grid/point2grid_conf_info.cc index 84cfec4a12..87d6aa966f 100644 --- a/src/tools/other/point2grid/point2grid_conf_info.cc +++ b/src/tools/other/point2grid/point2grid_conf_info.cc @@ -8,11 +8,13 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include "point2grid_conf_info.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class PointToGridConfInfo diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 309aaf3d6a..c348388263 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -28,7 +28,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -44,7 +43,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "vx_log.h" @@ -58,6 +56,10 @@ using namespace netCDF; #include "GridTemplate.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index 411f5dd10f..648531df22 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -27,7 +27,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -41,7 +40,6 @@ using namespace std; #include #include -using namespace netCDF; #include "GridTemplate.h" @@ -58,6 +56,10 @@ using namespace netCDF; #include "data2d_python.h" #endif +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; diff --git a/src/tools/other/wwmca_tool/af_cp_file.cc b/src/tools/other/wwmca_tool/af_cp_file.cc index 70acdb4941..aea2b6907c 100644 --- a/src/tools/other/wwmca_tool/af_cp_file.cc +++ b/src/tools/other/wwmca_tool/af_cp_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "af_file.h" #include "af_cp_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/af_file.cc b/src/tools/other/wwmca_tool/af_file.cc index e0618a2b41..7a252a184e 100644 --- a/src/tools/other/wwmca_tool/af_file.cc +++ b/src/tools/other/wwmca_tool/af_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "af_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/af_pt_file.cc b/src/tools/other/wwmca_tool/af_pt_file.cc index 4b875257d4..c1f55a2f7d 100644 --- a/src/tools/other/wwmca_tool/af_pt_file.cc +++ b/src/tools/other/wwmca_tool/af_pt_file.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,6 +28,8 @@ using namespace std; #include "af_file.h" #include "af_pt_file.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/ave_interp.cc b/src/tools/other/wwmca_tool/ave_interp.cc index a9a2cbcf32..efd3d5e90d 100644 --- a/src/tools/other/wwmca_tool/ave_interp.cc +++ b/src/tools/other/wwmca_tool/ave_interp.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "ave_interp.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/gridhemisphere_to_string.cc b/src/tools/other/wwmca_tool/gridhemisphere_to_string.cc index 884ed06486..4c32d7da8a 100644 --- a/src/tools/other/wwmca_tool/gridhemisphere_to_string.cc +++ b/src/tools/other/wwmca_tool/gridhemisphere_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "gridhemisphere_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/interp_base.cc b/src/tools/other/wwmca_tool/interp_base.cc index 0b7dd9f182..7eedff3fde 100644 --- a/src/tools/other/wwmca_tool/interp_base.cc +++ b/src/tools/other/wwmca_tool/interp_base.cc @@ -10,9 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -21,6 +18,8 @@ using namespace std; #include "vx_log.h" #include "interp_base.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/max_interp.cc b/src/tools/other/wwmca_tool/max_interp.cc index 42a1fe322c..bf8a5e7b89 100644 --- a/src/tools/other/wwmca_tool/max_interp.cc +++ b/src/tools/other/wwmca_tool/max_interp.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "max_interp.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/min_interp.cc b/src/tools/other/wwmca_tool/min_interp.cc index 536aa90211..5018b44698 100644 --- a/src/tools/other/wwmca_tool/min_interp.cc +++ b/src/tools/other/wwmca_tool/min_interp.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -22,6 +20,8 @@ using namespace std; #include "min_interp.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/nc_output.cc b/src/tools/other/wwmca_tool/nc_output.cc index 7e68c7ab11..54db32f195 100644 --- a/src/tools/other/wwmca_tool/nc_output.cc +++ b/src/tools/other/wwmca_tool/nc_output.cc @@ -10,15 +10,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include #include #include -using namespace netCDF; #include "vx_log.h" #include "vx_cal.h" @@ -29,6 +26,9 @@ using namespace netCDF; #include "nc_utils.h" #include "write_netcdf.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/nearest_interp.cc b/src/tools/other/wwmca_tool/nearest_interp.cc index 2951fdd635..9d7972d8f6 100644 --- a/src/tools/other/wwmca_tool/nearest_interp.cc +++ b/src/tools/other/wwmca_tool/nearest_interp.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "nearest_interp.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index b960362156..fafe1adedf 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -7,19 +7,6 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -//////////////////////////////////////////////////////////////////////// - -using namespace std; - -static const int gray_min = 130; // these values must be between 0 and 255 inclusive -static const int gray_max = 255; - -static const double h_margin = 40.0; -static const double v_margin = 80.0; - -static const char map_filename [] = "MET_BASE/map/country_major_lakes_data"; - - //////////////////////////////////////////////////////////////////////// @@ -44,6 +31,19 @@ static const char map_filename [] = "MET_BASE/map/country_major_lakes_data"; #include "af_cp_file.h" #include "af_pt_file.h" +using namespace std; + + +//////////////////////////////////////////////////////////////////////// + +static const int gray_min = 130; // these values must be between 0 and 255 inclusive +static const int gray_max = 255; + +static const double h_margin = 40.0; +static const double v_margin = 80.0; + +static const char map_filename [] = "MET_BASE/map/country_major_lakes_data"; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/wwmca_ref.cc b/src/tools/other/wwmca_tool/wwmca_ref.cc index ff66c54268..c154a45430 100644 --- a/src/tools/other/wwmca_tool/wwmca_ref.cc +++ b/src/tools/other/wwmca_tool/wwmca_ref.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -32,6 +30,8 @@ using namespace std; #include "grid_output.h" #include "apply_mask.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/wwmca_tool/wwmca_regrid.cc b/src/tools/other/wwmca_tool/wwmca_regrid.cc index e25929420b..d0c58ba608 100644 --- a/src/tools/other/wwmca_tool/wwmca_regrid.cc +++ b/src/tools/other/wwmca_tool/wwmca_regrid.cc @@ -10,8 +10,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -24,6 +22,8 @@ using namespace std; #include "wwmca_ref.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index f2d2b3b5cf..0cc3dfc333 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -6,7 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -using namespace std; #include #include @@ -19,7 +18,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "rmw_analysis.h" @@ -29,6 +27,9 @@ using namespace netCDF; #include "vx_util.h" #include "vx_log.h" +using namespace std; +using namespace netCDF; + //////////////////////////////////////////////////////////////////////// static void usage(); diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index 6862e56cae..cb7642a5fe 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -23,6 +22,9 @@ using namespace std; #include "apply_mask.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class RMWAnalysisConfInfo diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 332587b9eb..afdbec9992 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -20,7 +20,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -33,7 +32,6 @@ using namespace std; #include #include -using namespace netCDF; #ifdef _OPENMP #include "omp.h" @@ -57,6 +55,10 @@ using namespace netCDF; #include "met_file.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static void usage(); diff --git a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc index 7684308b81..b4651ca7e6 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -22,6 +21,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for struct DataOptInfo diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index dbdc7d976a..57af2dea1c 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -23,7 +23,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -36,7 +35,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "grib_classes.h" @@ -51,6 +49,10 @@ using namespace netCDF; #include "write_netcdf.h" #include "tc_poly.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; diff --git a/src/tools/tc_utils/tc_dland/tc_poly.cc b/src/tools/tc_utils/tc_dland/tc_poly.cc index 9f3f892097..b0b0a179c3 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.cc +++ b/src/tools/tc_utils/tc_dland/tc_poly.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -22,6 +21,9 @@ using namespace std; #include "tc_poly.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class TCPoly diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index e25c43f64d..9710e45a26 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -49,7 +49,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -73,6 +72,9 @@ using namespace std; #include "met_file.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static const int mxp = 1000; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc index cfd22631b5..5c53ff22fa 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -23,6 +22,9 @@ using namespace std; #include "apply_mask.h" #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// void parse_conf_diag_info_map(Dictionary *, diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 4520b1d5ca..e452508e59 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -22,7 +22,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -35,7 +34,6 @@ using namespace std; #include #include -using namespace netCDF; #include "main.h" #include "tc_rmw.h" @@ -55,6 +53,10 @@ using namespace netCDF; #include "met_file.h" +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static void usage(); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 19fa16a3c6..017a446c3c 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -22,6 +21,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class TCRMWConfInfo diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc index e5e1a5997e..5f717f3f3c 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc @@ -20,12 +20,14 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include "tc_rmw_wind_converter.h" #include "series_data.h" #include "vx_regrid.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static void wind_ne_to_ra(const TcrmwGrid&, diff --git a/src/tools/tc_utils/tc_stat/tc_stat.cc b/src/tools/tc_utils/tc_stat/tc_stat.cc index d1e85b0855..6519b7befc 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -25,7 +25,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -48,6 +47,9 @@ using namespace std; #include "met_file.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// static void process_command_line(int, char **); diff --git a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc index 7cc8f5a167..86eb2c43e8 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_conf_info.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -22,6 +21,9 @@ using namespace std; #include "vx_log.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // Functions for parsing config entries diff --git a/src/tools/tc_utils/tc_stat/tc_stat_files.cc b/src/tools/tc_utils/tc_stat/tc_stat_files.cc index 61a2ed8681..8410a9125f 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_files.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_files.cc @@ -8,7 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -27,6 +26,9 @@ using namespace std; #include "vx_util.h" #include "vx_math.h" +using namespace std; + + //////////////////////////////////////////////////////////////////////// // // Code for class TCStatFiles From 2509f7c1d99d3320930f5d597c6ad0abe80da27d Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 5 Mar 2024 15:40:05 +0000 Subject: [PATCH 21/72] #2673 Added std namespace --- src/tools/core/mode/combine_boolplanes.h | 4 +-- src/tools/core/mode/mode_superobject.h | 6 ++-- src/tools/core/mode/multivar_data.h | 28 +++++++++---------- src/tools/core/mode/multivar_frontend.h | 28 +++++++++---------- .../series_analysis_conf_info.h | 2 +- src/tools/core/stat_analysis/aggr_stat_line.h | 2 +- src/tools/dev_utils/insitu_nc_file.h | 10 +++---- src/tools/other/ascii2nc/ascii2nc_conf_info.h | 8 +++--- src/tools/other/ascii2nc/ismn_handler.h | 10 +++---- src/tools/other/ascii2nc/little_r_handler.h | 4 +-- src/tools/other/ascii2nc/met_handler.h | 4 +-- src/tools/other/ascii2nc/ndbc_handler.h | 22 +++++++-------- src/tools/other/ascii2nc/ndbc_locations.h | 16 +++++------ src/tools/other/ascii2nc/python_handler.h | 6 ++-- src/tools/other/ascii2nc/surfrad_handler.h | 8 +++--- src/tools/other/ascii2nc/wwsis_handler.h | 12 ++++---- src/tools/other/gen_vx_mask/gen_vx_mask.h | 2 +- src/tools/other/grid_diag/grid_diag.h | 26 ++++++++--------- .../other/grid_diag/grid_diag_conf_info.h | 2 +- src/tools/other/gsi_tools/gsid2mpr.h | 2 +- src/tools/other/madis2nc/madis2nc.h | 2 +- .../other/mode_time_domain/mtd_read_data.h | 6 ++-- .../other/point2grid/point2grid_conf_info.h | 4 +-- 23 files changed, 106 insertions(+), 108 deletions(-) diff --git a/src/tools/core/mode/combine_boolplanes.h b/src/tools/core/mode/combine_boolplanes.h index d086eb4f06..2a7c168628 100644 --- a/src/tools/core/mode/combine_boolplanes.h +++ b/src/tools/core/mode/combine_boolplanes.h @@ -34,13 +34,11 @@ //////////////////////////////////////////////////////////////////////// -extern void combine_boolplanes(const string &name, +extern void combine_boolplanes(const std::string &name, const BoolPlane * array, const int n_planes, BoolCalc & calc, BoolPlane & bp_out); - - //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/mode/mode_superobject.h b/src/tools/core/mode/mode_superobject.h index 4450487af4..71d88c430a 100644 --- a/src/tools/core/mode/mode_superobject.h +++ b/src/tools/core/mode/mode_superobject.h @@ -31,12 +31,12 @@ class ModeSuperObject { public: ModeSuperObject(bool isFcst, int n_files, bool do_clusters, - const vector &mvd, + const std::vector &mvd, BoolCalc &calc); inline ~ModeSuperObject() {} - void mask_data_simple(const string &name, MultiVarData &mvd) const; - void mask_data_super(const string &name, const MultiVarData &mvd); + void mask_data_simple(const std::string &name, MultiVarData &mvd) const; + void mask_data_super(const std::string &name, const MultiVarData &mvd); bool _isFcst; bool _hasUnion; diff --git a/src/tools/core/mode/multivar_data.h b/src/tools/core/mode/multivar_data.h index dcd4ef8197..5fbfd0af0b 100644 --- a/src/tools/core/mode/multivar_data.h +++ b/src/tools/core/mode/multivar_data.h @@ -30,11 +30,11 @@ class MultiVarData1 { int *_fill_int_array(ShapeData *sd); float *_fill_float_array(ShapeData *sd); - void _print_summary(const string &name, int *data, const ShapeData &sd) const; + void _print_summary(const std::string &name, int *data, const ShapeData &sd) const; public: - inline MultiVarData1(int nx, int ny, const string &name, + inline MultiVarData1(int nx, int ny, const std::string &name, ModeDataType dataType) : _dataType(dataType), _name(name), @@ -46,13 +46,13 @@ class MultiVarData1 { _convThreshArray(), _mergeThreshArray() {} - + inline ~MultiVarData1() { if (_obj_sd) delete _obj_sd; if (_obj_data) delete [] _obj_data; if (_raw_data) delete [] _raw_data; if (_sd) delete _sd; - } + } void set_obj(ShapeData *sd); void set_raw(ShapeData *sd); @@ -61,10 +61,10 @@ class MultiVarData1 { void set_merge_thresh_array(const ThreshArray &t); void objects_from_arrays(bool do_clusters, BoolPlane & out); - void print(const string &name) const; + void print(const std::string &name) const; ModeDataType _dataType; - string _name; + std::string _name; ShapeData *_obj_sd; int *_obj_data; float *_raw_data; @@ -84,12 +84,12 @@ class MultiVarData { MultiVarData(); ~MultiVarData(); - + void init(ModeDataType dataType, - const string &name, - const Grid &grid, - const string &units, - const string &level, + const std::string &name, + const Grid &grid, + const std::string &units, + const std::string &level, double data_min, double data_max); void set_obj(ShapeData *sd, bool simple); @@ -104,11 +104,11 @@ class MultiVarData { ModeDataType _dataType; MultiVarData1 *_simple; MultiVarData1 *_merge; - string _name; + std::string _name; int _nx, _ny; Grid *_grid; - string _units; - string _level; + std::string _units; + std::string _level; double _data_min, _data_max; }; diff --git a/src/tools/core/mode/multivar_frontend.h b/src/tools/core/mode/multivar_frontend.h index bb21913b9a..f4c78c243d 100644 --- a/src/tools/core/mode/multivar_frontend.h +++ b/src/tools/core/mode/multivar_frontend.h @@ -32,20 +32,20 @@ class MultivarFrontEnd { StringArray fcst_filenames; StringArray obs_filenames; BoolCalc f_calc, o_calc ; - vector fcstInput, obsInput; - vector mvdFcst, mvdObs; - string fcst_fof; - string obs_fof; + std::vector fcstInput, obsInput; + std::vector mvdFcst, mvdObs; + std::string fcst_fof; + std::string obs_fof; void _process_command_line(const StringArray &); - void _read_config(const string & filename); + void _read_config(const std::string & filename); void _setup_inputs(); void _set_output_path(); int _mkdir(const char *dir); void _simple_objects(ModeExecutive::Processing_t p, ModeDataType dtype, - int j, int n_files, const string &filename, + int j, int n_files, const std::string &filename, const ModeInputData &input); - void _init_exec(ModeExecutive::Processing_t p, const string &ffile, const string &ofile); + void _init_exec(ModeExecutive::Processing_t p, const std::string &ffile, const std::string &ofile); void _superobject_mode_algorithm(const ModeSuperObject &fsuper, const ModeSuperObject &osuper); void _intensity_compare_mode_algorithm(const MultiVarData &mvdf, const MultiVarData &mvdo, const ModeSuperObject &fsuper, const ModeSuperObject &osuper); @@ -55,11 +55,11 @@ class MultivarFrontEnd { public: bool do_clusters; - string default_out_dir; + std::string default_out_dir; ModeConfInfo config; ConcatString output_path; - string mode_path; - string config_file; + std::string mode_path; + std::string config_file; Grid verification_grid; MultivarFrontEnd(); @@ -75,22 +75,22 @@ class MultivarFrontEnd { static void set_verbosity (const StringArray &); static void set_compress (const StringArray &); - void read_input(const string &name, int index, ModeDataType type, + void read_input(const std::string &name, int index, ModeDataType type, GrdFileType f_t, GrdFileType other_t, int shift); void create_verif_grid(void); MultiVarData *create_simple_objects(ModeDataType dtype, int j, int n_files, - const string &filename, + const std::string &filename, const ModeInputData &input); void create_intensity_comparisons(int findex, int oindex, const ModeSuperObject &fsuper, const ModeSuperObject &osuper, MultiVarData &mvdf, MultiVarData &mvdo, - const string &fcst_filename, - const string &obs_filename); + const std::string &fcst_filename, + const std::string &obs_filename); void process_superobjects(ModeSuperObject &fsuper, ModeSuperObject &osuper, 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 4bf8527436..76f7041472 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.h +++ b/src/tools/core/series_analysis/series_analysis_conf_info.h @@ -81,7 +81,7 @@ class SeriesAnalysisConfInfo { ConcatString version; // Config file version // Mapping of line type to output statistics - map output_stats; + std::map output_stats; SeriesAnalysisConfInfo(); ~SeriesAnalysisConfInfo(); diff --git a/src/tools/core/stat_analysis/aggr_stat_line.h b/src/tools/core/stat_analysis/aggr_stat_line.h index 42f81d6a25..a934491a1f 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.h +++ b/src/tools/core/stat_analysis/aggr_stat_line.h @@ -178,7 +178,7 @@ struct ssvar_bin_cmp { // Otherwise, parse list of numbers and compare each element StringArray sa1 = cs1.split(":"); StringArray sa2 = cs2.split(":"); - for(int i=0; i getMessageTypeMap() const + std::map getMessageTypeMap() const { return _messageTypeMap; } @@ -56,7 +56,7 @@ class Ascii2NcConfInfo { ConcatString _version; TimeSummaryInfo _timeSummaryInfo; - map _messageTypeMap; + std::map _messageTypeMap; /////////////////////// diff --git a/src/tools/other/ascii2nc/ismn_handler.h b/src/tools/other/ascii2nc/ismn_handler.h index 9f8d26f829..d71cbd4d3e 100644 --- a/src/tools/other/ascii2nc/ismn_handler.h +++ b/src/tools/other/ascii2nc/ismn_handler.h @@ -22,7 +22,7 @@ struct obsVarInfo { int _gribCode; - string _varName; + std::string _varName; }; //////////////////////////////////////////////////////////////////////// @@ -90,12 +90,12 @@ class IsmnHandler : public FileHandler { public: - IsmnHandler(const string &program_name); + IsmnHandler(const std::string &program_name); virtual ~IsmnHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() { return "ismn"; } + static std::string getFormatString() { return "ismn"; } protected: @@ -124,8 +124,8 @@ class IsmnHandler : public FileHandler { StringArray _varNames; // Unchanging header information - string _networkName; - string _stationId; + std::string _networkName; + std::string _stationId; double _stationLat; double _stationLon; double _stationElv; diff --git a/src/tools/other/ascii2nc/little_r_handler.h b/src/tools/other/ascii2nc/little_r_handler.h index 0c72d9cefa..8d41180041 100644 --- a/src/tools/other/ascii2nc/little_r_handler.h +++ b/src/tools/other/ascii2nc/little_r_handler.h @@ -32,12 +32,12 @@ class LittleRHandler : public FileHandler public: - LittleRHandler(const string &program_name); + LittleRHandler(const std::string &program_name); virtual ~LittleRHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() + static std::string getFormatString() { return "little_r"; } diff --git a/src/tools/other/ascii2nc/met_handler.h b/src/tools/other/ascii2nc/met_handler.h index 54dbe39bda..17ef7ea852 100644 --- a/src/tools/other/ascii2nc/met_handler.h +++ b/src/tools/other/ascii2nc/met_handler.h @@ -30,12 +30,12 @@ class MetHandler : public FileHandler public: - MetHandler(const string &program_name); + MetHandler(const std::string &program_name); virtual ~MetHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() + static std::string getFormatString() { return "met_point"; } diff --git a/src/tools/other/ascii2nc/ndbc_handler.h b/src/tools/other/ascii2nc/ndbc_handler.h index 842b29eaac..95d0559e56 100644 --- a/src/tools/other/ascii2nc/ndbc_handler.h +++ b/src/tools/other/ascii2nc/ndbc_handler.h @@ -38,12 +38,12 @@ class NdbcHandler : public FileHandler class Column { public: - string name; // name of the header as found in the file + std::string name; // name of the header as found in the file int ptr; // column index for that data (0,1,..) - inline Column(const string &n) : name(n), ptr(-1) {} + inline Column(const std::string &n) : name(n), ptr(-1) {} inline ~Column() {} inline void clear(void) {ptr = -1;} - inline bool nameEquals(const string &s) const {return name == s;} + inline bool nameEquals(const std::string &s) const {return name == s;} inline void setPtr(int ipt) {ptr = ipt;} inline bool notSet(void) const {return ptr == -1;} }; @@ -51,14 +51,14 @@ class NdbcHandler : public FileHandler public: - NdbcHandler(const string &program_name); + NdbcHandler(const std::string &program_name); virtual ~NdbcHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; void setFormatVersion(int version); - static string getFormatStringStandard() + static std::string getFormatStringStandard() { return "ndbc_standard"; } @@ -92,7 +92,7 @@ class NdbcHandler : public FileHandler // // Unchanging header information for a file (each file is one station) // - string stationId; + std::string stationId; double stationLat; double stationLon; double stationAlt; @@ -107,10 +107,10 @@ class NdbcHandler : public FileHandler int column_pointer_minute; // storage for non time column information (name/pointer) - vector column; + std::vector column; // the lookup file for location information - string locationsFileName; + std::string locationsFileName; // the lookup object NdbcLocations locations; @@ -126,7 +126,7 @@ class NdbcHandler : public FileHandler // parse the file name to identify the station, then lookup and set the // location // - bool _setStationInfo(const string &filename); + bool _setStationInfo(const std::string &filename); // Read and save the header information from the given file, The file pointer // is assumed to be at the beginning of the file. Sets all the pointers based @@ -151,9 +151,9 @@ class NdbcHandler : public FileHandler // parse one line from the ascii file and add to observations bool _parseObservationLineStandard(DataLine &data_line, - const string &filename); + const std::string &filename); - string _extractColumn(const DataLine &data_line, int ptr) const; + std::string _extractColumn(const DataLine &data_line, int ptr) const; double _extractDouble(const DataLine &data_line, int ptr) const; }; diff --git a/src/tools/other/ascii2nc/ndbc_locations.h b/src/tools/other/ascii2nc/ndbc_locations.h index 4b4fc68eb9..9b238c9114 100644 --- a/src/tools/other/ascii2nc/ndbc_locations.h +++ b/src/tools/other/ascii2nc/ndbc_locations.h @@ -28,20 +28,20 @@ class NdbcLocations NdbcLocations(); virtual ~NdbcLocations(); - bool initialize(const string &locationsFile); - bool lookupLatLonElev(const string aqsid, double &lat, double &lon, double &elev) const; + bool initialize(const std::string &locationsFile); + bool lookupLatLonElev(const std::string aqsid, double &lat, double &lon, double &elev) const; void print(void) const; private: - bool _setPtr(DataLine &data_line, const string &headerName, int &ptr) const; + bool _setPtr(DataLine &data_line, const std::string &headerName, int &ptr) const; - string fileName; + std::string fileName; - vector StationId; - vector Lat; - vector Lon; - vector Elev; + std::vector StationId; + std::vector Lat; + std::vector Lon; + std::vector Elev; }; diff --git a/src/tools/other/ascii2nc/python_handler.h b/src/tools/other/ascii2nc/python_handler.h index 85f0a5c418..bd2d794092 100644 --- a/src/tools/other/ascii2nc/python_handler.h +++ b/src/tools/other/ascii2nc/python_handler.h @@ -41,13 +41,13 @@ class PythonHandler : public FileHandler public: - PythonHandler(const string &program_name); + PythonHandler(const std::string &program_name); PythonHandler(const char * program_name, const char * ascii_filename); virtual ~PythonHandler(); bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() { return "python"; } + static std::string getFormatString() { return "python"; } bool use_tmp_ascii; @@ -66,7 +66,7 @@ class PythonHandler : public FileHandler virtual bool _readObservations(LineDataFile &ascii_file); // this shouldn't be called - virtual bool readAsciiFiles(const vector< ConcatString > &ascii_filename_list); + virtual bool readAsciiFiles(const std::vector< ConcatString > &ascii_filename_list); bool do_straight (); // run compiled python interpreter bool do_tmp_ascii(); // run user-defined MET_PYTHON_EXE diff --git a/src/tools/other/ascii2nc/surfrad_handler.h b/src/tools/other/ascii2nc/surfrad_handler.h index 9f479db7c5..d6d71ffafe 100644 --- a/src/tools/other/ascii2nc/surfrad_handler.h +++ b/src/tools/other/ascii2nc/surfrad_handler.h @@ -31,12 +31,12 @@ class SurfradHandler : public FileHandler public: - SurfradHandler(const string &program_name); + SurfradHandler(const std::string &program_name); virtual ~SurfradHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() + static std::string getFormatString() { return "surfrad"; } @@ -59,7 +59,7 @@ class SurfradHandler : public FileHandler // The header type for these observations - static const string HEADER_TYPE; + static const std::string HEADER_TYPE; // Grib codes for the different fields @@ -91,7 +91,7 @@ class SurfradHandler : public FileHandler // Unchanging header information - string _stationId; + std::string _stationId; double _stationLat; double _stationLon; double _stationAlt; diff --git a/src/tools/other/ascii2nc/wwsis_handler.h b/src/tools/other/ascii2nc/wwsis_handler.h index ebb546a088..a5c913effb 100644 --- a/src/tools/other/ascii2nc/wwsis_handler.h +++ b/src/tools/other/ascii2nc/wwsis_handler.h @@ -33,12 +33,12 @@ class WwsisHandler : public FileHandler public: - WwsisHandler(const string &program_name); + WwsisHandler(const std::string &program_name); virtual ~WwsisHandler(); virtual bool isFileType(LineDataFile &ascii_file) const; - static string getFormatString() + static std::string getFormatString() { return "wwsis"; } @@ -51,7 +51,7 @@ class WwsisHandler : public FileHandler // The header type for these observations - static const string HEADER_TYPE; + static const std::string HEADER_TYPE; // Grib code for the field @@ -70,7 +70,7 @@ class WwsisHandler : public FileHandler int _stepSecs; double _watts; double _derate; - string _tracking; + std::string _tracking; double _tilt; double _azimuth; @@ -101,8 +101,8 @@ class WwsisHandler : public FileHandler // Get the initial valid time from the file name - int _getYearFromFilename(const string &filename) const; - time_t _initValidTime(const string &filename) const; + int _getYearFromFilename(const std::string &filename) const; + time_t _initValidTime(const std::string &filename) const; // Read the observations from the given file and add them to the // _observations vector. diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.h b/src/tools/other/gen_vx_mask/gen_vx_mask.h index 00c6f986cb..8ab03376a7 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.h +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.h @@ -106,7 +106,7 @@ static double mask_val = default_mask_val; static ConcatString mask_name; static unixtime solar_ut = (unixtime) 0; -static std::map shape_str_map; +static std::map shape_str_map; static NumArray shape_numbers; static std::vector shape_recs; diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 5f661bdb22..663bb70e7f 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -67,8 +67,8 @@ static const char * default_config_filename = //////////////////////////////////////////////////////////////////////// // Input files -static vector data_files; -static vector file_types; +static std::vector data_files; +static std::vector file_types; static int compress_level = -1; // Output file @@ -86,9 +86,9 @@ static GridDiagConfInfo conf_info; // Output NetCDF file static netCDF::NcFile *nc_out = (netCDF::NcFile *) nullptr; -vector data_var_dims; -vector hist_vars; -vector joint_hist_vars; +std::vector data_var_dims; +std::vector hist_vars; +std::vector joint_hist_vars; static bool multiple_data_sources = false; static bool unique_variable_names = true; @@ -110,16 +110,16 @@ static Met2dDataFileFactory mtddf_factory; static Met2dDataFile *data_mtddf = (Met2dDataFile *) nullptr; // Variable min/max values -vector var_mins; -vector var_maxs; +std::vector var_mins; +std::vector var_maxs; // Variable histogram map -map > histograms; -map > joint_histograms; -map > bin_mins; -map > bin_maxs; -map > bin_mids; -map bin_deltas; +std::map > histograms; +std::map > joint_histograms; +std::map > bin_mins; +std::map > bin_maxs; +std::map > bin_mids; +std::map bin_deltas; // Series length static int n_series = bad_data_int; diff --git a/src/tools/other/grid_diag/grid_diag_conf_info.h b/src/tools/other/grid_diag/grid_diag_conf_info.h index 396c19f300..5a4a2f1a13 100644 --- a/src/tools/other/grid_diag/grid_diag_conf_info.h +++ b/src/tools/other/grid_diag/grid_diag_conf_info.h @@ -58,7 +58,7 @@ class GridDiagConfInfo { void read_config(const char *, const char *); void set_n_data(); - void process_config(vector); + void process_config(std::vector); void process_masks(const Grid &); int get_n_data() const; diff --git a/src/tools/other/gsi_tools/gsid2mpr.h b/src/tools/other/gsi_tools/gsid2mpr.h index 0e5c7f26be..17eb97fa44 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.h +++ b/src/tools/other/gsi_tools/gsid2mpr.h @@ -138,7 +138,7 @@ static StatHdrColumns shc; // Store observation keys to search for duplicates static StringArray obs_key; -static map obs_key_map; +static std::map obs_key_map; //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index ab108d497c..aea7ec5b48 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -132,7 +132,7 @@ static int rej_sid = 0; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -NcFile *f_out = (NcFile *) nullptr; +netCDF::NcFile *f_out = (netCDF::NcFile *) nullptr; int processed_count; diff --git a/src/tools/other/mode_time_domain/mtd_read_data.h b/src/tools/other/mode_time_domain/mtd_read_data.h index 16393d6e9f..74d7627da3 100644 --- a/src/tools/other/mode_time_domain/mtd_read_data.h +++ b/src/tools/other/mode_time_domain/mtd_read_data.h @@ -30,9 +30,9 @@ // returns the actual valid times // -extern vector mtd_read_data(MtdConfigInfo &, VarInfo &, - const StringArray & filenames, - MtdFloatFile &); +extern std::vector mtd_read_data(MtdConfigInfo &, VarInfo &, + const StringArray & filenames, + MtdFloatFile &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/point2grid/point2grid_conf_info.h b/src/tools/other/point2grid/point2grid_conf_info.h index 2d0bd63da3..f6dff25b55 100644 --- a/src/tools/other/point2grid/point2grid_conf_info.h +++ b/src/tools/other/point2grid/point2grid_conf_info.h @@ -31,8 +31,8 @@ class PointToGridConfInfo { void init_from_scratch(); protected: - map var_name_map; - map def_var_name_map; + std::map var_name_map; + std::map def_var_name_map; public: From ca64f001506784f3b65979d1079cc1064c412bd1 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 5 Mar 2024 19:09:39 +0000 Subject: [PATCH 22/72] #2673 Added std namespace --- src/basic/vx_config/celltype_to_string.cc | 5 ++--- src/libcode/vx_afm/afm_line.cc | 5 ++--- src/libcode/vx_bool_calc/tokentype_to_string.cc | 9 ++++----- src/libcode/vx_regrid/vx_regrid_budget.cc | 3 +-- src/libcode/vx_render/hex_filter.cc | 4 ++-- src/libcode/vx_shapedata/node.cc | 3 ++- src/tools/other/ascii2nc/ismn_handler.cc | 2 -- src/tools/other/gsi_tools/gsidens2orank.cc | 4 ++-- src/tools/other/point2grid/point2grid.cc | 6 ++++-- 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/basic/vx_config/celltype_to_string.cc b/src/basic/vx_config/celltype_to_string.cc index 09c23b0343..8864b0dce5 100644 --- a/src/basic/vx_config/celltype_to_string.cc +++ b/src/basic/vx_config/celltype_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "celltype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afm_line.cc b/src/libcode/vx_afm/afm_line.cc index d7a4234601..4371e6f00e 100644 --- a/src/libcode/vx_afm/afm_line.cc +++ b/src/libcode/vx_afm/afm_line.cc @@ -11,9 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include #include @@ -24,6 +21,8 @@ using namespace std; #include "afm_line.h" #include "vx_util.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_bool_calc/tokentype_to_string.cc b/src/libcode/vx_bool_calc/tokentype_to_string.cc index eafea54a4c..571ef9ddea 100644 --- a/src/libcode/vx_bool_calc/tokentype_to_string.cc +++ b/src/libcode/vx_bool_calc/tokentype_to_string.cc @@ -24,13 +24,12 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - - #include #include "tokentype_to_string.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// @@ -39,7 +38,7 @@ ConcatString tokentype_to_string(const TokenType t) { -const char * s = (const char *) 0; +const char * s = (const char *) nullptr; switch ( t ) { @@ -60,7 +59,7 @@ switch ( t ) { } // switch -return ( ConcatString (s) ); +return ConcatString(s); } diff --git a/src/libcode/vx_regrid/vx_regrid_budget.cc b/src/libcode/vx_regrid/vx_regrid_budget.cc index 9fbedcfc81..d467b5aa0b 100644 --- a/src/libcode/vx_regrid/vx_regrid_budget.cc +++ b/src/libcode/vx_regrid/vx_regrid_budget.cc @@ -11,12 +11,11 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_regrid.h" #include "interp_mthd.h" +using namespace std; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_render/hex_filter.cc b/src/libcode/vx_render/hex_filter.cc index deb92552d0..584c8d0f5e 100644 --- a/src/libcode/vx_render/hex_filter.cc +++ b/src/libcode/vx_render/hex_filter.cc @@ -11,8 +11,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -21,6 +19,8 @@ using namespace std; #include "hex_filter.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/node.cc b/src/libcode/vx_shapedata/node.cc index 38a65049c6..74310ea451 100644 --- a/src/libcode/vx_shapedata/node.cc +++ b/src/libcode/vx_shapedata/node.cc @@ -19,7 +19,6 @@ // /////////////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -30,6 +29,8 @@ using namespace std; #include "vx_log.h" #include "vx_math.h" +using namespace std; + /////////////////////////////////////////////////////////////////////////////// // // Code for class Node diff --git a/src/tools/other/ascii2nc/ismn_handler.cc b/src/tools/other/ascii2nc/ismn_handler.cc index 507f86d6c1..b46f6971c1 100644 --- a/src/tools/other/ascii2nc/ismn_handler.cc +++ b/src/tools/other/ascii2nc/ismn_handler.cc @@ -8,8 +8,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_log.h" diff --git a/src/tools/other/gsi_tools/gsidens2orank.cc b/src/tools/other/gsi_tools/gsidens2orank.cc index c821d03bdc..0c75717fa8 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.cc +++ b/src/tools/other/gsi_tools/gsidens2orank.cc @@ -20,8 +20,6 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -46,6 +44,8 @@ using namespace std; #include "gsi_util.h" #include "gsidens2orank.h" +using namespace std; + //////////////////////////////////////////////////////////////////////// static void process_conv(const char *conv_filename, int i_mem); diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 6708d1cf9e..fe8e7dafe8 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -24,14 +24,12 @@ // //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include #include #include -using namespace netCDF; #include "main.h" #include "vx_log.h" @@ -52,6 +50,10 @@ using namespace netCDF; #include "pointdata_python.h" #endif +using namespace std; +using namespace netCDF; + + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; From a7f0e0618cf74b2505f27d424286bfed056776cf Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 5 Mar 2024 19:23:18 +0000 Subject: [PATCH 23/72] #2673 Added std namespace --- src/tools/other/gsi_tools/gsidens2orank.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/other/gsi_tools/gsidens2orank.h b/src/tools/other/gsi_tools/gsidens2orank.h index ecd5c31ee7..7dc533f131 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.h +++ b/src/tools/other/gsi_tools/gsidens2orank.h @@ -126,12 +126,12 @@ static ConcatString rng_seed; //////////////////////////////////////////////////////////////////////// // Store conventional and radiance information -static StringArray obs_key; -static map obs_key_map; -static map obs_index_map; -static vector conv_data; -static vector rad_data; -static PairDataEnsemble ens_pd; +static StringArray obs_key; +static std::map obs_key_map; +static std::map obs_index_map; +static std::vector conv_data; +static std::vector rad_data; +static PairDataEnsemble ens_pd; //////////////////////////////////////////////////////////////////////// From 0ab2466d222aade31f504311da622b54c1b067f8 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 6 Mar 2024 20:51:18 +0000 Subject: [PATCH 24/72] #2673 Changed literal 1 to boolean value, true --- src/basic/enum_to_string/my_enum_scanner.cc | 8 ++++---- src/basic/vx_config/config.tab.cc | 2 +- src/basic/vx_config/config_file.cc | 2 +- src/basic/vx_config/my_config_scanner.cc | 10 +++++----- src/basic/vx_util/command_line.cc | 2 +- src/libcode/vx_afm/afm.cc | 4 ++-- src/libcode/vx_afm/afm_line.cc | 2 +- src/libcode/vx_bool_calc/make_program.cc | 2 +- src/libcode/vx_bool_calc/tokenizer.cc | 2 +- src/libcode/vx_color/my_color_scanner.cc | 8 ++++---- src/libcode/vx_pxm/pbm.cc | 2 +- src/libcode/vx_pxm/pcm.cc | 2 +- src/libcode/vx_pxm/pgm.cc | 2 +- src/libcode/vx_pxm/ppm.cc | 2 +- src/libcode/vx_pxm/pxm_utils.cc | 4 ++-- src/tools/dev_utils/nceptab_to_flat.cc | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/basic/enum_to_string/my_enum_scanner.cc b/src/basic/enum_to_string/my_enum_scanner.cc index 40e1577c42..375d2344c5 100644 --- a/src/basic/enum_to_string/my_enum_scanner.cc +++ b/src/basic/enum_to_string/my_enum_scanner.cc @@ -130,7 +130,7 @@ if ( first_call ) { init(); first_call = false; } yytext = (char *) lexeme; -while ( 1 ) { +while ( true ) { t = next_token(); @@ -174,7 +174,7 @@ int c, c2; // skip whitespace // -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -600,7 +600,7 @@ c1 = nextchar(); c2 = nextchar(); -while ( 1 ) { +while ( true ) { if ( (c1 == EOF) || (c2 == EOF) ) break; @@ -629,7 +629,7 @@ void do_cpp_comment() int c; -while ( 1 ) { +while ( true ) { c = nextchar(); diff --git a/src/basic/vx_config/config.tab.cc b/src/basic/vx_config/config.tab.cc index 6805b14a43..61513c670b 100644 --- a/src/basic/vx_config/config.tab.cc +++ b/src/basic/vx_config/config.tab.cc @@ -2421,7 +2421,7 @@ DictionaryEntry e; count = 0; -while ( 1 ) { +while ( true ) { v = icvs.pop(); diff --git a/src/basic/vx_config/config_file.cc b/src/basic/vx_config/config_file.cc index c1b363b452..441fa3a9a8 100644 --- a/src/basic/vx_config/config_file.cc +++ b/src/basic/vx_config/config_file.cc @@ -622,7 +622,7 @@ void recursive_envs(string & line) { -while ( 1 ) { +while ( true ) { if ( ! replace_env(line) ) break; diff --git a/src/basic/vx_config/my_config_scanner.cc b/src/basic/vx_config/my_config_scanner.cc index f630924c98..13e41a196c 100644 --- a/src/basic/vx_config/my_config_scanner.cc +++ b/src/basic/vx_config/my_config_scanner.cc @@ -188,7 +188,7 @@ if ( first_call ) { init(); first_call = false; } configtext = (char *) lexeme; -while ( 1 ) { +while ( true ) { t = next_token(); @@ -218,7 +218,7 @@ int c, c2; // skip whitespace // -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -827,7 +827,7 @@ c1 = nextchar(); c2 = nextchar(); -while ( 1 ) { +while ( true ) { if ( (c1 == eof) || (c2 == eof) ) break; @@ -858,7 +858,7 @@ int c = 0; reading_comment = true; -while ( 1 ) { +while ( true ) { if ( configin->eof() ) break; @@ -1034,7 +1034,7 @@ if ( c == '$' ) { env_value = e; - while ( 1 ) { + while ( true ) { if ( ! replace_env(env_value) ) break; diff --git a/src/basic/vx_util/command_line.cc b/src/basic/vx_util/command_line.cc index 0f9e205ebe..de06658b07 100644 --- a/src/basic/vx_util/command_line.cc +++ b/src/basic/vx_util/command_line.cc @@ -1093,7 +1093,7 @@ a.clear(); count = 0; -while ( 1 ) { +while ( true ) { k = pos + count; diff --git a/src/libcode/vx_afm/afm.cc b/src/libcode/vx_afm/afm.cc index 31974f00d0..28b15563d6 100644 --- a/src/libcode/vx_afm/afm.cc +++ b/src/libcode/vx_afm/afm.cc @@ -1903,7 +1903,7 @@ ascii_code = tok.i; c.ascii_code = ascii_code; -while ( 1 ) { +while ( true ) { tok = line.nexttoken(); if ( tok.type == afm_token_endofline ) break; @@ -2024,7 +2024,7 @@ c.pcc = new PCC [c.n_parts]; n_pcc = 0; -while ( 1 ) { +while ( true ) { tok = line.nexttoken(); diff --git a/src/libcode/vx_afm/afm_line.cc b/src/libcode/vx_afm/afm_line.cc index 4371e6f00e..fdf05c6aec 100644 --- a/src/libcode/vx_afm/afm_line.cc +++ b/src/libcode/vx_afm/afm_line.cc @@ -334,7 +334,7 @@ extern istream & operator>>(istream & in, AfmLine & L) L.clear(); -while ( 1 ) { +while ( true ) { L.Line.read_line(in); diff --git a/src/libcode/vx_bool_calc/make_program.cc b/src/libcode/vx_bool_calc/make_program.cc index dabbb8b7ec..8f35e5824a 100644 --- a/src/libcode/vx_bool_calc/make_program.cc +++ b/src/libcode/vx_bool_calc/make_program.cc @@ -65,7 +65,7 @@ tiz.set(input); //////////////// -while ( 1 ) { +while ( true ) { tok = tiz.next_token(); diff --git a/src/libcode/vx_bool_calc/tokenizer.cc b/src/libcode/vx_bool_calc/tokenizer.cc index eed9ada855..7a7d690819 100644 --- a/src/libcode/vx_bool_calc/tokenizer.cc +++ b/src/libcode/vx_bool_calc/tokenizer.cc @@ -167,7 +167,7 @@ char c, c2; // skip whitespace // -while ( 1 ) { +while ( true ) { c = source[pos]; diff --git a/src/libcode/vx_color/my_color_scanner.cc b/src/libcode/vx_color/my_color_scanner.cc index fcd4ef525f..5994787349 100644 --- a/src/libcode/vx_color/my_color_scanner.cc +++ b/src/libcode/vx_color/my_color_scanner.cc @@ -126,7 +126,7 @@ if ( first_call ) { init(); first_call = false; } colortext = (char *) lexeme; -while ( 1 ) { +while ( true ) { t = next_token(); @@ -156,7 +156,7 @@ int c, c2; // skip whitespace // -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -765,7 +765,7 @@ c1 = nextchar(); c2 = nextchar(); -while ( 1 ) { +while ( true ) { if ( (c1 == EOF) || (c2 == EOF) ) break; @@ -794,7 +794,7 @@ void do_cpp_comment() int c; -while ( 1 ) { +while ( true ) { c = nextchar(); diff --git a/src/libcode/vx_pxm/pbm.cc b/src/libcode/vx_pxm/pbm.cc index 9c1e39b7e8..4d4f622327 100644 --- a/src/libcode/vx_pxm/pbm.cc +++ b/src/libcode/vx_pxm/pbm.cc @@ -364,7 +364,7 @@ if ( (c1 != 'P') || (c2 != '4') ) { skip_whitespace(in); -while ( 1 ) { +while ( true ) { j = in.peek(); diff --git a/src/libcode/vx_pxm/pcm.cc b/src/libcode/vx_pxm/pcm.cc index 1fe14b5ee9..c6c41d4878 100644 --- a/src/libcode/vx_pxm/pcm.cc +++ b/src/libcode/vx_pxm/pcm.cc @@ -446,7 +446,7 @@ if ( (c1 != 'P') || (c2 != '9') ) { skip_whitespace(in); -while ( 1 ) { +while ( true ) { j = in.peek(); diff --git a/src/libcode/vx_pxm/pgm.cc b/src/libcode/vx_pxm/pgm.cc index 47d1c7732b..87f6170bc0 100644 --- a/src/libcode/vx_pxm/pgm.cc +++ b/src/libcode/vx_pxm/pgm.cc @@ -326,7 +326,7 @@ if ( (c1 != 'P') || (c2 != '5') ) { skip_whitespace(in); -while ( 1 ) { +while ( true ) { j = in.peek(); diff --git a/src/libcode/vx_pxm/ppm.cc b/src/libcode/vx_pxm/ppm.cc index af49251531..9ce2c79e44 100644 --- a/src/libcode/vx_pxm/ppm.cc +++ b/src/libcode/vx_pxm/ppm.cc @@ -326,7 +326,7 @@ if ( (c1 != 'P') || (c2 != '6') ) { skip_whitespace(in); -while ( 1 ) { +while ( true ) { j = in.peek(); diff --git a/src/libcode/vx_pxm/pxm_utils.cc b/src/libcode/vx_pxm/pxm_utils.cc index 0a1663a6fe..c238c3b94b 100644 --- a/src/libcode/vx_pxm/pxm_utils.cc +++ b/src/libcode/vx_pxm/pxm_utils.cc @@ -53,7 +53,7 @@ void skip_whitespace(istream & in) int c; -while ( 1 ) { +while ( true ) { c = in.peek(); @@ -82,7 +82,7 @@ in.get(c); // toss leading '#' k = 0; -while ( 1 ) { +while ( true ) { in.get(c); diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index c24585b0ae..4041cab117 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -212,7 +212,7 @@ if ( !found ) { // -while ( 1 ) { +while ( true ) { line.read_line(in); From a6f7646724a03c30ccba79edb9b3ed6946877514 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 14 Mar 2024 08:45:13 -0600 Subject: [PATCH 25/72] Feature #2673 enum_to_string (#2835) --- src/basic/enum_to_string/code.cc | 18 +-- src/basic/enum_to_string/enum_parser.yy | 4 +- src/basic/enum_to_string/enum_scanner.ll | 54 ++++---- src/basic/enum_to_string/info.cc | 2 +- src/basic/enum_to_string/info.h | 12 +- src/basic/enum_to_string/my_enum_scanner.cc | 2 +- src/basic/enum_to_string/scope.h | 6 +- src/basic/vx_config/config.tab.yy | 2 +- src/basic/vx_config/config_scanner.ll | 122 +++++++++--------- .../vx_config/configobjecttype_to_string.cc | 1 - src/libcode/vx_color/color_scanner.ll | 46 +++---- 11 files changed, 132 insertions(+), 137 deletions(-) diff --git a/src/basic/enum_to_string/code.cc b/src/basic/enum_to_string/code.cc index fb62ba003f..9b5c431f35 100644 --- a/src/basic/enum_to_string/code.cc +++ b/src/basic/enum_to_string/code.cc @@ -489,21 +489,19 @@ warning(out); out << "\n\n" << sep << "\n\n" - << "using namespace std;\n" - << "\n\n" << "#include \n" << "\n" << "#include " << L << lower << "_to_string"; if ( header_suffix ) out << header_suffix; -out << R - << "\n" +out << R + << "\n\n" + << "using namespace std;\n" << "\n\n" << sep << "\n\n"; - forward(e, lower, out); out << "\n\n" @@ -607,8 +605,6 @@ warning(out); out << "\n\n" << sep << "\n\n" - << "using namespace std;\n" - << "\n\n" << "#include \n" << "\n" << "#include " << L << lower << "_to_string"; @@ -616,12 +612,12 @@ out << "\n\n" if ( header_suffix ) out << header_suffix; out << R - << "\n" + << "\n\n" + << "using namespace std;\n" << "\n\n" << sep << "\n\n"; - forward_cs(e, lower, out); out << "\n\n" @@ -758,7 +754,7 @@ out << e.name() << " t)\n" << "{\n" << "\n"; -out << "const char * s = (const char *) 0;\n\n"; +out << "const char * s = (const char *) nullptr;\n\n"; out << "switch ( t ) {\n" << "\n"; @@ -802,7 +798,7 @@ out << "\n" << "} // switch\n" << "\n\n"; -out << "return ( ConcatString (s) );\n" +out << "return ConcatString(s);\n" << "\n"; out << "}\n"; diff --git a/src/basic/enum_to_string/enum_parser.yy b/src/basic/enum_to_string/enum_parser.yy index 61718fe01a..989ccd2702 100644 --- a/src/basic/enum_to_string/enum_parser.yy +++ b/src/basic/enum_to_string/enum_parser.yy @@ -46,7 +46,7 @@ extern bool do_concat_string; EnumInfo einfo; -const char * header_filename = (const char *) 0; +const char * header_filename = (const char *) nullptr; ScopeStack ss; @@ -171,7 +171,7 @@ void set_name(const char * text) { int j, n; -const char * c = (const char *) 0; +const char * c = (const char *) nullptr; ostringstream s; diff --git a/src/basic/enum_to_string/enum_scanner.ll b/src/basic/enum_to_string/enum_scanner.ll index f69a8e3e08..a59f4e358a 100644 --- a/src/basic/enum_to_string/enum_scanner.ll +++ b/src/basic/enum_to_string/enum_scanner.ll @@ -89,16 +89,16 @@ WS " "|"\t" %% -enum { do_enum(); return ( token(ENUM) ); } -class { do_class(); return ( token(CLASS) ); } +enum { do_enum(); return token(ENUM); } +class { do_class(); return token(CLASS); } -"{" { if ( do_left_curly() ) return ( token(L_CURLY) ); } -"}" { if ( do_right_curly() ) return ( token(R_CURLY) ); } -"=" { if ( do_equals() ) return ( token (EQ) ); } -";" { if ( do_semi() ) return ( token(';') ); } -"," { if ( do_comma() ) return ( token(',') ); } -("-"?)({DIGIT})+ { if ( do_int() ) return ( token(INTEGER) ); } -({LETTER})({LETTER}|{DIGIT})* { if ( do_id() ) return ( token(ID) ); } +"{" { if ( do_left_curly() ) return token(L_CURLY); } +"}" { if ( do_right_curly() ) return token(R_CURLY); } +"=" { if ( do_equals() ) return token (EQ); } +";" { if ( do_semi() ) return token(';'); } +"," { if ( do_comma() ) return token(','); } +("-"?)({DIGIT})+ { if ( do_int() ) return token(INTEGER); } +({LETTER})({LETTER}|{DIGIT})* { if ( do_id() ) return token(ID); } @@ -160,13 +160,13 @@ if ( enum_mode || last_was_enum || last_was_class ) { strncpy(yylval.name, yytext, sizeof(yylval.name)); - return ( 1 ); + return 1; } -return ( 0 ); +return 0; } @@ -180,13 +180,13 @@ int do_int() column += strlen(yytext); -if ( !enum_mode ) return ( 0 ); +if ( !enum_mode ) return 0; yylval.ival = atoi(yytext); -return ( 1 ); +return 1; } @@ -202,12 +202,12 @@ int do_left_curly() ++column; -if ( !enum_mode ) return ( 0 ); +if ( !enum_mode ) return 0; yylval.ival = bracket_level; -return ( 1 ); +return 1; } @@ -225,12 +225,12 @@ int do_right_curly() ss.clear_to_level(bracket_level); -if ( !enum_mode ) return ( 0 ); +if ( !enum_mode ) return 0; yylval.ival = bracket_level + 1; -return ( 1 ); +return 1; } @@ -244,10 +244,10 @@ int do_semi() ++column; -if ( enum_mode ) return ( 1 ); +if ( enum_mode ) return 1; -return ( 0 ); +return 0; } @@ -261,10 +261,10 @@ int do_equals() ++column; -if ( enum_mode ) return ( 1 ); +if ( enum_mode ) return 1; -return ( 0 ); +return 0; } @@ -278,10 +278,10 @@ int do_comma() ++column; -if ( enum_mode ) return ( 1 ); +if ( enum_mode ) return 1; -return ( 0 ); +return 0; } @@ -300,7 +300,7 @@ c1 = nextchar(); c2 = nextchar(); -while ( 1 ) { +while ( true ) { if ( (c1 == EOF) || (c2 == EOF) ) break; @@ -329,7 +329,7 @@ void do_cpp_comment() int c; -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -366,7 +366,7 @@ if ( c == '\n' ) { } -return ( c ); +return c; } @@ -388,7 +388,7 @@ if ( t == CLASS ) last_was_class = 1; if ( t == ENUM ) last_was_enum = 1; -return ( t ); +return t; } diff --git a/src/basic/enum_to_string/info.cc b/src/basic/enum_to_string/info.cc index c1794c37a4..76927b8979 100644 --- a/src/basic/enum_to_string/info.cc +++ b/src/basic/enum_to_string/info.cc @@ -275,7 +275,7 @@ for (j=0; j 0 ); +return digit_count > 0; } diff --git a/src/basic/enum_to_string/scope.h b/src/basic/enum_to_string/scope.h index ee27397451..93ca9d44ec 100644 --- a/src/basic/enum_to_string/scope.h +++ b/src/basic/enum_to_string/scope.h @@ -57,9 +57,9 @@ class ScopeStackElement { //////////////////////////////////////////////////////////////////////// -inline int ScopeStackElement::level() const { return ( Level ); } +inline int ScopeStackElement::level() const { return Level; } -inline const char * ScopeStackElement::name() const { return ( Name ); } +inline const char * ScopeStackElement::name() const { return Name; } //////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ class ScopeStack { //////////////////////////////////////////////////////////////////////// -inline int ScopeStack::n_elements() const { return ( N ); } +inline int ScopeStack::n_elements() const { return N; } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/config.tab.yy b/src/basic/vx_config/config.tab.yy index 836a874747..dabe56d786 100644 --- a/src/basic/vx_config/config.tab.yy +++ b/src/basic/vx_config/config.tab.yy @@ -815,7 +815,7 @@ DictionaryEntry e; count = 0; -while ( 1 ) { +while ( true ) { v = icvs.pop(); diff --git a/src/basic/vx_config/config_scanner.ll b/src/basic/vx_config/config_scanner.ll index 515b068416..371af9971a 100644 --- a/src/basic/vx_config/config_scanner.ll +++ b/src/basic/vx_config/config_scanner.ll @@ -129,63 +129,63 @@ REAL_NUMBER (("-"?){DIGITS}{EXP})|(("-"?)"."{DIGITS}{OPT_EXP})|(("-"?){DIGITS}" %% -"<" { return ( do_comp() ); } -">" { return ( do_comp() ); } -"<=" { return ( do_comp() ); } -">=" { return ( do_comp() ); } -"==" { return ( do_comp() ); } -"!=" { return ( do_comp() ); } -"NA" { return ( do_comp() ); } +"<" { return do_comp(); } +">" { return do_comp(); } +"<=" { return do_comp(); } +">=" { return do_comp(); } +"==" { return do_comp(); } +"!=" { return do_comp(); } +"NA" { return do_comp(); } -"le"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } -"lt"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } -"gt"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } -"ge"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } -"eq"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } -"ne"({INT_NUMBER}|{REAL_NUMBER}) { return ( do_fort_thresh() ); } +"le"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } +"lt"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } +"gt"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } +"ge"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } +"eq"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } +"ne"({INT_NUMBER}|{REAL_NUMBER}) { return do_fort_thresh(); } -"&&" { Column+=2; return ( LOGICAL_OP_AND ); } -"||" { Column+=2; return ( LOGICAL_OP_OR ); } +"&&" { Column+=2; return LOGICAL_OP_AND; } +"||" { Column+=2; return LOGICAL_OP_OR; } -"!" { Column+=1; return ( LOGICAL_OP_NOT ); } +"!" { Column+=1; return LOGICAL_OP_NOT; } -"[" { ++Column; is_lhs = false; dict_stack->push_array(); return ( configtext[0] ); } -"{" { ++Column; is_lhs = true; dict_stack->push(); return ( configtext[0] ); } +"[" { ++Column; is_lhs = false; dict_stack->push_array(); return configtext[0]; } +"{" { ++Column; is_lhs = true; dict_stack->push(); return configtext[0]; } -"]" { ++Column; return ( configtext[0] ); } -"}" { ++Column; return ( configtext[0] ); } +"]" { ++Column; return configtext[0]; } +"}" { ++Column; return configtext[0]; } -"(" { ++Column; return ( configtext[0] ); } -")" { ++Column; return ( configtext[0] ); } +"(" { ++Column; return configtext[0]; } +")" { ++Column; return configtext[0]; } -"+" { ++Column; return ( configtext[0] ); } -"-" { ++Column; return ( configtext[0] ); } -"/" { ++Column; return ( configtext[0] ); } -"*" { ++Column; return ( configtext[0] ); } -"^" { ++Column; return ( configtext[0] ); } +"+" { ++Column; return configtext[0]; } +"-" { ++Column; return configtext[0]; } +"/" { ++Column; return configtext[0]; } +"*" { ++Column; return configtext[0]; } +"^" { ++Column; return configtext[0]; } -"=" { ++Column; return ( configtext[0] ); } -";" { ++Column; is_lhs = true; return ( configtext[0] ); } -"," { ++Column; return ( configtext[0] ); } +"=" { ++Column; return configtext[0]; } +";" { ++Column; is_lhs = true; return configtext[0]; } +"," { ++Column; return configtext[0]; } -"\"" { do_quoted_string(); return ( QUOTED_STRING ); } +"\"" { do_quoted_string(); return QUOTED_STRING; } "${"{IDENTIFIER}"}" { do_env(); } -{IDENTIFIER} { return ( do_id() ); } +{IDENTIFIER} { return do_id(); } -{INT_NUMBER} { do_int(); return ( INTEGER ); } +{INT_NUMBER} { do_int(); return INTEGER; } -{REAL_NUMBER} { do_float(); return ( FLOAT ); } +{REAL_NUMBER} { do_float(); return FLOAT; } @@ -199,7 +199,7 @@ REAL_NUMBER (("-"?){DIGITS}{EXP})|(("-"?)"."{DIGITS}{OPT_EXP})|(("-"?){DIGITS}" "\n" { ++LineNumber; Column = 1; } -<> { if ( do_eof() ) return ( 0 ); } +<> { if ( do_eof() ) return 0; } . { ++Column; } @@ -230,7 +230,7 @@ if ( c == '\n' ) { } -return ( c ); +return c; } @@ -245,7 +245,7 @@ void do_cpp_comment() int c; -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -275,7 +275,7 @@ c2 = nextchar(); comment_depth = 1; -while ( 1 ) { +while ( true ) { if ( (c1 == EOF) || (c2 == EOF) ) break; @@ -338,7 +338,7 @@ else { // done // -return ( return_value ); +return return_value; } @@ -389,7 +389,7 @@ char line[max_id_length]; n = 0; -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -476,32 +476,32 @@ Column += strlen(configtext); // print? // -if ( strcmp(configtext, "print" ) == 0 ) { return ( PRINT ); } +if ( strcmp(configtext, "print" ) == 0 ) { return PRINT; } // // boolean? // -if ( strcmp(configtext, "true" ) == 0 ) { configlval.bval = true; return ( BOOLEAN ); } -if ( strcmp(configtext, "false" ) == 0 ) { configlval.bval = false; return ( BOOLEAN ); } +if ( strcmp(configtext, "true" ) == 0 ) { configlval.bval = true; return BOOLEAN; } +if ( strcmp(configtext, "false" ) == 0 ) { configlval.bval = false; return BOOLEAN; } -if ( strcmp(configtext, "TRUE" ) == 0 ) { configlval.bval = true; return ( BOOLEAN ); } -if ( strcmp(configtext, "FALSE" ) == 0 ) { configlval.bval = false; return ( BOOLEAN ); } +if ( strcmp(configtext, "TRUE" ) == 0 ) { configlval.bval = true; return BOOLEAN; } +if ( strcmp(configtext, "FALSE" ) == 0 ) { configlval.bval = false; return BOOLEAN; } // // comparison? // -if ( strcmp(configtext, "lt" ) == 0 ) { configlval.cval = thresh_lt; return ( COMPARISON ); } -if ( strcmp(configtext, "le" ) == 0 ) { configlval.cval = thresh_le; return ( COMPARISON ); } +if ( strcmp(configtext, "lt" ) == 0 ) { configlval.cval = thresh_lt; return COMPARISON; } +if ( strcmp(configtext, "le" ) == 0 ) { configlval.cval = thresh_le; return COMPARISON; } -if ( strcmp(configtext, "gt" ) == 0 ) { configlval.cval = thresh_gt; return ( COMPARISON ); } -if ( strcmp(configtext, "ge" ) == 0 ) { configlval.cval = thresh_ge; return ( COMPARISON ); } +if ( strcmp(configtext, "gt" ) == 0 ) { configlval.cval = thresh_gt; return COMPARISON; } +if ( strcmp(configtext, "ge" ) == 0 ) { configlval.cval = thresh_ge; return COMPARISON; } -if ( strcmp(configtext, "ne" ) == 0 ) { configlval.cval = thresh_ne; return ( COMPARISON ); } -if ( strcmp(configtext, "eq" ) == 0 ) { configlval.cval = thresh_eq; return ( COMPARISON ); } +if ( strcmp(configtext, "ne" ) == 0 ) { configlval.cval = thresh_ne; return COMPARISON; } +if ( strcmp(configtext, "eq" ) == 0 ) { configlval.cval = thresh_eq; return COMPARISON; } -if ( strcmp(configtext, na_str ) == 0 ) { configlval.cval = thresh_na; return ( NA_COMPARISON ); } +if ( strcmp(configtext, na_str ) == 0 ) { configlval.cval = thresh_na; return NA_COMPARISON; } // // builtin ? @@ -509,13 +509,13 @@ if ( strcmp(configtext, na_str ) == 0 ) { configlval.cval = thresh_na; return int index; -if ( (! is_lhs) && is_builtin((string)configtext, index) ) { configlval.index = index; return ( BUILTIN ); } +if ( (! is_lhs) && is_builtin((string)configtext, index) ) { configlval.index = index; return BUILTIN; } // // local variable ? // -if ( is_function_def && ida.has(configtext, index) ) { configlval.index = index; return ( LOCAL_VAR ); } +if ( is_function_def && ida.has(configtext, index) ) { configlval.index = index; return LOCAL_VAR; } // // number? @@ -529,13 +529,13 @@ if ( e && (e->is_number()) && (! is_lhs) ) { set_int(configlval.nval, e->i_value()); - return ( INTEGER ); + return INTEGER; } else { set_double(configlval.nval, e->d_value()); - return ( FLOAT ); + return FLOAT; } @@ -549,7 +549,7 @@ if ( e && (! is_lhs) && (e->type() == UserFunctionType) ) { configlval.entry = e; - return ( USER_FUNCTION ); + return USER_FUNCTION; } @@ -560,7 +560,7 @@ if ( e && (! is_lhs) && (e->type() == UserFunctionType) ) { strncpy(configlval.text, configtext, sizeof(configlval.text) - 1); -return ( IDENTIFIER ); +return IDENTIFIER; } @@ -759,7 +759,7 @@ bool do_eof() { -if ( ! reading_env ) return ( true ); +if ( ! reading_env ) return true; config_delete_buffer(YY_CURRENT_BUFFER); @@ -769,7 +769,7 @@ reading_env = false; Column += 3; -return ( false ); +return false; } @@ -844,7 +844,7 @@ int do_fort_thresh() strncpy(configlval.text, configtext, sizeof(configlval.text)); -return ( FORTRAN_THRESHOLD ); +return FORTRAN_THRESHOLD; } diff --git a/src/basic/vx_config/configobjecttype_to_string.cc b/src/basic/vx_config/configobjecttype_to_string.cc index 91d34685bc..d8088d406c 100644 --- a/src/basic/vx_config/configobjecttype_to_string.cc +++ b/src/basic/vx_config/configobjecttype_to_string.cc @@ -28,7 +28,6 @@ #include "configobjecttype_to_string.h" - using namespace std; diff --git a/src/libcode/vx_color/color_scanner.ll b/src/libcode/vx_color/color_scanner.ll index 85242c3f67..3efa922f81 100644 --- a/src/libcode/vx_color/color_scanner.ll +++ b/src/libcode/vx_color/color_scanner.ll @@ -82,38 +82,38 @@ OPT_EXP {EXP}? %% -"," { ++color_file_column; return ( ',' ); } +"," { ++color_file_column; return ','; } -"{" { ++color_file_column; return ( '{' ); } -"}" { ++color_file_column; return ( '}' ); } +"{" { ++color_file_column; return '{'; } +"}" { ++color_file_column; return '}'; } -"(" { ++color_file_column; return ( '(' ); } -")" { ++color_file_column; return ( ')' ); } +"(" { ++color_file_column; return '('; } +")" { ++color_file_column; return ')'; } -"=" { ++color_file_column; return ( '=' ); } +"=" { ++color_file_column; return '='; } -"\"" { do_quoted_string(); return ( QUOTED_STRING ); } +"\"" { do_quoted_string(); return QUOTED_STRING; } -({LETTER})({LETTER}|{DIGIT})* { return ( do_id() ); } +({LETTER})({LETTER}|{DIGIT})* { return do_id(); } -("-"?){DIGITS} { do_int(); return ( INTEGER ); } +("-"?){DIGITS} { do_int(); return INTEGER; } -("-"?){DIGITS}{EXP} { do_float(); return ( FLOAT ); } +("-"?){DIGITS}{EXP} { do_float(); return FLOAT; } -("-"?)"."{DIGITS}{OPT_EXP} { do_float(); return ( FLOAT ); } +("-"?)"."{DIGITS}{OPT_EXP} { do_float(); return FLOAT; } -("-"?){DIGITS}"."{OPT_EXP} { do_float(); return ( FLOAT ); } +("-"?){DIGITS}"."{OPT_EXP} { do_float(); return FLOAT; } -("-"?){DIGITS}"."{DIGITS}{OPT_EXP} { do_float(); return ( FLOAT ); } +("-"?){DIGITS}"."{DIGITS}{OPT_EXP} { do_float(); return FLOAT; } @@ -145,10 +145,10 @@ int do_id() color_file_column += strlen(colortext); -if ( strcmp(colortext, "blend" ) == 0 ) return ( BLEND ); -if ( strcmp(colortext, "hsv" ) == 0 ) return ( HSV ); -if ( strcmp(colortext, "cmyk" ) == 0 ) return ( CMYK ); -if ( strcmp(colortext, "grayvalue") == 0 ) return ( GRAYVALUE ); +if ( strcmp(colortext, "blend" ) == 0 ) return BLEND; +if ( strcmp(colortext, "hsv" ) == 0 ) return HSV; +if ( strcmp(colortext, "cmyk" ) == 0 ) return CMYK; +if ( strcmp(colortext, "grayvalue") == 0 ) return GRAYVALUE; int index; @@ -157,13 +157,13 @@ if ( clist.has_name(colortext, index) ) { colorlval.ival = index; - return ( COLOR_NAME ); + return COLOR_NAME; } strncpy(colorlval.text, colortext, sizeof(colorlval.text) - 1); -return ( ID ); +return ID; } @@ -215,7 +215,7 @@ c2 = nextchar(); comment_depth = 1; -while ( 1 ) { +while ( true ) { if ( (c1 == EOF) || (c2 == EOF) ) break; @@ -252,7 +252,7 @@ void do_cpp_comment() int c; -while ( 1 ) { +while ( true ) { c = nextchar(); @@ -289,7 +289,7 @@ if ( c == '\n' ) { } -return ( c ); +return c; } @@ -308,7 +308,7 @@ char line[128]; n = 0; -while ( 1 ) { +while ( true ) { c = nextchar(); From 108a8958b206d6712197823a083666ab039bf818 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 14 Mar 2024 09:23:53 -0600 Subject: [PATCH 26/72] Feature #2583 ecnt (#2825) * Unrelated to #2583, fix typo in code comments. * Per #2583, add hooks write 3 new ECNT columns for observation error data. * Per #2583, make error messages about mis-matched array lengths more informative. * Per #2583, switch to more concise variable naming conventions of ign_oerr_cnv, ign_oerr_cor, and dawid_seb. * Per #2583, fix typo to enable compilation * Per #2583, define the 5 new ECNT column names. * Per #2583, add 5 new columns to the ECNT table in the Ensemble-Stat chapter * Per #2583, update stat_columns.cc to write these 5 new ECNT columns * Per #2583, update ECNTInfo class to compute the 5 new ECNT statistics. * Per #2583, update stat-analysis to parse the 5 new ECNT columns. * Per #2583, update aggregate_stat logic for 5 new ECNT columns. * Per #2583, update PairDataEnsemble logic for 5 new ECNT columns * Per #2583, update vx_statistics library with obs_error handling logic for the 5 new ECNT columns * Per #2583, changes to make it compile * Per #2583, changes to make it compile * Per #2583, switch to a consistent ECNT column naming convention with OERR at the end. Using IGN_CONV_OERR and IGN_CORR_OERR. * Per #2583, define ObsErrorEntry::variance() with a call to the dist_var() utility function. * Per #2583, update PairDataEnsemble::compute_pair_vals() to compute the 5 new stats with the correct inputs. * Per #2583, add DEBUG(10) log messages about computing these new stats. * Per #2583, update Stat-Analysis to compute these 5 new stats from the ORANK line type. * Per #2583, whitespace and comments. * Per #2583, update the User's Guide. * Per #2583, remove the DS_ADD_OERR and DS_MULT_OERR ECNT columns and rename DS_OERR as DSS, since observation error is not actually involved in its computation. * Per #2583, minor update to Appendix C * Per #2583, rename ECNT line type statistic DSS to IDSS. * Per #2583, fix a couple of typos * Per #2583, more error checking. * Per #2583, remove the ECNT IDSS column since its just 2*pi*IGN, the existing ignorance score, and only provides meaningful information when combined with the other Dawid-Sebastiani statistics that have already been removed. * Per #2583, add Eric's documentation of these new stats to Appendix C. Along the way, update the DOI links in the references based on this APA style guide: https://apastyle.apa.org/style-grammar-guidelines/references/dois-urls#:~:text=Include%20a%20DOI%20for%20all,URL%2C%20include%20only%20the%20DOI. * Per #2583, fix new equations with embedded underscores for PDF by defining both html and pdf formatting options. * Per #2583, update the ign_conv_oerr equation to include a 2 *pi multiplier for consistency with the existing ignorance score. Also, fix the documented equations. * Per #2583, remove log file that was inadvertently added on this branch. * Per #2583, simplify ObsErrorEntry::variance() implementation. For the distribution type of NONE, return a variance of 0.0 rather than bad data, as discussed with @michelleharrold and @JeffBeck-NOAA on 3/8/2024. --------- Co-authored-by: MET Tools Test Account --- data/table_files/met_header_columns_V12.0.txt | 2 +- docs/Users_Guide/appendixC.rst | 53 +++++-- docs/Users_Guide/ensemble-stat.rst | 10 +- docs/Users_Guide/refs.rst | 135 ++++++++++++------ internal/test_unit/hdr/met_12_0.hdr | 2 +- src/basic/vx_util/num_array.cc | 8 +- src/basic/vx_util/stat_column_defs.h | 2 +- src/libcode/vx_gsl_prob/gsl_randist.h | 4 +- src/libcode/vx_stat_out/stat_columns.cc | 8 +- src/libcode/vx_statistics/ens_stats.cc | 18 ++- src/libcode/vx_statistics/ens_stats.h | 4 + src/libcode/vx_statistics/met_stats.cc | 19 +++ src/libcode/vx_statistics/met_stats.h | 2 + src/libcode/vx_statistics/obs_error.cc | 7 + src/libcode/vx_statistics/obs_error.h | 3 + .../vx_statistics/pair_data_ensemble.cc | 117 ++++++++++++--- .../vx_statistics/pair_data_ensemble.h | 90 ++++++------ src/libcode/vx_statistics/pair_data_point.cc | 2 +- .../core/stat_analysis/aggr_stat_line.cc | 27 +++- .../core/stat_analysis/parse_stat_line.cc | 5 + .../core/stat_analysis/parse_stat_line.h | 3 + src/tools/core/wavelet_stat/wavelet_stat.cc | 4 +- 22 files changed, 390 insertions(+), 135 deletions(-) diff --git a/data/table_files/met_header_columns_V12.0.txt b/data/table_files/met_header_columns_V12.0.txt index 7ed1e5a187..299e6cb4d6 100644 --- a/data/table_files/met_header_columns_V12.0.txt +++ b/data/table_files/met_header_columns_V12.0.txt @@ -19,7 +19,7 @@ V12.0 : STAT : PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V12.0 : STAT : PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) THRESH_[0-9]* PODY_[0-9]* POFD_[0-9]* V12.0 : STAT : PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL THRESH_[0-9]* V12.0 : STAT : ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASER VALUE_BASER (N_PTS) CL_[0-9]* VALUE_[0-9]* -V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS +V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR V12.0 : STAT : RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP V12.0 : STAT : RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_RANK) RANK_[0-9]* V12.0 : STAT : PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE (N_BIN) BIN_[0-9]* diff --git a/docs/Users_Guide/appendixC.rst b/docs/Users_Guide/appendixC.rst index 7c5c618a43..037bd93455 100644 --- a/docs/Users_Guide/appendixC.rst +++ b/docs/Users_Guide/appendixC.rst @@ -401,7 +401,7 @@ SEEPS scores are expected to lie between 0 and 1, with a perfect forecast having MET Verification Measures for Continuous Variables ================================================== -For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, (1987) `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. +For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, 1987 `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. The verification measures currently evaluated by the Point-Stat tool are defined and described in the subsections below. In these definitions, **f** represents the forecasts, **o** represents the observation, and **n** is the number of forecast-observation pairs. @@ -894,7 +894,7 @@ Calibration Called "CALIBRATION" in PJC output :numref:`table_PS_format_info_PJC` -Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, (2011) `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. +Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, 2011 `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. .. math:: \text{Calibration}(i) = \frac{n_{i1}}{n_{1.}} = \text{probability}(o_1|p_i) @@ -903,7 +903,7 @@ Refinement Called "REFINEMENT" in PJC output :numref:`table_PS_format_info_PJC` -The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks (2011) `. +The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks, 2011 `. .. math:: \text{Refinement}(i) = \frac{n_{i.}}{T} = \text{probability}(p_i) @@ -912,7 +912,7 @@ Likelihood Called "LIKELIHOOD" in PJC output :numref:`table_PS_format_info_PJC` -Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks (2011) ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. +Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks, 2011 ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. .. math:: \text{Likelihood}(i) = \frac{n_{i1}}{n_{.1}} = \text{probability}(p_i|o_1) @@ -923,7 +923,7 @@ Base Rate Called "BASER" in PJC output :numref:`table_PS_format_info_PJC` -This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks (2011) ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. +This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks, 2011 ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. .. math:: \text{Base Rate}(i) = \frac{n_{i1}}{n_{i.}} = \text{probability}(o_{i1}) @@ -976,18 +976,18 @@ RPS Called "RPS" in RPS output :numref:`table_ES_header_info_es_out_ECNT` -While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012`), and is a proper score (:ref:`Mason, 2008`). +While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012 `), and is a proper score (:ref:`Mason, 2008 `). Let :math:`\text{J}` be the number of categories, then both the forecast, :math:`\text{f} = (f_1,…,f_J)`, and observation, :math:`\text{o} = (o_1,…,o_J)`, are length-:math:`\text{J}` vectors, where the components of :math:`\text{f}` include the probabilities forecast for each category :math:`\text{1,…,J}` and :math:`\text{o}` contains 1 in the category that is realized and zero everywhere else. The cumulative forecasts, :math:`F_m`, and observations, :math:`O_m`, are defined to be: :math:`F_m = \sum_{j=1}^m (f_j)` and :math:`O_m = \sum_{j=1}^m (o_j), m = 1,…,J`. -To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: +To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: .. math:: \text{RPS} = \sum_{m=1}^J (F_m - O_m)^2 = \sum_{m=1}^J BS_m, -where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012`). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. +where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012 `). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. CRPS ---- @@ -1066,7 +1066,7 @@ The continuous ranked probability skill score (CRPSS) is similar to the MSESS an .. math:: \text{CRPSS} = 1 - \frac{\text{CRPS}_{fcst}}{ \text{CRPS}_{ref}} -For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. +For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. Bias Ratio ---------- @@ -1105,6 +1105,37 @@ Called "PIT" in ORANK output :numref:`table_ES_header_info_es_out_ORANK` The probability integral transform (PIT) is the analog of the rank histogram for a probability distribution forecast (:ref:`Dawid, 1984 `). Its interpretation is the same as that of the verification rank histogram: Calibrated probabilistic forecasts yield PIT histograms that are flat, or uniform. Under-dispersed (not enough spread in the ensemble) forecasts have U-shaped PIT histograms while over-dispersed forecasts have bell-shaped histograms. In MET, the PIT calculation uses a normal distribution fit to the ensemble forecasts. In many cases, use of other distributions would be better. +Observation Error Logarithmic Scoring Rules +------------------------------------------- + +Called "IGN_CONV_OERR" and "IGN_CORR_OERR" in ECNT output :numref:`table_ES_header_info_es_out_ECNT` + +One approach that is used to take observation error into account in a summary measure is to add error to the forecast by a convolution with the observation model (e.g., :ref:`Anderson, 1996 `; :ref:`Hamill, 2001 `; :ref:`Saetra et. al., 2004 `; :ref:`Bröcker and Smith, 2007 `; :ref:`Candille et al., 2007 `; :ref:`Candille and Talagrand, 2008 `; :ref:`Röpnack et al., 2013 `). Specifically, suppose :math:`y=x+w`, where :math:`y` is the observed value, :math:`x` is the true value, and :math:`w` is the error. Then, if :math:`f` is the density forecast for :math:`x` and :math:`\nu` is the observation model, then the implied density forecast for :math:`y` is given by the convolution: + +.. math:: (f*\nu)(y) = \int\nu(y|x)f(x)dx + +:ref:`Ferro, 2017 ` gives the error-convolved version of the ignorance scoring rule (referred to therein as the error-convolved logarithmic scoring rule), which is proper under the model where :math:`w\sim N(0,c^2)`) when the forecast for :math:`x` is :math:`N(\mu,\sigma^2)` with density function :math:`f`, by + +.. only:: latex + + .. math:: \text{IGN\_CONV\_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} + +.. only:: html + + .. math:: \text{IGN_CONV_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} + +Another approach to incorporation of observation uncertainty into a measure is the error-correction approach. The approach merely ensures that the scoring rule, :math:`s`, is unbiased for a scoring rule :math:`s_0` if they have the same expected value. :ref:`Ferro, 2017 ` gives the error-corrected ignorance scoring rule (which is also proposer when :math:`w\sim N(0,c^2)`) as + +.. only:: latex + + .. math:: \text{IGN\_CORR\_OERR} = s(f,y) = \log\sigma + \frac{(y - \mu)^2 - c^2}{2\sigma^2} + +.. only:: html + + .. math:: \text{IGN_CORR_OERR} = s(f,y) = \log\sigma + \frac{(y - \mu)^2 - c^2}{2\sigma^2} + +The expected score for the error-convolved ignorance scoring rule typically differs from the expected score that would be achieved if there were no observation error. The error-corrected score, on the other hand, has the same expectation. + RANK ---- @@ -1160,7 +1191,7 @@ The traditional contingency table statistics computed by the Grid-Stat neighborh All of these measures are defined in :numref:`categorical variables`. -In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert (2008) ` and :ref:`Roberts and Lean (2008) `. :ref:`Roberts and Lean (2008) ` also present an application of the methodology. +In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert, 2008 ` and :ref:`Roberts and Lean, 2008 `. :ref:`Roberts and Lean, 2008 ` also present an application of the methodology. Fractions Brier Score --------------------- @@ -1225,7 +1256,7 @@ A mathematical metric, :math:`m(A,B)\geq 0`, must have the following three prope The first establishes that a perfect score is zero and that the only way to obtain a perfect score is if the two sets are identical according to the metric. The second requirement ensures that the order by which the two sets are evaluated will not change the result. The third property ensures that if *C* is closer to *A* than *B* is to *A*, then :math:`m(A,C) < m(A,B)`. -It has been argued in :ref:`Gilleland (2017) ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. +It has been argued in :ref:`Gilleland, 2017 ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. The results of the distance map verification approaches that are included in the Grid-Stat tool are summarized using a variety of measures. These measures include Baddeley's :math:`\Delta` Metric, the Hausdorff Distance, the Mean-error Distance, Pratt's Figure of Merit, and Zhu's Measure. Their equations are listed below. diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 42443aa315..7eba9f1aa9 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -66,7 +66,9 @@ The climatological distribution is also used for the RPSS. The forecast RPS stat Ensemble Observation Error -------------------------- -In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) `. can be replicated using the appropriate options. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both, of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. +In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) ` can be replicated using the appropriate options. Additional probabilistic measures that include observational uncertainty recommended by :ref:`Ferro, 2017 ` are also provided. + +Observation error information can be defined directly in the Ensemble-Stat configuration file or through a more flexible observation error table lookup. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both, of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. Normal and uniform are common choices for the observation error distribution. The uniform distribution provides the benefit of being bounded on both sides, thus preventing the perturbation from taking on extreme values. Normal is the most common choice for observation error. However, the user should realize that with the very large samples typical in NWP, some large outliers will almost certainly be introduced with the perturbation. For variables that are bounded below by 0, and that may have inconsistent observation errors (e.g. larger errors with larger measurements), a lognormal distribution may be selected. Wind speeds and precipitation measurements are the most common of this type of NWP variable. The lognormal error perturbation prevents measurements of 0 from being perturbed, and applies larger perturbations when measurements are larger. This is often the desired behavior in these cases, but this distribution can also lead to some outliers being introduced in the perturbation step. @@ -647,6 +649,12 @@ The format of the STAT and ASCII output of the Ensemble-Stat tool are described * - 49 - ME_LT_OBS - The Mean Error of the ensemble values less than or equal to their observations + * - 50 + - IGN_CONV_OERR + - Error-convolved logarithmic scoring rule (i.e. ignornance score) from Equation 5 of :ref:`Ferro, 2017 ` + * - 51 + - IGN_CORR_OERR + - Error-corrected logarithmic scoring rule (i.e. ignornance score) from Equation 7 of :ref:`Ferro, 2017 ` .. _table_ES_header_info_es_out_RPS: diff --git a/docs/Users_Guide/refs.rst b/docs/Users_Guide/refs.rst index b4045f90b6..1c328014cb 100644 --- a/docs/Users_Guide/refs.rst +++ b/docs/Users_Guide/refs.rst @@ -14,11 +14,18 @@ References | Ahijevych, D., E. Gilleland, B.G. Brown, and E.E. Ebert, 2009: Application of | spatial verification methods to idealized and NWP-gridded precipitation forecasts. -| *Weather and Forecasting*, 24 (6), 1485 - 1497, doi: 10.1175/2009WAF2222298.1. +| *Weather and Forecasting*, 24 (6), 1485 - 1497. +| doi: https://doi.org/10.1175/2009WAF2222298.1 | -.. _Barker-1991: +.. _Andersen-1996: + +| Anderson JL., 1996: A method for producing and evaluating probabilistic forecasts +| from ensemble model integrations. *J. Clim.* 9: 1518-1530. +| doi: `https://doi.org/10.1175/1520-0442(1996)009<1518:AMFPAE>2.0.CO;2 2.0.CO;2>`_ +| +.. _Barker-1991: | Barker, T. W., 1991: The relationship between spread and forecast error in | extended-range forecasts. *Journal of Climate*, 4, 733-742. @@ -29,14 +36,14 @@ References | Bradley, A.A., S.S. Schwartz, and T. Hashino, 2008: Sampling Uncertainty | and Confidence Intervals for the Brier Score and Brier Skill Score. | *Weather and Forecasting*, 23, 992-1006. -| +| .. _Brill-2009: | Brill, K. F., and F. Mesinger, 2009: Applying a general analytic method | for assessing bias sensitivity to bias-adjusted threat and equitable | threat scores. *Weather and Forecasting*, 24, 1748-1754. -| +| .. _Brown-2007: @@ -49,32 +56,47 @@ References | http://ams.confex.com/ams/pdfpapers/124856.pdf. | +.. _Bröcker-2007: + +| Bröcker J, Smith LA., 2007: Scoring probabilistic forecasts: The importance +| of being proper. *Weather Forecasting*, 22, 382-388. +| doi: https://doi.org/10.1175/WAF966.1 +| + .. _Buizza-1997: | Buizza, R., 1997: Potential forecast skill of ensemble prediction and spread | and skill distributions of the ECMWF ensemble prediction system. *Monthly* -| *Weather Review*,125, 99-119. -| +| *Weather Review*, 125, 99-119. +| .. _Bullock-2016: | Bullock, R., T. Fowler, and B. Brown, 2016: Method for Object-Based | Diagnostic Evaluation. *NCAR Technical Note* NCAR/TN-532+STR, 66 pp. -| +| + +.. _Candille-2007: + +| Candille G, Côté C, Houtekamer PL, Pellerin G, 2007: Verification of an +| ensemble prediction system against observations. *Mon. Weather Rev.* +| 135: 2688-2699. +| doi: https://doi.org/10.1175/MWR3414.1 +| .. _Candille-2008: | Candille, G., and O. Talagrand, 2008: Impact of observational error on the | validation of ensemble prediction systems. *Quarterly Journal of the Royal* | *Meteorological Society* 134: 959-971. -| +| .. _Casati-2004: | Casati, B., G. Ross, and D. Stephenson, 2004: A new intensity-scale approach | for the verification of spatial precipitation forecasts. *Meteorological* | *Applications* 11, 141-154. -| +| .. _Davis-2006: @@ -86,37 +108,45 @@ References | Davis, C.A., B.G. Brown, and R.G. Bullock, 2006b: Object-based verification | of precipitation forecasts, Part II: Application to convective rain systems. | *Monthly Weather Review*, 134, 1785-1795. -| +| .. _Dawid-1984: | Dawid, A.P., 1984: Statistical theory: The prequential approach. *Journal of* | *the Royal Statistical Society* A147, 278-292. -| +| .. _Ebert-2008: | Ebert, E.E., 2008: Fuzzy verification of high-resolution gridded forecasts: -| a review and proposed framework. *Meteorological Applications,* 15, 51-64. -| +| a review and proposed framework. *Meteorological Applications*, 15, 51-64. +| .. _Eckel-2012: | Eckel, F. A., M.S. Allen, M. C. Sittel, 2012: Estimation of Ambiguity in -| Ensemble Forecasts. *Weather Forecasting,* 27, 50-69. -| doi: http://dx.doi.org/10.1175/WAF-D-11-00015.1 +| Ensemble Forecasts. *Weather Forecasting*, 27, 50-69. +| doi: https://doi.org/10.1175/WAF-D-11-00015.1 | .. _Efron-2007: | Efron, B. 2007: Correlation and large-scale significance testing. *Journal* -| of the American Statistical Association,* 102(477), 93-103. +| of the American Statistical Association*, 102(477), 93-103. | .. _Epstein-1969: | Epstein, E. S., 1969: A scoring system for probability forecasts of ranked categories. -| *J. Appl. Meteor.*, 8, 985-987, 10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2. +| *J. Appl. Meteor.*, 8, 985-987. +| doi: `https://doi.org/10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2 2.0.CO;2>`_ +| + +.. _Ferro-2017: + +| Ferro C. A. T., 2017: Measuring forecast performance in the presence of observation error. +| *Q. J. R. Meteorol. Soc.*, 143 (708), 2665-2676. +| doi: https://doi.org/10.1002/qj.3115 | .. _Gilleland-2010: @@ -129,29 +159,32 @@ References | Gilleland, E., 2017: A new characterization in the spatial verification | framework for false alarms, misses, and overall patterns. -| *Weather and Forecasting*, 32 (1), 187 - 198, doi: 10.1175/WAF-D-16-0134.1. +| *Weather and Forecasting*, 32 (1), 187 - 198. +| doi: https://doi.org/10.1175/WAF-D-16-0134.1 | .. _Gilleland_PartI-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part I: Comparative forecast verification for continuous variables. -| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134, -| doi: 10.1175/JTECH-D-20-0069.1. +| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134. +| doi: https://doi.org/10.1175/JTECH-D-20-0069.1 | .. _Gilleland_PartII-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part II: Extreme-value analysis. *Journal of Atmospheric and Oceanic* -| *Technology*, 37 (11), 2135 - 2144, doi: 10.1175/JTECH-D-20-0070.1. +| *Technology*, 37 (11), 2135 - 2144. +| doi: https://doi.org/10.1175/JTECH-D-20-0070.1 | .. _Gilleland-2021: | Gilleland, E., 2021: Novel measures for summarizing high-resolution forecast | performance. *Advances in Statistical Climatology, Meteorology and Oceanography*, -| 7 (1), 13 - 34, doi: 10.5194/ascmo-7-13-2021. +| 7 (1), 13 - 34. +| doi: https://doi.org/10.5194/ascmo-7-13-2021 | .. _Gneiting-2004: @@ -161,7 +194,7 @@ References | *Minimum CRPS Estimation*. Technical Report no. 449, Department of | Statistics, University of Washington. Available at | http://www.stat.washington.edu/www/research/reports/ -| +| .. _Haiden-2012: @@ -175,41 +208,41 @@ References | Hamill, T. M., 2001: Interpretation of rank histograms for verifying ensemble | forecasts. *Monthly Weather Review*, 129, 550-560. -| +| .. _Hersbach-2000: | Hersbach, H., 2000: Decomposition of the Continuous Ranked Probability Score | for Ensemble Prediction Systems. *Weather and Forecasting*, 15, 559-570. -| +| .. _Jolliffe-2012: | Jolliffe, I.T., and D.B. Stephenson, 2012: *Forecast verification. A* | *practitioner's guide in atmospheric science.* Wiley and Sons Ltd, 240 pp. -| +| .. _Knaff-2003: | Knaff, J.A., M. DeMaria, C.R. Sampson, and J.M. Gross, 2003: Statistical, | Five-Day Tropical Cyclone Intensity Forecasts Derived from Climatology -| and Persistence. *Weather and Forecasting,* Vol. 18 Issue 2, p. 80-92. -| +| and Persistence. *Weather and Forecasting*, Vol. 18 Issue 2, p. 80-92. +| .. _Mason-2004: | Mason, S. J., 2004: On Using "Climatology" as a Reference Strategy | in the Brier and Ranked Probability Skill Scores. *Monthly Weather Review*, | 132, 1891-1895. -| +| .. _Mason-2008: | Mason, S. J., 2008: Understanding forecast verification statistics. -| *Meteor. Appl.*, 15, 31-40, doi: 10.1002/met.51. +| *Meteor. Appl.*, 15, 31-40. +| doi: https://doi.org/10.1002/met.51 | - .. _Mittermaier-2014: | Mittermaier, M., 2014: A strategy for verifying near-convection-resolving @@ -220,21 +253,20 @@ References | Mood, A. M., F. A. Graybill and D. C. Boes, 1974: *Introduction to the* | *Theory of Statistics*, McGraw-Hill, 299-338. -| +| .. _Murphy-1969: | Murphy, A.H., 1969: On the ranked probability score. *Journal of Applied* | *Meteorology and Climatology*, 8 (6), 988 - 989, -| doi: 10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2. +| doi: `https://doi.org/10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2 2.0.CO;2>`_ | .. _Murphy-1987: | Murphy, A.H., and R.L. Winkler, 1987: A general framework for forecast | verification. *Monthly Weather Review*, 115, 1330-1338. -| - +| .. _North-2022: @@ -256,7 +288,7 @@ References | Roberts, N.M., and H.W. Lean, 2008: Scale-selective verification of rainfall | accumulations from high-resolution forecasts of convective events. | *Monthly Weather Review*, 136, 78-97. -| +| .. _Rodwell-2010: @@ -273,11 +305,18 @@ References | https://www.ecmwf.int/node/14595 | +.. _Röpnack-2013: + +| Röpnack A, Hense A, Gebhardt C, Majewski D., 2013: Bayesian model verification +| of NWP ensemble forecasts. *Mon. Weather Rev.* 141: 375–387. +| doi: https://doi.org/10.1175/MWR-D-11-00350.1 +| + .. _Saetra-2004: -| Saetra O., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of +| Saetra Ø., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of | observation errors on the statistics for ensemble spread and -| reliability. *Monthly Weather Review* 132: 1487-1501. +| reliability. *Monthly Weather Review*, 132: 1487-1501. | .. _Santos-2012: @@ -285,7 +324,7 @@ References | Santos C. and A. Ghelli, 2012: Observational probability method to assess | ensemble precipitation forecasts. *Quarterly Journal of the Royal* | *Meteorological Society* 138: 209-221. -| +| .. _Schwartz-2017: @@ -298,20 +337,21 @@ References | Stephenson, D.B., 2000: Use of the "Odds Ratio" for diagnosing | forecast skill. *Weather and Forecasting*, 15, 221-232. -| +| .. _Stephenson-2008: | Stephenson, D.B., B. Casati, C.A.T. Ferro, and C.A. Wilson, 2008: The extreme | dependency score: A non-vanishing measure for forecasts of rare events. | *Meteorological Applications* 15, 41-50. -| +| -.. _Todter-2012: +.. _Tödter-2012: | Tödter, J. and B. Ahrens, 2012: Generalization of the Ignorance Score: | Continuous ranked version and its decomposition. *Monthly Weather Review*, -| 140 (6), 2005 - 2017, doi: 10.1175/MWR-D-11-00266.1. +| 140 (6), 2005 - 2017. +| doi: https://doi.org/10.1175/MWR-D-11-00266.1 | .. _Weniger-2016: @@ -319,17 +359,18 @@ References | Weniger, M., F. Kapp, and P. Friederichs, 2016: Spatial Verification Using | Wavelet Transforms: A Review. *Quarterly Journal of the Royal* | *Meteorological Society*, 143, 120-136. -| +| .. _Wilks-2010: | Wilks, D.S. 2010: Sampling distributions of the Brier score and Brier skill | score under serial dependence. *Quarterly Journal of the Royal* -| *Meteorological Society*, 136, 2109-2118. doi:10.1002/qj.709 -| +| *Meteorological Society*, 136, 2109-2118. +| doi: https://doi.org/10.1002/qj.709 +| .. _Wilks-2011: | Wilks, D., 2011: *Statistical methods in the atmospheric sciences.* | Elsevier, San Diego. -| +| diff --git a/internal/test_unit/hdr/met_12_0.hdr b/internal/test_unit/hdr/met_12_0.hdr index d6bf9fb0b9..a1113d5102 100644 --- a/internal/test_unit/hdr/met_12_0.hdr +++ b/internal/test_unit/hdr/met_12_0.hdr @@ -19,7 +19,7 @@ PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH _VAR_ PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL _VAR_ ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASE N_PTS _VAR_ -ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS +ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL CRPS IGN N_RANK CRPSS SPREAD _VAR_ PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE N_BIN _VAR_ diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index 144736cc88..baaac11c6a 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -1075,7 +1075,9 @@ NumArray NumArray::subset(const NumArray &keep) const // Check bounds if ( keep.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::subset(const NumArray &) -> " - << "the number of elements do not match\n\n"; + << "the number of elements do not match (" + << keep.n_elements() << " keep flags != " + << n_elements() << " array elements)\n\n"; exit ( 1 ); } @@ -1156,7 +1158,9 @@ double NumArray::wmean(const NumArray &wgt) const if ( wgt.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::wmean(const NumArray &) -> " - << "the number of elements do not match\n\n"; + << "the number of elements do not match (" + << wgt.n_elements() << " weights != " + << n_elements() << " array elements)\n\n"; exit ( 1 ); } diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index 909441b5ba..826d5101c9 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -276,7 +276,7 @@ static const char * ecnt_columns [] = { "CRPSS_EMP", "CRPS_EMP_FAIR", "SPREAD_MD", "MAE", "MAE_OERR", "BIAS_RATIO", "N_GE_OBS", "ME_GE_OBS", "N_LT_OBS", - "ME_LT_OBS" + "ME_LT_OBS", "IGN_CONV_OERR", "IGN_CORR_OERR" }; static const char * rps_columns [] = { diff --git a/src/libcode/vx_gsl_prob/gsl_randist.h b/src/libcode/vx_gsl_prob/gsl_randist.h index d562bfe733..e66c312230 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.h +++ b/src/libcode/vx_gsl_prob/gsl_randist.h @@ -58,9 +58,9 @@ extern void ran_sample(const gsl_rng *r, double *, int, double *, int); extern void ran_sample(const gsl_rng *r, NumArray &, NumArray &, int); extern double ran_draw(const gsl_rng *r, DistType, - double p1, double p2 = bad_data_int); + double p1, double p2 = bad_data_double); extern double dist_var(DistType, - double p1, double p2 = bad_data_int); + double p1, double p2 = bad_data_double); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index c4880f83eb..55aded1e28 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -4275,7 +4275,7 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, // CRPSS_EMP CRPS_EMP_FAIR, SPREAD_MD, // MAE, MAE_OERR, BIAS_RATIO, // N_GE_OBS, ME_GE_OBS, N_LT_OBS, - // ME_LT_OBS + // ME_LT_OBS, IGN_CONV_OERR, IGN_CORR_OERR // at.set_entry(r, c+0, // Total Number of Pairs ecnt_info.n_pair); @@ -4352,6 +4352,12 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, at.set_entry(r, c+24, // ME of ensemble values < observations ecnt_info.me_lt_obs); + at.set_entry(r, c+25, // Ignorance Score, observation error convolved + ecnt_info.ign_conv_oerr); + + at.set_entry(r, c+26, // Ignorance Score, observation error corrected + ecnt_info.ign_corr_oerr); + return; } diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 4ed6f821ca..782832b79f 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -181,13 +181,15 @@ void ECNTInfo::clear() { crps_emp_fair = spread_md = bad_data_double; crps_gaus = crpscl_gaus = crpss_gaus = bad_data_double; ign = bad_data_double; - me = mae = rmse = spread = bad_data_double; - me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; + me = mae = rmse = spread = bad_data_double; + me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; spread_plus_oerr = bad_data_double; - n_ge_obs = n_lt_obs = 0; - me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; - + ign_conv_oerr = ign_corr_oerr = bad_data_double; + + n_ge_obs = n_lt_obs = 0; + me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; + return; } @@ -221,6 +223,8 @@ void ECNTInfo::assign(const ECNTInfo &c) { rmse_oerr = c.rmse_oerr; spread_oerr = c.spread_oerr; spread_plus_oerr = c.spread_plus_oerr; + ign_conv_oerr = c.ign_conv_oerr; + ign_corr_oerr = c.ign_corr_oerr; n_ge_obs = c.n_ge_obs; n_lt_obs = c.n_lt_obs; @@ -361,6 +365,10 @@ void ECNTInfo::set(const PairDataEnsemble &pd) { // Compute the square root of the average variance plus oerr spread_plus_oerr = square_root(pd.var_plus_oerr_na.wmean(pd.wgt_na)); + // Compute log scores with observational uncertainty + ign_conv_oerr = pd.ign_conv_oerr_na.wmean(pd.wgt_na); + ign_corr_oerr = pd.ign_corr_oerr_na.wmean(pd.wgt_na); + // Compute bias ratio terms n_ge_obs = nint(pd.n_ge_obs_na.sum()); me_ge_obs = pd.me_ge_obs_na.wmean(pd.n_ge_obs_na); diff --git a/src/libcode/vx_statistics/ens_stats.h b/src/libcode/vx_statistics/ens_stats.h index 17e864fb5e..69eca9f4e1 100644 --- a/src/libcode/vx_statistics/ens_stats.h +++ b/src/libcode/vx_statistics/ens_stats.h @@ -82,6 +82,10 @@ class ECNTInfo { double me_oerr, mae_oerr, rmse_oerr, spread_oerr; double spread_plus_oerr; + // Log scores that incorporate observational uncertainty, + // as advised in Ferro (2017) + double ign_conv_oerr, ign_corr_oerr; + // Bias ratio information int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index a290afcb30..8487d751b5 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -3456,6 +3456,25 @@ int min_int(const int *v_int, int n) { return v_min; } +//////////////////////////////////////////////////////////////////////// +// +// Compute mean from a sum +// +//////////////////////////////////////////////////////////////////////// + +double compute_mean(double sum, int n) { + double v; + + if(is_bad_data(sum) || is_bad_data(n) || n == 0) { + v = bad_data_double; + } + else { + v = sum / n; + } + + return(v); +} + //////////////////////////////////////////////////////////////////////// // // Compute variance from sums of squares diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index f0715d45b3..1d5def71a7 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -726,6 +726,8 @@ extern int min_int(const int *, int); // //////////////////////////////////////////////////////////////////////// +extern double compute_mean(double, int); + extern double compute_variance(double, double, int); extern double compute_stdev(double, double, int); diff --git a/src/libcode/vx_statistics/obs_error.cc b/src/libcode/vx_statistics/obs_error.cc index eae4bed423..5b753346a3 100644 --- a/src/libcode/vx_statistics/obs_error.cc +++ b/src/libcode/vx_statistics/obs_error.cc @@ -5,6 +5,7 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + //////////////////////////////////////////////////////////////////////// #include @@ -184,6 +185,12 @@ void ObsErrorEntry::dump(ostream & out, int depth) const { //////////////////////////////////////////////////////////////////////// +double ObsErrorEntry::variance() const { + return dist_var(dist_type, dist_parm[0], dist_parm[1]); +} + +//////////////////////////////////////////////////////////////////////// + bool ObsErrorEntry::parse_line(const DataLine &dl) { // Initialize diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 732c4c3ced..11cce141dc 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -5,6 +5,7 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + //////////////////////////////////////////////////////////////////////// #ifndef __OBS_ERROR_H__ @@ -68,6 +69,8 @@ class ObsErrorEntry { // get stuff // + double variance() const; + // // do stuff // diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index cc25f891d3..b9c3868036 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -108,6 +108,9 @@ void PairDataEnsemble::clear() { ign_na.clear(); pit_na.clear(); + ign_conv_oerr_na.clear(); + ign_corr_oerr_na.clear(); + n_ge_obs_na.clear(); me_ge_obs_na.clear(); n_lt_obs_na.clear(); @@ -179,6 +182,8 @@ void PairDataEnsemble::extend(int n) { crpscl_gaus_na.extend (n); ign_na.extend (n); pit_na.extend (n); + ign_conv_oerr_na.extend (n); + ign_corr_oerr_na.extend (n); n_ge_obs_na.extend (n); me_ge_obs_na.extend (n); n_lt_obs_na.extend (n); @@ -235,15 +240,20 @@ void PairDataEnsemble::assign(const PairDataEnsemble &pd) { // PairDataEnsemble v_na = pd.v_na; r_na = pd.r_na; + crps_emp_na = pd.crps_emp_na; crps_emp_fair_na = pd.crps_emp_fair_na; spread_md_na = pd.spread_md_na; crpscl_emp_na = pd.crpscl_emp_na; crps_gaus_na = pd.crps_gaus_na; crpscl_gaus_na = pd.crpscl_gaus_na; + ign_na = pd.ign_na; pit_na = pd.pit_na; + ign_conv_oerr_na = pd.ign_conv_oerr_na; + ign_corr_oerr_na = pd.ign_corr_oerr_na; + n_ge_obs_na = pd.n_ge_obs_na; me_ge_obs_na = pd.me_ge_obs_na; n_lt_obs_na = pd.n_lt_obs_na; @@ -449,6 +459,8 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { crpscl_gaus_na.add(bad_data_double); ign_na.add(bad_data_double); pit_na.add(bad_data_double); + ign_conv_oerr_na.add(bad_data_double); + ign_corr_oerr_na.add(bad_data_double); n_ge_obs_na.add(bad_data_double); me_ge_obs_na.add(bad_data_double); n_lt_obs_na.add(bad_data_double); @@ -461,22 +473,41 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { var_unperturbed = compute_variance(esum_na[i], esumsq_na[i], esumn_na[i]); var_na.add(var_unperturbed); - // Process the observation error information. + // Process the observation error information ObsErrorEntry * e = (has_obs_error() ? obs_error_entry[i] : 0); if(e) { + // Get observation error variance + double oerr_var = e->variance(); + + // Compute the observation error log scores + double v_conv, v_corr; + compute_obs_error_log_scores( + compute_mean(esum_na[i], esumn_na[i]), + compute_stdev(esum_na[i], esumsq_na[i], esumn_na[i]), + o_na[i], oerr_var, + v_conv, v_corr); + ign_conv_oerr_na.add(v_conv); + ign_corr_oerr_na.add(v_corr); + // Compute perturbed ensemble mean and variance // Exclude the control member from the variance mn_oerr_na.add(cur_ens.mean()); var_oerr_na.add(cur_ens.variance(ctrl_index)); - // Compute the variance plus observation error variance. - var_plus_oerr_na.add(var_unperturbed + - dist_var(e->dist_type, - e->dist_parm[0], e->dist_parm[1])); + // Compute the variance plus observation error variance + if(is_bad_data(var_unperturbed) || + is_bad_data(oerr_var)) { + var_plus_oerr_na.add(bad_data_double); + } + else { + var_plus_oerr_na.add(var_unperturbed + oerr_var); + } } - // If no observation error specified, store bad data values. + // If no observation error specified, store bad data values else { + ign_conv_oerr_na.add(bad_data_double); + ign_corr_oerr_na.add(bad_data_double); mn_oerr_na.add(bad_data_double); var_oerr_na.add(bad_data_double); var_plus_oerr_na.add(bad_data_double); @@ -506,8 +537,8 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { derive_climo_vals(cdf_info_ptr, cmn_na[i], csd_na[i], cur_clm); // Store empirical CRPS stats - // - // For crps_emp use temporary, local variable so we can use it for the crps_emp_fair calculation + // For crps_emp use temporary, local variable so we can use it + // for the crps_emp_fair calculation double crps_emp = compute_crps_emp(o_na[i], cur_ens); crps_emp_na.add(crps_emp); crps_emp_fair_na.add(crps_emp - cur_ens.wmean_abs_diff()); @@ -528,9 +559,10 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { // Compute the Bias Ratio terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms(o_na[i], cur_ens, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms( + o_na[i], cur_ens, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); // Store the Bias Ratio terms n_ge_obs_na.add(n_ge_obs); @@ -864,8 +896,11 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o // // Include in subset: // wgt_na, o_na, cmn_na, csd_na, v_na, r_na, - // crps_emp_na, crps_emp_fair_na, spread_md_na, crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, - // ign_na, pit_na, n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, + // crps_emp_na, crps_emp_fair_na, spread_md_na, + // crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, + // ign_na, pit_na, + // ign_conv_oerr, ign_corr_oerr, + // n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, // var_na, var_oerr_na, var_plus_oerr_na, // mn_na, mn_oerr_na, e_na // @@ -888,6 +923,8 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o pd.crpscl_gaus_na.add(crpscl_gaus_na[i]); pd.ign_na.add(ign_na[i]); pd.pit_na.add(pit_na[i]); + pd.ign_conv_oerr_na.add(ign_conv_oerr_na[i]); + pd.ign_corr_oerr_na.add(ign_corr_oerr_na[i]); pd.n_ge_obs_na.add(n_ge_obs_na[i]); pd.me_ge_obs_na.add(me_ge_obs_na[i]); pd.n_lt_obs_na.add(n_lt_obs_na[i]); @@ -1498,7 +1535,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, y < 0 || y >= gr.ny()) return; // For pressure levels, check if the observation pressure level - // falls in the requsted range. + // falls in the requested range. if(obs_info_grib->level().type() == LevelType_Pres) { if(obs_lvl < obs_info_grib->level().lower() || @@ -1593,7 +1630,8 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, } } - // Apply observation error logic bias correction, if requested + // Apply observation error additive and multiplicative + // bias correction, if requested if(obs_error_info->flag) { obs_v = add_obs_error_bc(obs_error_info->rng_ptr, FieldType_Obs, oerr_ptr, obs_v); @@ -2111,5 +2149,52 @@ double compute_bias_ratio(double me_ge_obs, double me_lt_obs) { return v; } - + +//////////////////////////////////////////////////////////////////////// + +void compute_obs_error_log_scores(double emn, double esd, + double obs, double oerr_var, + double &v_conv, double &v_corr) { + + const char *method_name = "compute_obs_error_log_scores() -> "; + + // Check for bad input data + if(is_bad_data(emn) || + is_bad_data(esd) || + is_bad_data(obs) || + is_bad_data(oerr_var)) { + v_conv = v_corr = bad_data_double; + } + else { + double sigma2 = esd * esd; + double ov2 = oerr_var * oerr_var; + + // Error-convolved logarithmic scoring rule in + // Ferro (2017, Eq 5) doi:10.1002/qj.3115 + // Scale by 2.0 * pi for consistency with ignorance score + v_conv = 0.5 * log(2.0 * pi * (sigma2 + ov2)) + + (obs - emn) * (obs - emn) / + (2.0 * (sigma2 + ov2)); + + // Error-corrected logarithmic scoring rule in + // Ferro (2017, Eq 7) doi:10.1002/qj.3115 + // Scale by 2.0 * pi for consistency with ignorance score + v_corr = log(esd) + + ((obs - emn) * (obs - emn) - ov2) / + (2.0 * sigma2); + } + + if(mlog.verbosity_level() >= 10) { + mlog << Debug(10) << method_name + << "inputs (emn = " << emn + << ", esd = " << esd + << ", obs = " << obs + << ", oerr_var = " << oerr_var + << ") and outputs (ign_oerr_conv = " << v_conv + << ", ign_oerr_corr = " << v_corr << ")\n"; + } + + return; +} + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index e6014b59fb..9be2eec3c8 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -6,6 +6,8 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +//////////////////////////////////////////////////////////////////////// + #ifndef __PAIR_DATA_ENSEMBLE_H__ #define __PAIR_DATA_ENSEMBLE_H__ @@ -74,64 +76,67 @@ class PairDataEnsemble : public PairBase { bool obs_error_flag; // Ensemble, valid count, and rank values - NumArray *e_na; // Ensemble values [n_ens][n_obs] - NumArray v_na; // Number of valid ensemble values [n_obs] - NumArray r_na; // Observation ranks [n_obs] + NumArray *e_na; // Ensemble values [n_ens][n_obs] + NumArray v_na; // Number of valid ensemble values [n_obs] + NumArray r_na; // Observation ranks [n_obs] + + NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] + NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] + NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] + NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] - NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] - NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] - NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] - NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] + NumArray crps_gaus_na; // Gaussian CRPS [n_obs] + NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] - NumArray crps_gaus_na; // Gaussian CRPS [n_obs] - NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] + NumArray ign_na; // Ignorance Score [n_obs] + NumArray pit_na; // Probability Integral Transform [n_obs] - NumArray ign_na; // Ignorance Score [n_obs] - NumArray pit_na; // Probability Integral Transform [n_obs] + NumArray ign_conv_oerr_na; // Error convolved log score [n_obs] + NumArray ign_corr_oerr_na; // Error corrected log score [n_obs] - NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] - NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] - NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] - NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] + NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] + NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] + NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] + NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] - int n_ens; // Number of ensemble members - int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) - int ctrl_index; // Index of the control member - bool skip_const; // Skip cases where the observation and - // all ensemble members are constant - BoolArray skip_ba; // Flag for each observation [n_obs] + int n_ens; // Number of ensemble members + int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) + int ctrl_index; // Index of the control member + bool skip_const; // Skip cases where the observation and + // all ensemble members are constant + BoolArray skip_ba; // Flag for each observation [n_obs] - NumArray rhist_na; // Ranked Histogram [n_ens+1] - NumArray relp_na; // Relative Position Histogram [n_ens] + NumArray rhist_na; // Ranked Histogram [n_ens+1] + NumArray relp_na; // Relative Position Histogram [n_ens] - double phist_bin_size; // Ensemble PIT histogram bin width - NumArray phist_na; // PIT Histogram [n_phist_bin] + double phist_bin_size; // Ensemble PIT histogram bin width + NumArray phist_na; // PIT Histogram [n_phist_bin] NumArray var_na; // Variance of unperturbed members [n_obs] NumArray var_oerr_na; // Variance of perturbed members [n_obs] NumArray var_plus_oerr_na; // Unperturbed variance plus observation error variance [n_obs] - NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] - NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] - NumArray esumn_na; // Count of ensemble values [n_obs] + NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] + NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] + NumArray esumn_na; // Count of ensemble values [n_obs] - NumArray mn_na; // Ensemble mean value [n_obs] - NumArray mn_oerr_na; // Mean of perturbed members [n_obs] + NumArray mn_na; // Ensemble mean value [n_obs] + NumArray mn_oerr_na; // Mean of perturbed members [n_obs] - double ssvar_bin_size; // Variance bin size for spread/skill - SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] + double ssvar_bin_size; // Variance bin size for spread/skill + SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] - double crpss_emp; // Empirical CRPS skill score - double crpss_gaus; // Guassian CRPS skill score + double crpss_emp; // Empirical CRPS skill score + double crpss_gaus; // Guassian CRPS skill score - double me; // ME for ensemble mean - double mae; // MAE for ensemble mean - double rmse; // RMSE for ensemble mean - double me_oerr; // ME for mean of perturbed members - double mae_oerr; // MAE for mean of perturbed members - double rmse_oerr; // RMSE for mean of perturbed members + double me; // ME for ensemble mean + double mae; // MAE for ensemble mean + double rmse; // RMSE for ensemble mean + double me_oerr; // ME for mean of perturbed members + double mae_oerr; // MAE for mean of perturbed members + double rmse_oerr; // RMSE for mean of perturbed members - double bias_ratio; // Bias ratio + double bias_ratio; // Bias ratio ////////////////////////////////////////////////////////////////// @@ -323,6 +328,9 @@ extern double compute_ens_pit(double, double, double); extern void compute_bias_ratio_terms(double, const NumArray &, int &, double &, int &, double &); extern double compute_bias_ratio(double, double); +extern void compute_obs_error_log_scores( + double, double, double, double, + double &, double &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index cd3b080bc6..2b19b94391 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -1119,7 +1119,7 @@ void VxPairDataPoint::add_point_obs(float *hdr_arr, const char *hdr_typ_str, } // For pressure levels, check if the observation pressure level - // falls in the requsted range. + // falls in the requested range. if(obs_info->level().type() == LevelType_Pres) { if(obs_lvl < obs_info->level().lower() || diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 49506e1402..3ca4cfcaff 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -39,6 +39,8 @@ // line types. // 018 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. +// 019 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -2656,6 +2658,8 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.crps_gaus_na.add(cur.crps_gaus); m[key].ens_pd.crpscl_gaus_na.add(cur.crpscl_gaus); m[key].ens_pd.ign_na.add(cur.ign); + m[key].ens_pd.ign_conv_oerr_na.add(cur.ign_conv_oerr); + m[key].ens_pd.ign_corr_oerr_na.add(cur.ign_corr_oerr); m[key].ens_pd.n_ge_obs_na.add(cur.n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(cur.me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(cur.n_lt_obs); @@ -3229,17 +3233,34 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.ign_na.add(compute_ens_ign(cur.obs, cur.ens_mean, cur.spread)); m[key].ens_pd.pit_na.add(compute_ens_pit(cur.obs, cur.ens_mean, cur.spread)); + // Back out the observation error variance + double oerr_var = bad_data_double; + if(!is_bad_data(cur.spread_plus_oerr) && + !is_bad_data(cur.spread)) { + oerr_var = square(cur.spread_plus_oerr) - + square(cur.spread); + } + // Store BIAS_RATIO terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms(cur.obs, cur.ens_na, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms( + cur.obs, cur.ens_na, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); m[key].ens_pd.n_ge_obs_na.add(n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(n_lt_obs); m[key].ens_pd.me_lt_obs_na.add(me_lt_obs); + // Compute observation error log scores + double v_conv, v_corr; + compute_obs_error_log_scores( + cur.ens_mean, cur.spread, cur.obs, oerr_var, + v_conv, v_corr); + m[key].ens_pd.ign_conv_oerr_na.add(v_conv); + m[key].ens_pd.ign_corr_oerr_na.add(v_corr); + // // Increment the RHIST counts // diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index b6ec116759..ebdc9d9a0a 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -33,6 +33,8 @@ // line types. // 013 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. +// 014 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -397,6 +399,9 @@ void parse_ecnt_line(STATLine &l, ECNTData &e_data) { e_data.n_lt_obs = atoi(l.get_item("N_LT_OBS")); e_data.me_lt_obs = atof(l.get_item("ME_LT_OBS")); + e_data.ign_conv_oerr = atof(l.get_item("IGN_CONV_OERR")); + e_data.ign_corr_oerr = atof(l.get_item("IGN_CORR_OERR")); + return; } diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index 529fdb2df9..c890b45ff7 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -28,6 +28,8 @@ // 011 09/28/22 Prestopnik MET #2227 Remove namespace std // 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR // line types. +// 013 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -72,6 +74,7 @@ struct ECNTData { double bias_ratio; int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; + double ign_conv_oerr, ign_corr_oerr; }; // Ranked Histogram (RHIST) data structure diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index 99b0f762ef..827662caf8 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -39,7 +39,7 @@ // 014 07/09/21 Linden MET #1746 Skip thresholding. // 015 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 016 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files -// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings +// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings // //////////////////////////////////////////////////////////////////////// @@ -425,7 +425,7 @@ void process_scores() { mlog << Debug(2) << "Observation field: "; fill_bad_data(obs_dp_fill, obs_fill); - // Pad the fields out to the nearest power of two if requsted + // Pad the fields out to the nearest power of two if requested if(conf_info.grid_decomp_flag == GridDecompType_Pad) { mlog << Debug(2) << "Padding the fields out to the nearest integer " << "power of two.\n"; From 4c322aa389e3affbe034a14aa6ec581e8fd0814b Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 14 Mar 2024 09:32:18 -0600 Subject: [PATCH 27/72] Revert #2825 since more documentation and testing is needed (#2837) This reverts commit 108a8958b206d6712197823a083666ab039bf818. --- data/table_files/met_header_columns_V12.0.txt | 2 +- docs/Users_Guide/appendixC.rst | 53 ++----- docs/Users_Guide/ensemble-stat.rst | 10 +- docs/Users_Guide/refs.rst | 135 ++++++------------ internal/test_unit/hdr/met_12_0.hdr | 2 +- src/basic/vx_util/num_array.cc | 8 +- src/basic/vx_util/stat_column_defs.h | 2 +- src/libcode/vx_gsl_prob/gsl_randist.h | 4 +- src/libcode/vx_stat_out/stat_columns.cc | 8 +- src/libcode/vx_statistics/ens_stats.cc | 18 +-- src/libcode/vx_statistics/ens_stats.h | 4 - src/libcode/vx_statistics/met_stats.cc | 19 --- src/libcode/vx_statistics/met_stats.h | 2 - src/libcode/vx_statistics/obs_error.cc | 7 - src/libcode/vx_statistics/obs_error.h | 3 - .../vx_statistics/pair_data_ensemble.cc | 117 +++------------ .../vx_statistics/pair_data_ensemble.h | 90 ++++++------ src/libcode/vx_statistics/pair_data_point.cc | 2 +- .../core/stat_analysis/aggr_stat_line.cc | 27 +--- .../core/stat_analysis/parse_stat_line.cc | 5 - .../core/stat_analysis/parse_stat_line.h | 3 - src/tools/core/wavelet_stat/wavelet_stat.cc | 4 +- 22 files changed, 135 insertions(+), 390 deletions(-) diff --git a/data/table_files/met_header_columns_V12.0.txt b/data/table_files/met_header_columns_V12.0.txt index 299e6cb4d6..7ed1e5a187 100644 --- a/data/table_files/met_header_columns_V12.0.txt +++ b/data/table_files/met_header_columns_V12.0.txt @@ -19,7 +19,7 @@ V12.0 : STAT : PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V12.0 : STAT : PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) THRESH_[0-9]* PODY_[0-9]* POFD_[0-9]* V12.0 : STAT : PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL THRESH_[0-9]* V12.0 : STAT : ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASER VALUE_BASER (N_PTS) CL_[0-9]* VALUE_[0-9]* -V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR +V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS V12.0 : STAT : RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP V12.0 : STAT : RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_RANK) RANK_[0-9]* V12.0 : STAT : PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE (N_BIN) BIN_[0-9]* diff --git a/docs/Users_Guide/appendixC.rst b/docs/Users_Guide/appendixC.rst index 037bd93455..7c5c618a43 100644 --- a/docs/Users_Guide/appendixC.rst +++ b/docs/Users_Guide/appendixC.rst @@ -401,7 +401,7 @@ SEEPS scores are expected to lie between 0 and 1, with a perfect forecast having MET Verification Measures for Continuous Variables ================================================== -For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, 1987 `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. +For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, (1987) `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. The verification measures currently evaluated by the Point-Stat tool are defined and described in the subsections below. In these definitions, **f** represents the forecasts, **o** represents the observation, and **n** is the number of forecast-observation pairs. @@ -894,7 +894,7 @@ Calibration Called "CALIBRATION" in PJC output :numref:`table_PS_format_info_PJC` -Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, 2011 `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. +Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, (2011) `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. .. math:: \text{Calibration}(i) = \frac{n_{i1}}{n_{1.}} = \text{probability}(o_1|p_i) @@ -903,7 +903,7 @@ Refinement Called "REFINEMENT" in PJC output :numref:`table_PS_format_info_PJC` -The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks, 2011 `. +The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks (2011) `. .. math:: \text{Refinement}(i) = \frac{n_{i.}}{T} = \text{probability}(p_i) @@ -912,7 +912,7 @@ Likelihood Called "LIKELIHOOD" in PJC output :numref:`table_PS_format_info_PJC` -Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks, 2011 ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. +Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks (2011) ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. .. math:: \text{Likelihood}(i) = \frac{n_{i1}}{n_{.1}} = \text{probability}(p_i|o_1) @@ -923,7 +923,7 @@ Base Rate Called "BASER" in PJC output :numref:`table_PS_format_info_PJC` -This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks, 2011 ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. +This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks (2011) ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. .. math:: \text{Base Rate}(i) = \frac{n_{i1}}{n_{i.}} = \text{probability}(o_{i1}) @@ -976,18 +976,18 @@ RPS Called "RPS" in RPS output :numref:`table_ES_header_info_es_out_ECNT` -While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012 `), and is a proper score (:ref:`Mason, 2008 `). +While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012`), and is a proper score (:ref:`Mason, 2008`). Let :math:`\text{J}` be the number of categories, then both the forecast, :math:`\text{f} = (f_1,…,f_J)`, and observation, :math:`\text{o} = (o_1,…,o_J)`, are length-:math:`\text{J}` vectors, where the components of :math:`\text{f}` include the probabilities forecast for each category :math:`\text{1,…,J}` and :math:`\text{o}` contains 1 in the category that is realized and zero everywhere else. The cumulative forecasts, :math:`F_m`, and observations, :math:`O_m`, are defined to be: :math:`F_m = \sum_{j=1}^m (f_j)` and :math:`O_m = \sum_{j=1}^m (o_j), m = 1,…,J`. -To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: +To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: .. math:: \text{RPS} = \sum_{m=1}^J (F_m - O_m)^2 = \sum_{m=1}^J BS_m, -where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012 `). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. +where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012`). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. CRPS ---- @@ -1066,7 +1066,7 @@ The continuous ranked probability skill score (CRPSS) is similar to the MSESS an .. math:: \text{CRPSS} = 1 - \frac{\text{CRPS}_{fcst}}{ \text{CRPS}_{ref}} -For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. +For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. Bias Ratio ---------- @@ -1105,37 +1105,6 @@ Called "PIT" in ORANK output :numref:`table_ES_header_info_es_out_ORANK` The probability integral transform (PIT) is the analog of the rank histogram for a probability distribution forecast (:ref:`Dawid, 1984 `). Its interpretation is the same as that of the verification rank histogram: Calibrated probabilistic forecasts yield PIT histograms that are flat, or uniform. Under-dispersed (not enough spread in the ensemble) forecasts have U-shaped PIT histograms while over-dispersed forecasts have bell-shaped histograms. In MET, the PIT calculation uses a normal distribution fit to the ensemble forecasts. In many cases, use of other distributions would be better. -Observation Error Logarithmic Scoring Rules -------------------------------------------- - -Called "IGN_CONV_OERR" and "IGN_CORR_OERR" in ECNT output :numref:`table_ES_header_info_es_out_ECNT` - -One approach that is used to take observation error into account in a summary measure is to add error to the forecast by a convolution with the observation model (e.g., :ref:`Anderson, 1996 `; :ref:`Hamill, 2001 `; :ref:`Saetra et. al., 2004 `; :ref:`Bröcker and Smith, 2007 `; :ref:`Candille et al., 2007 `; :ref:`Candille and Talagrand, 2008 `; :ref:`Röpnack et al., 2013 `). Specifically, suppose :math:`y=x+w`, where :math:`y` is the observed value, :math:`x` is the true value, and :math:`w` is the error. Then, if :math:`f` is the density forecast for :math:`x` and :math:`\nu` is the observation model, then the implied density forecast for :math:`y` is given by the convolution: - -.. math:: (f*\nu)(y) = \int\nu(y|x)f(x)dx - -:ref:`Ferro, 2017 ` gives the error-convolved version of the ignorance scoring rule (referred to therein as the error-convolved logarithmic scoring rule), which is proper under the model where :math:`w\sim N(0,c^2)`) when the forecast for :math:`x` is :math:`N(\mu,\sigma^2)` with density function :math:`f`, by - -.. only:: latex - - .. math:: \text{IGN\_CONV\_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} - -.. only:: html - - .. math:: \text{IGN_CONV_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} - -Another approach to incorporation of observation uncertainty into a measure is the error-correction approach. The approach merely ensures that the scoring rule, :math:`s`, is unbiased for a scoring rule :math:`s_0` if they have the same expected value. :ref:`Ferro, 2017 ` gives the error-corrected ignorance scoring rule (which is also proposer when :math:`w\sim N(0,c^2)`) as - -.. only:: latex - - .. math:: \text{IGN\_CORR\_OERR} = s(f,y) = \log\sigma + \frac{(y - \mu)^2 - c^2}{2\sigma^2} - -.. only:: html - - .. math:: \text{IGN_CORR_OERR} = s(f,y) = \log\sigma + \frac{(y - \mu)^2 - c^2}{2\sigma^2} - -The expected score for the error-convolved ignorance scoring rule typically differs from the expected score that would be achieved if there were no observation error. The error-corrected score, on the other hand, has the same expectation. - RANK ---- @@ -1191,7 +1160,7 @@ The traditional contingency table statistics computed by the Grid-Stat neighborh All of these measures are defined in :numref:`categorical variables`. -In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert, 2008 ` and :ref:`Roberts and Lean, 2008 `. :ref:`Roberts and Lean, 2008 ` also present an application of the methodology. +In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert (2008) ` and :ref:`Roberts and Lean (2008) `. :ref:`Roberts and Lean (2008) ` also present an application of the methodology. Fractions Brier Score --------------------- @@ -1256,7 +1225,7 @@ A mathematical metric, :math:`m(A,B)\geq 0`, must have the following three prope The first establishes that a perfect score is zero and that the only way to obtain a perfect score is if the two sets are identical according to the metric. The second requirement ensures that the order by which the two sets are evaluated will not change the result. The third property ensures that if *C* is closer to *A* than *B* is to *A*, then :math:`m(A,C) < m(A,B)`. -It has been argued in :ref:`Gilleland, 2017 ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. +It has been argued in :ref:`Gilleland (2017) ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. The results of the distance map verification approaches that are included in the Grid-Stat tool are summarized using a variety of measures. These measures include Baddeley's :math:`\Delta` Metric, the Hausdorff Distance, the Mean-error Distance, Pratt's Figure of Merit, and Zhu's Measure. Their equations are listed below. diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 7eba9f1aa9..42443aa315 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -66,9 +66,7 @@ The climatological distribution is also used for the RPSS. The forecast RPS stat Ensemble Observation Error -------------------------- -In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) ` can be replicated using the appropriate options. Additional probabilistic measures that include observational uncertainty recommended by :ref:`Ferro, 2017 ` are also provided. - -Observation error information can be defined directly in the Ensemble-Stat configuration file or through a more flexible observation error table lookup. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both, of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. +In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) `. can be replicated using the appropriate options. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both, of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. Normal and uniform are common choices for the observation error distribution. The uniform distribution provides the benefit of being bounded on both sides, thus preventing the perturbation from taking on extreme values. Normal is the most common choice for observation error. However, the user should realize that with the very large samples typical in NWP, some large outliers will almost certainly be introduced with the perturbation. For variables that are bounded below by 0, and that may have inconsistent observation errors (e.g. larger errors with larger measurements), a lognormal distribution may be selected. Wind speeds and precipitation measurements are the most common of this type of NWP variable. The lognormal error perturbation prevents measurements of 0 from being perturbed, and applies larger perturbations when measurements are larger. This is often the desired behavior in these cases, but this distribution can also lead to some outliers being introduced in the perturbation step. @@ -649,12 +647,6 @@ The format of the STAT and ASCII output of the Ensemble-Stat tool are described * - 49 - ME_LT_OBS - The Mean Error of the ensemble values less than or equal to their observations - * - 50 - - IGN_CONV_OERR - - Error-convolved logarithmic scoring rule (i.e. ignornance score) from Equation 5 of :ref:`Ferro, 2017 ` - * - 51 - - IGN_CORR_OERR - - Error-corrected logarithmic scoring rule (i.e. ignornance score) from Equation 7 of :ref:`Ferro, 2017 ` .. _table_ES_header_info_es_out_RPS: diff --git a/docs/Users_Guide/refs.rst b/docs/Users_Guide/refs.rst index 1c328014cb..b4045f90b6 100644 --- a/docs/Users_Guide/refs.rst +++ b/docs/Users_Guide/refs.rst @@ -14,19 +14,12 @@ References | Ahijevych, D., E. Gilleland, B.G. Brown, and E.E. Ebert, 2009: Application of | spatial verification methods to idealized and NWP-gridded precipitation forecasts. -| *Weather and Forecasting*, 24 (6), 1485 - 1497. -| doi: https://doi.org/10.1175/2009WAF2222298.1 -| - -.. _Andersen-1996: - -| Anderson JL., 1996: A method for producing and evaluating probabilistic forecasts -| from ensemble model integrations. *J. Clim.* 9: 1518-1530. -| doi: `https://doi.org/10.1175/1520-0442(1996)009<1518:AMFPAE>2.0.CO;2 2.0.CO;2>`_ +| *Weather and Forecasting*, 24 (6), 1485 - 1497, doi: 10.1175/2009WAF2222298.1. | .. _Barker-1991: + | Barker, T. W., 1991: The relationship between spread and forecast error in | extended-range forecasts. *Journal of Climate*, 4, 733-742. | @@ -36,14 +29,14 @@ References | Bradley, A.A., S.S. Schwartz, and T. Hashino, 2008: Sampling Uncertainty | and Confidence Intervals for the Brier Score and Brier Skill Score. | *Weather and Forecasting*, 23, 992-1006. -| +| .. _Brill-2009: | Brill, K. F., and F. Mesinger, 2009: Applying a general analytic method | for assessing bias sensitivity to bias-adjusted threat and equitable | threat scores. *Weather and Forecasting*, 24, 1748-1754. -| +| .. _Brown-2007: @@ -56,47 +49,32 @@ References | http://ams.confex.com/ams/pdfpapers/124856.pdf. | -.. _Bröcker-2007: - -| Bröcker J, Smith LA., 2007: Scoring probabilistic forecasts: The importance -| of being proper. *Weather Forecasting*, 22, 382-388. -| doi: https://doi.org/10.1175/WAF966.1 -| - .. _Buizza-1997: | Buizza, R., 1997: Potential forecast skill of ensemble prediction and spread | and skill distributions of the ECMWF ensemble prediction system. *Monthly* -| *Weather Review*, 125, 99-119. -| +| *Weather Review*,125, 99-119. +| .. _Bullock-2016: | Bullock, R., T. Fowler, and B. Brown, 2016: Method for Object-Based | Diagnostic Evaluation. *NCAR Technical Note* NCAR/TN-532+STR, 66 pp. -| - -.. _Candille-2007: - -| Candille G, Côté C, Houtekamer PL, Pellerin G, 2007: Verification of an -| ensemble prediction system against observations. *Mon. Weather Rev.* -| 135: 2688-2699. -| doi: https://doi.org/10.1175/MWR3414.1 -| +| .. _Candille-2008: | Candille, G., and O. Talagrand, 2008: Impact of observational error on the | validation of ensemble prediction systems. *Quarterly Journal of the Royal* | *Meteorological Society* 134: 959-971. -| +| .. _Casati-2004: | Casati, B., G. Ross, and D. Stephenson, 2004: A new intensity-scale approach | for the verification of spatial precipitation forecasts. *Meteorological* | *Applications* 11, 141-154. -| +| .. _Davis-2006: @@ -108,45 +86,37 @@ References | Davis, C.A., B.G. Brown, and R.G. Bullock, 2006b: Object-based verification | of precipitation forecasts, Part II: Application to convective rain systems. | *Monthly Weather Review*, 134, 1785-1795. -| +| .. _Dawid-1984: | Dawid, A.P., 1984: Statistical theory: The prequential approach. *Journal of* | *the Royal Statistical Society* A147, 278-292. -| +| .. _Ebert-2008: | Ebert, E.E., 2008: Fuzzy verification of high-resolution gridded forecasts: -| a review and proposed framework. *Meteorological Applications*, 15, 51-64. -| +| a review and proposed framework. *Meteorological Applications,* 15, 51-64. +| .. _Eckel-2012: | Eckel, F. A., M.S. Allen, M. C. Sittel, 2012: Estimation of Ambiguity in -| Ensemble Forecasts. *Weather Forecasting*, 27, 50-69. -| doi: https://doi.org/10.1175/WAF-D-11-00015.1 +| Ensemble Forecasts. *Weather Forecasting,* 27, 50-69. +| doi: http://dx.doi.org/10.1175/WAF-D-11-00015.1 | .. _Efron-2007: | Efron, B. 2007: Correlation and large-scale significance testing. *Journal* -| of the American Statistical Association*, 102(477), 93-103. +| of the American Statistical Association,* 102(477), 93-103. | .. _Epstein-1969: | Epstein, E. S., 1969: A scoring system for probability forecasts of ranked categories. -| *J. Appl. Meteor.*, 8, 985-987. -| doi: `https://doi.org/10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2 2.0.CO;2>`_ -| - -.. _Ferro-2017: - -| Ferro C. A. T., 2017: Measuring forecast performance in the presence of observation error. -| *Q. J. R. Meteorol. Soc.*, 143 (708), 2665-2676. -| doi: https://doi.org/10.1002/qj.3115 +| *J. Appl. Meteor.*, 8, 985-987, 10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2. | .. _Gilleland-2010: @@ -159,32 +129,29 @@ References | Gilleland, E., 2017: A new characterization in the spatial verification | framework for false alarms, misses, and overall patterns. -| *Weather and Forecasting*, 32 (1), 187 - 198. -| doi: https://doi.org/10.1175/WAF-D-16-0134.1 +| *Weather and Forecasting*, 32 (1), 187 - 198, doi: 10.1175/WAF-D-16-0134.1. | .. _Gilleland_PartI-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part I: Comparative forecast verification for continuous variables. -| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134. -| doi: https://doi.org/10.1175/JTECH-D-20-0069.1 +| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134, +| doi: 10.1175/JTECH-D-20-0069.1. | .. _Gilleland_PartII-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part II: Extreme-value analysis. *Journal of Atmospheric and Oceanic* -| *Technology*, 37 (11), 2135 - 2144. -| doi: https://doi.org/10.1175/JTECH-D-20-0070.1 +| *Technology*, 37 (11), 2135 - 2144, doi: 10.1175/JTECH-D-20-0070.1. | .. _Gilleland-2021: | Gilleland, E., 2021: Novel measures for summarizing high-resolution forecast | performance. *Advances in Statistical Climatology, Meteorology and Oceanography*, -| 7 (1), 13 - 34. -| doi: https://doi.org/10.5194/ascmo-7-13-2021 +| 7 (1), 13 - 34, doi: 10.5194/ascmo-7-13-2021. | .. _Gneiting-2004: @@ -194,7 +161,7 @@ References | *Minimum CRPS Estimation*. Technical Report no. 449, Department of | Statistics, University of Washington. Available at | http://www.stat.washington.edu/www/research/reports/ -| +| .. _Haiden-2012: @@ -208,41 +175,41 @@ References | Hamill, T. M., 2001: Interpretation of rank histograms for verifying ensemble | forecasts. *Monthly Weather Review*, 129, 550-560. -| +| .. _Hersbach-2000: | Hersbach, H., 2000: Decomposition of the Continuous Ranked Probability Score | for Ensemble Prediction Systems. *Weather and Forecasting*, 15, 559-570. -| +| .. _Jolliffe-2012: | Jolliffe, I.T., and D.B. Stephenson, 2012: *Forecast verification. A* | *practitioner's guide in atmospheric science.* Wiley and Sons Ltd, 240 pp. -| +| .. _Knaff-2003: | Knaff, J.A., M. DeMaria, C.R. Sampson, and J.M. Gross, 2003: Statistical, | Five-Day Tropical Cyclone Intensity Forecasts Derived from Climatology -| and Persistence. *Weather and Forecasting*, Vol. 18 Issue 2, p. 80-92. -| +| and Persistence. *Weather and Forecasting,* Vol. 18 Issue 2, p. 80-92. +| .. _Mason-2004: | Mason, S. J., 2004: On Using "Climatology" as a Reference Strategy | in the Brier and Ranked Probability Skill Scores. *Monthly Weather Review*, | 132, 1891-1895. -| +| .. _Mason-2008: | Mason, S. J., 2008: Understanding forecast verification statistics. -| *Meteor. Appl.*, 15, 31-40. -| doi: https://doi.org/10.1002/met.51 +| *Meteor. Appl.*, 15, 31-40, doi: 10.1002/met.51. | + .. _Mittermaier-2014: | Mittermaier, M., 2014: A strategy for verifying near-convection-resolving @@ -253,20 +220,21 @@ References | Mood, A. M., F. A. Graybill and D. C. Boes, 1974: *Introduction to the* | *Theory of Statistics*, McGraw-Hill, 299-338. -| +| .. _Murphy-1969: | Murphy, A.H., 1969: On the ranked probability score. *Journal of Applied* | *Meteorology and Climatology*, 8 (6), 988 - 989, -| doi: `https://doi.org/10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2 2.0.CO;2>`_ +| doi: 10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2. | .. _Murphy-1987: | Murphy, A.H., and R.L. Winkler, 1987: A general framework for forecast | verification. *Monthly Weather Review*, 115, 1330-1338. -| +| + .. _North-2022: @@ -288,7 +256,7 @@ References | Roberts, N.M., and H.W. Lean, 2008: Scale-selective verification of rainfall | accumulations from high-resolution forecasts of convective events. | *Monthly Weather Review*, 136, 78-97. -| +| .. _Rodwell-2010: @@ -305,18 +273,11 @@ References | https://www.ecmwf.int/node/14595 | -.. _Röpnack-2013: - -| Röpnack A, Hense A, Gebhardt C, Majewski D., 2013: Bayesian model verification -| of NWP ensemble forecasts. *Mon. Weather Rev.* 141: 375–387. -| doi: https://doi.org/10.1175/MWR-D-11-00350.1 -| - .. _Saetra-2004: -| Saetra Ø., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of +| Saetra O., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of | observation errors on the statistics for ensemble spread and -| reliability. *Monthly Weather Review*, 132: 1487-1501. +| reliability. *Monthly Weather Review* 132: 1487-1501. | .. _Santos-2012: @@ -324,7 +285,7 @@ References | Santos C. and A. Ghelli, 2012: Observational probability method to assess | ensemble precipitation forecasts. *Quarterly Journal of the Royal* | *Meteorological Society* 138: 209-221. -| +| .. _Schwartz-2017: @@ -337,21 +298,20 @@ References | Stephenson, D.B., 2000: Use of the "Odds Ratio" for diagnosing | forecast skill. *Weather and Forecasting*, 15, 221-232. -| +| .. _Stephenson-2008: | Stephenson, D.B., B. Casati, C.A.T. Ferro, and C.A. Wilson, 2008: The extreme | dependency score: A non-vanishing measure for forecasts of rare events. | *Meteorological Applications* 15, 41-50. -| +| -.. _Tödter-2012: +.. _Todter-2012: | Tödter, J. and B. Ahrens, 2012: Generalization of the Ignorance Score: | Continuous ranked version and its decomposition. *Monthly Weather Review*, -| 140 (6), 2005 - 2017. -| doi: https://doi.org/10.1175/MWR-D-11-00266.1 +| 140 (6), 2005 - 2017, doi: 10.1175/MWR-D-11-00266.1. | .. _Weniger-2016: @@ -359,18 +319,17 @@ References | Weniger, M., F. Kapp, and P. Friederichs, 2016: Spatial Verification Using | Wavelet Transforms: A Review. *Quarterly Journal of the Royal* | *Meteorological Society*, 143, 120-136. -| +| .. _Wilks-2010: | Wilks, D.S. 2010: Sampling distributions of the Brier score and Brier skill | score under serial dependence. *Quarterly Journal of the Royal* -| *Meteorological Society*, 136, 2109-2118. -| doi: https://doi.org/10.1002/qj.709 -| +| *Meteorological Society*, 136, 2109-2118. doi:10.1002/qj.709 +| .. _Wilks-2011: | Wilks, D., 2011: *Statistical methods in the atmospheric sciences.* | Elsevier, San Diego. -| +| diff --git a/internal/test_unit/hdr/met_12_0.hdr b/internal/test_unit/hdr/met_12_0.hdr index a1113d5102..d6bf9fb0b9 100644 --- a/internal/test_unit/hdr/met_12_0.hdr +++ b/internal/test_unit/hdr/met_12_0.hdr @@ -19,7 +19,7 @@ PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH _VAR_ PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL _VAR_ ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASE N_PTS _VAR_ -ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR +ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL CRPS IGN N_RANK CRPSS SPREAD _VAR_ PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE N_BIN _VAR_ diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index baaac11c6a..144736cc88 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -1075,9 +1075,7 @@ NumArray NumArray::subset(const NumArray &keep) const // Check bounds if ( keep.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::subset(const NumArray &) -> " - << "the number of elements do not match (" - << keep.n_elements() << " keep flags != " - << n_elements() << " array elements)\n\n"; + << "the number of elements do not match\n\n"; exit ( 1 ); } @@ -1158,9 +1156,7 @@ double NumArray::wmean(const NumArray &wgt) const if ( wgt.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::wmean(const NumArray &) -> " - << "the number of elements do not match (" - << wgt.n_elements() << " weights != " - << n_elements() << " array elements)\n\n"; + << "the number of elements do not match\n\n"; exit ( 1 ); } diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index 826d5101c9..909441b5ba 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -276,7 +276,7 @@ static const char * ecnt_columns [] = { "CRPSS_EMP", "CRPS_EMP_FAIR", "SPREAD_MD", "MAE", "MAE_OERR", "BIAS_RATIO", "N_GE_OBS", "ME_GE_OBS", "N_LT_OBS", - "ME_LT_OBS", "IGN_CONV_OERR", "IGN_CORR_OERR" + "ME_LT_OBS" }; static const char * rps_columns [] = { diff --git a/src/libcode/vx_gsl_prob/gsl_randist.h b/src/libcode/vx_gsl_prob/gsl_randist.h index e66c312230..d562bfe733 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.h +++ b/src/libcode/vx_gsl_prob/gsl_randist.h @@ -58,9 +58,9 @@ extern void ran_sample(const gsl_rng *r, double *, int, double *, int); extern void ran_sample(const gsl_rng *r, NumArray &, NumArray &, int); extern double ran_draw(const gsl_rng *r, DistType, - double p1, double p2 = bad_data_double); + double p1, double p2 = bad_data_int); extern double dist_var(DistType, - double p1, double p2 = bad_data_double); + double p1, double p2 = bad_data_int); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 55aded1e28..c4880f83eb 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -4275,7 +4275,7 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, // CRPSS_EMP CRPS_EMP_FAIR, SPREAD_MD, // MAE, MAE_OERR, BIAS_RATIO, // N_GE_OBS, ME_GE_OBS, N_LT_OBS, - // ME_LT_OBS, IGN_CONV_OERR, IGN_CORR_OERR + // ME_LT_OBS // at.set_entry(r, c+0, // Total Number of Pairs ecnt_info.n_pair); @@ -4352,12 +4352,6 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, at.set_entry(r, c+24, // ME of ensemble values < observations ecnt_info.me_lt_obs); - at.set_entry(r, c+25, // Ignorance Score, observation error convolved - ecnt_info.ign_conv_oerr); - - at.set_entry(r, c+26, // Ignorance Score, observation error corrected - ecnt_info.ign_corr_oerr); - return; } diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 782832b79f..4ed6f821ca 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -181,15 +181,13 @@ void ECNTInfo::clear() { crps_emp_fair = spread_md = bad_data_double; crps_gaus = crpscl_gaus = crpss_gaus = bad_data_double; ign = bad_data_double; - me = mae = rmse = spread = bad_data_double; - me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; + me = mae = rmse = spread = bad_data_double; + me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; spread_plus_oerr = bad_data_double; - ign_conv_oerr = ign_corr_oerr = bad_data_double; - - n_ge_obs = n_lt_obs = 0; - me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; - + n_ge_obs = n_lt_obs = 0; + me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; + return; } @@ -223,8 +221,6 @@ void ECNTInfo::assign(const ECNTInfo &c) { rmse_oerr = c.rmse_oerr; spread_oerr = c.spread_oerr; spread_plus_oerr = c.spread_plus_oerr; - ign_conv_oerr = c.ign_conv_oerr; - ign_corr_oerr = c.ign_corr_oerr; n_ge_obs = c.n_ge_obs; n_lt_obs = c.n_lt_obs; @@ -365,10 +361,6 @@ void ECNTInfo::set(const PairDataEnsemble &pd) { // Compute the square root of the average variance plus oerr spread_plus_oerr = square_root(pd.var_plus_oerr_na.wmean(pd.wgt_na)); - // Compute log scores with observational uncertainty - ign_conv_oerr = pd.ign_conv_oerr_na.wmean(pd.wgt_na); - ign_corr_oerr = pd.ign_corr_oerr_na.wmean(pd.wgt_na); - // Compute bias ratio terms n_ge_obs = nint(pd.n_ge_obs_na.sum()); me_ge_obs = pd.me_ge_obs_na.wmean(pd.n_ge_obs_na); diff --git a/src/libcode/vx_statistics/ens_stats.h b/src/libcode/vx_statistics/ens_stats.h index 69eca9f4e1..17e864fb5e 100644 --- a/src/libcode/vx_statistics/ens_stats.h +++ b/src/libcode/vx_statistics/ens_stats.h @@ -82,10 +82,6 @@ class ECNTInfo { double me_oerr, mae_oerr, rmse_oerr, spread_oerr; double spread_plus_oerr; - // Log scores that incorporate observational uncertainty, - // as advised in Ferro (2017) - double ign_conv_oerr, ign_corr_oerr; - // Bias ratio information int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index 8487d751b5..a290afcb30 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -3456,25 +3456,6 @@ int min_int(const int *v_int, int n) { return v_min; } -//////////////////////////////////////////////////////////////////////// -// -// Compute mean from a sum -// -//////////////////////////////////////////////////////////////////////// - -double compute_mean(double sum, int n) { - double v; - - if(is_bad_data(sum) || is_bad_data(n) || n == 0) { - v = bad_data_double; - } - else { - v = sum / n; - } - - return(v); -} - //////////////////////////////////////////////////////////////////////// // // Compute variance from sums of squares diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index 1d5def71a7..f0715d45b3 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -726,8 +726,6 @@ extern int min_int(const int *, int); // //////////////////////////////////////////////////////////////////////// -extern double compute_mean(double, int); - extern double compute_variance(double, double, int); extern double compute_stdev(double, double, int); diff --git a/src/libcode/vx_statistics/obs_error.cc b/src/libcode/vx_statistics/obs_error.cc index 5b753346a3..eae4bed423 100644 --- a/src/libcode/vx_statistics/obs_error.cc +++ b/src/libcode/vx_statistics/obs_error.cc @@ -5,7 +5,6 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// #include @@ -185,12 +184,6 @@ void ObsErrorEntry::dump(ostream & out, int depth) const { //////////////////////////////////////////////////////////////////////// -double ObsErrorEntry::variance() const { - return dist_var(dist_type, dist_parm[0], dist_parm[1]); -} - -//////////////////////////////////////////////////////////////////////// - bool ObsErrorEntry::parse_line(const DataLine &dl) { // Initialize diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 11cce141dc..732c4c3ced 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -5,7 +5,6 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - //////////////////////////////////////////////////////////////////////// #ifndef __OBS_ERROR_H__ @@ -69,8 +68,6 @@ class ObsErrorEntry { // get stuff // - double variance() const; - // // do stuff // diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index b9c3868036..cc25f891d3 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -108,9 +108,6 @@ void PairDataEnsemble::clear() { ign_na.clear(); pit_na.clear(); - ign_conv_oerr_na.clear(); - ign_corr_oerr_na.clear(); - n_ge_obs_na.clear(); me_ge_obs_na.clear(); n_lt_obs_na.clear(); @@ -182,8 +179,6 @@ void PairDataEnsemble::extend(int n) { crpscl_gaus_na.extend (n); ign_na.extend (n); pit_na.extend (n); - ign_conv_oerr_na.extend (n); - ign_corr_oerr_na.extend (n); n_ge_obs_na.extend (n); me_ge_obs_na.extend (n); n_lt_obs_na.extend (n); @@ -240,20 +235,15 @@ void PairDataEnsemble::assign(const PairDataEnsemble &pd) { // PairDataEnsemble v_na = pd.v_na; r_na = pd.r_na; - crps_emp_na = pd.crps_emp_na; crps_emp_fair_na = pd.crps_emp_fair_na; spread_md_na = pd.spread_md_na; crpscl_emp_na = pd.crpscl_emp_na; crps_gaus_na = pd.crps_gaus_na; crpscl_gaus_na = pd.crpscl_gaus_na; - ign_na = pd.ign_na; pit_na = pd.pit_na; - ign_conv_oerr_na = pd.ign_conv_oerr_na; - ign_corr_oerr_na = pd.ign_corr_oerr_na; - n_ge_obs_na = pd.n_ge_obs_na; me_ge_obs_na = pd.me_ge_obs_na; n_lt_obs_na = pd.n_lt_obs_na; @@ -459,8 +449,6 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { crpscl_gaus_na.add(bad_data_double); ign_na.add(bad_data_double); pit_na.add(bad_data_double); - ign_conv_oerr_na.add(bad_data_double); - ign_corr_oerr_na.add(bad_data_double); n_ge_obs_na.add(bad_data_double); me_ge_obs_na.add(bad_data_double); n_lt_obs_na.add(bad_data_double); @@ -473,41 +461,22 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { var_unperturbed = compute_variance(esum_na[i], esumsq_na[i], esumn_na[i]); var_na.add(var_unperturbed); - // Process the observation error information + // Process the observation error information. ObsErrorEntry * e = (has_obs_error() ? obs_error_entry[i] : 0); if(e) { - // Get observation error variance - double oerr_var = e->variance(); - - // Compute the observation error log scores - double v_conv, v_corr; - compute_obs_error_log_scores( - compute_mean(esum_na[i], esumn_na[i]), - compute_stdev(esum_na[i], esumsq_na[i], esumn_na[i]), - o_na[i], oerr_var, - v_conv, v_corr); - ign_conv_oerr_na.add(v_conv); - ign_corr_oerr_na.add(v_corr); - // Compute perturbed ensemble mean and variance // Exclude the control member from the variance mn_oerr_na.add(cur_ens.mean()); var_oerr_na.add(cur_ens.variance(ctrl_index)); - // Compute the variance plus observation error variance - if(is_bad_data(var_unperturbed) || - is_bad_data(oerr_var)) { - var_plus_oerr_na.add(bad_data_double); - } - else { - var_plus_oerr_na.add(var_unperturbed + oerr_var); - } + // Compute the variance plus observation error variance. + var_plus_oerr_na.add(var_unperturbed + + dist_var(e->dist_type, + e->dist_parm[0], e->dist_parm[1])); } - // If no observation error specified, store bad data values + // If no observation error specified, store bad data values. else { - ign_conv_oerr_na.add(bad_data_double); - ign_corr_oerr_na.add(bad_data_double); mn_oerr_na.add(bad_data_double); var_oerr_na.add(bad_data_double); var_plus_oerr_na.add(bad_data_double); @@ -537,8 +506,8 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { derive_climo_vals(cdf_info_ptr, cmn_na[i], csd_na[i], cur_clm); // Store empirical CRPS stats - // For crps_emp use temporary, local variable so we can use it - // for the crps_emp_fair calculation + // + // For crps_emp use temporary, local variable so we can use it for the crps_emp_fair calculation double crps_emp = compute_crps_emp(o_na[i], cur_ens); crps_emp_na.add(crps_emp); crps_emp_fair_na.add(crps_emp - cur_ens.wmean_abs_diff()); @@ -559,10 +528,9 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { // Compute the Bias Ratio terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms( - o_na[i], cur_ens, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms(o_na[i], cur_ens, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); // Store the Bias Ratio terms n_ge_obs_na.add(n_ge_obs); @@ -896,11 +864,8 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o // // Include in subset: // wgt_na, o_na, cmn_na, csd_na, v_na, r_na, - // crps_emp_na, crps_emp_fair_na, spread_md_na, - // crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, - // ign_na, pit_na, - // ign_conv_oerr, ign_corr_oerr, - // n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, + // crps_emp_na, crps_emp_fair_na, spread_md_na, crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, + // ign_na, pit_na, n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, // var_na, var_oerr_na, var_plus_oerr_na, // mn_na, mn_oerr_na, e_na // @@ -923,8 +888,6 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o pd.crpscl_gaus_na.add(crpscl_gaus_na[i]); pd.ign_na.add(ign_na[i]); pd.pit_na.add(pit_na[i]); - pd.ign_conv_oerr_na.add(ign_conv_oerr_na[i]); - pd.ign_corr_oerr_na.add(ign_corr_oerr_na[i]); pd.n_ge_obs_na.add(n_ge_obs_na[i]); pd.me_ge_obs_na.add(me_ge_obs_na[i]); pd.n_lt_obs_na.add(n_lt_obs_na[i]); @@ -1535,7 +1498,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, y < 0 || y >= gr.ny()) return; // For pressure levels, check if the observation pressure level - // falls in the requested range. + // falls in the requsted range. if(obs_info_grib->level().type() == LevelType_Pres) { if(obs_lvl < obs_info_grib->level().lower() || @@ -1630,8 +1593,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, } } - // Apply observation error additive and multiplicative - // bias correction, if requested + // Apply observation error logic bias correction, if requested if(obs_error_info->flag) { obs_v = add_obs_error_bc(obs_error_info->rng_ptr, FieldType_Obs, oerr_ptr, obs_v); @@ -2149,52 +2111,5 @@ double compute_bias_ratio(double me_ge_obs, double me_lt_obs) { return v; } - -//////////////////////////////////////////////////////////////////////// - -void compute_obs_error_log_scores(double emn, double esd, - double obs, double oerr_var, - double &v_conv, double &v_corr) { - - const char *method_name = "compute_obs_error_log_scores() -> "; - - // Check for bad input data - if(is_bad_data(emn) || - is_bad_data(esd) || - is_bad_data(obs) || - is_bad_data(oerr_var)) { - v_conv = v_corr = bad_data_double; - } - else { - double sigma2 = esd * esd; - double ov2 = oerr_var * oerr_var; - - // Error-convolved logarithmic scoring rule in - // Ferro (2017, Eq 5) doi:10.1002/qj.3115 - // Scale by 2.0 * pi for consistency with ignorance score - v_conv = 0.5 * log(2.0 * pi * (sigma2 + ov2)) + - (obs - emn) * (obs - emn) / - (2.0 * (sigma2 + ov2)); - - // Error-corrected logarithmic scoring rule in - // Ferro (2017, Eq 7) doi:10.1002/qj.3115 - // Scale by 2.0 * pi for consistency with ignorance score - v_corr = log(esd) + - ((obs - emn) * (obs - emn) - ov2) / - (2.0 * sigma2); - } - - if(mlog.verbosity_level() >= 10) { - mlog << Debug(10) << method_name - << "inputs (emn = " << emn - << ", esd = " << esd - << ", obs = " << obs - << ", oerr_var = " << oerr_var - << ") and outputs (ign_oerr_conv = " << v_conv - << ", ign_oerr_corr = " << v_corr << ")\n"; - } - - return; -} - + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index 9be2eec3c8..e6014b59fb 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -6,8 +6,6 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -//////////////////////////////////////////////////////////////////////// - #ifndef __PAIR_DATA_ENSEMBLE_H__ #define __PAIR_DATA_ENSEMBLE_H__ @@ -76,67 +74,64 @@ class PairDataEnsemble : public PairBase { bool obs_error_flag; // Ensemble, valid count, and rank values - NumArray *e_na; // Ensemble values [n_ens][n_obs] - NumArray v_na; // Number of valid ensemble values [n_obs] - NumArray r_na; // Observation ranks [n_obs] - - NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] - NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] - NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] - NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] + NumArray *e_na; // Ensemble values [n_ens][n_obs] + NumArray v_na; // Number of valid ensemble values [n_obs] + NumArray r_na; // Observation ranks [n_obs] - NumArray crps_gaus_na; // Gaussian CRPS [n_obs] - NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] + NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] + NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] + NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] + NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] - NumArray ign_na; // Ignorance Score [n_obs] - NumArray pit_na; // Probability Integral Transform [n_obs] + NumArray crps_gaus_na; // Gaussian CRPS [n_obs] + NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] - NumArray ign_conv_oerr_na; // Error convolved log score [n_obs] - NumArray ign_corr_oerr_na; // Error corrected log score [n_obs] + NumArray ign_na; // Ignorance Score [n_obs] + NumArray pit_na; // Probability Integral Transform [n_obs] - NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] - NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] - NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] - NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] + NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] + NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] + NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] + NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] - int n_ens; // Number of ensemble members - int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) - int ctrl_index; // Index of the control member - bool skip_const; // Skip cases where the observation and - // all ensemble members are constant - BoolArray skip_ba; // Flag for each observation [n_obs] + int n_ens; // Number of ensemble members + int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) + int ctrl_index; // Index of the control member + bool skip_const; // Skip cases where the observation and + // all ensemble members are constant + BoolArray skip_ba; // Flag for each observation [n_obs] - NumArray rhist_na; // Ranked Histogram [n_ens+1] - NumArray relp_na; // Relative Position Histogram [n_ens] + NumArray rhist_na; // Ranked Histogram [n_ens+1] + NumArray relp_na; // Relative Position Histogram [n_ens] - double phist_bin_size; // Ensemble PIT histogram bin width - NumArray phist_na; // PIT Histogram [n_phist_bin] + double phist_bin_size; // Ensemble PIT histogram bin width + NumArray phist_na; // PIT Histogram [n_phist_bin] NumArray var_na; // Variance of unperturbed members [n_obs] NumArray var_oerr_na; // Variance of perturbed members [n_obs] NumArray var_plus_oerr_na; // Unperturbed variance plus observation error variance [n_obs] - NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] - NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] - NumArray esumn_na; // Count of ensemble values [n_obs] + NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] + NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] + NumArray esumn_na; // Count of ensemble values [n_obs] - NumArray mn_na; // Ensemble mean value [n_obs] - NumArray mn_oerr_na; // Mean of perturbed members [n_obs] + NumArray mn_na; // Ensemble mean value [n_obs] + NumArray mn_oerr_na; // Mean of perturbed members [n_obs] - double ssvar_bin_size; // Variance bin size for spread/skill - SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] + double ssvar_bin_size; // Variance bin size for spread/skill + SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] - double crpss_emp; // Empirical CRPS skill score - double crpss_gaus; // Guassian CRPS skill score + double crpss_emp; // Empirical CRPS skill score + double crpss_gaus; // Guassian CRPS skill score - double me; // ME for ensemble mean - double mae; // MAE for ensemble mean - double rmse; // RMSE for ensemble mean - double me_oerr; // ME for mean of perturbed members - double mae_oerr; // MAE for mean of perturbed members - double rmse_oerr; // RMSE for mean of perturbed members + double me; // ME for ensemble mean + double mae; // MAE for ensemble mean + double rmse; // RMSE for ensemble mean + double me_oerr; // ME for mean of perturbed members + double mae_oerr; // MAE for mean of perturbed members + double rmse_oerr; // RMSE for mean of perturbed members - double bias_ratio; // Bias ratio + double bias_ratio; // Bias ratio ////////////////////////////////////////////////////////////////// @@ -328,9 +323,6 @@ extern double compute_ens_pit(double, double, double); extern void compute_bias_ratio_terms(double, const NumArray &, int &, double &, int &, double &); extern double compute_bias_ratio(double, double); -extern void compute_obs_error_log_scores( - double, double, double, double, - double &, double &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 2b19b94391..cd3b080bc6 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -1119,7 +1119,7 @@ void VxPairDataPoint::add_point_obs(float *hdr_arr, const char *hdr_typ_str, } // For pressure levels, check if the observation pressure level - // falls in the requested range. + // falls in the requsted range. if(obs_info->level().type() == LevelType_Pres) { if(obs_lvl < obs_info->level().lower() || diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 3ca4cfcaff..49506e1402 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -39,8 +39,6 @@ // line types. // 018 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. -// 019 02/21/24 Halley Gotway MET #2583 Add observation error -// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -2658,8 +2656,6 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.crps_gaus_na.add(cur.crps_gaus); m[key].ens_pd.crpscl_gaus_na.add(cur.crpscl_gaus); m[key].ens_pd.ign_na.add(cur.ign); - m[key].ens_pd.ign_conv_oerr_na.add(cur.ign_conv_oerr); - m[key].ens_pd.ign_corr_oerr_na.add(cur.ign_corr_oerr); m[key].ens_pd.n_ge_obs_na.add(cur.n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(cur.me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(cur.n_lt_obs); @@ -3233,34 +3229,17 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.ign_na.add(compute_ens_ign(cur.obs, cur.ens_mean, cur.spread)); m[key].ens_pd.pit_na.add(compute_ens_pit(cur.obs, cur.ens_mean, cur.spread)); - // Back out the observation error variance - double oerr_var = bad_data_double; - if(!is_bad_data(cur.spread_plus_oerr) && - !is_bad_data(cur.spread)) { - oerr_var = square(cur.spread_plus_oerr) - - square(cur.spread); - } - // Store BIAS_RATIO terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms( - cur.obs, cur.ens_na, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms(cur.obs, cur.ens_na, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); m[key].ens_pd.n_ge_obs_na.add(n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(n_lt_obs); m[key].ens_pd.me_lt_obs_na.add(me_lt_obs); - // Compute observation error log scores - double v_conv, v_corr; - compute_obs_error_log_scores( - cur.ens_mean, cur.spread, cur.obs, oerr_var, - v_conv, v_corr); - m[key].ens_pd.ign_conv_oerr_na.add(v_conv); - m[key].ens_pd.ign_corr_oerr_na.add(v_corr); - // // Increment the RHIST counts // diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index ebdc9d9a0a..b6ec116759 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -33,8 +33,6 @@ // line types. // 013 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. -// 014 02/21/24 Halley Gotway MET #2583 Add observation error -// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -399,9 +397,6 @@ void parse_ecnt_line(STATLine &l, ECNTData &e_data) { e_data.n_lt_obs = atoi(l.get_item("N_LT_OBS")); e_data.me_lt_obs = atof(l.get_item("ME_LT_OBS")); - e_data.ign_conv_oerr = atof(l.get_item("IGN_CONV_OERR")); - e_data.ign_corr_oerr = atof(l.get_item("IGN_CORR_OERR")); - return; } diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index c890b45ff7..529fdb2df9 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -28,8 +28,6 @@ // 011 09/28/22 Prestopnik MET #2227 Remove namespace std // 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR // line types. -// 013 02/21/24 Halley Gotway MET #2583 Add observation error -// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -74,7 +72,6 @@ struct ECNTData { double bias_ratio; int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - double ign_conv_oerr, ign_corr_oerr; }; // Ranked Histogram (RHIST) data structure diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index 827662caf8..99b0f762ef 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -39,7 +39,7 @@ // 014 07/09/21 Linden MET #1746 Skip thresholding. // 015 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 016 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files -// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings +// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings // //////////////////////////////////////////////////////////////////////// @@ -425,7 +425,7 @@ void process_scores() { mlog << Debug(2) << "Observation field: "; fill_bad_data(obs_dp_fill, obs_fill); - // Pad the fields out to the nearest power of two if requested + // Pad the fields out to the nearest power of two if requsted if(conf_info.grid_decomp_flag == GridDecompType_Pad) { mlog << Debug(2) << "Padding the fields out to the nearest integer " << "power of two.\n"; From fd1b250593c60cd750a3f703de1fdb8c6480b34b Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 14 Mar 2024 12:17:54 -0600 Subject: [PATCH 28/72] Feature #2583 ecnt fix IGN_OERR_CORR (#2838) * Unrelated to #2583, fix typo in code comments. * Per #2583, add hooks write 3 new ECNT columns for observation error data. * Per #2583, make error messages about mis-matched array lengths more informative. * Per #2583, switch to more concise variable naming conventions of ign_oerr_cnv, ign_oerr_cor, and dawid_seb. * Per #2583, fix typo to enable compilation * Per #2583, define the 5 new ECNT column names. * Per #2583, add 5 new columns to the ECNT table in the Ensemble-Stat chapter * Per #2583, update stat_columns.cc to write these 5 new ECNT columns * Per #2583, update ECNTInfo class to compute the 5 new ECNT statistics. * Per #2583, update stat-analysis to parse the 5 new ECNT columns. * Per #2583, update aggregate_stat logic for 5 new ECNT columns. * Per #2583, update PairDataEnsemble logic for 5 new ECNT columns * Per #2583, update vx_statistics library with obs_error handling logic for the 5 new ECNT columns * Per #2583, changes to make it compile * Per #2583, changes to make it compile * Per #2583, switch to a consistent ECNT column naming convention with OERR at the end. Using IGN_CONV_OERR and IGN_CORR_OERR. * Per #2583, define ObsErrorEntry::variance() with a call to the dist_var() utility function. * Per #2583, update PairDataEnsemble::compute_pair_vals() to compute the 5 new stats with the correct inputs. * Per #2583, add DEBUG(10) log messages about computing these new stats. * Per #2583, update Stat-Analysis to compute these 5 new stats from the ORANK line type. * Per #2583, whitespace and comments. * Per #2583, update the User's Guide. * Per #2583, remove the DS_ADD_OERR and DS_MULT_OERR ECNT columns and rename DS_OERR as DSS, since observation error is not actually involved in its computation. * Per #2583, minor update to Appendix C * Per #2583, rename ECNT line type statistic DSS to IDSS. * Per #2583, fix a couple of typos * Per #2583, more error checking. * Per #2583, remove the ECNT IDSS column since its just 2*pi*IGN, the existing ignorance score, and only provides meaningful information when combined with the other Dawid-Sebastiani statistics that have already been removed. * Per #2583, add Eric's documentation of these new stats to Appendix C. Along the way, update the DOI links in the references based on this APA style guide: https://apastyle.apa.org/style-grammar-guidelines/references/dois-urls#:~:text=Include%20a%20DOI%20for%20all,URL%2C%20include%20only%20the%20DOI. * Per #2583, fix new equations with embedded underscores for PDF by defining both html and pdf formatting options. * Per #2583, update the ign_conv_oerr equation to include a 2 *pi multiplier for consistency with the existing ignorance score. Also, fix the documented equations. * Per #2583, remove log file that was inadvertently added on this branch. * Per #2583, simplify ObsErrorEntry::variance() implementation. For the distribution type of NONE, return a variance of 0.0 rather than bad data, as discussed with @michelleharrold and @JeffBeck-NOAA on 3/8/2024. * Per #2583, updates to ensemble-stat.rst recommended by @michelleharrold and @JeffBeck-NOAA. * Per #2583, implement changes to the IGN_CORR_OERR corrected as directed by @ericgilleland. --------- Co-authored-by: MET Tools Test Account --- data/table_files/met_header_columns_V12.0.txt | 2 +- docs/Users_Guide/appendixC.rst | 53 +++++-- docs/Users_Guide/ensemble-stat.rst | 10 +- docs/Users_Guide/refs.rst | 135 ++++++++++++------ internal/test_unit/hdr/met_12_0.hdr | 2 +- src/basic/vx_util/num_array.cc | 8 +- src/basic/vx_util/stat_column_defs.h | 2 +- src/libcode/vx_gsl_prob/gsl_randist.h | 4 +- src/libcode/vx_stat_out/stat_columns.cc | 8 +- src/libcode/vx_statistics/ens_stats.cc | 18 ++- src/libcode/vx_statistics/ens_stats.h | 4 + src/libcode/vx_statistics/met_stats.cc | 19 +++ src/libcode/vx_statistics/met_stats.h | 2 + src/libcode/vx_statistics/obs_error.cc | 7 + src/libcode/vx_statistics/obs_error.h | 3 + .../vx_statistics/pair_data_ensemble.cc | 117 ++++++++++++--- .../vx_statistics/pair_data_ensemble.h | 90 ++++++------ src/libcode/vx_statistics/pair_data_point.cc | 2 +- .../core/stat_analysis/aggr_stat_line.cc | 27 +++- .../core/stat_analysis/parse_stat_line.cc | 5 + .../core/stat_analysis/parse_stat_line.h | 3 + src/tools/core/wavelet_stat/wavelet_stat.cc | 4 +- 22 files changed, 390 insertions(+), 135 deletions(-) diff --git a/data/table_files/met_header_columns_V12.0.txt b/data/table_files/met_header_columns_V12.0.txt index 7ed1e5a187..299e6cb4d6 100644 --- a/data/table_files/met_header_columns_V12.0.txt +++ b/data/table_files/met_header_columns_V12.0.txt @@ -19,7 +19,7 @@ V12.0 : STAT : PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V12.0 : STAT : PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) THRESH_[0-9]* PODY_[0-9]* POFD_[0-9]* V12.0 : STAT : PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_THRESH) BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL THRESH_[0-9]* V12.0 : STAT : ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASER VALUE_BASER (N_PTS) CL_[0-9]* VALUE_[0-9]* -V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS +V12.0 : STAT : ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR V12.0 : STAT : RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP V12.0 : STAT : RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL (N_RANK) RANK_[0-9]* V12.0 : STAT : PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE (N_BIN) BIN_[0-9]* diff --git a/docs/Users_Guide/appendixC.rst b/docs/Users_Guide/appendixC.rst index 7c5c618a43..15c3ab5c2d 100644 --- a/docs/Users_Guide/appendixC.rst +++ b/docs/Users_Guide/appendixC.rst @@ -401,7 +401,7 @@ SEEPS scores are expected to lie between 0 and 1, with a perfect forecast having MET Verification Measures for Continuous Variables ================================================== -For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, (1987) `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. +For continuous variables, many verification measures are based on the forecast error (i.e., **f - o**). However, it also is of interest to investigate characteristics of the forecasts, and the observations, as well as their relationship. These concepts are consistent with the general framework for verification outlined by :ref:`Murphy and Winkler, 1987 `. The statistics produced by MET for continuous forecasts represent this philosophy of verification, which focuses on a variety of aspects of performance rather than a single measure. The verification measures currently evaluated by the Point-Stat tool are defined and described in the subsections below. In these definitions, **f** represents the forecasts, **o** represents the observation, and **n** is the number of forecast-observation pairs. @@ -894,7 +894,7 @@ Calibration Called "CALIBRATION" in PJC output :numref:`table_PS_format_info_PJC` -Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, (2011) `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. +Calibration is the conditional probability of an event given each probability forecast category (i.e. each row in the **nx2** contingency table). This set of measures is paired with refinement in the calibration-refinement factorization discussed in :ref:`Wilks, 2011 `. A well-calibrated forecast will have calibration values that are near the forecast probability. For example, a 50% probability of precipitation should ideally have a calibration value of 0.5. If the calibration value is higher, then the probability has been underestimated, and vice versa. .. math:: \text{Calibration}(i) = \frac{n_{i1}}{n_{1.}} = \text{probability}(o_1|p_i) @@ -903,7 +903,7 @@ Refinement Called "REFINEMENT" in PJC output :numref:`table_PS_format_info_PJC` -The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks (2011) `. +The relative frequency associated with each forecast probability, sometimes called the marginal distribution or row probability. This measure ignores the event outcome, and simply provides information about the frequency of forecasts for each probability category. This set of measures is paired with the calibration measures in the calibration-refinement factorization discussed by :ref:`Wilks, 2011 `. .. math:: \text{Refinement}(i) = \frac{n_{i.}}{T} = \text{probability}(p_i) @@ -912,7 +912,7 @@ Likelihood Called "LIKELIHOOD" in PJC output :numref:`table_PS_format_info_PJC` -Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks (2011) ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. +Likelihood is the conditional probability for each forecast category (row) given an event and a component of the likelihood-base rate factorization; see :ref:`Wilks, 2011 ` for details. This set of measures considers the distribution of forecasts for only the cases when events occur. Thus, as the forecast probability increases, so should the likelihood. For example, 10% probability of precipitation forecasts should have a much smaller likelihood value than 90% probability of precipitation forecasts. .. math:: \text{Likelihood}(i) = \frac{n_{i1}}{n_{.1}} = \text{probability}(p_i|o_1) @@ -923,7 +923,7 @@ Base Rate Called "BASER" in PJC output :numref:`table_PS_format_info_PJC` -This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks (2011) ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. +This is the probability of an event for each forecast category :math:`p_i` (row), i.e. the conditional base rate. This set of measures is paired with likelihood in the likelihood-base rate factorization, see :ref:`Wilks, 2011 ` for further information. This measure is calculated for each row of the contingency table. Ideally, the event should become more frequent as the probability forecast increases. .. math:: \text{Base Rate}(i) = \frac{n_{i1}}{n_{i.}} = \text{probability}(o_{i1}) @@ -976,18 +976,18 @@ RPS Called "RPS" in RPS output :numref:`table_ES_header_info_es_out_ECNT` -While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012`), and is a proper score (:ref:`Mason, 2008`). +While the above probabilistic verification measures utilize dichotomous observations, the Ranked Probability Score (RPS, :ref:`Epstein, 1969 `, :ref:`Murphy, 1969 `) is the only probabilistic verification measure for discrete multiple-category events available in MET. It is assumed that the categories are ordinal as nominal categorical variables can be collapsed into sequences of binary predictands, which can in turn be evaluated with the above measures for dichotomous variables (:ref:`Wilks, 2011 `). The RPS is the multi-category extension of the Brier score (:ref:`Tödter and Ahrens, 2012 `), and is a proper score (:ref:`Mason, 2008 `). Let :math:`\text{J}` be the number of categories, then both the forecast, :math:`\text{f} = (f_1,…,f_J)`, and observation, :math:`\text{o} = (o_1,…,o_J)`, are length-:math:`\text{J}` vectors, where the components of :math:`\text{f}` include the probabilities forecast for each category :math:`\text{1,…,J}` and :math:`\text{o}` contains 1 in the category that is realized and zero everywhere else. The cumulative forecasts, :math:`F_m`, and observations, :math:`O_m`, are defined to be: :math:`F_m = \sum_{j=1}^m (f_j)` and :math:`O_m = \sum_{j=1}^m (o_j), m = 1,…,J`. -To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: +To clarify, :math:`F_1 = f_1` is the first component of :math:`F_m`, :math:`F_2 = f_1+f_2`, etc., and :math:`F_J = 1`. Similarly, if :math:`o_j = 1` and :math:`i < j`, then :math:`O_i = 0` and when :math:`i >= j`, :math:`O_i = 1`, and of course, :math:`O_J = 1`. Finally, the RPS is defined to be: .. math:: \text{RPS} = \sum_{m=1}^J (F_m - O_m)^2 = \sum_{m=1}^J BS_m, -where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012`). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. +where :math:`BS_m` is the Brier score for the m-th category (:ref:`Tödter and Ahrens, 2012 `). Subsequently, the RPS lends itself to a decomposition into reliability, resolution and uncertainty components, noting that each component is aggregated over the different categories; these are written to the columns named "RPS_REL", "RPS_RES" and "RPS_UNC" in RPS output :numref:`table_ES_header_info_es_out_ECNT`. CRPS ---- @@ -1066,7 +1066,7 @@ The continuous ranked probability skill score (CRPSS) is similar to the MSESS an .. math:: \text{CRPSS} = 1 - \frac{\text{CRPS}_{fcst}}{ \text{CRPS}_{ref}} -For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. +For the normal distribution fit (CRPSS), the reference CRPS is computed using the climatological mean and standard deviation. For the empirical distribution (CRPSS_EMP), the reference CRPS is computed by sampling from the assumed normal climatological distribution defined by the mean and standard deviation. Bias Ratio ---------- @@ -1105,6 +1105,37 @@ Called "PIT" in ORANK output :numref:`table_ES_header_info_es_out_ORANK` The probability integral transform (PIT) is the analog of the rank histogram for a probability distribution forecast (:ref:`Dawid, 1984 `). Its interpretation is the same as that of the verification rank histogram: Calibrated probabilistic forecasts yield PIT histograms that are flat, or uniform. Under-dispersed (not enough spread in the ensemble) forecasts have U-shaped PIT histograms while over-dispersed forecasts have bell-shaped histograms. In MET, the PIT calculation uses a normal distribution fit to the ensemble forecasts. In many cases, use of other distributions would be better. +Observation Error Logarithmic Scoring Rules +------------------------------------------- + +Called "IGN_CONV_OERR" and "IGN_CORR_OERR" in ECNT output :numref:`table_ES_header_info_es_out_ECNT` + +One approach that is used to take observation error into account in a summary measure is to add error to the forecast by a convolution with the observation model (e.g., :ref:`Anderson, 1996 `; :ref:`Hamill, 2001 `; :ref:`Saetra et. al., 2004 `; :ref:`Bröcker and Smith, 2007 `; :ref:`Candille et al., 2007 `; :ref:`Candille and Talagrand, 2008 `; :ref:`Röpnack et al., 2013 `). Specifically, suppose :math:`y=x+w`, where :math:`y` is the observed value, :math:`x` is the true value, and :math:`w` is the error. Then, if :math:`f` is the density forecast for :math:`x` and :math:`\nu` is the observation model, then the implied density forecast for :math:`y` is given by the convolution: + +.. math:: (f*\nu)(y) = \int\nu(y|x)f(x)dx + +:ref:`Ferro, 2017 ` gives the error-convolved version of the ignorance scoring rule (referred to therein as the error-convolved logarithmic scoring rule), which is proper under the model where :math:`w\sim N(0,c^2)`) when the forecast for :math:`x` is :math:`N(\mu,\sigma^2)` with density function :math:`f`, by + +.. only:: latex + + .. math:: \text{IGN\_CONV\_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} + +.. only:: html + + .. math:: \text{IGN_CONV_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi (\sigma^2 + c^2)) + \frac{(y - \mu)^2}{2 (\sigma^2 + c^2)} + +Another approach to incorporation of observation uncertainty into a measure is the error-correction approach. The approach merely ensures that the scoring rule, :math:`s`, is unbiased for a scoring rule :math:`s_0` if they have the same expected value. :ref:`Ferro, 2017 ` gives the error-corrected ignorance scoring rule (which is also proposer when :math:`w\sim N(0,c^2)`) as + +.. only:: latex + + .. math:: \text{IGN\_CORR\_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi\sigma^2) + \frac{(y - \mu)^2 - c^2}{2\sigma^2} + +.. only:: html + + .. math:: \text{IGN_CORR_OERR} = s(f,y) = \frac{1}{2}\log(2 \pi\sigma^2) + \frac{(y - \mu)^2 - c^2}{2\sigma^2} + +The expected score for the error-convolved ignorance scoring rule typically differs from the expected score that would be achieved if there were no observation error. The error-corrected score, on the other hand, has the same expectation. + RANK ---- @@ -1160,7 +1191,7 @@ The traditional contingency table statistics computed by the Grid-Stat neighborh All of these measures are defined in :numref:`categorical variables`. -In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert (2008) ` and :ref:`Roberts and Lean (2008) `. :ref:`Roberts and Lean (2008) ` also present an application of the methodology. +In addition to these standard statistics, the neighborhood analysis provides additional continuous measures, the Fractions Brier Score and the Fractions Skill Score. For reference, the Asymptotic Fractions Skill Score and Uniform Fractions Skill Score are also calculated. These measures are defined here, but are explained in much greater detail in :ref:`Ebert, 2008 ` and :ref:`Roberts and Lean, 2008 `. :ref:`Roberts and Lean, 2008 ` also present an application of the methodology. Fractions Brier Score --------------------- @@ -1225,7 +1256,7 @@ A mathematical metric, :math:`m(A,B)\geq 0`, must have the following three prope The first establishes that a perfect score is zero and that the only way to obtain a perfect score is if the two sets are identical according to the metric. The second requirement ensures that the order by which the two sets are evaluated will not change the result. The third property ensures that if *C* is closer to *A* than *B* is to *A*, then :math:`m(A,C) < m(A,B)`. -It has been argued in :ref:`Gilleland (2017) ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. +It has been argued in :ref:`Gilleland, 2017 ` that the second property of symmetry is not necessarily an important quality to have for a summary measure for verification purposes because lack of symmetry allows for information about false alarms and misses. The results of the distance map verification approaches that are included in the Grid-Stat tool are summarized using a variety of measures. These measures include Baddeley's :math:`\Delta` Metric, the Hausdorff Distance, the Mean-error Distance, Pratt's Figure of Merit, and Zhu's Measure. Their equations are listed below. diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 42443aa315..9a5574a658 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -66,7 +66,9 @@ The climatological distribution is also used for the RPSS. The forecast RPS stat Ensemble Observation Error -------------------------- -In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) `. can be replicated using the appropriate options. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both, of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. +In an attempt to ameliorate the effect of observation errors on the verification of forecasts, a random perturbation approach has been implemented. A great deal of user flexibility has been built in, but the methods detailed in :ref:`Candille and Talagrand (2008) ` can be replicated using the appropriate options. Additional variations of the ignorance score that include observational uncertainty recommended by :ref:`Ferro, 2017 ` are also provided. + +Observation error information can be defined directly in the Ensemble-Stat configuration file or through a more flexible observation error lookup table. The user selects a distribution for the observation error, along with parameters for that distribution. Rescaling and bias correction can also be specified prior to the perturbation. Random draws from the distribution can then be added to either, or both of the forecast and observed fields, including ensemble members. Details about the effects of the choices on verification statistics should be considered, with many details provided in the literature (*e.g.* :ref:`Candille and Talagrand, 2008 `; :ref:`Saetra et al., 2004 `; :ref:`Santos and Ghelli, 2012 `). Generally, perturbation makes verification statistics better when applied to ensemble members, and worse when applied to the observations themselves. Normal and uniform are common choices for the observation error distribution. The uniform distribution provides the benefit of being bounded on both sides, thus preventing the perturbation from taking on extreme values. Normal is the most common choice for observation error. However, the user should realize that with the very large samples typical in NWP, some large outliers will almost certainly be introduced with the perturbation. For variables that are bounded below by 0, and that may have inconsistent observation errors (e.g. larger errors with larger measurements), a lognormal distribution may be selected. Wind speeds and precipitation measurements are the most common of this type of NWP variable. The lognormal error perturbation prevents measurements of 0 from being perturbed, and applies larger perturbations when measurements are larger. This is often the desired behavior in these cases, but this distribution can also lead to some outliers being introduced in the perturbation step. @@ -647,6 +649,12 @@ The format of the STAT and ASCII output of the Ensemble-Stat tool are described * - 49 - ME_LT_OBS - The Mean Error of the ensemble values less than or equal to their observations + * - 50 + - IGN_CONV_OERR + - Error-convolved logarithmic scoring rule (i.e. ignornance score) from Equation 5 of :ref:`Ferro, 2017 ` + * - 51 + - IGN_CORR_OERR + - Error-corrected logarithmic scoring rule (i.e. ignornance score) from Equation 7 of :ref:`Ferro, 2017 ` .. _table_ES_header_info_es_out_RPS: diff --git a/docs/Users_Guide/refs.rst b/docs/Users_Guide/refs.rst index b4045f90b6..1c328014cb 100644 --- a/docs/Users_Guide/refs.rst +++ b/docs/Users_Guide/refs.rst @@ -14,11 +14,18 @@ References | Ahijevych, D., E. Gilleland, B.G. Brown, and E.E. Ebert, 2009: Application of | spatial verification methods to idealized and NWP-gridded precipitation forecasts. -| *Weather and Forecasting*, 24 (6), 1485 - 1497, doi: 10.1175/2009WAF2222298.1. +| *Weather and Forecasting*, 24 (6), 1485 - 1497. +| doi: https://doi.org/10.1175/2009WAF2222298.1 | -.. _Barker-1991: +.. _Andersen-1996: + +| Anderson JL., 1996: A method for producing and evaluating probabilistic forecasts +| from ensemble model integrations. *J. Clim.* 9: 1518-1530. +| doi: `https://doi.org/10.1175/1520-0442(1996)009<1518:AMFPAE>2.0.CO;2 2.0.CO;2>`_ +| +.. _Barker-1991: | Barker, T. W., 1991: The relationship between spread and forecast error in | extended-range forecasts. *Journal of Climate*, 4, 733-742. @@ -29,14 +36,14 @@ References | Bradley, A.A., S.S. Schwartz, and T. Hashino, 2008: Sampling Uncertainty | and Confidence Intervals for the Brier Score and Brier Skill Score. | *Weather and Forecasting*, 23, 992-1006. -| +| .. _Brill-2009: | Brill, K. F., and F. Mesinger, 2009: Applying a general analytic method | for assessing bias sensitivity to bias-adjusted threat and equitable | threat scores. *Weather and Forecasting*, 24, 1748-1754. -| +| .. _Brown-2007: @@ -49,32 +56,47 @@ References | http://ams.confex.com/ams/pdfpapers/124856.pdf. | +.. _Bröcker-2007: + +| Bröcker J, Smith LA., 2007: Scoring probabilistic forecasts: The importance +| of being proper. *Weather Forecasting*, 22, 382-388. +| doi: https://doi.org/10.1175/WAF966.1 +| + .. _Buizza-1997: | Buizza, R., 1997: Potential forecast skill of ensemble prediction and spread | and skill distributions of the ECMWF ensemble prediction system. *Monthly* -| *Weather Review*,125, 99-119. -| +| *Weather Review*, 125, 99-119. +| .. _Bullock-2016: | Bullock, R., T. Fowler, and B. Brown, 2016: Method for Object-Based | Diagnostic Evaluation. *NCAR Technical Note* NCAR/TN-532+STR, 66 pp. -| +| + +.. _Candille-2007: + +| Candille G, Côté C, Houtekamer PL, Pellerin G, 2007: Verification of an +| ensemble prediction system against observations. *Mon. Weather Rev.* +| 135: 2688-2699. +| doi: https://doi.org/10.1175/MWR3414.1 +| .. _Candille-2008: | Candille, G., and O. Talagrand, 2008: Impact of observational error on the | validation of ensemble prediction systems. *Quarterly Journal of the Royal* | *Meteorological Society* 134: 959-971. -| +| .. _Casati-2004: | Casati, B., G. Ross, and D. Stephenson, 2004: A new intensity-scale approach | for the verification of spatial precipitation forecasts. *Meteorological* | *Applications* 11, 141-154. -| +| .. _Davis-2006: @@ -86,37 +108,45 @@ References | Davis, C.A., B.G. Brown, and R.G. Bullock, 2006b: Object-based verification | of precipitation forecasts, Part II: Application to convective rain systems. | *Monthly Weather Review*, 134, 1785-1795. -| +| .. _Dawid-1984: | Dawid, A.P., 1984: Statistical theory: The prequential approach. *Journal of* | *the Royal Statistical Society* A147, 278-292. -| +| .. _Ebert-2008: | Ebert, E.E., 2008: Fuzzy verification of high-resolution gridded forecasts: -| a review and proposed framework. *Meteorological Applications,* 15, 51-64. -| +| a review and proposed framework. *Meteorological Applications*, 15, 51-64. +| .. _Eckel-2012: | Eckel, F. A., M.S. Allen, M. C. Sittel, 2012: Estimation of Ambiguity in -| Ensemble Forecasts. *Weather Forecasting,* 27, 50-69. -| doi: http://dx.doi.org/10.1175/WAF-D-11-00015.1 +| Ensemble Forecasts. *Weather Forecasting*, 27, 50-69. +| doi: https://doi.org/10.1175/WAF-D-11-00015.1 | .. _Efron-2007: | Efron, B. 2007: Correlation and large-scale significance testing. *Journal* -| of the American Statistical Association,* 102(477), 93-103. +| of the American Statistical Association*, 102(477), 93-103. | .. _Epstein-1969: | Epstein, E. S., 1969: A scoring system for probability forecasts of ranked categories. -| *J. Appl. Meteor.*, 8, 985-987, 10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2. +| *J. Appl. Meteor.*, 8, 985-987. +| doi: `https://doi.org/10.1175/1520-0450(1969)008<0985:ASSFPF>2.0.CO;2 2.0.CO;2>`_ +| + +.. _Ferro-2017: + +| Ferro C. A. T., 2017: Measuring forecast performance in the presence of observation error. +| *Q. J. R. Meteorol. Soc.*, 143 (708), 2665-2676. +| doi: https://doi.org/10.1002/qj.3115 | .. _Gilleland-2010: @@ -129,29 +159,32 @@ References | Gilleland, E., 2017: A new characterization in the spatial verification | framework for false alarms, misses, and overall patterns. -| *Weather and Forecasting*, 32 (1), 187 - 198, doi: 10.1175/WAF-D-16-0134.1. +| *Weather and Forecasting*, 32 (1), 187 - 198. +| doi: https://doi.org/10.1175/WAF-D-16-0134.1 | .. _Gilleland_PartI-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part I: Comparative forecast verification for continuous variables. -| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134, -| doi: 10.1175/JTECH-D-20-0069.1. +| *Journal of Atmospheric and Oceanic Technology*, 37 (11), 2117 - 2134. +| doi: https://doi.org/10.1175/JTECH-D-20-0069.1 | .. _Gilleland_PartII-2020: | Gilleland, E., 2020: Bootstrap methods for statistical inference. | Part II: Extreme-value analysis. *Journal of Atmospheric and Oceanic* -| *Technology*, 37 (11), 2135 - 2144, doi: 10.1175/JTECH-D-20-0070.1. +| *Technology*, 37 (11), 2135 - 2144. +| doi: https://doi.org/10.1175/JTECH-D-20-0070.1 | .. _Gilleland-2021: | Gilleland, E., 2021: Novel measures for summarizing high-resolution forecast | performance. *Advances in Statistical Climatology, Meteorology and Oceanography*, -| 7 (1), 13 - 34, doi: 10.5194/ascmo-7-13-2021. +| 7 (1), 13 - 34. +| doi: https://doi.org/10.5194/ascmo-7-13-2021 | .. _Gneiting-2004: @@ -161,7 +194,7 @@ References | *Minimum CRPS Estimation*. Technical Report no. 449, Department of | Statistics, University of Washington. Available at | http://www.stat.washington.edu/www/research/reports/ -| +| .. _Haiden-2012: @@ -175,41 +208,41 @@ References | Hamill, T. M., 2001: Interpretation of rank histograms for verifying ensemble | forecasts. *Monthly Weather Review*, 129, 550-560. -| +| .. _Hersbach-2000: | Hersbach, H., 2000: Decomposition of the Continuous Ranked Probability Score | for Ensemble Prediction Systems. *Weather and Forecasting*, 15, 559-570. -| +| .. _Jolliffe-2012: | Jolliffe, I.T., and D.B. Stephenson, 2012: *Forecast verification. A* | *practitioner's guide in atmospheric science.* Wiley and Sons Ltd, 240 pp. -| +| .. _Knaff-2003: | Knaff, J.A., M. DeMaria, C.R. Sampson, and J.M. Gross, 2003: Statistical, | Five-Day Tropical Cyclone Intensity Forecasts Derived from Climatology -| and Persistence. *Weather and Forecasting,* Vol. 18 Issue 2, p. 80-92. -| +| and Persistence. *Weather and Forecasting*, Vol. 18 Issue 2, p. 80-92. +| .. _Mason-2004: | Mason, S. J., 2004: On Using "Climatology" as a Reference Strategy | in the Brier and Ranked Probability Skill Scores. *Monthly Weather Review*, | 132, 1891-1895. -| +| .. _Mason-2008: | Mason, S. J., 2008: Understanding forecast verification statistics. -| *Meteor. Appl.*, 15, 31-40, doi: 10.1002/met.51. +| *Meteor. Appl.*, 15, 31-40. +| doi: https://doi.org/10.1002/met.51 | - .. _Mittermaier-2014: | Mittermaier, M., 2014: A strategy for verifying near-convection-resolving @@ -220,21 +253,20 @@ References | Mood, A. M., F. A. Graybill and D. C. Boes, 1974: *Introduction to the* | *Theory of Statistics*, McGraw-Hill, 299-338. -| +| .. _Murphy-1969: | Murphy, A.H., 1969: On the ranked probability score. *Journal of Applied* | *Meteorology and Climatology*, 8 (6), 988 - 989, -| doi: 10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2. +| doi: `https://doi.org/10.1175/1520-0450(1969)008<0988:OTPS>2.0.CO;2 2.0.CO;2>`_ | .. _Murphy-1987: | Murphy, A.H., and R.L. Winkler, 1987: A general framework for forecast | verification. *Monthly Weather Review*, 115, 1330-1338. -| - +| .. _North-2022: @@ -256,7 +288,7 @@ References | Roberts, N.M., and H.W. Lean, 2008: Scale-selective verification of rainfall | accumulations from high-resolution forecasts of convective events. | *Monthly Weather Review*, 136, 78-97. -| +| .. _Rodwell-2010: @@ -273,11 +305,18 @@ References | https://www.ecmwf.int/node/14595 | +.. _Röpnack-2013: + +| Röpnack A, Hense A, Gebhardt C, Majewski D., 2013: Bayesian model verification +| of NWP ensemble forecasts. *Mon. Weather Rev.* 141: 375–387. +| doi: https://doi.org/10.1175/MWR-D-11-00350.1 +| + .. _Saetra-2004: -| Saetra O., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of +| Saetra Ø., H. Hersbach, J-R Bidlot, D. Richardson, 2004: Effects of | observation errors on the statistics for ensemble spread and -| reliability. *Monthly Weather Review* 132: 1487-1501. +| reliability. *Monthly Weather Review*, 132: 1487-1501. | .. _Santos-2012: @@ -285,7 +324,7 @@ References | Santos C. and A. Ghelli, 2012: Observational probability method to assess | ensemble precipitation forecasts. *Quarterly Journal of the Royal* | *Meteorological Society* 138: 209-221. -| +| .. _Schwartz-2017: @@ -298,20 +337,21 @@ References | Stephenson, D.B., 2000: Use of the "Odds Ratio" for diagnosing | forecast skill. *Weather and Forecasting*, 15, 221-232. -| +| .. _Stephenson-2008: | Stephenson, D.B., B. Casati, C.A.T. Ferro, and C.A. Wilson, 2008: The extreme | dependency score: A non-vanishing measure for forecasts of rare events. | *Meteorological Applications* 15, 41-50. -| +| -.. _Todter-2012: +.. _Tödter-2012: | Tödter, J. and B. Ahrens, 2012: Generalization of the Ignorance Score: | Continuous ranked version and its decomposition. *Monthly Weather Review*, -| 140 (6), 2005 - 2017, doi: 10.1175/MWR-D-11-00266.1. +| 140 (6), 2005 - 2017. +| doi: https://doi.org/10.1175/MWR-D-11-00266.1 | .. _Weniger-2016: @@ -319,17 +359,18 @@ References | Weniger, M., F. Kapp, and P. Friederichs, 2016: Spatial Verification Using | Wavelet Transforms: A Review. *Quarterly Journal of the Royal* | *Meteorological Society*, 143, 120-136. -| +| .. _Wilks-2010: | Wilks, D.S. 2010: Sampling distributions of the Brier score and Brier skill | score under serial dependence. *Quarterly Journal of the Royal* -| *Meteorological Society*, 136, 2109-2118. doi:10.1002/qj.709 -| +| *Meteorological Society*, 136, 2109-2118. +| doi: https://doi.org/10.1002/qj.709 +| .. _Wilks-2011: | Wilks, D., 2011: *Statistical methods in the atmospheric sciences.* | Elsevier, San Diego. -| +| diff --git a/internal/test_unit/hdr/met_12_0.hdr b/internal/test_unit/hdr/met_12_0.hdr index d6bf9fb0b9..a1113d5102 100644 --- a/internal/test_unit/hdr/met_12_0.hdr +++ b/internal/test_unit/hdr/met_12_0.hdr @@ -19,7 +19,7 @@ PJC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L PRC : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH _VAR_ PSTD : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_THRESH BASER BASER_NCL BASER_NCU RELIABILITY RESOLUTION UNCERTAINTY ROC_AUC BRIER BRIER_NCL BRIER_NCU BRIERCL BRIERCL_NCL BRIERCL_NCU BSS BSS_SMPL _VAR_ ECLV : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BASE N_PTS _VAR_ -ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS +ECNT : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_ENS CRPS CRPSS IGN ME RMSE SPREAD ME_OERR RMSE_OERR SPREAD_OERR SPREAD_PLUS_OERR CRPSCL CRPS_EMP CRPSCL_EMP CRPSS_EMP CRPS_EMP_FAIR SPREAD_MD MAE MAE_OERR BIAS_RATIO N_GE_OBS ME_GE_OBS N_LT_OBS ME_LT_OBS IGN_CONV_OERR IGN_CORR_OERR RPS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL N_PROB RPS_REL RPS_RES RPS_UNC RPS RPSS RPSS_SMPL RPS_COMP RHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL CRPS IGN N_RANK CRPSS SPREAD _VAR_ PHIST : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE TOTAL BIN_SIZE N_BIN _VAR_ diff --git a/src/basic/vx_util/num_array.cc b/src/basic/vx_util/num_array.cc index 144736cc88..baaac11c6a 100644 --- a/src/basic/vx_util/num_array.cc +++ b/src/basic/vx_util/num_array.cc @@ -1075,7 +1075,9 @@ NumArray NumArray::subset(const NumArray &keep) const // Check bounds if ( keep.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::subset(const NumArray &) -> " - << "the number of elements do not match\n\n"; + << "the number of elements do not match (" + << keep.n_elements() << " keep flags != " + << n_elements() << " array elements)\n\n"; exit ( 1 ); } @@ -1156,7 +1158,9 @@ double NumArray::wmean(const NumArray &wgt) const if ( wgt.n_elements() != n_elements() ) { mlog << Error << "\nNumArray::wmean(const NumArray &) -> " - << "the number of elements do not match\n\n"; + << "the number of elements do not match (" + << wgt.n_elements() << " weights != " + << n_elements() << " array elements)\n\n"; exit ( 1 ); } diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index 909441b5ba..826d5101c9 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -276,7 +276,7 @@ static const char * ecnt_columns [] = { "CRPSS_EMP", "CRPS_EMP_FAIR", "SPREAD_MD", "MAE", "MAE_OERR", "BIAS_RATIO", "N_GE_OBS", "ME_GE_OBS", "N_LT_OBS", - "ME_LT_OBS" + "ME_LT_OBS", "IGN_CONV_OERR", "IGN_CORR_OERR" }; static const char * rps_columns [] = { diff --git a/src/libcode/vx_gsl_prob/gsl_randist.h b/src/libcode/vx_gsl_prob/gsl_randist.h index d562bfe733..e66c312230 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.h +++ b/src/libcode/vx_gsl_prob/gsl_randist.h @@ -58,9 +58,9 @@ extern void ran_sample(const gsl_rng *r, double *, int, double *, int); extern void ran_sample(const gsl_rng *r, NumArray &, NumArray &, int); extern double ran_draw(const gsl_rng *r, DistType, - double p1, double p2 = bad_data_int); + double p1, double p2 = bad_data_double); extern double dist_var(DistType, - double p1, double p2 = bad_data_int); + double p1, double p2 = bad_data_double); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index c4880f83eb..55aded1e28 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -4275,7 +4275,7 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, // CRPSS_EMP CRPS_EMP_FAIR, SPREAD_MD, // MAE, MAE_OERR, BIAS_RATIO, // N_GE_OBS, ME_GE_OBS, N_LT_OBS, - // ME_LT_OBS + // ME_LT_OBS, IGN_CONV_OERR, IGN_CORR_OERR // at.set_entry(r, c+0, // Total Number of Pairs ecnt_info.n_pair); @@ -4352,6 +4352,12 @@ void write_ecnt_cols(const ECNTInfo &ecnt_info, at.set_entry(r, c+24, // ME of ensemble values < observations ecnt_info.me_lt_obs); + at.set_entry(r, c+25, // Ignorance Score, observation error convolved + ecnt_info.ign_conv_oerr); + + at.set_entry(r, c+26, // Ignorance Score, observation error corrected + ecnt_info.ign_corr_oerr); + return; } diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 4ed6f821ca..782832b79f 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -181,13 +181,15 @@ void ECNTInfo::clear() { crps_emp_fair = spread_md = bad_data_double; crps_gaus = crpscl_gaus = crpss_gaus = bad_data_double; ign = bad_data_double; - me = mae = rmse = spread = bad_data_double; - me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; + me = mae = rmse = spread = bad_data_double; + me_oerr = mae_oerr = rmse_oerr = spread_oerr = bad_data_double; spread_plus_oerr = bad_data_double; - n_ge_obs = n_lt_obs = 0; - me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; - + ign_conv_oerr = ign_corr_oerr = bad_data_double; + + n_ge_obs = n_lt_obs = 0; + me_ge_obs = me_lt_obs = bias_ratio = bad_data_double; + return; } @@ -221,6 +223,8 @@ void ECNTInfo::assign(const ECNTInfo &c) { rmse_oerr = c.rmse_oerr; spread_oerr = c.spread_oerr; spread_plus_oerr = c.spread_plus_oerr; + ign_conv_oerr = c.ign_conv_oerr; + ign_corr_oerr = c.ign_corr_oerr; n_ge_obs = c.n_ge_obs; n_lt_obs = c.n_lt_obs; @@ -361,6 +365,10 @@ void ECNTInfo::set(const PairDataEnsemble &pd) { // Compute the square root of the average variance plus oerr spread_plus_oerr = square_root(pd.var_plus_oerr_na.wmean(pd.wgt_na)); + // Compute log scores with observational uncertainty + ign_conv_oerr = pd.ign_conv_oerr_na.wmean(pd.wgt_na); + ign_corr_oerr = pd.ign_corr_oerr_na.wmean(pd.wgt_na); + // Compute bias ratio terms n_ge_obs = nint(pd.n_ge_obs_na.sum()); me_ge_obs = pd.me_ge_obs_na.wmean(pd.n_ge_obs_na); diff --git a/src/libcode/vx_statistics/ens_stats.h b/src/libcode/vx_statistics/ens_stats.h index 17e864fb5e..69eca9f4e1 100644 --- a/src/libcode/vx_statistics/ens_stats.h +++ b/src/libcode/vx_statistics/ens_stats.h @@ -82,6 +82,10 @@ class ECNTInfo { double me_oerr, mae_oerr, rmse_oerr, spread_oerr; double spread_plus_oerr; + // Log scores that incorporate observational uncertainty, + // as advised in Ferro (2017) + double ign_conv_oerr, ign_corr_oerr; + // Bias ratio information int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index a290afcb30..8487d751b5 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -3456,6 +3456,25 @@ int min_int(const int *v_int, int n) { return v_min; } +//////////////////////////////////////////////////////////////////////// +// +// Compute mean from a sum +// +//////////////////////////////////////////////////////////////////////// + +double compute_mean(double sum, int n) { + double v; + + if(is_bad_data(sum) || is_bad_data(n) || n == 0) { + v = bad_data_double; + } + else { + v = sum / n; + } + + return(v); +} + //////////////////////////////////////////////////////////////////////// // // Compute variance from sums of squares diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index f0715d45b3..1d5def71a7 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -726,6 +726,8 @@ extern int min_int(const int *, int); // //////////////////////////////////////////////////////////////////////// +extern double compute_mean(double, int); + extern double compute_variance(double, double, int); extern double compute_stdev(double, double, int); diff --git a/src/libcode/vx_statistics/obs_error.cc b/src/libcode/vx_statistics/obs_error.cc index eae4bed423..5b753346a3 100644 --- a/src/libcode/vx_statistics/obs_error.cc +++ b/src/libcode/vx_statistics/obs_error.cc @@ -5,6 +5,7 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + //////////////////////////////////////////////////////////////////////// #include @@ -184,6 +185,12 @@ void ObsErrorEntry::dump(ostream & out, int depth) const { //////////////////////////////////////////////////////////////////////// +double ObsErrorEntry::variance() const { + return dist_var(dist_type, dist_parm[0], dist_parm[1]); +} + +//////////////////////////////////////////////////////////////////////// + bool ObsErrorEntry::parse_line(const DataLine &dl) { // Initialize diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 732c4c3ced..11cce141dc 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -5,6 +5,7 @@ // ** Research Applications Lab (RAL) // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + //////////////////////////////////////////////////////////////////////// #ifndef __OBS_ERROR_H__ @@ -68,6 +69,8 @@ class ObsErrorEntry { // get stuff // + double variance() const; + // // do stuff // diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index cc25f891d3..c2178687ce 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -108,6 +108,9 @@ void PairDataEnsemble::clear() { ign_na.clear(); pit_na.clear(); + ign_conv_oerr_na.clear(); + ign_corr_oerr_na.clear(); + n_ge_obs_na.clear(); me_ge_obs_na.clear(); n_lt_obs_na.clear(); @@ -179,6 +182,8 @@ void PairDataEnsemble::extend(int n) { crpscl_gaus_na.extend (n); ign_na.extend (n); pit_na.extend (n); + ign_conv_oerr_na.extend (n); + ign_corr_oerr_na.extend (n); n_ge_obs_na.extend (n); me_ge_obs_na.extend (n); n_lt_obs_na.extend (n); @@ -235,15 +240,20 @@ void PairDataEnsemble::assign(const PairDataEnsemble &pd) { // PairDataEnsemble v_na = pd.v_na; r_na = pd.r_na; + crps_emp_na = pd.crps_emp_na; crps_emp_fair_na = pd.crps_emp_fair_na; spread_md_na = pd.spread_md_na; crpscl_emp_na = pd.crpscl_emp_na; crps_gaus_na = pd.crps_gaus_na; crpscl_gaus_na = pd.crpscl_gaus_na; + ign_na = pd.ign_na; pit_na = pd.pit_na; + ign_conv_oerr_na = pd.ign_conv_oerr_na; + ign_corr_oerr_na = pd.ign_corr_oerr_na; + n_ge_obs_na = pd.n_ge_obs_na; me_ge_obs_na = pd.me_ge_obs_na; n_lt_obs_na = pd.n_lt_obs_na; @@ -449,6 +459,8 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { crpscl_gaus_na.add(bad_data_double); ign_na.add(bad_data_double); pit_na.add(bad_data_double); + ign_conv_oerr_na.add(bad_data_double); + ign_corr_oerr_na.add(bad_data_double); n_ge_obs_na.add(bad_data_double); me_ge_obs_na.add(bad_data_double); n_lt_obs_na.add(bad_data_double); @@ -461,22 +473,41 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { var_unperturbed = compute_variance(esum_na[i], esumsq_na[i], esumn_na[i]); var_na.add(var_unperturbed); - // Process the observation error information. + // Process the observation error information ObsErrorEntry * e = (has_obs_error() ? obs_error_entry[i] : 0); if(e) { + // Get observation error variance + double oerr_var = e->variance(); + + // Compute the observation error log scores + double v_conv, v_corr; + compute_obs_error_log_scores( + compute_mean(esum_na[i], esumn_na[i]), + compute_stdev(esum_na[i], esumsq_na[i], esumn_na[i]), + o_na[i], oerr_var, + v_conv, v_corr); + ign_conv_oerr_na.add(v_conv); + ign_corr_oerr_na.add(v_corr); + // Compute perturbed ensemble mean and variance // Exclude the control member from the variance mn_oerr_na.add(cur_ens.mean()); var_oerr_na.add(cur_ens.variance(ctrl_index)); - // Compute the variance plus observation error variance. - var_plus_oerr_na.add(var_unperturbed + - dist_var(e->dist_type, - e->dist_parm[0], e->dist_parm[1])); + // Compute the variance plus observation error variance + if(is_bad_data(var_unperturbed) || + is_bad_data(oerr_var)) { + var_plus_oerr_na.add(bad_data_double); + } + else { + var_plus_oerr_na.add(var_unperturbed + oerr_var); + } } - // If no observation error specified, store bad data values. + // If no observation error specified, store bad data values else { + ign_conv_oerr_na.add(bad_data_double); + ign_corr_oerr_na.add(bad_data_double); mn_oerr_na.add(bad_data_double); var_oerr_na.add(bad_data_double); var_plus_oerr_na.add(bad_data_double); @@ -506,8 +537,8 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { derive_climo_vals(cdf_info_ptr, cmn_na[i], csd_na[i], cur_clm); // Store empirical CRPS stats - // - // For crps_emp use temporary, local variable so we can use it for the crps_emp_fair calculation + // For crps_emp use temporary, local variable so we can use it + // for the crps_emp_fair calculation double crps_emp = compute_crps_emp(o_na[i], cur_ens); crps_emp_na.add(crps_emp); crps_emp_fair_na.add(crps_emp - cur_ens.wmean_abs_diff()); @@ -528,9 +559,10 @@ void PairDataEnsemble::compute_pair_vals(const gsl_rng *rng_ptr) { // Compute the Bias Ratio terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms(o_na[i], cur_ens, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms( + o_na[i], cur_ens, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); // Store the Bias Ratio terms n_ge_obs_na.add(n_ge_obs); @@ -864,8 +896,11 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o // // Include in subset: // wgt_na, o_na, cmn_na, csd_na, v_na, r_na, - // crps_emp_na, crps_emp_fair_na, spread_md_na, crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, - // ign_na, pit_na, n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, + // crps_emp_na, crps_emp_fair_na, spread_md_na, + // crpscl_emp_na, crps_gaus_na, crpscl_gaus_na, + // ign_na, pit_na, + // ign_conv_oerr, ign_corr_oerr, + // n_gt_obs_na, me_gt_obs_na, n_lt_obs_na, me_lt_obs_na, // var_na, var_oerr_na, var_plus_oerr_na, // mn_na, mn_oerr_na, e_na // @@ -888,6 +923,8 @@ PairDataEnsemble PairDataEnsemble::subset_pairs_obs_thresh(const SingleThresh &o pd.crpscl_gaus_na.add(crpscl_gaus_na[i]); pd.ign_na.add(ign_na[i]); pd.pit_na.add(pit_na[i]); + pd.ign_conv_oerr_na.add(ign_conv_oerr_na[i]); + pd.ign_corr_oerr_na.add(ign_corr_oerr_na[i]); pd.n_ge_obs_na.add(n_ge_obs_na[i]); pd.me_ge_obs_na.add(me_ge_obs_na[i]); pd.n_lt_obs_na.add(n_lt_obs_na[i]); @@ -1498,7 +1535,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, y < 0 || y >= gr.ny()) return; // For pressure levels, check if the observation pressure level - // falls in the requsted range. + // falls in the requested range. if(obs_info_grib->level().type() == LevelType_Pres) { if(obs_lvl < obs_info_grib->level().lower() || @@ -1593,7 +1630,8 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, } } - // Apply observation error logic bias correction, if requested + // Apply observation error additive and multiplicative + // bias correction, if requested if(obs_error_info->flag) { obs_v = add_obs_error_bc(obs_error_info->rng_ptr, FieldType_Obs, oerr_ptr, obs_v); @@ -2111,5 +2149,52 @@ double compute_bias_ratio(double me_ge_obs, double me_lt_obs) { return v; } - + +//////////////////////////////////////////////////////////////////////// + +void compute_obs_error_log_scores(double emn, double esd, + double obs, double oerr_var, + double &v_conv, double &v_corr) { + + const char *method_name = "compute_obs_error_log_scores() -> "; + + // Check for bad input data + if(is_bad_data(emn) || + is_bad_data(esd) || + is_bad_data(obs) || + is_bad_data(oerr_var)) { + v_conv = v_corr = bad_data_double; + } + else { + double sigma2 = esd * esd; + double ov2 = oerr_var * oerr_var; + + // Error-convolved logarithmic scoring rule in + // Ferro (2017, Eq 5) doi:10.1002/qj.3115 + // Scale by 2.0 * pi for consistency with ignorance score + v_conv = 0.5 * log(2.0 * pi * (sigma2 + ov2)) + + ((obs - emn) * (obs - emn)) / + (2.0 * (sigma2 + ov2)); + + // Error-corrected logarithmic scoring rule in + // Ferro (2017, Eq 7) doi:10.1002/qj.3115 + // Scale by 2.0 * pi for consistency with ignorance score + v_corr = 0.5 * log(2.0 * pi * sigma2) + + ((obs - emn) * (obs - emn) - ov2) / + (2.0 * sigma2); + } + + if(mlog.verbosity_level() >= 10) { + mlog << Debug(10) << method_name + << "inputs (emn = " << emn + << ", esd = " << esd + << ", obs = " << obs + << ", oerr_var = " << oerr_var + << ") and outputs (ign_oerr_conv = " << v_conv + << ", ign_oerr_corr = " << v_corr << ")\n"; + } + + return; +} + //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index e6014b59fb..9be2eec3c8 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -6,6 +6,8 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +//////////////////////////////////////////////////////////////////////// + #ifndef __PAIR_DATA_ENSEMBLE_H__ #define __PAIR_DATA_ENSEMBLE_H__ @@ -74,64 +76,67 @@ class PairDataEnsemble : public PairBase { bool obs_error_flag; // Ensemble, valid count, and rank values - NumArray *e_na; // Ensemble values [n_ens][n_obs] - NumArray v_na; // Number of valid ensemble values [n_obs] - NumArray r_na; // Observation ranks [n_obs] + NumArray *e_na; // Ensemble values [n_ens][n_obs] + NumArray v_na; // Number of valid ensemble values [n_obs] + NumArray r_na; // Observation ranks [n_obs] + + NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] + NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] + NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] + NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] - NumArray crps_emp_na; // Empirical Continuous Ranked Probability Score [n_obs] - NumArray crps_emp_fair_na; // Fair Empirical Continuous Ranked Probability Score [n_obs] - NumArray spread_md_na; // Mean absolute difference of ensemble members [n_obs] - NumArray crpscl_emp_na; // Empirical climatological CRPS [n_obs] + NumArray crps_gaus_na; // Gaussian CRPS [n_obs] + NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] - NumArray crps_gaus_na; // Gaussian CRPS [n_obs] - NumArray crpscl_gaus_na; // Gaussian climatological CRPS [n_obs] + NumArray ign_na; // Ignorance Score [n_obs] + NumArray pit_na; // Probability Integral Transform [n_obs] - NumArray ign_na; // Ignorance Score [n_obs] - NumArray pit_na; // Probability Integral Transform [n_obs] + NumArray ign_conv_oerr_na; // Error convolved log score [n_obs] + NumArray ign_corr_oerr_na; // Error corrected log score [n_obs] - NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] - NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] - NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] - NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] + NumArray n_ge_obs_na; // Number of ensemble memebers >= obs [n_obs] + NumArray me_ge_obs_na; // Mean error of ensemble members >= obs [n_obs] + NumArray n_lt_obs_na; // Number of ensemble members < obs [n_obs] + NumArray me_lt_obs_na; // Mean error of ensemble members < obs [n_obs] - int n_ens; // Number of ensemble members - int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) - int ctrl_index; // Index of the control member - bool skip_const; // Skip cases where the observation and - // all ensemble members are constant - BoolArray skip_ba; // Flag for each observation [n_obs] + int n_ens; // Number of ensemble members + int n_pair; // Number of valid pairs, n_obs - sum(skip_ba) + int ctrl_index; // Index of the control member + bool skip_const; // Skip cases where the observation and + // all ensemble members are constant + BoolArray skip_ba; // Flag for each observation [n_obs] - NumArray rhist_na; // Ranked Histogram [n_ens+1] - NumArray relp_na; // Relative Position Histogram [n_ens] + NumArray rhist_na; // Ranked Histogram [n_ens+1] + NumArray relp_na; // Relative Position Histogram [n_ens] - double phist_bin_size; // Ensemble PIT histogram bin width - NumArray phist_na; // PIT Histogram [n_phist_bin] + double phist_bin_size; // Ensemble PIT histogram bin width + NumArray phist_na; // PIT Histogram [n_phist_bin] NumArray var_na; // Variance of unperturbed members [n_obs] NumArray var_oerr_na; // Variance of perturbed members [n_obs] NumArray var_plus_oerr_na; // Unperturbed variance plus observation error variance [n_obs] - NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] - NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] - NumArray esumn_na; // Count of ensemble values [n_obs] + NumArray esum_na; // Sum of unperturbed ensemble values [n_obs] + NumArray esumsq_na; // Sum of unperturbed ensemble squared values [n_obs] + NumArray esumn_na; // Count of ensemble values [n_obs] - NumArray mn_na; // Ensemble mean value [n_obs] - NumArray mn_oerr_na; // Mean of perturbed members [n_obs] + NumArray mn_na; // Ensemble mean value [n_obs] + NumArray mn_oerr_na; // Mean of perturbed members [n_obs] - double ssvar_bin_size; // Variance bin size for spread/skill - SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] + double ssvar_bin_size; // Variance bin size for spread/skill + SSVARInfo *ssvar_bins; // Ensemble spread/skill bin information [n_ssvar_bin] - double crpss_emp; // Empirical CRPS skill score - double crpss_gaus; // Guassian CRPS skill score + double crpss_emp; // Empirical CRPS skill score + double crpss_gaus; // Guassian CRPS skill score - double me; // ME for ensemble mean - double mae; // MAE for ensemble mean - double rmse; // RMSE for ensemble mean - double me_oerr; // ME for mean of perturbed members - double mae_oerr; // MAE for mean of perturbed members - double rmse_oerr; // RMSE for mean of perturbed members + double me; // ME for ensemble mean + double mae; // MAE for ensemble mean + double rmse; // RMSE for ensemble mean + double me_oerr; // ME for mean of perturbed members + double mae_oerr; // MAE for mean of perturbed members + double rmse_oerr; // RMSE for mean of perturbed members - double bias_ratio; // Bias ratio + double bias_ratio; // Bias ratio ////////////////////////////////////////////////////////////////// @@ -323,6 +328,9 @@ extern double compute_ens_pit(double, double, double); extern void compute_bias_ratio_terms(double, const NumArray &, int &, double &, int &, double &); extern double compute_bias_ratio(double, double); +extern void compute_obs_error_log_scores( + double, double, double, double, + double &, double &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index cd3b080bc6..2b19b94391 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -1119,7 +1119,7 @@ void VxPairDataPoint::add_point_obs(float *hdr_arr, const char *hdr_typ_str, } // For pressure levels, check if the observation pressure level - // falls in the requsted range. + // falls in the requested range. if(obs_info->level().type() == LevelType_Pres) { if(obs_lvl < obs_info->level().lower() || diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 49506e1402..3ca4cfcaff 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -39,6 +39,8 @@ // line types. // 018 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. +// 019 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -2656,6 +2658,8 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.crps_gaus_na.add(cur.crps_gaus); m[key].ens_pd.crpscl_gaus_na.add(cur.crpscl_gaus); m[key].ens_pd.ign_na.add(cur.ign); + m[key].ens_pd.ign_conv_oerr_na.add(cur.ign_conv_oerr); + m[key].ens_pd.ign_corr_oerr_na.add(cur.ign_corr_oerr); m[key].ens_pd.n_ge_obs_na.add(cur.n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(cur.me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(cur.n_lt_obs); @@ -3229,17 +3233,34 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, m[key].ens_pd.ign_na.add(compute_ens_ign(cur.obs, cur.ens_mean, cur.spread)); m[key].ens_pd.pit_na.add(compute_ens_pit(cur.obs, cur.ens_mean, cur.spread)); + // Back out the observation error variance + double oerr_var = bad_data_double; + if(!is_bad_data(cur.spread_plus_oerr) && + !is_bad_data(cur.spread)) { + oerr_var = square(cur.spread_plus_oerr) - + square(cur.spread); + } + // Store BIAS_RATIO terms int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; - compute_bias_ratio_terms(cur.obs, cur.ens_na, - n_ge_obs, me_ge_obs, - n_lt_obs, me_lt_obs); + compute_bias_ratio_terms( + cur.obs, cur.ens_na, + n_ge_obs, me_ge_obs, + n_lt_obs, me_lt_obs); m[key].ens_pd.n_ge_obs_na.add(n_ge_obs); m[key].ens_pd.me_ge_obs_na.add(me_ge_obs); m[key].ens_pd.n_lt_obs_na.add(n_lt_obs); m[key].ens_pd.me_lt_obs_na.add(me_lt_obs); + // Compute observation error log scores + double v_conv, v_corr; + compute_obs_error_log_scores( + cur.ens_mean, cur.spread, cur.obs, oerr_var, + v_conv, v_corr); + m[key].ens_pd.ign_conv_oerr_na.add(v_conv); + m[key].ens_pd.ign_corr_oerr_na.add(v_corr); + // // Increment the RHIST counts // diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index b6ec116759..ebdc9d9a0a 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -33,6 +33,8 @@ // line types. // 013 02/13/24 Halley Gotway MET #2395 Add wind direction stats // to VL1L2, VAL1L2, and VCNT. +// 014 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -397,6 +399,9 @@ void parse_ecnt_line(STATLine &l, ECNTData &e_data) { e_data.n_lt_obs = atoi(l.get_item("N_LT_OBS")); e_data.me_lt_obs = atof(l.get_item("ME_LT_OBS")); + e_data.ign_conv_oerr = atof(l.get_item("IGN_CONV_OERR")); + e_data.ign_corr_oerr = atof(l.get_item("IGN_CORR_OERR")); + return; } diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index 529fdb2df9..c890b45ff7 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -28,6 +28,8 @@ // 011 09/28/22 Prestopnik MET #2227 Remove namespace std // 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR // line types. +// 013 02/21/24 Halley Gotway MET #2583 Add observation error +// ECNT statistics. // //////////////////////////////////////////////////////////////////////// @@ -72,6 +74,7 @@ struct ECNTData { double bias_ratio; int n_ge_obs, n_lt_obs; double me_ge_obs, me_lt_obs; + double ign_conv_oerr, ign_corr_oerr; }; // Ranked Histogram (RHIST) data structure diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index 99b0f762ef..827662caf8 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -39,7 +39,7 @@ // 014 07/09/21 Linden MET #1746 Skip thresholding. // 015 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 016 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files -// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings +// 017 01/29/24 Halley Gotway MET #2801 Configure time difference warnings // //////////////////////////////////////////////////////////////////////// @@ -425,7 +425,7 @@ void process_scores() { mlog << Debug(2) << "Observation field: "; fill_bad_data(obs_dp_fill, obs_fill); - // Pad the fields out to the nearest power of two if requsted + // Pad the fields out to the nearest power of two if requested if(conf_info.grid_decomp_flag == GridDecompType_Pad) { mlog << Debug(2) << "Padding the fields out to the nearest integer " << "power of two.\n"; From f11318182ab81c3eccc3a781fc6dca6ccccfb100 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 14 Mar 2024 14:11:15 -0600 Subject: [PATCH 29/72] Update the pull request template to include a question about expected impacts to existing METplus Use Cases. --- .github/pull_request_template.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6f7f5e04c4..d3a97c7a05 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,9 +16,12 @@ If **yes**, please describe:
- [ ] Do these changes include sufficient testing updates? **[Yes or No]** -- [ ] Will this PR result in changes to the test suite? **[Yes or No]**
+- [ ] Will this PR result in changes to the MET test suite? **[Yes or No]**
If **yes**, describe the new output and/or changes to the existing output:
+- [ ] Will this PR result in changes to existing METplus Use Cases? **[Yes or No]**
+If **yes**, create a new **Update Truth** [METplus issue](https://github.com/dtcenter/METplus/issues/new/choose) to describe them. + - [ ] Please complete this pull request review by **[Fill in date]**.
## Pull Request Checklist ## From be3ce26753de9d6c7aa32b2bed0dc111d9836269 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 19 Mar 2024 18:20:42 +0000 Subject: [PATCH 30/72] #2830 Changed enum Builtin to enum class --- src/basic/vx_config/builtin.cc | 64 ++++++++++++++--------------- src/basic/vx_config/builtin.h | 68 +++++++++++++++---------------- src/basic/vx_config/calculator.cc | 4 +- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/basic/vx_config/builtin.cc b/src/basic/vx_config/builtin.cc index ed54d132b0..966db34858 100644 --- a/src/basic/vx_config/builtin.cc +++ b/src/basic/vx_config/builtin.cc @@ -75,54 +75,54 @@ static double my_C_to_F (double); const BuiltinInfo binfo[] = { - { "sin", 1, builtin_sin, nullptr, nullptr, sin, nullptr }, - { "cos", 1, builtin_cos, nullptr, nullptr, cos, nullptr }, - { "tan", 1, builtin_tan, nullptr, nullptr, tan, nullptr }, + { "sin", 1, Builtin::sin, nullptr, nullptr, sin, nullptr }, + { "cos", 1, Builtin::cos, nullptr, nullptr, cos, nullptr }, + { "tan", 1, Builtin::tan, nullptr, nullptr, tan, nullptr }, - { "sind", 1, builtin_sind, nullptr, nullptr, sin_deg, nullptr }, - { "cosd", 1, builtin_cosd, nullptr, nullptr, cos_deg, nullptr }, - { "tand", 1, builtin_tand, nullptr, nullptr, tan_deg, nullptr }, + { "sind", 1, Builtin::sind, nullptr, nullptr, sin_deg, nullptr }, + { "cosd", 1, Builtin::cosd, nullptr, nullptr, cos_deg, nullptr }, + { "tand", 1, Builtin::tand, nullptr, nullptr, tan_deg, nullptr }, - { "asin", 1, builtin_asin, nullptr, nullptr, asin, nullptr }, - { "acos", 1, builtin_acos, nullptr, nullptr, acos, nullptr }, - { "atan", 1, builtin_atan, nullptr, nullptr, atan, nullptr }, + { "asin", 1, Builtin::asin, nullptr, nullptr, asin, nullptr }, + { "acos", 1, Builtin::acos, nullptr, nullptr, acos, nullptr }, + { "atan", 1, Builtin::atan, nullptr, nullptr, atan, nullptr }, - { "asind", 1, builtin_sind, nullptr, nullptr, arc_sin_deg, nullptr }, - { "acosd", 1, builtin_cosd, nullptr, nullptr, arc_cos_deg, nullptr }, - { "atand", 1, builtin_tand, nullptr, nullptr, arc_tan_deg, nullptr }, + { "asind", 1, Builtin::sind, nullptr, nullptr, arc_sin_deg, nullptr }, + { "acosd", 1, Builtin::cosd, nullptr, nullptr, arc_cos_deg, nullptr }, + { "atand", 1, Builtin::tand, nullptr, nullptr, arc_tan_deg, nullptr }, - { "atan2", 2, builtin_atan2, nullptr, nullptr, nullptr, atan2 }, - { "atan2d", 2, builtin_atan2d, nullptr, nullptr, nullptr, atan2_deg }, + { "atan2", 2, Builtin::atan2, nullptr, nullptr, nullptr, atan2 }, + { "atan2d", 2, Builtin::atan2d, nullptr, nullptr, nullptr, atan2_deg }, - { "arg", 2, builtin_arg, nullptr, nullptr, nullptr, my_arg }, - { "argd", 2, builtin_argd, nullptr, nullptr, nullptr, my_arg_deg }, + { "arg", 2, Builtin::arg, nullptr, nullptr, nullptr, my_arg }, + { "argd", 2, Builtin::argd, nullptr, nullptr, nullptr, my_arg_deg }, - { "log", 1, builtin_log, nullptr, nullptr, log, nullptr }, - { "exp", 1, builtin_exp, nullptr, nullptr, exp, nullptr }, + { "log", 1, Builtin::log, nullptr, nullptr, log, nullptr }, + { "exp", 1, Builtin::exp, nullptr, nullptr, exp, nullptr }, - { "log10", 1, builtin_log10, nullptr, nullptr, log10, nullptr }, - { "exp10", 1, builtin_exp10, nullptr, nullptr, my_exp10, nullptr }, + { "log10", 1, Builtin::log10, nullptr, nullptr, log10, nullptr }, + { "exp10", 1, Builtin::exp10, nullptr, nullptr, my_exp10, nullptr }, - { "sqrt", 1, builtin_sqrt, nullptr, nullptr, sqrt, nullptr }, + { "sqrt", 1, Builtin::sqrt, nullptr, nullptr, sqrt, nullptr }, - { "abs", 1, builtin_abs, abs, nullptr, fabs, nullptr }, + { "abs", 1, Builtin::abs, abs, nullptr, fabs, nullptr }, - { "min", 2, builtin_min, nullptr, my_imin, nullptr, my_dmin }, - { "max", 2, builtin_max, nullptr, my_imax, nullptr, my_dmax }, + { "min", 2, Builtin::min, nullptr, my_imin, nullptr, my_dmin }, + { "max", 2, Builtin::max, nullptr, my_imax, nullptr, my_dmax }, - { "mod", 2, builtin_mod, nullptr, my_imod, nullptr, my_dmod }, + { "mod", 2, Builtin::mod, nullptr, my_imod, nullptr, my_dmod }, - { "floor", 1, builtin_floor, nullptr, nullptr, floor, nullptr }, - { "ceil", 1, builtin_ceil, nullptr, nullptr, ceil, nullptr }, + { "floor", 1, Builtin::floor, nullptr, nullptr, floor, nullptr }, + { "ceil", 1, Builtin::ceil, nullptr, nullptr, ceil, nullptr }, - { "step", 1, builtin_step, my_istep, nullptr, my_dstep, nullptr }, + { "step", 1, Builtin::step, my_istep, nullptr, my_dstep, nullptr }, // Functions defined in ConfigConstants - // { "F_to_C", 1, builtin_F_to_C, nullptr, nullptr, my_F_to_C, nullptr }, - // { "C_to_F", 1, builtin_C_to_F, nullptr, nullptr, my_C_to_F, nullptr }, + // { "F_to_C", 1, Builtin::F_to_C, nullptr, nullptr, my_F_to_C, nullptr }, + // { "C_to_F", 1, Builtin::C_to_F, nullptr, nullptr, my_C_to_F, nullptr }, - { "nint", 1, builtin_nint, nullptr, nullptr, nullptr, nullptr }, - { "sign", 1, builtin_sign, nullptr, nullptr, nullptr, nullptr }, + { "nint", 1, Builtin::nint, nullptr, nullptr, nullptr, nullptr }, + { "sign", 1, Builtin::sign, nullptr, nullptr, nullptr, nullptr }, // diff --git a/src/basic/vx_config/builtin.h b/src/basic/vx_config/builtin.h index d729e8a2a6..369ede5d09 100644 --- a/src/basic/vx_config/builtin.h +++ b/src/basic/vx_config/builtin.h @@ -30,69 +30,69 @@ static const int max_builtin_args = 2; //////////////////////////////////////////////////////////////////////// -enum Builtin { +enum class Builtin { // // built-in functions of one variable // - builtin_sin, - builtin_cos, - builtin_tan, + sin, + cos, + tan, - builtin_sind, - builtin_cosd, - builtin_tand, + sind, + cosd, + tand, - builtin_asin, - builtin_acos, - builtin_atan, + asin, + acos, + atan, - builtin_asind, - builtin_acosd, - builtin_atand, + asind, + acosd, + atand, - builtin_log, - builtin_exp, + log, + exp, - builtin_log10, - builtin_exp10, + log10, + exp10, - builtin_sqrt, - builtin_abs, - builtin_floor, - builtin_ceil, - builtin_nint, - builtin_sign, + sqrt, + abs, + floor, + ceil, + nint, + sign, - builtin_step, + step, // Functions defined in ConfigConstants - // builtin_F_to_C, - // builtin_C_to_F, + // F_to_C, + // C_to_F, // // built-in functions of two variables // - builtin_atan2, - builtin_atan2d, + atan2, + atan2d, - builtin_arg, - builtin_argd, + arg, + argd, - builtin_min, - builtin_max, + min, + max, - builtin_mod, + mod, // // built-in functions of three variables // - // builtin_ifte + // ifte // // flag value diff --git a/src/basic/vx_config/calculator.cc b/src/basic/vx_config/calculator.cc index 9b87fbbb74..1dbc427f4e 100644 --- a/src/basic/vx_config/calculator.cc +++ b/src/basic/vx_config/calculator.cc @@ -391,9 +391,9 @@ const BuiltinInfo & info = binfo[which]; // nint and sign are treated differently // -if ( info.id == builtin_nint ) { do_nint(); return; } +if ( info.id == Builtin::nint ) { do_nint(); return; } -if ( info.id == builtin_sign ) { do_sign(); return; } +if ( info.id == Builtin::sign ) { do_sign(); return; } // // From 0153110cdbd0381e46211343870931b9fa2e0183 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 19 Mar 2024 22:48:20 +0000 Subject: [PATCH 31/72] #2830 Converted enum to enum class at config_constants.h --- src/basic/vx_config/config_constants.h | 136 ++++---- src/basic/vx_config/config_util.cc | 329 +++++++++--------- src/basic/vx_config/config_util.h | 14 + src/libcode/vx_afm/afmtokentype_to_string.cc | 1 - src/libcode/vx_analysis_util/stat_job.cc | 10 +- src/libcode/vx_analysis_util/stat_job.h | 2 +- src/libcode/vx_analysis_util/stat_line.cc | 10 +- src/libcode/vx_nc_util/write_netcdf.cc | 4 +- src/libcode/vx_shapedata/engine.cc | 50 +-- src/libcode/vx_shapedata/mode_conf_info.cc | 18 +- src/libcode/vx_shapedata/mode_field_info.cc | 10 +- src/libcode/vx_stat_out/stat_columns.cc | 118 +++---- src/libcode/vx_stat_out/stat_hdr_columns.cc | 4 +- src/libcode/vx_statistics/apply_mask.cc | 8 +- src/libcode/vx_statistics/met_stats.cc | 6 +- src/libcode/vx_statistics/pair_base.cc | 24 +- src/libcode/vx_statistics/pair_base.h | 2 +- .../vx_statistics/pair_data_ensemble.cc | 6 +- src/libcode/vx_statistics/pair_data_point.cc | 12 +- src/libcode/vx_tc_util/diag_file.cc | 10 +- src/libcode/vx_tc_util/track_info.cc | 2 +- src/libcode/vx_tc_util/track_pair_info.cc | 14 +- src/tools/core/ensemble_stat/ensemble_stat.cc | 66 ++-- .../ensemble_stat/ensemble_stat_conf_info.cc | 24 +- src/tools/core/grid_stat/grid_stat.cc | 242 ++++++------- .../core/grid_stat/grid_stat_conf_info.cc | 34 +- src/tools/core/mode/mode_exec.cc | 64 ++-- src/tools/core/mode/mode_ps_file.cc | 8 +- src/tools/core/mode/multivar_frontend.cc | 8 +- src/tools/core/mode/page_1.cc | 42 +-- src/tools/core/point_stat/point_stat.cc | 144 ++++---- .../core/point_stat/point_stat_conf_info.cc | 42 +-- .../series_analysis_conf_info.cc | 2 +- src/tools/core/wavelet_stat/wavelet_stat.cc | 18 +- .../wavelet_stat/wavelet_stat_conf_info.cc | 56 +-- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 16 +- src/tools/other/gen_vx_mask/gen_vx_mask.h | 2 +- src/tools/other/grid_diag/grid_diag.cc | 4 +- .../other/mode_time_domain/mtd_config_info.cc | 18 +- src/tools/other/point2grid/point2grid.cc | 2 +- .../regrid_data_plane/regrid_data_plane.cc | 2 +- src/tools/tc_utils/tc_gen/tc_gen.cc | 28 +- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 12 +- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 14 +- .../tc_utils/tc_pairs/tc_pairs_conf_info.cc | 4 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 6 +- src/tools/tc_utils/tc_stat/tc_stat_job.h | 2 +- 47 files changed, 836 insertions(+), 814 deletions(-) diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index 56908edd31..e7f872f6b5 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -25,10 +25,10 @@ // Enumeration for output_flag configuration parameter // -enum STATOutputType { - STATOutputType_None, // Do not output this line type - STATOutputType_Stat, // Write output to the .stat file - STATOutputType_Both // Write output to .stat and .txt files +enum class STATOutputType { + None, // Do not output this line type + Stat, // Write output to the .stat file + Both // Write output to .stat and .txt files }; //////////////////////////////////////////////////////////////////////// @@ -37,11 +37,11 @@ enum STATOutputType { // Enumeration for field type configuration parameters // -enum FieldType { - FieldType_None, // Default - FieldType_Fcst, // Apply to forecast field - FieldType_Obs, // Apply to observation field - FieldType_Both // Apply to both forecast and observation field +enum class FieldType { + None, // Default + Fcst, // Apply to forecast field + Obs, // Apply to observation field + Both // Apply to both forecast and observation field }; //////////////////////////////////////////////////////////////////////// @@ -50,11 +50,11 @@ enum FieldType { // Enumeration for set logic // -enum SetLogic { - SetLogic_None, // Default - SetLogic_Union, // Union - SetLogic_Intersection, // Intersection - SetLogic_SymDiff // Symmetric Difference +enum class SetLogic { + None, // Default + Union, // Union + Intersection, // Intersection + SymDiff // Symmetric Difference }; //////////////////////////////////////////////////////////////////////// @@ -77,11 +77,11 @@ static const char setlogic_symbol_symdiff[] = "*"; // Enumeration for track type configuration parameters // -enum TrackType { - TrackType_None, // Default - TrackType_ADeck, // Apply to ADeck tracks - TrackType_BDeck, // Apply to BDeck tracks - TrackType_Both // Apply to both ADeck and BDeck tracks +enum class TrackType { + None, // Default + ADeck, // Apply to ADeck tracks + BDeck, // Apply to BDeck tracks + Both // Apply to both ADeck and BDeck tracks }; //////////////////////////////////////////////////////////////////////// @@ -90,12 +90,12 @@ enum TrackType { // Enumeration for tropical cyclone diagnostic types // -enum DiagType { - DiagType_None, // Default - DiagType_CIRA_RT, // Realtime CIRA Tropical Cyclone Diagnostics - DiagType_CIRA_Dev, // Developmental CIRA Tropical Cyclone Diagnostics - DiagType_SHIPS_RT, // Realtime SHIPS Large Scale Diagnostics - DiagType_SHIPS_Dev // Developmental SHIPS Large Scale Diagnostics +enum class DiagType { + None, // Default + CIRA_RT, // Realtime CIRA Tropical Cyclone Diagnostics + CIRA_Dev, // Developmental CIRA Tropical Cyclone Diagnostics + SHIPS_RT, // Realtime SHIPS Large Scale Diagnostics + SHIPS_Dev // Developmental SHIPS Large Scale Diagnostics }; //////////////////////////////////////////////////////////////////////// @@ -117,10 +117,10 @@ static const char ships_diag_dev_str[] = "SHIPS_DIAG_DEV"; // Enumeration for 12-hour interpolation logic // -enum Interp12Type { - Interp12Type_None, // Do not apply 12-hour interpolation logic - Interp12Type_Fill, // Fill in missing 'I' tracks with '2' tracks - Interp12Type_Replace // Replace all 'I' tracks with '2' tracks +enum class Interp12Type { + None, // Do not apply 12-hour interpolation logic + Fill, // Fill in missing 'I' tracks with '2' tracks + Replace // Replace all 'I' tracks with '2' tracks }; //////////////////////////////////////////////////////////////////////// @@ -423,9 +423,9 @@ struct MaskLatLon { // Enumeration for duplicate_flag configuration parameter // -enum DuplicateType { - DuplicateType_None, // Apply no logic for duplicate point obs - DuplicateType_Unique // Filter out duplicate observation values +enum class DuplicateType { + None, // Apply no logic for duplicate point obs + Unique // Filter out duplicate observation values }; //////////////////////////////////////////////////////////////////////// @@ -434,15 +434,15 @@ enum DuplicateType { // Enumeration for obs_summary configuration parameter // -enum ObsSummary { - ObsSummary_None, // Keep all observations, no statistics - ObsSummary_Nearest, // Keep only the observation closest in time - ObsSummary_Min, // Keep only smallest value - ObsSummary_Max, // Keep only largest value - ObsSummary_UW_Mean, // Calculate un-weighted mean - ObsSummary_DW_Mean, // Calculate time weighted mean - ObsSummary_Median, // Calculate median - ObsSummary_Perc // Calculate precentile +enum class ObsSummary { + None, // Keep all observations, no statistics + Nearest, // Keep only the observation closest in time + Min, // Keep only smallest value + Max, // Keep only largest value + UW_Mean, // Calculate un-weighted mean + DW_Mean, // Calculate time weighted mean + Median, // Calculate median + Perc // Calculate precentile }; //////////////////////////////////////////////////////////////////////// @@ -451,10 +451,10 @@ enum ObsSummary { // Enumeration for grid_weight_flag configuration parameter // -enum GridWeightType { - GridWeightType_None, // Apply no grid box weighting - GridWeightType_Cos_Lat, // Apply cosine latitude weighting - GridWeightType_Area // Apply true grid box area weighting +enum class GridWeightType { + None, // Apply no grid box weighting + Cos_Lat, // Apply cosine latitude weighting + Area // Apply true grid box area weighting }; //////////////////////////////////////////////////////////////////////// @@ -463,11 +463,11 @@ enum GridWeightType { // Enumeration for grid_decomp_flag configuration parameter // -enum GridDecompType { - GridDecompType_None, // Default - GridDecompType_Auto, // Automatic tiling - GridDecompType_Tile, // User-specified tile definitions - GridDecompType_Pad // Pad out to next largest tile +enum class GridDecompType { + None, // Default + Auto, // Automatic tiling + Tile, // User-specified tile definitions + Pad // Pad out to next largest tile }; //////////////////////////////////////////////////////////////////////// @@ -476,14 +476,14 @@ enum GridDecompType { // Enumeration for wavelet.type configuration parameter // -enum WaveletType { - WaveletType_None, // Default - WaveletType_Haar, // Haar wavelet - WaveletType_Haar_Cntr, // Centered Haar wavelet - WaveletType_Daub, // Daubechies wavelet - WaveletType_Daub_Cntr, // Centered Daubechies wavelet - WaveletType_BSpline, // BSpline wavelet - WaveletType_BSpline_Cntr // Centered BSpline wavelet +enum class WaveletType { + None, // Default + Haar, // Haar wavelet + Haar_Cntr, // Centered Haar wavelet + Daub, // Daubechies wavelet + Daub_Cntr, // Centered Daubechies wavelet + BSpline, // BSpline wavelet + BSpline_Cntr // Centered BSpline wavelet }; //////////////////////////////////////////////////////////////////////// @@ -492,11 +492,11 @@ enum WaveletType { // Enumeration for MODE merging options // -enum MergeType { - MergeType_None, // No additional merging - MergeType_Both, // Double-threshold and fuzzy engine - MergeType_Thresh, // Double-threshold only - MergeType_Engine // Fuzzy engine only +enum class MergeType { + None, // No additional merging + Both, // Double-threshold and fuzzy engine + Thresh, // Double-threshold only + Engine // Fuzzy engine only }; //////////////////////////////////////////////////////////////////////// @@ -505,11 +505,11 @@ enum MergeType { // Enumeration for MODE matching options // -enum MatchType { - MatchType_None, // No matching - MatchType_MergeBoth, // Match with merging in both fcst and obs - MatchType_MergeFcst, // Match with merging in fcst only - MatchType_NoMerge // Match with no additional merging +enum class MatchType { + None, // No matching + MergeBoth, // Match with merging in both fcst and obs + MergeFcst, // Match with merging in fcst only + NoMerge // Match with no additional merging }; //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index a39bff6c39..1eec001151 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -121,7 +121,7 @@ void GaussianInfo::validate() { void RegridInfo::clear() { enable = false; - field = FieldType_None; + field = FieldType::None; vld_thresh = bad_data_double; name.clear(); method = InterpMthd_None; @@ -266,6 +266,15 @@ RegridInfo &RegridInfo::operator=(const RegridInfo &a) noexcept { /////////////////////////////////////////////////////////////////////////////// +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + +/////////////////////////////////////////////////////////////////////////////// + ConcatString parse_conf_version(Dictionary *dict) { ConcatString s; @@ -375,7 +384,7 @@ GrdFileType parse_conf_file_type(Dictionary *dict) { map parse_conf_output_flag(Dictionary *dict, const STATLineType *line_type, int n_lty) { map output_map; - STATOutputType t = STATOutputType_None; + STATOutputType t = STATOutputType::None; ConcatString cs; int v; @@ -397,9 +406,9 @@ map parse_conf_output_flag(Dictionary *dict, v = dict->lookup_int(cs.c_str()); // Convert integer to enumerated STATOutputType - if(v == conf_const.lookup_int(conf_val_none)) t = STATOutputType_None; - else if(v == conf_const.lookup_int(conf_val_stat)) t = STATOutputType_Stat; - else if(v == conf_const.lookup_int(conf_val_both)) t = STATOutputType_Both; + if(v == conf_const.lookup_int(conf_val_none)) t = STATOutputType::None; + else if(v == conf_const.lookup_int(conf_val_stat)) t = STATOutputType::Stat; + else if(v == conf_const.lookup_int(conf_val_both)) t = STATOutputType::Both; else { mlog << Error << "\nparse_conf_output_flag() -> " << "Unexpected config file value of " << v << " for \"" @@ -1360,8 +1369,8 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) { // If integer lookup successful, convert to FieldType. if(regrid_dict->last_lookup_status()) { info.field = int_to_fieldtype(v); - info.enable = (info.field == FieldType_Fcst || - info.field == FieldType_Obs); + info.enable = (info.field == FieldType::Fcst || + info.field == FieldType::Obs); } // If integer lookup unsuccessful, parse vx_grid as a string. // Do not error out since to_grid isn't specified for climo.regrid. @@ -1419,7 +1428,7 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) { /////////////////////////////////////////////////////////////////////////////// void InterpInfo::clear() { - field = FieldType_None; + field = FieldType::None; vld_thresh = bad_data_double; n_interp = 0; method.clear(); @@ -1556,7 +1565,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) { // If found, interpret value. Otherwise, set to a default value. if(interp_dict->last_lookup_status()) info.field = int_to_fieldtype(v); - else info.field = FieldType_None; + else info.field = FieldType::None; // Conf: vld_thresh double thr = interp_dict->lookup_double(conf_key_vld_thresh, false); @@ -1844,7 +1853,7 @@ ClimoCDFInfo parse_conf_climo_cdf(Dictionary *dict) { void NbrhdInfo::clear() { - field = FieldType_None; + field = FieldType::None; vld_thresh = bad_data_double; width.clear(); cov_ta.clear(); @@ -1885,7 +1894,7 @@ NbrhdInfo parse_conf_nbrhd(Dictionary *dict, const char *conf_key) { // Conf: field - may be missing // Default info.field to BOTH - info.field = FieldType_Both; + info.field = FieldType::Both; // Skip lookup for conf_key_nbrhd_prob if(strncmp(conf_key, conf_key_nbrhd_prob, strlen(conf_key_nbrhd_prob)) != 0) { @@ -2073,7 +2082,7 @@ HiRAInfo parse_conf_hira(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) { - GridWeightType t = GridWeightType_None; + GridWeightType t = GridWeightType::None; int v; if(!dict) { @@ -2086,9 +2095,9 @@ GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) { v = dict->lookup_int(conf_key_grid_weight_flag); // Convert integer to enumerated GridWeightType - if(v == conf_const.lookup_int(conf_val_none)) t = GridWeightType_None; - else if(v == conf_const.lookup_int(conf_val_cos_lat)) t = GridWeightType_Cos_Lat; - else if(v == conf_const.lookup_int(conf_val_area)) t = GridWeightType_Area; + if(v == conf_const.lookup_int(conf_val_none)) t = GridWeightType::None; + else if(v == conf_const.lookup_int(conf_val_cos_lat)) t = GridWeightType::Cos_Lat; + else if(v == conf_const.lookup_int(conf_val_area)) t = GridWeightType::Area; else { mlog << Error << "\nparse_conf_grid_weight_flag() -> " << "Unexpected config file value of " << v << " for \"" @@ -2102,7 +2111,7 @@ GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// DuplicateType parse_conf_duplicate_flag(Dictionary *dict) { - DuplicateType t = DuplicateType_None; + DuplicateType t = DuplicateType::None; int v; if(!dict) { @@ -2115,8 +2124,8 @@ DuplicateType parse_conf_duplicate_flag(Dictionary *dict) { v = dict->lookup_int(conf_key_duplicate_flag); // Convert integer to enumerated DuplicateType - if(v == conf_const.lookup_int(conf_val_none)) t = DuplicateType_None; - else if(v == conf_const.lookup_int(conf_val_unique)) t = DuplicateType_Unique; + if(v == conf_const.lookup_int(conf_val_none)) t = DuplicateType::None; + else if(v == conf_const.lookup_int(conf_val_unique)) t = DuplicateType::Unique; else if(v == conf_const.lookup_int(conf_val_single)) { mlog << Error << "\nparse_conf_duplicate_flag() -> " << "duplicate_flag = SINGLE has been deprecated\n" @@ -2136,7 +2145,7 @@ DuplicateType parse_conf_duplicate_flag(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// ObsSummary parse_conf_obs_summary(Dictionary *dict) { - ObsSummary t = ObsSummary_None; + ObsSummary t = ObsSummary::None; int v; if(!dict) { @@ -2149,14 +2158,14 @@ ObsSummary parse_conf_obs_summary(Dictionary *dict) { v = dict->lookup_int(conf_key_obs_summary); // Convert integer to enumerated ObsSummary - if(v == conf_const.lookup_int(conf_val_none)) t = ObsSummary_None; - else if(v == conf_const.lookup_int(conf_val_nearest)) t = ObsSummary_Nearest; - else if(v == conf_const.lookup_int(conf_val_min)) t = ObsSummary_Min; - else if(v == conf_const.lookup_int(conf_val_max)) t = ObsSummary_Max; - else if(v == conf_const.lookup_int(conf_val_uw_mean)) t = ObsSummary_UW_Mean; - else if(v == conf_const.lookup_int(conf_val_dw_mean)) t = ObsSummary_DW_Mean; - else if(v == conf_const.lookup_int(conf_val_median)) t = ObsSummary_Median; - else if(v == conf_const.lookup_int(conf_val_perc)) t = ObsSummary_Perc; + if(v == conf_const.lookup_int(conf_val_none)) t = ObsSummary::None; + else if(v == conf_const.lookup_int(conf_val_nearest)) t = ObsSummary::Nearest; + else if(v == conf_const.lookup_int(conf_val_min)) t = ObsSummary::Min; + else if(v == conf_const.lookup_int(conf_val_max)) t = ObsSummary::Max; + else if(v == conf_const.lookup_int(conf_val_uw_mean)) t = ObsSummary::UW_Mean; + else if(v == conf_const.lookup_int(conf_val_dw_mean)) t = ObsSummary::DW_Mean; + else if(v == conf_const.lookup_int(conf_val_median)) t = ObsSummary::Median; + else if(v == conf_const.lookup_int(conf_val_perc)) t = ObsSummary::Perc; else { mlog << Error << "\nparse_conf_obs_summary() -> " << "Unexpected config file value of " << v << " for \"" @@ -2225,7 +2234,7 @@ ConcatString parse_conf_tmp_dir(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) { - GridDecompType t = GridDecompType_None; + GridDecompType t = GridDecompType::None; int v; if(!dict) { @@ -2238,10 +2247,10 @@ GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) { v = dict->lookup_int(conf_key_grid_decomp_flag); // Convert integer to enumerated GridDecompType - if(v == conf_const.lookup_int(conf_val_none)) t = GridDecompType_None; - else if(v == conf_const.lookup_int(conf_val_auto)) t = GridDecompType_Auto; - else if(v == conf_const.lookup_int(conf_val_tile)) t = GridDecompType_Tile; - else if(v == conf_const.lookup_int(conf_val_pad)) t = GridDecompType_Pad; + if(v == conf_const.lookup_int(conf_val_none)) t = GridDecompType::None; + else if(v == conf_const.lookup_int(conf_val_auto)) t = GridDecompType::Auto; + else if(v == conf_const.lookup_int(conf_val_tile)) t = GridDecompType::Tile; + else if(v == conf_const.lookup_int(conf_val_pad)) t = GridDecompType::Pad; else { mlog << Error << "\nparse_conf_grid_decomp_flag() -> " << "Unexpected config file value of " << v << " for \"" @@ -2255,7 +2264,7 @@ GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// WaveletType parse_conf_wavelet_type(Dictionary *dict) { - WaveletType t = WaveletType_None; + WaveletType t = WaveletType::None; int v; if(!dict) { @@ -2268,13 +2277,13 @@ WaveletType parse_conf_wavelet_type(Dictionary *dict) { v = dict->lookup_int(conf_key_wavelet_type); // Convert integer to enumerated WaveletType - if(v == conf_const.lookup_int(conf_val_none)) t = WaveletType_None; - else if(v == conf_const.lookup_int(conf_val_haar)) t = WaveletType_Haar; - else if(v == conf_const.lookup_int(conf_val_haar_cntr)) t = WaveletType_Haar_Cntr; - else if(v == conf_const.lookup_int(conf_val_daub)) t = WaveletType_Daub; - else if(v == conf_const.lookup_int(conf_val_daub_cntr)) t = WaveletType_Daub_Cntr; - else if(v == conf_const.lookup_int(conf_val_bspline)) t = WaveletType_BSpline; - else if(v == conf_const.lookup_int(conf_val_bspline_cntr)) t = WaveletType_BSpline_Cntr; + if(v == conf_const.lookup_int(conf_val_none)) t = WaveletType::None; + else if(v == conf_const.lookup_int(conf_val_haar)) t = WaveletType::Haar; + else if(v == conf_const.lookup_int(conf_val_haar_cntr)) t = WaveletType::Haar_Cntr; + else if(v == conf_const.lookup_int(conf_val_daub)) t = WaveletType::Daub; + else if(v == conf_const.lookup_int(conf_val_daub_cntr)) t = WaveletType::Daub_Cntr; + else if(v == conf_const.lookup_int(conf_val_bspline)) t = WaveletType::BSpline; + else if(v == conf_const.lookup_int(conf_val_bspline_cntr)) t = WaveletType::BSpline_Cntr; else { mlog << Error << "\nparse_conf_wavelet_type() -> " << "Unexpected config file value of " << v << " for \"" @@ -2723,13 +2732,13 @@ STATLineType string_to_statlinetype(const char *s) { /////////////////////////////////////////////////////////////////////////////// FieldType int_to_fieldtype(int v) { - FieldType t = FieldType_None; + FieldType t = FieldType::None; // Convert integer to enumerated FieldType - if(v == conf_const.lookup_int(conf_val_none)) t = FieldType_None; - else if(v == conf_const.lookup_int(conf_val_both)) t = FieldType_Both; - else if(v == conf_const.lookup_int(conf_val_fcst)) t = FieldType_Fcst; - else if(v == conf_const.lookup_int(conf_val_obs)) t = FieldType_Obs; + if(v == conf_const.lookup_int(conf_val_none)) t = FieldType::None; + else if(v == conf_const.lookup_int(conf_val_both)) t = FieldType::Both; + else if(v == conf_const.lookup_int(conf_val_fcst)) t = FieldType::Fcst; + else if(v == conf_const.lookup_int(conf_val_obs)) t = FieldType::Obs; else { mlog << Error << "\nint_to_fieldtype() -> " << "Unexpected value of " << v << ".\n\n"; @@ -2767,13 +2776,13 @@ ConcatString fieldtype_to_string(FieldType type) { // Convert enumerated FieldType to string switch(type) { - case(FieldType_None): s = conf_val_none; break; - case(FieldType_Both): s = conf_val_both; break; - case(FieldType_Fcst): s = conf_val_fcst; break; - case(FieldType_Obs): s = conf_val_obs; break; + case(FieldType::None): s = conf_val_none; break; + case(FieldType::Both): s = conf_val_both; break; + case(FieldType::Fcst): s = conf_val_fcst; break; + case(FieldType::Obs): s = conf_val_obs; break; default: mlog << Error << "\nfieldtype_to_string() -> " - << "Unexpected FieldType value of " << type << ".\n\n"; + << "Unexpected FieldType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -2783,13 +2792,13 @@ ConcatString fieldtype_to_string(FieldType type) { /////////////////////////////////////////////////////////////////////////////// SetLogic int_to_setlogic(int v) { - SetLogic t = SetLogic_None; + SetLogic t = SetLogic::None; // Convert integer to enumerated SetLogic - if(v == conf_const.lookup_int(conf_val_none)) t = SetLogic_None; - else if(v == conf_const.lookup_int(conf_val_union)) t = SetLogic_Union; - else if(v == conf_const.lookup_int(conf_val_intersection)) t = SetLogic_Intersection; - else if(v == conf_const.lookup_int(conf_val_symdiff)) t = SetLogic_SymDiff; + if(v == conf_const.lookup_int(conf_val_none)) t = SetLogic::None; + else if(v == conf_const.lookup_int(conf_val_union)) t = SetLogic::Union; + else if(v == conf_const.lookup_int(conf_val_intersection)) t = SetLogic::Intersection; + else if(v == conf_const.lookup_int(conf_val_symdiff)) t = SetLogic::SymDiff; else { mlog << Error << "\nint_to_setlogic() -> " << "Unexpected value of " << v << ".\n\n"; @@ -2802,22 +2811,22 @@ SetLogic int_to_setlogic(int v) { /////////////////////////////////////////////////////////////////////////////// SetLogic string_to_setlogic(const char *s) { - SetLogic t = SetLogic_None; + SetLogic t = SetLogic::None; // Convert string to enumerated SetLogic - if(strcasecmp(s, conf_val_none) == 0) t = SetLogic_None; + if(strcasecmp(s, conf_val_none) == 0) t = SetLogic::None; else if(strcasecmp(s, conf_val_union) == 0 || strcasecmp(s, setlogic_abbr_union) == 0 || - strcasecmp(s, setlogic_symbol_union) == 0) t = SetLogic_Union; + strcasecmp(s, setlogic_symbol_union) == 0) t = SetLogic::Union; else if(strcasecmp(s, conf_val_intersection) == 0 || strcasecmp(s, setlogic_abbr_intersection) == 0 || - strcasecmp(s, setlogic_symbol_intersection) == 0) t = SetLogic_Intersection; + strcasecmp(s, setlogic_symbol_intersection) == 0) t = SetLogic::Intersection; else if(strcasecmp(s, conf_val_symdiff) == 0 || strcasecmp(s, setlogic_abbr_symdiff) == 0 || - strcasecmp(s, setlogic_symbol_symdiff) == 0) t = SetLogic_SymDiff; + strcasecmp(s, setlogic_symbol_symdiff) == 0) t = SetLogic::SymDiff; else { mlog << Error << "\nstring_to_setlogic() -> " @@ -2836,13 +2845,13 @@ ConcatString setlogic_to_string(SetLogic type) { // Convert enumerated SetLogic to string switch(type) { - case(SetLogic_None): s = conf_val_none; break; - case(SetLogic_Union): s = conf_val_union; break; - case(SetLogic_Intersection): s = conf_val_intersection; break; - case(SetLogic_SymDiff): s = conf_val_symdiff; break; + case(SetLogic::None): s = conf_val_none; break; + case(SetLogic::Union): s = conf_val_union; break; + case(SetLogic::Intersection): s = conf_val_intersection; break; + case(SetLogic::SymDiff): s = conf_val_symdiff; break; default: mlog << Error << "\nsetlogic_to_string() -> " - << "Unexpected SetLogic value of " << type << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -2856,13 +2865,13 @@ ConcatString setlogic_to_abbr(SetLogic type) { // Convert enumerated SetLogic to an abbreviation switch(type) { - case(SetLogic_None): s = na_str; break; - case(SetLogic_Union): s = setlogic_abbr_union; break; - case(SetLogic_Intersection): s = setlogic_abbr_intersection; break; - case(SetLogic_SymDiff): s = setlogic_abbr_symdiff; break; + case(SetLogic::None): s = na_str; break; + case(SetLogic::Union): s = setlogic_abbr_union; break; + case(SetLogic::Intersection): s = setlogic_abbr_intersection; break; + case(SetLogic::SymDiff): s = setlogic_abbr_symdiff; break; default: mlog << Error << "\nsetlogic_to_abbr() -> " - << "Unexpected SetLogic value of " << type << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -2876,13 +2885,13 @@ ConcatString setlogic_to_symbol(SetLogic type) { // Convert enumerated SetLogic to a symbol switch(type) { - case(SetLogic_None): s = na_str; break; - case(SetLogic_Union): s = setlogic_symbol_union; break; - case(SetLogic_Intersection): s = setlogic_symbol_intersection; break; - case(SetLogic_SymDiff): s = setlogic_symbol_symdiff; break; + case(SetLogic::None): s = na_str; break; + case(SetLogic::Union): s = setlogic_symbol_union; break; + case(SetLogic::Intersection): s = setlogic_symbol_intersection; break; + case(SetLogic::SymDiff): s = setlogic_symbol_symdiff; break; default: mlog << Error << "\nsetlogic_to_symbol() -> " - << "Unexpected SetLogic value of " << type << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -2892,12 +2901,12 @@ ConcatString setlogic_to_symbol(SetLogic type) { /////////////////////////////////////////////////////////////////////////////// SetLogic check_setlogic(SetLogic t1, SetLogic t2) { - SetLogic t = SetLogic_None; + SetLogic t = SetLogic::None; // If not equal, select the non-default logic type if(t1 == t2) t = t1; - else if(t1 == SetLogic_None) t = t2; - else if(t2 == SetLogic_None) t = t1; + else if(t1 == SetLogic::None) t = t2; + else if(t2 == SetLogic::None) t = t1; // If not equal and both non-default, error out else { mlog << Error << "\ncheck_setlogic() -> " @@ -2913,13 +2922,13 @@ SetLogic check_setlogic(SetLogic t1, SetLogic t2) { /////////////////////////////////////////////////////////////////////////////// TrackType int_to_tracktype(int v) { - TrackType t = TrackType_None; + TrackType t = TrackType::None; // Convert integer to enumerated TrackType - if(v == conf_const.lookup_int(conf_val_none)) t = TrackType_None; - else if(v == conf_const.lookup_int(conf_val_both)) t = TrackType_Both; - else if(v == conf_const.lookup_int(conf_val_adeck)) t = TrackType_ADeck; - else if(v == conf_const.lookup_int(conf_val_bdeck)) t = TrackType_BDeck; + if(v == conf_const.lookup_int(conf_val_none)) t = TrackType::None; + else if(v == conf_const.lookup_int(conf_val_both)) t = TrackType::Both; + else if(v == conf_const.lookup_int(conf_val_adeck)) t = TrackType::ADeck; + else if(v == conf_const.lookup_int(conf_val_bdeck)) t = TrackType::BDeck; else { mlog << Error << "\nint_to_tracktype() -> " << "Unexpected value of " << v << ".\n\n"; @@ -2932,13 +2941,13 @@ TrackType int_to_tracktype(int v) { /////////////////////////////////////////////////////////////////////////////// TrackType string_to_tracktype(const char *s) { - TrackType t = TrackType_None; + TrackType t = TrackType::None; // Convert string to enumerated TrackType - if(strcasecmp(s, conf_val_none) == 0) t = TrackType_None; - else if(strcasecmp(s, conf_val_both) == 0) t = TrackType_Both; - else if(strcasecmp(s, conf_val_adeck) == 0) t = TrackType_ADeck; - else if(strcasecmp(s, conf_val_bdeck) == 0) t = TrackType_BDeck; + if(strcasecmp(s, conf_val_none) == 0) t = TrackType::None; + else if(strcasecmp(s, conf_val_both) == 0) t = TrackType::Both; + else if(strcasecmp(s, conf_val_adeck) == 0) t = TrackType::ADeck; + else if(strcasecmp(s, conf_val_bdeck) == 0) t = TrackType::BDeck; else { mlog << Error << "\nstring_to_tracktype() -> " << "Unexpected TrackType string \"" << s << "\".\n\n"; @@ -2955,13 +2964,13 @@ ConcatString tracktype_to_string(TrackType type) { // Convert enumerated TrackType to string switch(type) { - case(TrackType_None): s = conf_val_none; break; - case(TrackType_Both): s = conf_val_both; break; - case(TrackType_ADeck): s = conf_val_adeck; break; - case(TrackType_BDeck): s = conf_val_bdeck; break; + case(TrackType::None): s = conf_val_none; break; + case(TrackType::Both): s = conf_val_both; break; + case(TrackType::ADeck): s = conf_val_adeck; break; + case(TrackType::BDeck): s = conf_val_bdeck; break; default: mlog << Error << "\ntracktype_to_string() -> " - << "Unexpected TrackType value of " << type << ".\n\n"; + << "Unexpected TrackType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -2971,15 +2980,15 @@ ConcatString tracktype_to_string(TrackType type) { /////////////////////////////////////////////////////////////////////////////// DiagType string_to_diagtype(const char *s) { - DiagType t = DiagType_None; + DiagType t = DiagType::None; // Convert string to enumerated DiagType, storing unknown strings // as the default type - if(strcasecmp(s, cira_diag_rt_str) == 0) t = DiagType_CIRA_RT; - else if(strcasecmp(s, cira_diag_dev_str) == 0) t = DiagType_CIRA_Dev; - else if(strcasecmp(s, ships_diag_rt_str) == 0) t = DiagType_SHIPS_RT; - else if(strcasecmp(s, ships_diag_dev_str) == 0) t = DiagType_SHIPS_Dev; - else t = DiagType_None; + if(strcasecmp(s, cira_diag_rt_str) == 0) t = DiagType::CIRA_RT; + else if(strcasecmp(s, cira_diag_dev_str) == 0) t = DiagType::CIRA_Dev; + else if(strcasecmp(s, ships_diag_rt_str) == 0) t = DiagType::SHIPS_RT; + else if(strcasecmp(s, ships_diag_dev_str) == 0) t = DiagType::SHIPS_Dev; + else t = DiagType::None; return t; } @@ -2991,14 +3000,14 @@ ConcatString diagtype_to_string(DiagType type) { // Convert enumerated DiagType to string switch(type) { - case(DiagType_None): s = conf_val_none; break; - case(DiagType_CIRA_RT): s = cira_diag_rt_str; break; - case(DiagType_CIRA_Dev): s = cira_diag_dev_str; break; - case(DiagType_SHIPS_RT): s = ships_diag_rt_str; break; - case(DiagType_SHIPS_Dev): s = ships_diag_dev_str; break; + case(DiagType::None): s = conf_val_none; break; + case(DiagType::CIRA_RT): s = cira_diag_rt_str; break; + case(DiagType::CIRA_Dev): s = cira_diag_dev_str; break; + case(DiagType::SHIPS_RT): s = ships_diag_rt_str; break; + case(DiagType::SHIPS_Dev): s = ships_diag_dev_str; break; default: mlog << Error << "\ndiagtype_to_string() -> " - << "Unexpected DiagType value of " << type << ".\n\n"; + << "Unexpected DiagType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3008,12 +3017,12 @@ ConcatString diagtype_to_string(DiagType type) { /////////////////////////////////////////////////////////////////////////////// Interp12Type int_to_interp12type(int v) { - Interp12Type t = Interp12Type_None; + Interp12Type t = Interp12Type::None; // Convert integer to enumerated Interp12Type - if(v == conf_const.lookup_int(conf_val_none)) t = Interp12Type_None; - else if(v == conf_const.lookup_int(conf_val_fill)) t = Interp12Type_Fill; - else if(v == conf_const.lookup_int(conf_val_replace)) t = Interp12Type_Replace; + if(v == conf_const.lookup_int(conf_val_none)) t = Interp12Type::None; + else if(v == conf_const.lookup_int(conf_val_fill)) t = Interp12Type::Fill; + else if(v == conf_const.lookup_int(conf_val_replace)) t = Interp12Type::Replace; else { mlog << Error << "\nint_to_interp12type() -> " << "Unexpected value of " << v << ".\n\n"; @@ -3026,12 +3035,12 @@ Interp12Type int_to_interp12type(int v) { /////////////////////////////////////////////////////////////////////////////// Interp12Type string_to_interp12type(const char *s) { - Interp12Type t = Interp12Type_None; + Interp12Type t = Interp12Type::None; // Convert string to enumerated Interp12Type - if(strcasecmp(s, conf_val_none) == 0) t = Interp12Type_None; - else if(strcasecmp(s, conf_val_fill) == 0) t = Interp12Type_Fill; - else if(strcasecmp(s, conf_val_replace) == 0) t = Interp12Type_Replace; + if(strcasecmp(s, conf_val_none) == 0) t = Interp12Type::None; + else if(strcasecmp(s, conf_val_fill) == 0) t = Interp12Type::Fill; + else if(strcasecmp(s, conf_val_replace) == 0) t = Interp12Type::Replace; else { mlog << Error << "\nstring_to_interp12type() -> " << "Unexpected Interp12Type string \"" << s << "\".\n\n"; @@ -3048,12 +3057,12 @@ ConcatString interp12type_to_string(Interp12Type type) { // Convert enumerated Interp12Type to string switch(type) { - case(Interp12Type_None): s = conf_val_none; break; - case(Interp12Type_Fill): s = conf_val_fill; break; - case(Interp12Type_Replace): s = conf_val_replace; break; + case(Interp12Type::None): s = conf_val_none; break; + case(Interp12Type::Fill): s = conf_val_fill; break; + case(Interp12Type::Replace): s = conf_val_replace; break; default: mlog << Error << "\ninterp12type_to_string() -> " - << "Unexpected Interp12Type value of " << type << ".\n\n"; + << "Unexpected Interp12Type value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3063,13 +3072,13 @@ ConcatString interp12type_to_string(Interp12Type type) { /////////////////////////////////////////////////////////////////////////////// MergeType int_to_mergetype(int v) { - MergeType t = MergeType_None; + MergeType t = MergeType::None; // Convert integer to enumerated MergeType - if(v == conf_const.lookup_int(conf_val_none)) t = MergeType_None; - else if(v == conf_const.lookup_int(conf_val_both)) t = MergeType_Both; - else if(v == conf_const.lookup_int(conf_val_thresh)) t = MergeType_Thresh; - else if(v == conf_const.lookup_int(conf_val_engine)) t = MergeType_Engine; + if(v == conf_const.lookup_int(conf_val_none)) t = MergeType::None; + else if(v == conf_const.lookup_int(conf_val_both)) t = MergeType::Both; + else if(v == conf_const.lookup_int(conf_val_thresh)) t = MergeType::Thresh; + else if(v == conf_const.lookup_int(conf_val_engine)) t = MergeType::Engine; else { mlog << Error << "\nint_to_mergetype() -> " << "Unexpected value of " << v << ".\n\n"; @@ -3086,13 +3095,13 @@ ConcatString mergetype_to_string(MergeType type) { // Convert enumerated MergeType to string switch(type) { - case(MergeType_None): s = conf_val_none; break; - case(MergeType_Both): s = conf_val_both; break; - case(MergeType_Thresh): s = conf_val_thresh; break; - case(MergeType_Engine): s = conf_val_engine; break; + case(MergeType::None): s = conf_val_none; break; + case(MergeType::Both): s = conf_val_both; break; + case(MergeType::Thresh): s = conf_val_thresh; break; + case(MergeType::Engine): s = conf_val_engine; break; default: mlog << Error << "\nmergetype_to_string() -> " - << "Unexpected MergeType value of " << type << ".\n\n"; + << "Unexpected MergeType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3106,19 +3115,19 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) { // Convert enumerated ObsSummary to string switch(type) { - case(ObsSummary_None): s = conf_val_none; break; - case(ObsSummary_Nearest): s = conf_val_nearest; break; - case(ObsSummary_Min): s = conf_val_min; break; - case(ObsSummary_Max): s = conf_val_max; break; - case(ObsSummary_UW_Mean): s = conf_val_uw_mean; break; - case(ObsSummary_DW_Mean): s = conf_val_dw_mean; break; - case(ObsSummary_Median): s = conf_val_median; break; - case(ObsSummary_Perc): + case(ObsSummary::None): s = conf_val_none; break; + case(ObsSummary::Nearest): s = conf_val_nearest; break; + case(ObsSummary::Min): s = conf_val_min; break; + case(ObsSummary::Max): s = conf_val_max; break; + case(ObsSummary::UW_Mean): s = conf_val_uw_mean; break; + case(ObsSummary::DW_Mean): s = conf_val_dw_mean; break; + case(ObsSummary::Median): s = conf_val_median; break; + case(ObsSummary::Perc): s << conf_val_perc << "(" << perc_val << ")"; break; default: mlog << Error << "\nobssummary_to_string() -> " - << "Unexpected ObsSummary value of " << type << ".\n\n"; + << "Unexpected ObsSummary value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3128,13 +3137,13 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) { /////////////////////////////////////////////////////////////////////////////// MatchType int_to_matchtype(int v) { - MatchType t = MatchType_None; + MatchType t = MatchType::None; // Convert integer to enumerated MatchType - if(v == conf_const.lookup_int(conf_val_none)) t = MatchType_None; - else if(v == conf_const.lookup_int(conf_val_merge_both)) t = MatchType_MergeBoth; - else if(v == conf_const.lookup_int(conf_val_merge_fcst)) t = MatchType_MergeFcst; - else if(v == conf_const.lookup_int(conf_val_no_merge)) t = MatchType_NoMerge; + if(v == conf_const.lookup_int(conf_val_none)) t = MatchType::None; + else if(v == conf_const.lookup_int(conf_val_merge_both)) t = MatchType::MergeBoth; + else if(v == conf_const.lookup_int(conf_val_merge_fcst)) t = MatchType::MergeFcst; + else if(v == conf_const.lookup_int(conf_val_no_merge)) t = MatchType::NoMerge; else { mlog << Error << "\nint_to_matchtype() -> " << "Unexpected value of " << v << ".\n\n"; @@ -3151,13 +3160,13 @@ ConcatString matchtype_to_string(MatchType type) { // Convert enumerated MatchType to string switch(type) { - case(MatchType_None): s = conf_val_none; break; - case(MatchType_MergeBoth): s = conf_val_merge_both; break; - case(MatchType_MergeFcst): s = conf_val_merge_fcst; break; - case(MatchType_NoMerge): s = conf_val_no_merge; break; + case(MatchType::None): s = conf_val_none; break; + case(MatchType::MergeBoth): s = conf_val_merge_both; break; + case(MatchType::MergeFcst): s = conf_val_merge_fcst; break; + case(MatchType::NoMerge): s = conf_val_no_merge; break; default: mlog << Error << "\nmatchtype_to_string() -> " - << "Unexpected MatchType value of " << type << ".\n\n"; + << "Unexpected MatchType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3224,7 +3233,7 @@ ConcatString disttype_to_string(DistType type) { case(DistType_Beta): s = conf_val_beta; break; default: mlog << Error << "\ndisttype_to_string() -> " - << "Unexpected DistType value of " << type << ".\n\n"; + << "Unexpected DistType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3259,13 +3268,13 @@ ConcatString griddecomptype_to_string(GridDecompType type) { // Convert enumerated GridDecompType to string switch(type) { - case(GridDecompType_None): s = conf_val_none; break; - case(GridDecompType_Auto): s = conf_val_auto; break; - case(GridDecompType_Tile): s = conf_val_tile; break; - case(GridDecompType_Pad): s = conf_val_pad; break; + case(GridDecompType::None): s = conf_val_none; break; + case(GridDecompType::Auto): s = conf_val_auto; break; + case(GridDecompType::Tile): s = conf_val_tile; break; + case(GridDecompType::Pad): s = conf_val_pad; break; default: mlog << Error << "\ngriddecomptype_to_string() -> " - << "Unexpected GridDecompType value of " << type << ".\n\n"; + << "Unexpected GridDecompType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -3279,16 +3288,16 @@ ConcatString wavelettype_to_string(WaveletType type) { // Convert enumerated WaveletType to string switch(type) { - case(WaveletType_None): s = conf_val_none; break; - case(WaveletType_Haar): s = conf_val_haar; break; - case(WaveletType_Haar_Cntr): s = conf_val_haar_cntr; break; - case(WaveletType_Daub): s = conf_val_daub; break; - case(WaveletType_Daub_Cntr): s = conf_val_daub_cntr; break; - case(WaveletType_BSpline): s = conf_val_bspline; break; - case(WaveletType_BSpline_Cntr): s = conf_val_bspline_cntr; break; + case(WaveletType::None): s = conf_val_none; break; + case(WaveletType::Haar): s = conf_val_haar; break; + case(WaveletType::Haar_Cntr): s = conf_val_haar_cntr; break; + case(WaveletType::Daub): s = conf_val_daub; break; + case(WaveletType::Daub_Cntr): s = conf_val_daub_cntr; break; + case(WaveletType::BSpline): s = conf_val_bspline; break; + case(WaveletType::BSpline_Cntr): s = conf_val_bspline_cntr; break; default: mlog << Error << "\nwavlettype_to_string() -> " - << "Unexpected WaveletType value of " << type << ".\n\n"; + << "Unexpected WaveletType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index d8137919cb..316c8eb14a 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -150,8 +150,22 @@ extern int parse_conf_percentile(Dictionary *dict); extern void python_compile_error(const char *caller=nullptr); extern void ugrid_compile_error(const char *caller=nullptr); +template +extern auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type; + //////////////////////////////////////////////////////////////////////// +/* +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} +*/ +/////////////////////////////////////////////////////////////////////////////// + #endif /* __CONFIG_UTIL_H__ */ //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afmtokentype_to_string.cc b/src/libcode/vx_afm/afmtokentype_to_string.cc index 03ee5c72d4..5d04baffd9 100644 --- a/src/libcode/vx_afm/afmtokentype_to_string.cc +++ b/src/libcode/vx_afm/afmtokentype_to_string.cc @@ -28,7 +28,6 @@ #include "afmtokentype_to_string.h" - using namespace std; diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index f5ead39e40..c36758f8db 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -158,7 +158,7 @@ void STATAnalysisJob::clear() { obs_thresh.clear(); cov_thresh.clear(); - thresh_logic = SetLogic_None; + thresh_logic = SetLogic::None; alpha.clear(); @@ -192,11 +192,11 @@ void STATAnalysisJob::clear() { out_fcst_thresh.clear(); out_obs_thresh.clear(); - out_cnt_logic = SetLogic_Union; + out_cnt_logic = SetLogic::Union; out_fcst_wind_thresh.clear(); out_obs_wind_thresh.clear(); - out_wind_logic = SetLogic_Union; + out_wind_logic = SetLogic::Union; out_alpha = bad_data_double; boot_interval = bad_data_int; @@ -942,7 +942,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // // thresh_logic // - if(thresh_logic != SetLogic_None && + if(thresh_logic != SetLogic::None && thresh_logic != L.thresh_logic()) return 0; // @@ -2567,7 +2567,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // thresh_logic - if(thresh_logic != SetLogic_None) { + if(thresh_logic != SetLogic::None) { js << "-thresh_logic " << setlogic_to_string(thresh_logic) << " "; } diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 96ee2fc103..e88ba5b1d8 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -305,7 +305,7 @@ class STATAnalysisJob { // // Type of bootstrap confidence interval method: - // 0 = BCa, 1 = Percentile (Default = 1) + // 0 = BCA, 1 = Percentile (Default = 1) // int boot_interval; diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index a8f869fa74..9ea8949eda 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -829,14 +829,14 @@ SetLogic STATLine::thresh_logic() const { -SetLogic t = SetLogic_None; +SetLogic t = SetLogic::None; ConcatString cs = (string)get_item("FCST_THRESH", false); - if(cs.endswith(setlogic_symbol_union)) t = SetLogic_Union; -else if(cs.endswith(setlogic_symbol_intersection)) t = SetLogic_Intersection; -else if(cs.endswith(setlogic_symbol_symdiff)) t = SetLogic_SymDiff; -else t = SetLogic_None; + if(cs.endswith(setlogic_symbol_union)) t = SetLogic::Union; +else if(cs.endswith(setlogic_symbol_intersection)) t = SetLogic::Intersection; +else if(cs.endswith(setlogic_symbol_symdiff)) t = SetLogic::SymDiff; +else t = SetLogic::None; return t; diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc index 0f141ac50e..6a747cf7df 100644 --- a/src/libcode/vx_nc_util/write_netcdf.cc +++ b/src/libcode/vx_nc_util/write_netcdf.cc @@ -228,12 +228,12 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, switch(t) { - case GridWeightType_Cos_Lat: + case GridWeightType::Cos_Lat: add_att(&wgt_var, long_name_att_name, "cosine latitude grid weight"); add_att(&wgt_var, units_att_name, "NA"); break; - case GridWeightType_Area: + case GridWeightType::Area: add_att(&wgt_var, long_name_att_name, "true area grid weight"); add_att(&wgt_var, units_att_name, "km^2"); break; diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index e0fc008464..06b767f579 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -916,12 +916,12 @@ void ModeFuzzyEngine::do_fcst_merging(const char *default_config, if(!need_fcst_merge) return; - if(conf_info.Fcst->merge_flag == MergeType_Both || - conf_info.Fcst->merge_flag == MergeType_Thresh) + if(conf_info.Fcst->merge_flag == MergeType::Both || + conf_info.Fcst->merge_flag == MergeType::Thresh) do_fcst_merge_thresh(); - if(conf_info.Fcst->merge_flag == MergeType_Both || - conf_info.Fcst->merge_flag == MergeType_Engine) + if(conf_info.Fcst->merge_flag == MergeType::Both || + conf_info.Fcst->merge_flag == MergeType::Engine) do_fcst_merge_engine(default_config, merge_config); // @@ -944,12 +944,12 @@ void ModeFuzzyEngine::do_obs_merging(const char *default_config, if(!need_obs_merge) return; - if(conf_info.Obs->merge_flag == MergeType_Both || - conf_info.Obs->merge_flag == MergeType_Thresh) + if(conf_info.Obs->merge_flag == MergeType::Both || + conf_info.Obs->merge_flag == MergeType::Thresh) do_obs_merge_thresh(); - if(conf_info.Obs->merge_flag == MergeType_Both || - conf_info.Obs->merge_flag == MergeType_Engine) + if(conf_info.Obs->merge_flag == MergeType::Both || + conf_info.Obs->merge_flag == MergeType::Engine) do_obs_merge_engine(default_config, merge_config); // @@ -978,12 +978,12 @@ void ModeFuzzyEngine::do_fcst_merging(const ShapeData &merge_data) exit(1); } - if(conf_info.Fcst->merge_flag == MergeType_Both || - conf_info.Fcst->merge_flag == MergeType_Thresh) + if(conf_info.Fcst->merge_flag == MergeType::Both || + conf_info.Fcst->merge_flag == MergeType::Thresh) do_fcst_merge_thresh(merge_data); - if(conf_info.Fcst->merge_flag == MergeType_Both || - conf_info.Fcst->merge_flag == MergeType_Engine) + if(conf_info.Fcst->merge_flag == MergeType::Both || + conf_info.Fcst->merge_flag == MergeType::Engine) do_fcst_merge_engine("", ""); // @@ -1012,12 +1012,12 @@ void ModeFuzzyEngine::do_obs_merging(const ShapeData &merge_data) exit(1); } - if(conf_info.Obs->merge_flag == MergeType_Both || - conf_info.Obs->merge_flag == MergeType_Thresh) + if(conf_info.Obs->merge_flag == MergeType::Both || + conf_info.Obs->merge_flag == MergeType::Thresh) do_obs_merge_thresh(merge_data); - if(conf_info.Obs->merge_flag == MergeType_Both || - conf_info.Obs->merge_flag == MergeType_Engine) + if(conf_info.Obs->merge_flag == MergeType::Both || + conf_info.Obs->merge_flag == MergeType::Engine) do_obs_merge_engine("", ""); // @@ -1037,23 +1037,23 @@ void ModeFuzzyEngine::do_matching() { if(!need_match) return; - if(conf_info.match_flag == MatchType_None) { + if(conf_info.match_flag == MatchType::None) { mlog << Warning << "\nModeFuzzyEngine::do_matching() -> " << "no matching requested in configuration file\n\n"; do_no_match(); } - else if(conf_info.match_flag == MatchType_MergeBoth) { + else if(conf_info.match_flag == MatchType::MergeBoth) { do_match_merge(); } - else if(conf_info.match_flag == MatchType_MergeFcst) { + else if(conf_info.match_flag == MatchType::MergeFcst) { do_match_fcst_merge(); } - else if(conf_info.match_flag == MatchType_NoMerge) { + else if(conf_info.match_flag == MatchType::NoMerge) { do_match_only(); } else { mlog << Error << "\nModeFuzzyEngine::do_matching() -> " - << "invalid match_flag value of " << conf_info.match_flag + << "invalid match_flag value of " << enum_class_as_integer(conf_info.match_flag) << " specified.\n\n"; exit(1); } @@ -2928,9 +2928,9 @@ double interest_percentile(ModeFuzzyEngine &eng, const double p, const int flag) double *v = (double *) nullptr; NumArray fcst_na, obs_na; - if(eng.conf_info.match_flag == 0 || - eng.n_fcst == 0 || - eng.n_obs == 0) return 0.0; + if(eng.conf_info.match_flag == MatchType::None || + eng.n_fcst == 0 || + eng.n_obs == 0) return 0.0; // // Initialize the maximum interest value for each object to zero. @@ -3079,7 +3079,7 @@ for (x=0; x<(grid.nx()); ++x) { // // If no matching was requested, don't write any more // - if(eng.conf_info.match_flag == 0) return; + if(eng.conf_info.match_flag == MatchType::None) return; // // Object pairs, increment the counter within the subroutine diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index c037fd4b0e..a46d678289 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -192,7 +192,7 @@ void ModeConfInfo::clear() desc.clear(); obtype.clear(); - mask_missing_flag = FieldType_None; + mask_missing_flag = FieldType::None; grid_res = bad_data_double; @@ -202,15 +202,15 @@ void ModeConfInfo::clear() fcst_multivar_logic.clear(); obs_multivar_logic.clear(); - match_flag = MatchType_None; + match_flag = MatchType::None; max_centroid_dist = bad_data_double; mask_grid_name.clear(); - mask_grid_flag = FieldType_None; + mask_grid_flag = FieldType::None; mask_poly_name.clear(); - mask_poly_flag = FieldType_None; + mask_poly_flag = FieldType::None; centroid_dist_wt = bad_data_double; boundary_dist_wt = bad_data_double; @@ -412,7 +412,7 @@ void ModeConfInfo::process_config_except_fields() // Check that the sum of the weights is non-zero for matching - if(match_flag != MatchType_None && + if(match_flag != MatchType::None && is_eq(centroid_dist_wt + boundary_dist_wt + convex_hull_dist_wt + angle_diff_wt + aspect_diff_wt + area_ratio_wt + @@ -850,7 +850,7 @@ void ModeConfInfo::evaluate_fcst_settings(int j) if ( fcst_array[j].merge_thresh_array.n_elements() == 1 ) fcst_array[j].merge_thresh = fcst_array[j].merge_thresh_array[0]; - if(match_flag == MatchType_None && fcst_array[j].merge_flag != MergeType_None) { + if(match_flag == MatchType::None && fcst_array[j].merge_flag != MergeType::None) { mlog << Warning << "\nModeConfInfo::evaluate_fcst_settings(" << j << ") -> " << "When matching is disabled (match_flag = " << matchtype_to_string(match_flag) @@ -903,7 +903,7 @@ void ModeConfInfo::evaluate_obs_settings(int j) if ( obs_array[j].merge_thresh_array.n_elements() == 1 ) obs_array[j].merge_thresh = obs_array[j].merge_thresh_array[0]; // Check that match_flag is set between 0 and 3 - if(match_flag == MatchType_None && obs_array[j].merge_flag != MergeType_None) { + if(match_flag == MatchType::None && obs_array[j].merge_flag != MergeType::None) { mlog << Warning << "\nModeConfInfo::evaluate_obs_settings(" << j << ") -> " << "When matching is disabled (match_flag = " << matchtype_to_string(match_flag) @@ -1735,7 +1735,7 @@ void ModeConfInfo::check_multivar_not_implemented() for (int i=0; ilookup(conf_key_vld_thresh) ) { if ( _multivar ) { // set defaults to no merging merge_thresh.clear(); - merge_flag = MergeType_None; + merge_flag = MergeType::None; // pull out the name string name = var_info->name(); @@ -286,7 +286,7 @@ if ( _multivar ) { // because that is inconsistent merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); - if (merge_flag != MergeType_None) { + if (merge_flag != MergeType::None) { mlog << Error << "\nMode_Field_Info::set() -> " << "Field:" << name << ". " << " When 'merge_flag' is explicitly set, 'merge_thresh' must be explicitly set for multivariate mode\n\n"; @@ -310,7 +310,7 @@ if ( _multivar ) { // individual entry doesn't have a merge_thresh, parent has a merge_flag // expect parent to have a merge_thresh merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); - if (merge_thresh_array.n() == 0 && merge_flag != MergeType_None) { + if (merge_thresh_array.n() == 0 && merge_flag != MergeType::None) { // parent has a merge_flag but no merge_thresh mlog << Error << "\nMode_Field_Info::set() -> " << "Field:" << name << ". using parent merge_flag: " << merge_name @@ -403,7 +403,7 @@ bool Mode_Field_Info::need_merge_thresh () const { -bool status = (merge_flag == MergeType_Both) || (merge_flag == MergeType_Thresh); +bool status = (merge_flag == MergeType::Both) || (merge_flag == MergeType::Thresh); return status; diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 55aded1e28..896d347ad4 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -536,7 +536,7 @@ void write_fho_row(StatHdrColumns &shc, const CTSInfo &cts_info, shc.set_obs_thresh(cts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_alpha(bad_data_double); shc.set_cov_thresh(na_str); @@ -547,7 +547,7 @@ void write_fho_row(StatHdrColumns &shc, const CTSInfo &cts_info, write_fho_cols(cts_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -575,7 +575,7 @@ void write_ctc_row(StatHdrColumns &shc, const CTSInfo &cts_info, shc.set_obs_thresh(cts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_alpha(bad_data_double); shc.set_cov_thresh(na_str); @@ -586,7 +586,7 @@ void write_ctc_row(StatHdrColumns &shc, const CTSInfo &cts_info, write_ctc_cols(cts_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -615,7 +615,7 @@ void write_cts_row(StatHdrColumns &shc, const CTSInfo &cts_info, shc.set_obs_thresh(cts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); // Write a line for each alpha value @@ -631,7 +631,7 @@ void write_cts_row(StatHdrColumns &shc, const CTSInfo &cts_info, write_cts_cols(cts_info, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -660,7 +660,7 @@ void write_mctc_row(StatHdrColumns &shc, const MCTSInfo &mcts_info, shc.set_obs_thresh(mcts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_alpha(bad_data_double); shc.set_cov_thresh(na_str); @@ -671,7 +671,7 @@ void write_mctc_row(StatHdrColumns &shc, const MCTSInfo &mcts_info, write_mctc_cols(mcts_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -700,7 +700,7 @@ void write_mcts_row(StatHdrColumns &shc, const MCTSInfo &mcts_info, shc.set_obs_thresh(mcts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); // Write a line for each alpha value @@ -716,7 +716,7 @@ void write_mcts_row(StatHdrColumns &shc, const MCTSInfo &mcts_info, write_mcts_cols(mcts_info, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -767,7 +767,7 @@ void write_cnt_row(StatHdrColumns &shc, const CNTInfo &cnt_info, write_cnt_cols(cnt_info, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -815,7 +815,7 @@ void write_sl1l2_row(StatHdrColumns &shc, const SL1L2Info &sl1l2_info, write_sl1l2_cols(sl1l2_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -862,7 +862,7 @@ void write_sal1l2_row(StatHdrColumns &shc, const SL1L2Info &sl1l2_info, write_sal1l2_cols(sl1l2_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -904,7 +904,7 @@ void write_vl1l2_row(StatHdrColumns &shc, const VL1L2Info &vl1l2_info, write_vl1l2_cols(vl1l2_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -943,7 +943,7 @@ void write_val1l2_row(StatHdrColumns &shc, const VL1L2Info &vl1l2_info, write_val1l2_cols(vl1l2_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -988,7 +988,7 @@ void write_vcnt_row(StatHdrColumns &shc, const VL1L2Info &vcnt_info, write_vcnt_cols(vcnt_info, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1019,7 +1019,7 @@ void write_pct_row(StatHdrColumns &shc, const PCTInfo &pct_info, if(update_thresh) { shc.set_fcst_thresh(pct_info.fthresh); shc.set_obs_thresh(pct_info.othresh); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); } @@ -1037,7 +1037,7 @@ void write_pct_row(StatHdrColumns &shc, const PCTInfo &pct_info, write_pct_cols(pct_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1070,7 +1070,7 @@ void write_pstd_row(StatHdrColumns &shc, const PCTInfo &pct_info, if(update_thresh) { shc.set_fcst_thresh(pct_info.fthresh); shc.set_obs_thresh(pct_info.othresh); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); } @@ -1091,7 +1091,7 @@ void write_pstd_row(StatHdrColumns &shc, const PCTInfo &pct_info, write_pstd_cols(pct_info, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1124,7 +1124,7 @@ void write_pjc_row(StatHdrColumns &shc, const PCTInfo &pct_info, if(update_thresh) { shc.set_fcst_thresh(pct_info.fthresh); shc.set_obs_thresh(pct_info.othresh); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); } @@ -1142,7 +1142,7 @@ void write_pjc_row(StatHdrColumns &shc, const PCTInfo &pct_info, write_pjc_cols(pct_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1174,7 +1174,7 @@ void write_prc_row(StatHdrColumns &shc, const PCTInfo &pct_info, if(update_thresh) { shc.set_fcst_thresh(pct_info.fthresh); shc.set_obs_thresh(pct_info.othresh); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); } @@ -1192,7 +1192,7 @@ void write_prc_row(StatHdrColumns &shc, const PCTInfo &pct_info, write_prc_cols(pct_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1223,7 +1223,7 @@ void write_eclv_row(StatHdrColumns &shc, const PCTInfo &pct_info, // Set the threshold columns, if requested. shc.set_obs_thresh(pct_info.othresh); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh(na_str); // Not Applicable @@ -1247,7 +1247,7 @@ void write_eclv_row(StatHdrColumns &shc, const PCTInfo &pct_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1280,7 +1280,7 @@ void write_eclv_row(StatHdrColumns &shc, const CTSInfo &cts_info, shc.set_obs_thresh(cts_info.othresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_alpha(bad_data_double); shc.set_cov_thresh(na_str); @@ -1292,7 +1292,7 @@ void write_eclv_row(StatHdrColumns &shc, const CTSInfo &cts_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1323,7 +1323,7 @@ void write_nbrctc_row(StatHdrColumns &shc, const NBRCTSInfo &nbrcts_info, shc.set_cov_thresh(nbrcts_info.cthresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_alpha(bad_data_double); // Write the header columns @@ -1333,7 +1333,7 @@ void write_nbrctc_row(StatHdrColumns &shc, const NBRCTSInfo &nbrcts_info, write_nbrctc_cols(nbrcts_info, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -1365,7 +1365,7 @@ void write_nbrcts_row(StatHdrColumns &shc, const NBRCTSInfo &nbrcts_info, shc.set_cov_thresh(nbrcts_info.cthresh); // Not Applicable - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); // Write a line for each alpha value for(i=0; i map_val; // Storage for single obs values diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index c2178687ce..173aa68d76 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -1634,7 +1634,7 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, // bias correction, if requested if(obs_error_info->flag) { obs_v = add_obs_error_bc(obs_error_info->rng_ptr, - FieldType_Obs, oerr_ptr, obs_v); + FieldType::Obs, oerr_ptr, obs_v); } // Look through all of the PairData objects to see if the observation @@ -1844,7 +1844,7 @@ void VxPairDataEnsemble::add_ens(int member, bool mn, Grid &gr) { // Apply observation error perturbation, if requested if(obs_error_info->flag) { fcst_v = add_obs_error_inc( - obs_error_info->rng_ptr, FieldType_Fcst, + obs_error_info->rng_ptr, FieldType::Fcst, pd[i][j][k].obs_error_entry[l], pd[i][j][k].o_na[l], fcst_na[m]); } @@ -1891,7 +1891,7 @@ void VxPairDataEnsemble::set_duplicate_flag(DuplicateType duplicate_flag) { 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].set_check_unique(duplicate_flag == DuplicateType_Unique); + pd[i][j][k].set_check_unique(duplicate_flag == DuplicateType::Unique); } } } diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 2b19b94391..0a99b81d0c 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -1429,7 +1429,7 @@ void VxPairDataPoint::set_duplicate_flag(DuplicateType duplicate_flag) { 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].set_check_unique(duplicate_flag == DuplicateType_Unique); + pd[i][j][k].set_check_unique(duplicate_flag == DuplicateType::Unique); } } } @@ -1592,25 +1592,25 @@ bool check_fo_thresh(double f, double o, double cmn, double csd, // If either of the thresholds is NA, reset the logic to intersection // because an NA threshold is always true. if(ft.get_type() == thresh_na || ot.get_type() == thresh_na) { - t = SetLogic_Intersection; + t = SetLogic::Intersection; } 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; default: mlog << Error << "\ncheck_fo_thresh() -> " - << "Unexpected SetLogic value of " << type << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 2ea4fdeb3c..71cd94a81b 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -163,7 +163,7 @@ void DiagFile::init_from_scratch() { void DiagFile::clear() { // Initialize values - DiagSource = DiagType_None; + DiagSource = DiagType::None; TrackSource.clear(); FieldSource.clear(); StormId.clear(); @@ -215,10 +215,10 @@ void DiagFile::read(const ConcatString &path, const ConcatString &diag_source, DiagType type = string_to_diagtype(diag_source.c_str()); // Read diagnostics based on the source type - if(type == DiagType_CIRA_RT) { + if(type == DiagType::CIRA_RT) { read_cira_rt(path, convert_map); } - else if(type == DiagType_SHIPS_RT) { + else if(type == DiagType::SHIPS_RT) { read_ships_rt(path, convert_map); } else { @@ -249,7 +249,7 @@ void DiagFile::read_cira_rt(const ConcatString &path, clear(); // Store the file type - DiagSource = DiagType_CIRA_RT; + DiagSource = DiagType::CIRA_RT; // Open the file open(path.c_str()); @@ -399,7 +399,7 @@ void DiagFile::read_ships_rt(const ConcatString &path, clear(); // Store the file type - DiagSource = DiagType_SHIPS_RT; + DiagSource = DiagType::SHIPS_RT; // Open the file open(path.c_str()); diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index a6c411c572..c287d47f9a 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -91,7 +91,7 @@ void TrackInfo::clear() { MaxValidTime = (unixtime) 0; MinWarmCore = (unixtime) 0; MaxWarmCore = (unixtime) 0; - DiagSource = DiagType_None; + DiagSource = DiagType::None; TrackSource.clear(); FieldSource.clear(); DiagName.clear(); diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index 37e92621e5..8206db0bc7 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -473,7 +473,7 @@ void TrackPairInfo::add_tcdiag_line(const TCStatLine &l) { // Make sure DIAG_SOURCE does not change DiagType diag_source = string_to_diagtype(l.get_item("DIAG_SOURCE")); - if(ADeck.diag_source() != DiagType_None && + if(ADeck.diag_source() != DiagType::None && ADeck.diag_source() != diag_source) { mlog << Error << "\nTrackPairInfo::add_tcdiag_line() -> " << "the diagnostic source type has changed (" @@ -642,7 +642,7 @@ int TrackPairInfo::check_rirw(const TrackType track_type, int acur, aprv, bcur, bprv; // Nothing to do. - if(track_type == TrackType_None) return 0; + if(track_type == TrackType::None) return 0; // Check threshold type for non-exact intensity differences. if(!exact_adeck && @@ -751,7 +751,7 @@ int TrackPairInfo::check_rirw(const TrackType track_type, // Print debug message when rapid intensification is found if(is_eq(ADeckRIRW[i], 1.0) && - (track_type == TrackType_ADeck || track_type == TrackType_Both)) { + (track_type == TrackType::ADeck || track_type == TrackType::Both)) { mlog << Debug(4) << "Found ADECK RI/RW: " << case_info() << ", VALID = " << unix_to_yyyymmdd_hhmmss(ADeck[i].valid()) << ", " @@ -762,7 +762,7 @@ int TrackPairInfo::check_rirw(const TrackType track_type, << acur - aprv << st_adeck.get_str() << "\n"; } if(is_eq(BDeckRIRW[i], 1.0) && - (track_type == TrackType_BDeck || track_type == TrackType_Both)) { + (track_type == TrackType::BDeck || track_type == TrackType::Both)) { mlog << Debug(4) << "Found BDECK RI/RW: " << case_info() << ", VALID = " << unix_to_yyyymmdd_hhmmss(BDeck[i].valid()) << ", " @@ -777,9 +777,9 @@ int TrackPairInfo::check_rirw(const TrackType track_type, if(!Keep[i]) continue; // Update the keep status - if((track_type == TrackType_ADeck && !is_eq(ADeckRIRW[i], 1.0)) || - (track_type == TrackType_BDeck && !is_eq(BDeckRIRW[i], 1.0)) || - (track_type == TrackType_Both && !is_eq(ADeckRIRW[i], 1.0) && !is_eq(BDeckRIRW[i], 1.0))) { + if((track_type == TrackType::ADeck && !is_eq(ADeckRIRW[i], 1.0)) || + (track_type == TrackType::BDeck && !is_eq(BDeckRIRW[i], 1.0)) || + (track_type == TrackType::Both && !is_eq(ADeckRIRW[i], 1.0) && !is_eq(BDeckRIRW[i], 1.0))) { Keep.set(i, 0); n_rej++; } diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 73204c02f9..6a069322d6 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -517,7 +517,7 @@ void process_grid(const Grid &fcst_grid) { ri = conf_info.vx_opt[0].vx_pd.fcst_info->get_var_info()->regrid(); // Read gridded observation data, if necessary - if(ri.field == FieldType_Obs) { + if(ri.field == FieldType::Obs) { if(!grid_obs_flag) { mlog << Error << "\nprocess_grid() -> " @@ -1493,13 +1493,13 @@ void process_grid_vx() { shc.set_interp_wdth(wdth); // Smooth the ensemble mean field, if requested - if(field == FieldType_Fcst || field == FieldType_Both) { + if(field == FieldType::Fcst || field == FieldType::Both) { emn_dp = smooth_field(emn_dp, mthd, wdth, shape, grid.wrap_lon(), vld_thresh, gaussian); } // Smooth the observation field, if requested - if(field == FieldType_Obs || field == FieldType_Both) { + if(field == FieldType::Obs || field == FieldType::Both) { obs_dp = smooth_field(obs_dp, mthd, wdth, shape, grid.wrap_lon(), vld_thresh, gaussian); } @@ -1513,7 +1513,7 @@ void process_grid_vx() { << "Applying observation error bias correction to " << "gridded observation data.\n"; obs_dp = add_obs_error_bc(conf_info.rng_ptr, - FieldType_Obs, oerr_ptr, oraw_dp, oraw_dp, + FieldType::Obs, oerr_ptr, oraw_dp, oraw_dp, conf_info.vx_opt[i].vx_pd.obs_info->name().c_str(), conf_info.obtype.c_str()); } @@ -1522,7 +1522,7 @@ void process_grid_vx() { for(k=0; k < conf_info.vx_opt[i].vx_pd.fcst_info->inputs_n(); k++) { // Smooth the forecast field, if requested - if(field == FieldType_Fcst || field == FieldType_Both) { + if(field == FieldType::Fcst || field == FieldType::Both) { fcst_dp[k] = smooth_field(fcst_dp[k], mthd, wdth, shape, grid.wrap_lon(), vld_thresh, gaussian); } @@ -1538,7 +1538,7 @@ void process_grid_vx() { << "Applying observation error perturbation to " << "ensemble member " << k+1 << ".\n"; fcst_dp[k] = add_obs_error_inc(conf_info.rng_ptr, - FieldType_Fcst, oerr_ptr, fraw_dp[k], oraw_dp, + FieldType::Fcst, oerr_ptr, fraw_dp[k], oraw_dp, conf_info.vx_opt[i].vx_pd.obs_info->name().c_str(), conf_info.obtype.c_str()); } @@ -1719,7 +1719,7 @@ void do_ecnt(const EnsembleStatVxOpt &vx_opt, ecnt_info.set(*pd_ptr); // Write out ECNT - if(vx_opt.output_flag[i_ecnt] != STATOutputType_None && + if(vx_opt.output_flag[i_ecnt] != STATOutputType::None && ecnt_info.n_pair > 0) { write_ecnt_row(shc, ecnt_info, vx_opt.output_flag[i_ecnt], stat_at, i_stat_row, @@ -1756,7 +1756,7 @@ void do_rps(const EnsembleStatVxOpt &vx_opt, rps_info.set(*pd_ptr); // Write out RPS - if(vx_opt.output_flag[i_rps] != STATOutputType_None && + if(vx_opt.output_flag[i_rps] != STATOutputType::None && rps_info.n_pair > 0) { write_rps_row(shc, rps_info, vx_opt.output_flag[i_rps], stat_at, i_stat_row, @@ -1878,7 +1878,7 @@ void setup_txt_files() { for(i=0; i 1 && (type_cs != "OBS" || - conf_info.vx_opt[i_vx].interp_info.field == FieldType_Obs || - conf_info.vx_opt[i_vx].interp_info.field == FieldType_Both)) { + conf_info.vx_opt[i_vx].interp_info.field == FieldType::Obs || + conf_info.vx_opt[i_vx].interp_info.field == FieldType::Both)) { var_name << "_" << mthd_str << "_" << wdth*wdth; name_str << "_" << mthd_str << "_" << wdth*wdth; } @@ -2739,7 +2739,7 @@ void finish_txt_files() { for(i=0; ifield == FieldType_Fcst || - interp->field == FieldType_Both) { + if(interp->field == FieldType::Fcst || + interp->field == FieldType::Both) { smooth_field(fcst_dp, fcst_dp_smooth, interp_mthd, interp->width[j], interp->shape, grid.wrap_lon(), interp->vld_thresh, interp->gaussian); @@ -855,8 +855,8 @@ void process_scores() { } // If requested in the config file, smooth the observation field - if(interp->field == FieldType_Obs || - interp->field == FieldType_Both) { + if(interp->field == FieldType::Obs || + interp->field == FieldType::Both) { smooth_field(obs_dp, obs_dp_smooth, interp_mthd, interp->width[j], interp->shape, grid.wrap_lon(), interp->vld_thresh, interp->gaussian); @@ -910,10 +910,10 @@ void process_scores() { // Compute CTS scores if(!conf_info.vx_opt[i].fcst_info->is_prob() && conf_info.vx_opt[i].fcat_ta.n() > 0 && - (conf_info.vx_opt[i].output_flag[i_fho] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_fho] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType::None)) { // Initialize for(m=0; m 0) { write_fho_row(shc, cts_info[m], @@ -935,7 +935,7 @@ void process_scores() { } // Write out CTC - if(conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType::None && cts_info[m].cts.n() > 0) { write_ctc_row(shc, cts_info[m], @@ -945,7 +945,7 @@ void process_scores() { } // Write out CTS - if(conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType::None && cts_info[m].cts.n() > 0) { write_cts_row(shc, cts_info[m], @@ -955,7 +955,7 @@ void process_scores() { } // Write out ECLV - if(conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType::None && cts_info[m].cts.n() > 0) { write_eclv_row(shc, cts_info[m], conf_info.vx_opt[i].eclv_points, @@ -969,8 +969,8 @@ void process_scores() { // Compute MCTS scores if(!conf_info.vx_opt[i].fcst_info->is_prob() && conf_info.vx_opt[i].fcat_ta.n() > 1 && - (conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType::None)) { // Initialize mcts_info.clear(); @@ -979,7 +979,7 @@ void process_scores() { do_mcts(mcts_info, i, &pd); // Write out MCTC - if(conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType::None && mcts_info.cts.total() > 0) { write_mctc_row(shc, mcts_info, @@ -989,7 +989,7 @@ void process_scores() { } // Write out MCTS - if(conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType::None && mcts_info.cts.total() > 0) { write_mcts_row(shc, mcts_info, @@ -1001,9 +1001,9 @@ void process_scores() { // Compute CNT, SL1L2, and SAL1L2 scores if(!conf_info.vx_opt[i].fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType::None)) { do_cnt_sl1l2(conf_info.vx_opt[i], &pd); } @@ -1011,9 +1011,9 @@ void process_scores() { if(!conf_info.vx_opt[i].fcst_info->is_prob() && conf_info.vx_opt[i].fcst_info->is_v_wind() && conf_info.vx_opt[i].fcst_info->uv_index() >= 0 && - (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None)) { // Store the forecast variable name shc.set_fcst_var(ugrd_vgrd_abbr_str); @@ -1045,8 +1045,8 @@ void process_scores() { // If requested in the config file, smooth the forecast // and climatology U-wind fields - if(interp->field == FieldType_Fcst || - interp->field == FieldType_Both) { + if(interp->field == FieldType::Fcst || + interp->field == FieldType::Both) { smooth_field(fu_dp, fu_dp_smooth, interp_mthd, interp->width[j], interp->shape, grid.wrap_lon(), interp->vld_thresh, interp->gaussian); @@ -1058,8 +1058,8 @@ void process_scores() { // If requested in the config file, smooth the observation // U-wind field - if(interp->field == FieldType_Obs || - interp->field == FieldType_Both) { + if(interp->field == FieldType::Obs || + interp->field == FieldType::Both) { smooth_field(ou_dp, ou_dp_smooth, interp_mthd, interp->width[j], interp->shape, grid.wrap_lon(), @@ -1082,7 +1082,7 @@ void process_scores() { for(m=0; m 0) { write_vl1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vl1l2], @@ -1091,7 +1091,7 @@ void process_scores() { } // Write out VAL1L2 - if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None && vl1l2_info[m].vacount > 0) { write_val1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_val1l2], @@ -1100,7 +1100,7 @@ void process_scores() { } // Write out VCNT - if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None && vl1l2_info[m].vcount > 0) { write_vcnt_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vcnt], @@ -1120,11 +1120,11 @@ void process_scores() { // Compute PCT counts and scores if(conf_info.vx_opt[i].fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType::None)) { do_pct(conf_info.vx_opt[i], &pd); } @@ -1189,7 +1189,7 @@ void process_scores() { } // Write out the fields of requested SEEPS - if(conf_info.vx_opt[i].output_flag[i_seeps] != STATOutputType_None + if(conf_info.vx_opt[i].output_flag[i_seeps] != STATOutputType::None && conf_info.vx_opt[i].fcst_info->is_precipitation() && conf_info.vx_opt[i].obs_info->is_precipitation()) { SeepsAggScore seeps; @@ -1213,7 +1213,7 @@ void process_scores() { // Compute gradient statistics if requested in the config file if(!conf_info.vx_opt[i].fcst_info->is_prob() && - conf_info.vx_opt[i].output_flag[i_grad] != STATOutputType_None) { + conf_info.vx_opt[i].output_flag[i_grad] != STATOutputType::None) { // Allocate memory in one big chunk based on grid size DataPlane fgx_dp, fgy_dp, ogx_dp, ogy_dp; @@ -1268,7 +1268,7 @@ void process_scores() { pd_gx.o_na, pd_gy.o_na, pd_gx.wgt_na); // Write out GRAD - if(conf_info.vx_opt[i].output_flag[i_grad] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_grad] != STATOutputType::None && grad_info.total > 0) { write_grad_row(shc, grad_info, @@ -1301,7 +1301,7 @@ void process_scores() { // Compute distance map statistics if requested in the config file if(!conf_info.vx_opt[i].fcst_info->is_prob() && - conf_info.vx_opt[i].output_flag[i_dmap] != STATOutputType_None) { + conf_info.vx_opt[i].output_flag[i_dmap] != STATOutputType::None) { // Allocate memory in one big chunk based on grid size DataPlane fcst_dp_dmap, obs_dp_dmap; @@ -1412,7 +1412,7 @@ void process_scores() { pd.f_na, pd.o_na, pd_thr.f_na, pd_thr.o_na); // Write out DMAP - if(conf_info.vx_opt[i].output_flag[i_dmap] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_dmap] != STATOutputType::None && dmap_info.total > 0) { write_dmap_row(shc, dmap_info, @@ -1431,9 +1431,9 @@ void process_scores() { // Loop through and apply the Neighborhood methods for each of the // neighborhood widths if requested in the config file if(!conf_info.vx_opt[i].fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_nbrcnt] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_nbrcnt] != STATOutputType::None)) { // Pointer to current interpolation object NbrhdInfo * nbrhd = &conf_info.vx_opt[i].nbrhd_info; @@ -1479,8 +1479,8 @@ void process_scores() { } // Process the forecast data - if(nbrhd->field == FieldType_Fcst || - nbrhd->field == FieldType_Both) { + if(nbrhd->field == FieldType::Fcst || + nbrhd->field == FieldType::Both) { // Compute fractional coverage field, if necessary. if(fcst_dp_smooth.is_empty() || @@ -1519,8 +1519,8 @@ void process_scores() { } // Process the observation data - if(nbrhd->field == FieldType_Obs || - nbrhd->field == FieldType_Both) { + if(nbrhd->field == FieldType::Obs || + nbrhd->field == FieldType::Both) { // Compute fractional coverage field, if necessary. if(obs_dp_smooth.is_empty() || @@ -1562,13 +1562,13 @@ void process_scores() { mask_bad_data(mask_mp, fcst_dp_smooth); mask_bad_data(mask_mp, obs_dp_smooth); - if(nbrhd->field == FieldType_Fcst || - nbrhd->field == FieldType_Both) { + if(nbrhd->field == FieldType::Fcst || + nbrhd->field == FieldType::Both) { mask_bad_data(mask_mp, fcst_dp_thresh); } - if(nbrhd->field == FieldType_Obs || - nbrhd->field == FieldType_Both) { + if(nbrhd->field == FieldType::Obs || + nbrhd->field == FieldType::Both) { mask_bad_data(mask_mp, obs_dp_thresh); } @@ -1604,8 +1604,8 @@ void process_scores() { if(pd.f_na.n() == 0) continue; // Compute NBRCTS scores - if(conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType_None) { + if(conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType::None) { // Initialize for(n=0; n 0) { // Write out NBRCTC - if(conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType_None) { + if(conf_info.vx_opt[i].output_flag[i_nbrctc] != STATOutputType::None) { write_nbrctc_row(shc, nbrcts_info[n], conf_info.vx_opt[i].output_flag[i_nbrctc], @@ -1630,7 +1630,7 @@ void process_scores() { } // Write out NBRCTS - if(conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType_None) { + if(conf_info.vx_opt[i].output_flag[i_nbrcts] != STATOutputType::None) { write_nbrcts_row(shc, nbrcts_info[n], conf_info.vx_opt[i].output_flag[i_nbrcts], @@ -1642,7 +1642,7 @@ void process_scores() { } // end compute NBRCTS // Compute NBRCNT scores - if(conf_info.vx_opt[i].output_flag[i_nbrcnt] != STATOutputType_None) { + if(conf_info.vx_opt[i].output_flag[i_nbrcnt] != STATOutputType::None) { // Initialize nbrcnt_info.clear(); @@ -1651,7 +1651,7 @@ void process_scores() { // Write out NBRCNT if(nbrcnt_info.sl1l2_info.scount > 0 && - conf_info.vx_opt[i].output_flag[i_nbrcnt]) { + (STATOutputType::None!=conf_info.vx_opt[i].output_flag[i_nbrcnt])) { write_nbrcnt_row(shc, nbrcnt_info, conf_info.vx_opt[i].output_flag[i_nbrcnt], @@ -1670,12 +1670,12 @@ void process_scores() { } // end for m // If not computing fractional coverage, all finished with thresholds - if(nbrhd->field == FieldType_None) break; + if(nbrhd->field == FieldType::None) break; } // end for k // If not computing fractional coverage, all finished with neighborhood widths - if(nbrhd->field == FieldType_None) break; + if(nbrhd->field == FieldType::None) break; } // end for j } // end if @@ -1768,9 +1768,9 @@ void process_scores() { // Compute CNT, SL1L2, and SAL1L2 scores if(!conf_info.vx_opt[i].fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType::None)) { do_cnt_sl1l2(conf_info.vx_opt[i], &pd); } @@ -1778,9 +1778,9 @@ void process_scores() { if(!conf_info.vx_opt[i].fcst_info->is_prob() && conf_info.vx_opt[i].fcst_info->is_v_wind() && conf_info.vx_opt[i].fcst_info->uv_index() >= 0 && - (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None)) { // Store the forecast variable name shc.set_fcst_var(ugrd_vgrd_abbr_str); @@ -1850,7 +1850,7 @@ void process_scores() { for(m=0; m 0) { write_vl1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vl1l2], @@ -1859,7 +1859,7 @@ void process_scores() { } // Write out VAL1L2 - if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None && vl1l2_info[m].vacount > 0) { write_val1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_val1l2], @@ -1868,7 +1868,7 @@ void process_scores() { } // Write out VCNT - if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None && vl1l2_info[m].vcount > 0) { write_vcnt_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vcnt], @@ -1894,18 +1894,18 @@ void process_scores() { // Write out the data fields if requested in the config file if(conf_info.vx_opt[i].nc_info.do_raw) { write_nc((string)"FCST", fcst_dp_smooth, i, shc.get_interp_mthd(), - bad_data_int, FieldType_Both); + bad_data_int, FieldType::Both); write_nc((string)"OBS", obs_dp_smooth, i, shc.get_interp_mthd(), - bad_data_int, FieldType_Both); + bad_data_int, FieldType::Both); } if(conf_info.vx_opt[i].nc_info.do_diff) { write_nc((string)"DIFF", subtract(fcst_dp_smooth, obs_dp_smooth), i, shc.get_interp_mthd(), bad_data_int, - FieldType_Both); + FieldType::Both); } if(conf_info.vx_opt[i].nc_info.do_climo && !cmn_dp_smooth.is_empty()) { write_nc((string)"CLIMO_MEAN", cmn_dp_smooth, i, shc.get_interp_mthd(), - bad_data_int, FieldType_Both); + bad_data_int, FieldType::Both); } } // end if @@ -1992,7 +1992,7 @@ void do_cts(CTSInfo *&cts_info, int i_vx, compute_cts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, cts_info, n_cts, - conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } else { @@ -2000,7 +2000,7 @@ void do_cts(CTSInfo *&cts_info, int i_vx, conf_info.vx_opt[i_vx].boot_info.n_rep, conf_info.vx_opt[i_vx].boot_info.rep_prop, cts_info, n_cts, - conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -2041,7 +2041,7 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, compute_mcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, mcts_info, - conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } else { @@ -2049,7 +2049,7 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, conf_info.vx_opt[i_vx].boot_info.n_rep, conf_info.vx_opt[i_vx].boot_info.rep_prop, mcts_info, - conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -2078,9 +2078,9 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Set flags - bool do_sl1l2 = (vx_opt.output_flag[i_sl1l2] != STATOutputType_None || - vx_opt.output_flag[i_sal1l2] != STATOutputType_None); - bool do_cnt = (vx_opt.output_flag[i_cnt] != STATOutputType_None); + bool do_sl1l2 = (vx_opt.output_flag[i_sl1l2] != STATOutputType::None || + vx_opt.output_flag[i_sal1l2] != STATOutputType::None); + bool do_cnt = (vx_opt.output_flag[i_cnt] != STATOutputType::None); bool precip_flag = (vx_opt.fcst_info->is_precipitation() && vx_opt.obs_info->is_precipitation()); @@ -2127,7 +2127,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out SL1L2 if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_sl1l2] != STATOutputType_None && + vx_opt.output_flag[i_sl1l2] != STATOutputType::None && sl1l2_info[j].scount > 0) { write_sl1l2_row(shc, sl1l2_info[j], @@ -2138,7 +2138,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out SAL1L2 if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_sal1l2] != STATOutputType_None && + vx_opt.output_flag[i_sal1l2] != STATOutputType::None && sl1l2_info[j].sacount > 0) { write_sal1l2_row(shc, sl1l2_info[j], @@ -2180,7 +2180,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out CNT if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_cnt] != STATOutputType_None && + vx_opt.output_flag[i_cnt] != STATOutputType::None && cnt_info[j].n > 0) { write_cnt_row(shc, cnt_info[j], @@ -2194,14 +2194,14 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { if(n_bin > 1) { // Compute SL1L2 climo CDF bin means - if(vx_opt.output_flag[i_sl1l2] != STATOutputType_None || - vx_opt.output_flag[i_sal1l2] != STATOutputType_None) { + if(vx_opt.output_flag[i_sl1l2] != STATOutputType::None || + vx_opt.output_flag[i_sal1l2] != STATOutputType::None) { SL1L2Info sl1l2_mean; compute_sl1l2_mean(sl1l2_info, n_bin, sl1l2_mean); // Write out SL1L2 - if(vx_opt.output_flag[i_sl1l2] != STATOutputType_None && + if(vx_opt.output_flag[i_sl1l2] != STATOutputType::None && sl1l2_mean.scount > 0) { write_sl1l2_row(shc, sl1l2_mean, @@ -2211,7 +2211,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Write out SAL1L2 - if(vx_opt.output_flag[i_sal1l2] != STATOutputType_None && + if(vx_opt.output_flag[i_sal1l2] != STATOutputType::None && sl1l2_mean.sacount > 0) { write_sal1l2_row(shc, sl1l2_mean, @@ -2222,7 +2222,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Compute CNT climo CDF bin means - if(vx_opt.output_flag[i_cnt] != STATOutputType_None) { + if(vx_opt.output_flag[i_cnt] != STATOutputType::None) { CNTInfo cnt_mean; compute_cnt_mean(cnt_info, n_bin, cnt_mean); @@ -2339,14 +2339,14 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Compute the probabilistic counts and statistics - compute_pctinfo(pd, vx_opt.output_flag[i_pstd], pct_info[j]); + compute_pctinfo(pd, ( STATOutputType::None!=vx_opt.output_flag[i_pstd]), pct_info[j]); // Check for no matched pairs to process if(pd.n_obs == 0) continue; // Write out PCT if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pct] != STATOutputType_None) { + vx_opt.output_flag[i_pct] != STATOutputType::None) { write_pct_row(shc, pct_info[j], vx_opt.output_flag[i_pct], j, n_bin, stat_at, i_stat_row, @@ -2355,7 +2355,7 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PSTD if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pstd] != STATOutputType_None) { + vx_opt.output_flag[i_pstd] != STATOutputType::None) { write_pstd_row(shc, pct_info[j], vx_opt.output_flag[i_pstd], j, n_bin, stat_at, i_stat_row, @@ -2364,7 +2364,7 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PJC if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pjc] != STATOutputType_None) { + vx_opt.output_flag[i_pjc] != STATOutputType::None) { write_pjc_row(shc, pct_info[j], vx_opt.output_flag[i_pjc], j, n_bin, stat_at, i_stat_row, @@ -2373,7 +2373,7 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PRC if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_prc] != STATOutputType_None) { + vx_opt.output_flag[i_prc] != STATOutputType::None) { write_prc_row(shc, pct_info[j], vx_opt.output_flag[i_prc], j, n_bin, stat_at, i_stat_row, @@ -2382,7 +2382,7 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out ECLV if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_eclv] != STATOutputType_None) { + vx_opt.output_flag[i_eclv] != STATOutputType::None) { write_eclv_row(shc, pct_info[j], vx_opt.eclv_points, vx_opt.output_flag[i_eclv], j, n_bin, stat_at, i_stat_row, @@ -2397,7 +2397,7 @@ void do_pct(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { compute_pct_mean(pct_info, n_bin, pct_mean); // Write out PSTD - if(vx_opt.output_flag[i_pstd] != STATOutputType_None) { + if(vx_opt.output_flag[i_pstd] != STATOutputType::None) { write_pstd_row(shc, pct_mean, vx_opt.output_flag[i_pstd], -1, n_bin, stat_at, i_stat_row, @@ -2427,7 +2427,7 @@ void do_nbrcts(NBRCTSInfo *&nbrcts_info, n_nbrcts = conf_info.vx_opt[i_vx].get_n_cov_thresh(); for(i=0; iis_prob() && - (output_flag[i_mctc] != STATOutputType_None || - output_flag[i_mcts] != STATOutputType_None)) { + (output_flag[i_mctc] != STATOutputType::None || + output_flag[i_mcts] != STATOutputType::None)) { check_mctc_thresh(fcat_ta); check_mctc_thresh(ocat_ta); } @@ -1049,7 +1049,7 @@ int GridStatVxOpt::n_txt_row(int i_txt_row) const { } // Check if this output line type is requested - if(output_flag[i_txt_row] == STATOutputType_None) return 0; + if(output_flag[i_txt_row] == STATOutputType::None) return 0; bool prob_flag = fcst_info->is_prob(); bool vect_flag = (fcst_info->is_u_wind() && obs_info->is_u_wind()); diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index cd79fa029e..fde469e92f 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -362,14 +362,14 @@ void ModeExecutive::setup_traditional_fcst_obs_data() // Mask out the missing data between fields - if(engine.conf_info.mask_missing_flag == FieldType_Fcst || - engine.conf_info.mask_missing_flag == FieldType_Both) + if(engine.conf_info.mask_missing_flag == FieldType::Fcst || + engine.conf_info.mask_missing_flag == FieldType::Both) mask_bad_data(Fcst_sd.data, Obs_sd.data); // Mask out the missing data between fields - if(engine.conf_info.mask_missing_flag == FieldType_Obs || - engine.conf_info.mask_missing_flag == FieldType_Both) + if(engine.conf_info.mask_missing_flag == FieldType::Obs || + engine.conf_info.mask_missing_flag == FieldType::Both) mask_bad_data(Obs_sd.data, Fcst_sd.data); // Parse the grid and/or polyline masks from the configuration @@ -984,9 +984,9 @@ void ModeExecutive::do_merging_multivar(const ShapeData &f_merge, // set the merge flag and merge_thresh appropriately ModeConfInfo & conf = engine.conf_info; SingleThresh s("ne-9999"); - conf.set_fcst_merge_flag(MergeType_Thresh); + conf.set_fcst_merge_flag(MergeType::Thresh); conf.set_fcst_merge_thresh(s); - conf.set_obs_merge_flag(MergeType_Thresh); + conf.set_obs_merge_flag(MergeType::Thresh); conf.set_obs_merge_thresh(s); } else if (p != MULTIVAR_INTENSITY) { mlog << Error << "\nModeExecutive::do_merging(shapedata, shapedata, p) -> " @@ -1069,7 +1069,7 @@ void ModeExecutive::process_masks(ShapeData & fcst_sd, ShapeData & obs_sd) << "Processing masking regions.\n"; // Parse the grid mask into a ShapeData object - if(engine.conf_info.mask_grid_flag != FieldType_None) { + if(engine.conf_info.mask_grid_flag != FieldType::None) { mlog << Debug(3) << "Processing grid mask: " << engine.conf_info.mask_grid_name << "\n"; @@ -1078,7 +1078,7 @@ void ModeExecutive::process_masks(ShapeData & fcst_sd, ShapeData & obs_sd) } // Parse the poly mask into a ShapeData object - if(engine.conf_info.mask_poly_flag != FieldType_None) { + if(engine.conf_info.mask_poly_flag != FieldType::None) { mlog << Debug(3) << "Processing poly mask: " << engine.conf_info.mask_poly_name << "\n"; @@ -1087,26 +1087,26 @@ void ModeExecutive::process_masks(ShapeData & fcst_sd, ShapeData & obs_sd) } // Apply the grid mask to the forecast field if requested - if(engine.conf_info.mask_grid_flag == FieldType_Fcst || - engine.conf_info.mask_grid_flag == FieldType_Both) { + if(engine.conf_info.mask_grid_flag == FieldType::Fcst || + engine.conf_info.mask_grid_flag == FieldType::Both) { apply_mask(fcst_sd, grid_mask_sd); } // Apply the grid mask to the observation field if requested - if(engine.conf_info.mask_grid_flag == FieldType_Obs || - engine.conf_info.mask_grid_flag == FieldType_Both) { + if(engine.conf_info.mask_grid_flag == FieldType::Obs || + engine.conf_info.mask_grid_flag == FieldType::Both) { apply_mask(obs_sd, grid_mask_sd); } // Apply the polyline mask to the forecast field if requested - if(engine.conf_info.mask_poly_flag == FieldType_Fcst || - engine.conf_info.mask_poly_flag == FieldType_Both) { + if(engine.conf_info.mask_poly_flag == FieldType::Fcst || + engine.conf_info.mask_poly_flag == FieldType::Both) { apply_mask(fcst_sd, poly_mask_sd); } // Apply the polyline mask to the observation field if requested - if(engine.conf_info.mask_poly_flag == FieldType_Obs || - engine.conf_info.mask_poly_flag == FieldType_Both) { + if(engine.conf_info.mask_poly_flag == FieldType::Obs || + engine.conf_info.mask_poly_flag == FieldType::Both) { apply_mask(obs_sd, poly_mask_sd); } @@ -1125,7 +1125,7 @@ void ModeExecutive::process_fcst_masks(ShapeData & fcst_sd) mlog << Debug(3) << "Processing masking regions.\n"; // Parse the grid mask into a ShapeData object - if(engine.conf_info.mask_grid_flag != FieldType_None) { + if(engine.conf_info.mask_grid_flag != FieldType::None) { mlog << Debug(3) << "Processing grid mask: " << engine.conf_info.mask_grid_name << "\n"; @@ -1134,7 +1134,7 @@ void ModeExecutive::process_fcst_masks(ShapeData & fcst_sd) } // Parse the poly mask into a ShapeData object - if(engine.conf_info.mask_poly_flag != FieldType_None) { + if(engine.conf_info.mask_poly_flag != FieldType::None) { mlog << Debug(3) << "Processing poly mask: " << engine.conf_info.mask_poly_name << "\n"; @@ -1143,14 +1143,14 @@ void ModeExecutive::process_fcst_masks(ShapeData & fcst_sd) } // Apply the grid mask to the forecast field if requested - if(engine.conf_info.mask_grid_flag == FieldType_Fcst || - engine.conf_info.mask_grid_flag == FieldType_Both) { + if(engine.conf_info.mask_grid_flag == FieldType::Fcst || + engine.conf_info.mask_grid_flag == FieldType::Both) { apply_mask(fcst_sd, grid_mask_sd); } // Apply the polyline mask to the forecast field if requested - if(engine.conf_info.mask_poly_flag == FieldType_Fcst || - engine.conf_info.mask_poly_flag == FieldType_Both) { + if(engine.conf_info.mask_poly_flag == FieldType::Fcst || + engine.conf_info.mask_poly_flag == FieldType::Both) { apply_mask(fcst_sd, poly_mask_sd); } @@ -1170,7 +1170,7 @@ void ModeExecutive::process_obs_masks(ShapeData & obs_sd) << "Processing masking regions.\n"; // Parse the grid mask into a ShapeData object - if(engine.conf_info.mask_grid_flag != FieldType_None) { + if(engine.conf_info.mask_grid_flag != FieldType::None) { mlog << Debug(3) << "Processing grid mask: " << engine.conf_info.mask_grid_name << "\n"; @@ -1179,7 +1179,7 @@ void ModeExecutive::process_obs_masks(ShapeData & obs_sd) } // Parse the poly mask into a ShapeData object - if(engine.conf_info.mask_poly_flag != FieldType_None) { + if(engine.conf_info.mask_poly_flag != FieldType::None) { mlog << Debug(3) << "Processing poly mask: " << engine.conf_info.mask_poly_name << "\n"; @@ -1188,14 +1188,14 @@ void ModeExecutive::process_obs_masks(ShapeData & obs_sd) } // Apply the grid mask to the observation field if requested - if(engine.conf_info.mask_grid_flag == FieldType_Obs || - engine.conf_info.mask_grid_flag == FieldType_Both) { + if(engine.conf_info.mask_grid_flag == FieldType::Obs || + engine.conf_info.mask_grid_flag == FieldType::Both) { apply_mask(obs_sd, grid_mask_sd); } // Apply the polyline mask to the observation field if requested - if(engine.conf_info.mask_poly_flag == FieldType_Obs || - engine.conf_info.mask_poly_flag == FieldType_Both) { + if(engine.conf_info.mask_poly_flag == FieldType::Obs || + engine.conf_info.mask_poly_flag == FieldType::Both) { apply_mask(obs_sd, poly_mask_sd); } @@ -1548,8 +1548,8 @@ void ModeExecutive::write_obj_stats() out.close(); - if(engine.conf_info.Fcst->merge_flag == MergeType_Both || - engine.conf_info.Fcst->merge_flag == MergeType_Engine) { + if(engine.conf_info.Fcst->merge_flag == MergeType::Both || + engine.conf_info.Fcst->merge_flag == MergeType::Engine) { // // Create output stats file for forecast merging @@ -1580,8 +1580,8 @@ void ModeExecutive::write_obj_stats() out.close(); } - if(engine.conf_info.Obs->merge_flag == MergeType_Both || - engine.conf_info.Obs->merge_flag == MergeType_Engine) { + if(engine.conf_info.Obs->merge_flag == MergeType::Both || + engine.conf_info.Obs->merge_flag == MergeType::Engine) { // // Create output stats file for observation merging diff --git a/src/tools/core/mode/mode_ps_file.cc b/src/tools/core/mode/mode_ps_file.cc index dd80209b01..605fea24e5 100644 --- a/src/tools/core/mode/mode_ps_file.cc +++ b/src/tools/core/mode/mode_ps_file.cc @@ -554,25 +554,25 @@ void ModePsFile::make_plot(bool isMultivarSuper) plot_engine(*Engine, FOEng, s.c_str()); - if ( (fcst_merge_flag == MergeType_Both) || (fcst_merge_flag == MergeType_Thresh) ) { + if ( (fcst_merge_flag == MergeType::Both) || (fcst_merge_flag == MergeType::Thresh) ) { plot_threshold_merging(*Engine, "Forecast: Threshold Merging", 1); } - if ( (fcst_merge_flag == MergeType_Both) || (fcst_merge_flag == MergeType_Engine) ) { + if ( (fcst_merge_flag == MergeType::Both) || (fcst_merge_flag == MergeType::Engine) ) { plot_engine(*(Engine->fcst_engine), FFEng, "Forecast: ModeFuzzyEngine Merging"); } - if ( (obs_merge_flag == MergeType_Both) || (obs_merge_flag == MergeType_Thresh) ) { + if ( (obs_merge_flag == MergeType::Both) || (obs_merge_flag == MergeType::Thresh) ) { plot_threshold_merging(*Engine, "Observation: Threshold Merging", 0); } - if ( (obs_merge_flag == MergeType_Both) || (obs_merge_flag == MergeType_Engine) ) { + if ( (obs_merge_flag == MergeType::Both) || (obs_merge_flag == MergeType::Engine) ) { plot_engine(*(Engine->obs_engine), OOEng, "Observation: ModeFuzzyEngine Merging"); diff --git a/src/tools/core/mode/multivar_frontend.cc b/src/tools/core/mode/multivar_frontend.cc index efffb4deaa..8941780df3 100644 --- a/src/tools/core/mode/multivar_frontend.cc +++ b/src/tools/core/mode/multivar_frontend.cc @@ -350,14 +350,14 @@ MultivarFrontEnd::create_intensity_comparisons(int findex, int oindex, // from pass1 conf.Fcst->var_info->set_level_name(mvdf._level.c_str()); conf.Fcst->var_info->set_units(mvdf._units.c_str()); - if (fsuper._hasUnion && conf.Fcst->merge_flag == MergeType_Thresh) { + if (fsuper._hasUnion && conf.Fcst->merge_flag == MergeType::Thresh) { mlog << Warning << "\nModeFrontEnd::multivar_intensity_comparisons() -> " << "Logic includes union '||' along with 'merge_flag=THRESH' " << ". This can lead to bad results\n\n"; } conf.Obs->var_info->set_level_name(mvdo._level.c_str()); conf.Obs->var_info->set_units(mvdo._units.c_str()); - if (osuper._hasUnion && conf.Obs->merge_flag == MergeType_Thresh) { + if (osuper._hasUnion && conf.Obs->merge_flag == MergeType::Thresh) { mlog << Warning << "\nModeFrontEnd::multivar_intensity_comparisons() -> " << "Logic includes union '||' along with 'merge_flag=THRESH' " << ". This can lead to bad results\n\n"; @@ -395,8 +395,8 @@ void MultivarFrontEnd::process_superobjects(ModeSuperObject &fsuper, ModeConfInfo & conf = mode_exec->engine.conf_info; if ((fsuper._hasUnion || osuper._hasUnion) && - (conf.Fcst->merge_flag == MergeType_Thresh || - conf.Obs->merge_flag == MergeType_Thresh)) { + (conf.Fcst->merge_flag == MergeType::Thresh || + conf.Obs->merge_flag == MergeType::Thresh)) { mlog << Warning << "\nModeFrontEnd::run_super() -> " << "Logic includes union '||' along with 'merge_flag=THRESH' " << ". This can lead to bad results\n\n"; diff --git a/src/tools/core/mode/page_1.cc b/src/tools/core/mode/page_1.cc index 5a87e97424..74b757f734 100644 --- a/src/tools/core/mode/page_1.cc +++ b/src/tools/core/mode/page_1.cc @@ -690,26 +690,26 @@ void ModePsFile::do_page_1_FOEng(ModeFuzzyEngine & eng, EngineType eng_type, con // Mask missing, grid, and polyline Flags // // write_centered_text(1, 1, Htab_a, text_y, 0.0, 0.5, "Mask M/G/P:"); - if(eng.conf_info.mask_missing_flag == FieldType_Both || - eng.conf_info.mask_missing_flag == FieldType_Fcst) tmp1_str = "on"; + if(eng.conf_info.mask_missing_flag == FieldType::Both || + eng.conf_info.mask_missing_flag == FieldType::Fcst) tmp1_str = "on"; else tmp1_str = "off"; - if(eng.conf_info.mask_grid_flag == FieldType_Both || - eng.conf_info.mask_grid_flag == FieldType_Fcst) tmp2_str = "on"; + if(eng.conf_info.mask_grid_flag == FieldType::Both || + eng.conf_info.mask_grid_flag == FieldType::Fcst) tmp2_str = "on"; else tmp2_str = "off"; - if(eng.conf_info.mask_grid_flag == FieldType_Both || - eng.conf_info.mask_grid_flag == FieldType_Fcst) tmp3_str = "on"; + if(eng.conf_info.mask_grid_flag == FieldType::Both || + eng.conf_info.mask_grid_flag == FieldType::Fcst) tmp3_str = "on"; else tmp3_str = "off"; label << cs_erase << tmp1_str << '/' << tmp2_str << '/' << tmp3_str; t.write_xy1_to_cell(r, 1, dx, dy, 0.0, 0.0, label.c_str()); - if(eng.conf_info.mask_missing_flag == FieldType_Both || - eng.conf_info.mask_missing_flag == FieldType_Obs) tmp1_str = "on"; + if(eng.conf_info.mask_missing_flag == FieldType::Both || + eng.conf_info.mask_missing_flag == FieldType::Obs) tmp1_str = "on"; else tmp1_str = "off"; - if(eng.conf_info.mask_grid_flag == FieldType_Both || - eng.conf_info.mask_grid_flag == FieldType_Obs) tmp2_str = "on"; + if(eng.conf_info.mask_grid_flag == FieldType::Both || + eng.conf_info.mask_grid_flag == FieldType::Obs) tmp2_str = "on"; else tmp2_str = "off"; - if(eng.conf_info.mask_grid_flag == FieldType_Both || - eng.conf_info.mask_grid_flag == FieldType_Obs) tmp3_str = "on"; + if(eng.conf_info.mask_grid_flag == FieldType::Both || + eng.conf_info.mask_grid_flag == FieldType::Obs) tmp3_str = "on"; else tmp3_str = "off"; label << cs_erase << tmp1_str << '/' << tmp2_str << '/' << tmp3_str; t.write_xy1_to_cell(r, 2, dx, dy, 0.0, 0.0, label.c_str()); @@ -792,15 +792,15 @@ void ModePsFile::do_page_1_FOEng(ModeFuzzyEngine & eng, EngineType eng_type, con // Merging flag // - if(eng.conf_info.Fcst->merge_flag == MergeType_Thresh) label = "thresh"; - else if(eng.conf_info.Fcst->merge_flag == MergeType_Engine) label = "engine"; - else if(eng.conf_info.Fcst->merge_flag == MergeType_Both) label = "thresh/engine"; + if(eng.conf_info.Fcst->merge_flag == MergeType::Thresh) label = "thresh"; + else if(eng.conf_info.Fcst->merge_flag == MergeType::Engine) label = "engine"; + else if(eng.conf_info.Fcst->merge_flag == MergeType::Both) label = "thresh/engine"; else label = "none"; t.write_xy1_to_cell(r, 1, dx, dy, 0.0, 0.0, label.c_str()); - if(eng.conf_info.Obs->merge_flag == MergeType_Thresh) label = "thresh"; - else if(eng.conf_info.Obs->merge_flag == MergeType_Engine) label = "engine"; - else if(eng.conf_info.Obs->merge_flag == MergeType_Both) label = "thresh/engine"; + if(eng.conf_info.Obs->merge_flag == MergeType::Thresh) label = "thresh"; + else if(eng.conf_info.Obs->merge_flag == MergeType::Engine) label = "engine"; + else if(eng.conf_info.Obs->merge_flag == MergeType::Both) label = "thresh/engine"; else label = "none"; t.write_xy1_to_cell(r, 2, dx, dy, 0.0, 0.0, label.c_str()); @@ -811,9 +811,9 @@ void ModePsFile::do_page_1_FOEng(ModeFuzzyEngine & eng, EngineType eng_type, con // Matching scheme // - if(eng.conf_info.match_flag == MatchType_MergeBoth) label = "match/merge"; - else if(eng.conf_info.match_flag == MatchType_MergeFcst) label = "match/fcst merge"; - else if(eng.conf_info.match_flag == MatchType_NoMerge) label = "match/no merge"; + if(eng.conf_info.match_flag == MatchType::MergeBoth) label = "match/merge"; + else if(eng.conf_info.match_flag == MatchType::MergeFcst) label = "match/fcst merge"; + else if(eng.conf_info.match_flag == MatchType::NoMerge) label = "match/no merge"; else label = "none"; t.write_xy1_to_cell(r, 2, 0.0, dy, 0.5, 0.0, label.c_str()); diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index d950486015..80d16a6145 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -442,7 +442,7 @@ void setup_txt_files() { for(int i=0; iseeps); write_seeps_row(shc, &pd_ptr->seeps, conf_info.vx_opt[i].output_flag[i_seeps], @@ -1096,10 +1096,10 @@ void process_scores() { // Compute CTS scores if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && conf_info.vx_opt[i].fcat_ta.n() > 0 && - (conf_info.vx_opt[i].output_flag[i_fho] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_fho] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_ctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_cts] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType::None)) { // Initialize for(m=0; mis_prob() && conf_info.vx_opt[i].fcat_ta.n() > 1 && - (conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType::None)) { // Initialize mcts_info.clear(); @@ -1159,7 +1159,7 @@ void process_scores() { do_mcts(mcts_info, i, pd_ptr); // Write out MCTC - if(conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_mctc] != STATOutputType::None && mcts_info.cts.total() > 0) { write_mctc_row(shc, mcts_info, @@ -1169,7 +1169,7 @@ void process_scores() { } // Write out MCTS - if(conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_mcts] != STATOutputType::None && mcts_info.cts.total() > 0) { write_mcts_row(shc, mcts_info, @@ -1181,9 +1181,9 @@ void process_scores() { // Compute CNT, SL1L2, and SAL1L2 scores if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_cnt] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_sal1l2] != STATOutputType::None)) { do_cnt_sl1l2(conf_info.vx_opt[i], pd_ptr); } @@ -1191,9 +1191,9 @@ void process_scores() { if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && conf_info.vx_opt[i].vx_pd.fcst_info->is_v_wind() && conf_info.vx_opt[i].vx_pd.fcst_info->uv_index() >= 0 && - (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None)) { // Store the forecast variable name shc.set_fcst_var(ugrd_vgrd_abbr_str); @@ -1233,7 +1233,7 @@ void process_scores() { for(m=0; m 0) { write_vl1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vl1l2], @@ -1242,7 +1242,7 @@ void process_scores() { } // Write out VAL1L2 - if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType::None && vl1l2_info[m].vacount > 0) { write_val1l2_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_val1l2], @@ -1251,7 +1251,7 @@ void process_scores() { } // Write out VCNT - if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None && + if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType::None && vl1l2_info[m].vcount > 0) { write_vcnt_row(shc, vl1l2_info[m], conf_info.vx_opt[i].output_flag[i_vcnt], @@ -1271,11 +1271,11 @@ void process_scores() { // Compute PCT counts and scores if(conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && - (conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_eclv] != STATOutputType::None)) { do_pct(conf_info.vx_opt[i], pd_ptr); } @@ -1287,8 +1287,8 @@ void process_scores() { // Apply HiRA ensemble verification logic if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && conf_info.vx_opt[i].hira_info.flag && - (conf_info.vx_opt[i].output_flag[i_ecnt] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_rps] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_ecnt] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_rps] != STATOutputType::None)) { pd_ptr = &conf_info.vx_opt[i].vx_pd.pd[j][k][0]; @@ -1303,11 +1303,11 @@ void process_scores() { // Apply HiRA probabilistic verification logic if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() && conf_info.vx_opt[i].hira_info.flag && - (conf_info.vx_opt[i].output_flag[i_mpr] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType_None || - conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType_None)) { + (conf_info.vx_opt[i].output_flag[i_mpr] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pct] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pstd] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_pjc] != STATOutputType::None || + conf_info.vx_opt[i].output_flag[i_prc] != STATOutputType::None)) { pd_ptr = &conf_info.vx_opt[i].vx_pd.pd[j][k][0]; @@ -1365,11 +1365,11 @@ void do_cts(CTSInfo *&cts_info, int i_vx, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and bootstrap // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == boot_bca_flag) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { compute_cts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, cts_info, n_cat, - conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -1378,7 +1378,7 @@ void do_cts(CTSInfo *&cts_info, int i_vx, const PairDataPoint *pd_ptr) { conf_info.vx_opt[i_vx].boot_info.n_rep, conf_info.vx_opt[i_vx].boot_info.rep_prop, cts_info, n_cat, - conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_cts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -1416,11 +1416,11 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and bootstrap // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == boot_bca_flag) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { compute_mcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, mcts_info, - conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -1429,7 +1429,7 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, const PairDataPoint *pd_ptr) { conf_info.vx_opt[i_vx].boot_info.n_rep, conf_info.vx_opt[i_vx].boot_info.rep_prop, mcts_info, - conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType_None, + conf_info.vx_opt[i_vx].output_flag[i_mcts] != STATOutputType::None, conf_info.vx_opt[i_vx].rank_corr_flag, conf_info.tmp_dir.c_str()); } @@ -1458,9 +1458,9 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Set flags - bool do_sl1l2 = (vx_opt.output_flag[i_sl1l2] != STATOutputType_None || - vx_opt.output_flag[i_sal1l2] != STATOutputType_None); - bool do_cnt = (vx_opt.output_flag[i_cnt] != STATOutputType_None); + bool do_sl1l2 = (vx_opt.output_flag[i_sl1l2] != STATOutputType::None || + vx_opt.output_flag[i_sal1l2] != STATOutputType::None); + bool do_cnt = (vx_opt.output_flag[i_cnt] != STATOutputType::None); bool precip_flag = (vx_opt.vx_pd.fcst_info->is_precipitation() && vx_opt.vx_pd.obs_info->is_precipitation()); @@ -1507,7 +1507,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out SL1L2 if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_sl1l2] != STATOutputType_None && + vx_opt.output_flag[i_sl1l2] != STATOutputType::None && sl1l2_info[j].scount > 0) { write_sl1l2_row(shc, sl1l2_info[j], @@ -1518,7 +1518,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out SAL1L2 if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_sal1l2] != STATOutputType_None && + vx_opt.output_flag[i_sal1l2] != STATOutputType::None && sl1l2_info[j].sacount > 0) { write_sal1l2_row(shc, sl1l2_info[j], @@ -1560,7 +1560,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out CNT if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_cnt] != STATOutputType_None && + vx_opt.output_flag[i_cnt] != STATOutputType::None && cnt_info[j].n > 0) { write_cnt_row(shc, cnt_info[j], @@ -1574,14 +1574,14 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { if(n_bin > 1) { // Compute SL1L2 climo CDF bin means - if(vx_opt.output_flag[i_sl1l2] != STATOutputType_None || - vx_opt.output_flag[i_sal1l2] != STATOutputType_None) { + if(vx_opt.output_flag[i_sl1l2] != STATOutputType::None || + vx_opt.output_flag[i_sal1l2] != STATOutputType::None) { SL1L2Info sl1l2_mean; compute_sl1l2_mean(sl1l2_info, n_bin, sl1l2_mean); // Write out SL1L2 - if(vx_opt.output_flag[i_sl1l2] != STATOutputType_None && + if(vx_opt.output_flag[i_sl1l2] != STATOutputType::None && sl1l2_mean.scount > 0) { write_sl1l2_row(shc, sl1l2_mean, @@ -1591,7 +1591,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Write out SAL1L2 - if(vx_opt.output_flag[i_sal1l2] != STATOutputType_None && + if(vx_opt.output_flag[i_sal1l2] != STATOutputType::None && sl1l2_mean.sacount > 0) { write_sal1l2_row(shc, sl1l2_mean, @@ -1602,7 +1602,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Compute CNT climo CDF bin means - if(vx_opt.output_flag[i_cnt] != STATOutputType_None) { + if(vx_opt.output_flag[i_cnt] != STATOutputType::None) { CNTInfo cnt_mean; compute_cnt_mean(cnt_info, n_bin, cnt_mean); @@ -1720,14 +1720,14 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { } // Compute the probabilistic counts and statistics - compute_pctinfo(pd, vx_opt.output_flag[i_pstd], pct_info[j]); + compute_pctinfo(pd, (STATOutputType::None!=vx_opt.output_flag[i_pstd]), pct_info[j]); // Check for no matched pairs to process if(pd.n_obs == 0) continue; // Write out PCT if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pct] != STATOutputType_None) { + vx_opt.output_flag[i_pct] != STATOutputType::None) { write_pct_row(shc, pct_info[j], vx_opt.output_flag[i_pct], j, n_bin, stat_at, i_stat_row, @@ -1736,7 +1736,7 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PSTD if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pstd] != STATOutputType_None) { + vx_opt.output_flag[i_pstd] != STATOutputType::None) { write_pstd_row(shc, pct_info[j], vx_opt.output_flag[i_pstd], j, n_bin, stat_at, i_stat_row, @@ -1745,7 +1745,7 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PJC if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_pjc] != STATOutputType_None) { + vx_opt.output_flag[i_pjc] != STATOutputType::None) { write_pjc_row(shc, pct_info[j], vx_opt.output_flag[i_pjc], j, n_bin, stat_at, i_stat_row, @@ -1754,7 +1754,7 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out PRC if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_prc] != STATOutputType_None) { + vx_opt.output_flag[i_prc] != STATOutputType::None) { write_prc_row(shc, pct_info[j], vx_opt.output_flag[i_prc], j, n_bin, stat_at, i_stat_row, @@ -1763,7 +1763,7 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Write out ECLV if((n_bin == 1 || vx_opt.cdf_info.write_bins) && - vx_opt.output_flag[i_eclv] != STATOutputType_None) { + vx_opt.output_flag[i_eclv] != STATOutputType::None) { write_eclv_row(shc, pct_info[j], vx_opt.eclv_points, vx_opt.output_flag[i_eclv], j, n_bin, stat_at, i_stat_row, @@ -1778,7 +1778,7 @@ void do_pct(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { compute_pct_mean(pct_info, n_bin, pct_mean); // Write out PSTD - if(vx_opt.output_flag[i_pstd] != STATOutputType_None) { + if(vx_opt.output_flag[i_pstd] != STATOutputType::None) { write_pstd_row(shc, pct_mean, vx_opt.output_flag[i_pstd], -1, n_bin, stat_at, i_stat_row, @@ -1893,7 +1893,7 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { hira_pd.compute_pair_vals(rng_ptr); // Write out the ECNT line - if(conf_info.vx_opt[i_vx].output_flag[i_ecnt] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_ecnt] != STATOutputType::None) { // Compute ensemble statistics ECNTInfo ecnt_info; @@ -1906,7 +1906,7 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { } // end if ECNT // Write out the ORANK line - if(conf_info.vx_opt[i_vx].output_flag[i_orank] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_orank] != STATOutputType::None) { write_orank_row(shc, &hira_pd, conf_info.vx_opt[i_vx].output_flag[i_orank], @@ -1919,7 +1919,7 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { } // end if ORANK // Write out the RPS line - if(conf_info.vx_opt[i_vx].output_flag[i_rps] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_rps] != STATOutputType::None) { // Store ensemble RPS thresholds RPSInfo rps_info; @@ -2085,17 +2085,17 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { } // Compute the probabilistic counts and statistics - compute_pctinfo(hira_pd, conf_info.vx_opt[i_vx].output_flag[i_pstd], + compute_pctinfo(hira_pd, (STATOutputType::None!=conf_info.vx_opt[i_vx].output_flag[i_pstd]), pct_info, &cmn_cov_na); // Set the contents of the output threshold columns shc.set_fcst_thresh (conf_info.vx_opt[i_vx].fcat_ta[i]); shc.set_obs_thresh (conf_info.vx_opt[i_vx].ocat_ta[i]); - shc.set_thresh_logic(SetLogic_None); + shc.set_thresh_logic(SetLogic::None); shc.set_cov_thresh (na_str); // Write out the MPR lines - if(conf_info.vx_opt[i_vx].output_flag[i_mpr] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_mpr] != STATOutputType::None) { write_mpr_row(shc, &hira_pd, conf_info.vx_opt[i_vx].output_flag[i_mpr], stat_at, i_stat_row, @@ -2110,7 +2110,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { shc.set_cov_thresh(conf_info.vx_opt[i_vx].hira_info.cov_ta); // Write out PCT - if(conf_info.vx_opt[i_vx].output_flag[i_pct] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_pct] != STATOutputType::None) { write_pct_row(shc, pct_info, conf_info.vx_opt[i_vx].output_flag[i_pct],1, 1, stat_at, i_stat_row, @@ -2118,7 +2118,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { } // Write out PSTD - if(conf_info.vx_opt[i_vx].output_flag[i_pstd] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_pstd] != STATOutputType::None) { write_pstd_row(shc, pct_info, conf_info.vx_opt[i_vx].output_flag[i_pstd], 1, 1, stat_at, i_stat_row, @@ -2126,7 +2126,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { } // Write out PJC - if(conf_info.vx_opt[i_vx].output_flag[i_pjc] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_pjc] != STATOutputType::None) { write_pjc_row(shc, pct_info, conf_info.vx_opt[i_vx].output_flag[i_pjc], 1, 1, stat_at, i_stat_row, @@ -2134,7 +2134,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { } // Write out PRC - if(conf_info.vx_opt[i_vx].output_flag[i_prc] != STATOutputType_None) { + if(conf_info.vx_opt[i_vx].output_flag[i_prc] != STATOutputType::None) { write_prc_row(shc, pct_info, conf_info.vx_opt[i_vx].output_flag[i_prc], 1, 1, stat_at, i_stat_row, @@ -2163,7 +2163,7 @@ void finish_txt_files() { for(i=0; iis_prob() && - (output_flag[i_mctc] != STATOutputType_None || - output_flag[i_mcts] != STATOutputType_None)) { + (output_flag[i_mctc] != STATOutputType::None || + output_flag[i_mcts] != STATOutputType::None)) { check_mctc_thresh(fcat_ta); check_mctc_thresh(ocat_ta); } @@ -1168,8 +1168,8 @@ void PointStatVxOpt::set_vx_pd(PointStatConfInfo *conf_info) { vx_pd.set_duplicate_flag(duplicate_flag); vx_pd.set_obs_summary(obs_summary); vx_pd.set_obs_perc_value(obs_perc); - if (output_flag[i_seeps_mpr] != STATOutputType_None - || output_flag[i_seeps] != STATOutputType_None) { + if (output_flag[i_seeps_mpr] != STATOutputType::None + || output_flag[i_seeps] != STATOutputType::None) { vx_pd.load_seeps_climo(); vx_pd.set_seeps_thresh(seeps_p1_thresh); } @@ -1223,7 +1223,7 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { } // Check if this output line type is requested - if(output_flag[i_txt_row] == STATOutputType_None) return 0; + if(output_flag[i_txt_row] == STATOutputType::None) return 0; bool prob_flag = vx_pd.fcst_info->is_prob(); bool vect_flag = vx_pd.fcst_info->is_v_wind() && diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.cc b/src/tools/core/series_analysis/series_analysis_conf_info.cc index 309f82d4c1..6e79c25863 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -67,7 +67,7 @@ void SeriesAnalysisConfInfo::clear() { ocat_ta.clear(); fcnt_ta.clear(); ocnt_ta.clear(); - cnt_logic = SetLogic_None; + cnt_logic = SetLogic::None; cdf_info.clear(); ci_alpha.clear(); boot_interval = BootIntervalType_None; diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index 827662caf8..27d868d78b 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -401,13 +401,13 @@ void process_scores() { << " versus " << conf_info.obs_info[i]->magic_str() << ".\n"; // Mask out the missing data between fields - if(conf_info.mask_missing_flag == FieldType_Fcst || - conf_info.mask_missing_flag == FieldType_Both) + if(conf_info.mask_missing_flag == FieldType::Fcst || + conf_info.mask_missing_flag == FieldType::Both) mask_bad_data(fcst_dp, obs_dp); // Mask out the missing data between fields - if(conf_info.mask_missing_flag == FieldType_Obs || - conf_info.mask_missing_flag == FieldType_Both) + if(conf_info.mask_missing_flag == FieldType::Obs || + conf_info.mask_missing_flag == FieldType::Both) mask_bad_data(obs_dp, fcst_dp); // Get the fill data value to be used for each field @@ -426,7 +426,7 @@ void process_scores() { fill_bad_data(obs_dp_fill, obs_fill); // Pad the fields out to the nearest power of two if requested - if(conf_info.grid_decomp_flag == GridDecompType_Pad) { + if(conf_info.grid_decomp_flag == GridDecompType::Pad) { mlog << Debug(2) << "Padding the fields out to the nearest integer " << "power of two.\n"; pad_field(fcst_dp_fill, fcst_fill); @@ -459,7 +459,7 @@ void process_scores() { get_tile(fcst_dp_fill, obs_dp_fill, i, j, f_na, o_na); // Compute Intensity-Scale scores - if(conf_info.output_flag[i_isc] != STATOutputType_None) { + if(conf_info.output_flag[i_isc] != STATOutputType::None) { // Do the intensity-scale decomposition do_intensity_scale(f_na, o_na, isc_info[j], i, j); @@ -599,7 +599,7 @@ void setup_txt_files(unixtime valid_ut, int lead_sec) { // ///////////////////////////////////////////////////////////////////// - if(conf_info.output_flag[i_isc] != STATOutputType_None) { + if(conf_info.output_flag[i_isc] != STATOutputType::None) { // Initialize file stream @@ -1887,7 +1887,7 @@ void close_out_files() { // Write out the contents of the ISC AsciiTable and // close the ISC output files - if(conf_info.output_flag[i_isc] == STATOutputType_Both) { + if(conf_info.output_flag[i_isc] == STATOutputType::Both) { if(isc_out) { *isc_out << isc_at; close_txt_file(isc_out, isc_file.c_str()); @@ -2745,7 +2745,7 @@ void draw_tiles(PSfile *p, Box &dim, for(i=tile_start; i<=tile_end; i++) { // If padding was performed, the tile is the size of the domain - if(conf_info.grid_decomp_flag == GridDecompType_Pad) { + if(conf_info.grid_decomp_flag == GridDecompType::Pad) { tile_bb = dim; } // Find the lower-left and upper-right corners of the tile 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 4529fe0423..f8ad83eb9a 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -72,13 +72,13 @@ void WaveletStatConfInfo::clear() { model.clear(); desc.clear(); obtype.clear(); - mask_missing_flag = FieldType_None; - grid_decomp_flag = GridDecompType_None; + mask_missing_flag = FieldType::None; + grid_decomp_flag = GridDecompType::None; tile_dim = 0; tile_xll.clear(); tile_yll.clear(); pad_bb.set_llwh(0.0, 0.0, 0.0, 0.0); - wvlt_type = WaveletType_None; + wvlt_type = WaveletType::None; // nc_pairs_flag = false; nc_info.set_all_true(); ps_plot_flag = false; @@ -86,7 +86,7 @@ void WaveletStatConfInfo::clear() { output_prefix.clear(); version.clear(); - for(i=0; i " - << "Unsupported wavelet type value of " << wvlt_type << ".\n\n"; + << "Unsupported wavelet type value of " << enum_class_as_integer(wvlt_type) << ".\n\n"; exit(1); } @@ -349,8 +349,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 @@ -359,8 +359,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 @@ -369,8 +369,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 && @@ -383,10 +383,10 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, } break; - case(WaveletType_None): + case(WaveletType::None): default: mlog << Error << "\nWaveletStatConfInfo::process_config() -> " - << "Unsupported wavelet type value of " << wvlt_type << ".\n\n"; + << "Unsupported wavelet type value of " << enum_class_as_integer(wvlt_type) << ".\n\n"; exit(1); } @@ -510,7 +510,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()); @@ -527,7 +527,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(); @@ -546,7 +546,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()); @@ -561,11 +561,11 @@ 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 " - << grid_decomp_flag << ".\n\n"; + << enum_class_as_integer(grid_decomp_flag) << ".\n\n"; exit(1); } // end switch diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 36e54bb45e..4f1fbd4837 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -1347,17 +1347,17 @@ DataPlane combine(const DataPlane &dp_data, const DataPlane &dp_mask, switch(logic) { - case SetLogic_Union: + case SetLogic::Union: if(v_data || v_mask) v = mask_val; else v = 0.0; break; - case SetLogic_Intersection: + case SetLogic::Intersection: if(v_data && v_mask) v = mask_val; else v = 0.0; break; - case SetLogic_SymDiff: + case SetLogic::SymDiff: if((v_data && !v_mask) || (!v_data && v_mask)) v = mask_val; else v = 0.0; break; @@ -1380,10 +1380,10 @@ DataPlane combine(const DataPlane &dp_data, const DataPlane &dp_mask, } // end for x // List the number of points inside the mask - if(logic != SetLogic_None) { + if(logic != SetLogic::None) { mlog << Debug(3) << "Mask " << setlogic_to_string(logic) - << (logic == SetLogic_Intersection ? ":\t" : ":\t\t") + << (logic == SetLogic::Intersection ? ":\t" : ":\t\t") << n_in << " of " << grid.nx() * grid.ny() << " points inside\n"; } @@ -1703,19 +1703,19 @@ void set_complement(const StringArray & a) { //////////////////////////////////////////////////////////////////////// void set_union(const StringArray & a) { - set_logic = SetLogic_Union; + set_logic = SetLogic::Union; } //////////////////////////////////////////////////////////////////////// void set_intersection(const StringArray & a) { - set_logic = SetLogic_Intersection; + set_logic = SetLogic::Intersection; } //////////////////////////////////////////////////////////////////////// void set_symdiff(const StringArray & a) { - set_logic = SetLogic_SymDiff; + set_logic = SetLogic::SymDiff; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.h b/src/tools/other/gen_vx_mask/gen_vx_mask.h index 8ab03376a7..e6f985808c 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.h +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.h @@ -97,7 +97,7 @@ static bool type_is_set = false; // Optional arguments static ConcatString input_field_str, mask_field_str; -static SetLogic set_logic = SetLogic_None; +static SetLogic set_logic = SetLogic::None; static bool complement = false; static SingleThresh thresh; static int height = bad_data_double; diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index f804116648..87f263b68b 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -222,8 +222,8 @@ void process_command_line(int argc, char **argv) { &data_grid, &data_grid); // The regrid.to_grid option cannot be set to FCST or OBS - if(conf_info.data_info[0]->regrid().field == FieldType_Fcst || - conf_info.data_info[0]->regrid().field == FieldType_Obs) { + if(conf_info.data_info[0]->regrid().field == FieldType::Fcst || + conf_info.data_info[0]->regrid().field == FieldType::Obs) { mlog << Error << "\nprocess_command_line() -> " << "the \"regrid.to_grid\" configuration option cannot be set to " << "FCST or OBS!\nSpecify a named grid, grid specification string, " diff --git a/src/tools/other/mode_time_domain/mtd_config_info.cc b/src/tools/other/mode_time_domain/mtd_config_info.cc index 5fc84a1eb7..97b9d90e29 100644 --- a/src/tools/other/mode_time_domain/mtd_config_info.cc +++ b/src/tools/other/mode_time_domain/mtd_config_info.cc @@ -91,7 +91,7 @@ void MtdConfigInfo::clear() do_2d_att_ascii = true; do_3d_att_ascii = true; - mask_missing_flag = FieldType_None; + mask_missing_flag = FieldType::None; fcst_conv_radius = bad_data_int; obs_conv_radius = bad_data_int; @@ -111,18 +111,18 @@ void MtdConfigInfo::clear() fcst_merge_thresh.clear(); obs_merge_thresh.clear(); - fcst_merge_flag = MergeType_None; - obs_merge_flag = MergeType_None; + fcst_merge_flag = MergeType::None; + obs_merge_flag = MergeType::None; - match_flag = MatchType_None; + match_flag = MatchType::None; max_centroid_dist = bad_data_double; mask_grid_name.clear(); - mask_grid_flag = FieldType_None; + mask_grid_flag = FieldType::None; mask_poly_name.clear(); - mask_poly_flag = FieldType_None; + mask_poly_flag = FieldType::None; space_centroid_dist_wt = bad_data_double; time_centroid_delta_wt = bad_data_double; @@ -375,8 +375,8 @@ void MtdConfigInfo::process_config(GrdFileType ftype, GrdFileType otype) // Check that match_flag is set between 0 and 3 /* - if(match_flag == MatchType_None && - (fcst_merge_flag != MergeType_None || obs_merge_flag != MergeType_None) ) { + if(match_flag == MatchType::None && + (fcst_merge_flag != MergeType::None || obs_merge_flag != MergeType::None) ) { mlog << Warning << "\nMtdConfigInfo::process_config() -> " << "When matching is disabled (match_flag = " << matchtype_to_string(match_flag) @@ -458,7 +458,7 @@ void MtdConfigInfo::process_config(GrdFileType ftype, GrdFileType otype) + start_time_delta_wt + end_time_delta_wt; - if(match_flag != MatchType_None && + if(match_flag != MatchType::None && is_eq( sum, 0.0)) { mlog << Error << "\nMtdConfigInfo::process_config() -> " << "When matching is requested, the sum of the fuzzy engine " diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index fe8e7dafe8..64b6690ecd 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -238,7 +238,7 @@ void process_command_line(int argc, char **argv) { // Set default regridding options RGInfo.enable = true; - RGInfo.field = FieldType_None; + RGInfo.field = FieldType::None; RGInfo.method = DefaultInterpMthd; RGInfo.width = DefaultInterpWdth; RGInfo.vld_thresh = DefaultVldThresh; diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index de5961ae49..396b30633c 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -139,7 +139,7 @@ void process_command_line(int argc, char **argv) { // Set default regridding options RGInfo.enable = true; - RGInfo.field = FieldType_None; + RGInfo.field = FieldType::None; RGInfo.method = DefaultInterpMthd; RGInfo.width = DefaultInterpWdth; RGInfo.gaussian.dx = default_gaussian_dx; diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index 9afc59a3d9..7ad2078807 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -1743,7 +1743,7 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) { for(i=0, stat_rows=0, stat_cols=0; iVxMaskName.c_str()); // Write out FHO - if(gci.VxOpt->output_map(stat_fho) != STATOutputType_None) { + if(gci.VxOpt->output_map(stat_fho) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { shc.set_fcst_var(genesis_dev_name); @@ -1992,7 +1992,7 @@ void write_ctc_stats(const PairDataGenesis &gpd, } // Write out CTC - if(gci.VxOpt->output_map(stat_ctc) != STATOutputType_None) { + if(gci.VxOpt->output_map(stat_ctc) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { shc.set_fcst_var(genesis_dev_name); @@ -2014,7 +2014,7 @@ void write_ctc_stats(const PairDataGenesis &gpd, } // Write out CTS - if(gci.VxOpt->output_map(stat_cts) != STATOutputType_None) { + if(gci.VxOpt->output_map(stat_cts) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { gci.CTSDev.compute_stats(); @@ -2042,7 +2042,7 @@ void write_ctc_stats(const PairDataGenesis &gpd, } // Write out GENMPR - if(gci.VxOpt->output_map(stat_genmpr) != STATOutputType_None) { + if(gci.VxOpt->output_map(stat_genmpr) != STATOutputType::None) { shc.set_fcst_var(genesis_name); shc.set_obs_var (genesis_name); write_ctc_genmpr_row(shc, gpd, @@ -2096,7 +2096,7 @@ void write_ctc_genmpr_row(StatHdrColumns &shc, write_ctc_genmpr_cols(gpd, i, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -2219,7 +2219,7 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { shc.set_obs_valid_end(pgi.BestEnd); // Write PCT output - if(pgi.VxOpt->output_map(stat_pct) != STATOutputType_None) { + if(pgi.VxOpt->output_map(stat_pct) != STATOutputType::None) { write_pct_row(shc, pgi.PCTMap[lead_hr], pgi.VxOpt->output_map(stat_pct), 1, 1, stat_at, i_stat_row, @@ -2227,7 +2227,7 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { } // Write PSTD output - if(pgi.VxOpt->output_map(stat_pstd) != STATOutputType_None) { + if(pgi.VxOpt->output_map(stat_pstd) != STATOutputType::None) { pgi.PCTMap[lead_hr].compute_stats(); pgi.PCTMap[lead_hr].compute_ci(); write_pstd_row(shc, pgi.PCTMap[lead_hr], @@ -2237,7 +2237,7 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { } // Write PJC output - if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType_None) { + if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType::None) { write_pjc_row(shc, pgi.PCTMap[lead_hr], pgi.VxOpt->output_map(stat_pjc), 1, 1, stat_at, i_stat_row, @@ -2245,7 +2245,7 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { } // Write PRC output - if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType_None) { + if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType::None) { write_prc_row(shc, pgi.PCTMap[lead_hr], pgi.VxOpt->output_map(stat_prc), 1, 1, stat_at, i_stat_row, @@ -2253,7 +2253,7 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { } // Write out GENMPR - if(pgi.VxOpt->output_map(stat_genmpr) != STATOutputType_None) { + if(pgi.VxOpt->output_map(stat_genmpr) != STATOutputType::None) { write_pct_genmpr_row(shc, pgi, lead_hr, pgi.VxOpt->output_map(stat_genmpr), stat_at, i_stat_row, @@ -2308,7 +2308,7 @@ void write_pct_genmpr_row(StatHdrColumns &shc, stat_at, stat_row, n_header_columns); // If requested, copy row to the text file - if(out_type == STATOutputType_Both) { + if(out_type == STATOutputType::Both) { copy_ascii_table_row(stat_at, stat_row, txt_at, txt_row); // Increment the text row counter @@ -2565,7 +2565,7 @@ void finish_txt_files() { for(i=0; i=30.0"); From 0a771d48c2c0e4c0df603f6f072caabee3ace61b Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 22 Mar 2024 18:23:49 -0600 Subject: [PATCH 32/72] Feature #2830 bootstrap enum (#2843) --- src/basic/vx_config/config_constants.h | 12 ++++--- src/basic/vx_config/config_util.cc | 36 +++++++++++++++++-- src/basic/vx_config/config_util.h | 3 ++ src/basic/vx_util/util_constants.h | 4 --- src/libcode/vx_analysis_util/stat_job.cc | 8 ++--- src/libcode/vx_analysis_util/stat_job.h | 3 +- src/tools/core/grid_stat/grid_stat.cc | 10 +++--- src/tools/core/point_stat/point_stat.cc | 6 ++-- .../core/series_analysis/series_analysis.cc | 6 ++-- .../series_analysis_conf_info.cc | 2 +- .../core/stat_analysis/aggr_stat_line.cc | 8 ++--- .../core/stat_analysis/stat_analysis_job.cc | 2 +- 12 files changed, 64 insertions(+), 36 deletions(-) diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index e7f872f6b5..344e7295dc 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -50,7 +50,7 @@ enum class FieldType { // Enumeration for set logic // -enum class SetLogic { +enum class SetLogic { None, // Default Union, // Union Intersection, // Intersection @@ -256,12 +256,14 @@ struct TimeSummaryInfo { // Enumeration for bootstrapping interval configuration parameter // -enum BootIntervalType { - BootIntervalType_None, // Default - BootIntervalType_BCA, // Bias-Corrected and adjusted method - BootIntervalType_Percentile // Percentile method +enum class BootIntervalType { + None, // Default + BCA, // Bias-Corrected and adjusted method + PCTile // Percentile method }; +//////////////////////////////////////////////////////////////////////// + // // Struct to store bootstrapping information // diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 1eec001151..6f1bf64021 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -1268,7 +1268,7 @@ BootInfo & BootInfo::operator=(const BootInfo &a) noexcept { /////////////////////////////////////////////////////////////////////////////// void BootInfo::clear() { - interval = BootIntervalType_None; + interval = BootIntervalType::None; rep_prop = bad_data_double; n_rep = 0; rng.clear(); @@ -1292,8 +1292,12 @@ BootInfo parse_conf_boot(Dictionary *dict) { v = dict->lookup_int(conf_key_boot_interval); // Convert integer to enumerated BootIntervalType - if(v == conf_const.lookup_int(conf_val_bca)) info.interval = BootIntervalType_BCA; - else if(v == conf_const.lookup_int(conf_val_pctile)) info.interval = BootIntervalType_Percentile; + if(v == conf_const.lookup_int(conf_val_bca)) { + info.interval = BootIntervalType::BCA; + } + else if(v == conf_const.lookup_int(conf_val_pctile)) { + info.interval = BootIntervalType::PCTile; + } else { mlog << Error << "\nparse_conf_boot() -> " << "Unexpected config file value of " << v << " for \"" @@ -2731,6 +2735,32 @@ STATLineType string_to_statlinetype(const char *s) { /////////////////////////////////////////////////////////////////////////////// +const char * bootintervaltype_to_string(const BootIntervalType t) { + const char *s = (const char *) nullptr; + + switch(t) { + case(BootIntervalType::BCA): s = conf_val_bca; break; + case(BootIntervalType::PCTile): s = conf_val_pctile; break; + default: s = conf_val_none; break; + } + + return s; +} + +/////////////////////////////////////////////////////////////////////////////// + +BootIntervalType string_to_bootintervaltype(const char *s) { + BootIntervalType t; + + if(strcasecmp(s, conf_val_bca) == 0) t = BootIntervalType::BCA; + else if(strcasecmp(s, conf_val_pctile) == 0) t = BootIntervalType::PCTile; + else t = BootIntervalType::None; + + return t; +} + +/////////////////////////////////////////////////////////////////////////////// + FieldType int_to_fieldtype(int v) { FieldType t = FieldType::None; diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index 316c8eb14a..4ca142903d 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -105,6 +105,9 @@ extern const char * statlinetype_to_string(const STATLineType); extern void statlinetype_to_string(const STATLineType, char *); extern STATLineType string_to_statlinetype(const char *); +extern const char * bootintervaltype_to_string(const BootIntervalType); +extern BootIntervalType string_to_bootintervaltype(const char *); + extern FieldType int_to_fieldtype(int); extern ConcatString fieldtype_to_string(FieldType); diff --git a/src/basic/vx_util/util_constants.h b/src/basic/vx_util/util_constants.h index f80be6f21c..e2520efd18 100644 --- a/src/basic/vx_util/util_constants.h +++ b/src/basic/vx_util/util_constants.h @@ -95,10 +95,6 @@ static const char ws_reg_exp[] = "[ \t\r\n]"; static const char ws_line_reg_exp[] = "^[ \t\r\n]*$"; static const char sep_str[] = "--------------------------------------------------------------------------------"; -// Bootstrap methods -static const int boot_bca_flag = 0; -static const int boot_perc_flag = 1; - //////////////////////////////////////////////////////////////////////// static const int max_line_len = 2048; diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index c36758f8db..e65db03548 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -199,7 +199,7 @@ void STATAnalysisJob::clear() { out_wind_logic = SetLogic::Union; out_alpha = bad_data_double; - boot_interval = bad_data_int; + boot_interval = BootIntervalType::None; boot_rep_prop = bad_data_double; n_boot_rep = bad_data_int; @@ -621,7 +621,7 @@ void STATAnalysisJob::dump(ostream & out, int depth) const { << swing_width << "\n"; out << prefix << "boot_interval = " - << boot_interval << "\n"; + << bootintervaltype_to_string(boot_interval) << "\n"; out << prefix << "boot_rep_prop = " << boot_rep_prop << "\n"; @@ -1592,7 +1592,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { i++; } else if(jc_array[i] == "-boot_interval") { - boot_interval = atoi(jc_array[i+1].c_str()); + boot_interval = string_to_bootintervaltype(jc_array[i+1].c_str()); i++; } else if(jc_array[i] == "-boot_rep_prop") { @@ -2821,7 +2821,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { out_line_type.has(stat_nbrcnt_str))) { // Bootstrap Information - js << "-boot_interval " << boot_interval << " "; + js << "-boot_interval " << bootintervaltype_to_string(boot_interval) << " "; js << "-boot_rep_prop " << boot_rep_prop << " "; js << "-n_boot_rep " << n_boot_rep << " "; js << "-boot_rng " << boot_rng << " "; diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index e88ba5b1d8..36d00c8dfa 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -305,9 +305,8 @@ class STATAnalysisJob { // // Type of bootstrap confidence interval method: - // 0 = BCA, 1 = Percentile (Default = 1) // - int boot_interval; + BootIntervalType boot_interval; // // When using the percentile method, this is the proportion diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index 752a4bcfcb..86c99906a3 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -1988,7 +1988,7 @@ void do_cts(CTSInfo *&cts_info, int i_vx, // Compute the counts, stats, normal confidence intervals, and // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_cts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, cts_info, n_cts, @@ -2037,7 +2037,7 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, // Compute the counts, stats, normal confidence intervals, and // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_mcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, mcts_info, @@ -2164,7 +2164,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and // bootstrap confidence intervals - if(vx_opt.boot_info.interval == BootIntervalType_BCA) { + if(vx_opt.boot_info.interval == BootIntervalType::BCA) { compute_cnt_stats_ci_bca(rng_ptr, pd, precip_flag, vx_opt.rank_corr_flag, vx_opt.boot_info.n_rep, @@ -2469,7 +2469,7 @@ void do_nbrcts(NBRCTSInfo *&nbrcts_info, // Compute the stats, normal confidence intervals, and // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_nbrcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, nbrcts_info, n_nbrcts, @@ -2530,7 +2530,7 @@ void do_nbrcnt(NBRCNTInfo &nbrcnt_info, // Compute the stats, normal confidence intervals, and // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_nbrcnt_stats_ci_bca(rng_ptr, *pd_ptr, *pd_thr_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, nbrcnt_info, diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 80d16a6145..c911779718 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -1365,7 +1365,7 @@ void do_cts(CTSInfo *&cts_info, int i_vx, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and bootstrap // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_cts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, cts_info, n_cat, @@ -1416,7 +1416,7 @@ void do_mcts(MCTSInfo &mcts_info, int i_vx, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and bootstrap // bootstrap confidence intervals // - if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType_BCA) { + if(conf_info.vx_opt[i_vx].boot_info.interval == BootIntervalType::BCA) { compute_mcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.vx_opt[i_vx].boot_info.n_rep, mcts_info, @@ -1544,7 +1544,7 @@ void do_cnt_sl1l2(const PointStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { // Compute the stats, normal confidence intervals, and // bootstrap confidence intervals - if(vx_opt.boot_info.interval == BootIntervalType_BCA) { + if(vx_opt.boot_info.interval == BootIntervalType::BCA) { compute_cnt_stats_ci_bca(rng_ptr, pd, precip_flag, vx_opt.rank_corr_flag, vx_opt.boot_info.n_rep, diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index e7a05ad78a..3b1108b709 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -930,7 +930,7 @@ void do_cts(int n, const PairDataPoint *pd_ptr) { // Compute the counts, stats, normal confidence intervals, and // bootstrap confidence intervals - if(conf_info.boot_interval == BootIntervalType_BCA) { + if(conf_info.boot_interval == BootIntervalType::BCA) { compute_cts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.n_boot_rep, cts_info, n_cts, true, @@ -994,7 +994,7 @@ void do_mcts(int n, const PairDataPoint *pd_ptr) { // Compute the counts, stats, normal confidence intervals, and // bootstrap confidence intervals - if(conf_info.boot_interval == BootIntervalType_BCA) { + if(conf_info.boot_interval == BootIntervalType::BCA) { compute_mcts_stats_ci_bca(rng_ptr, *pd_ptr, conf_info.n_boot_rep, mcts_info, true, @@ -1060,7 +1060,7 @@ void do_cnt(int n, const PairDataPoint *pd_ptr) { int precip_flag = (conf_info.fcst_info[0]->is_precipitation() && conf_info.obs_info[0]->is_precipitation()); - if(conf_info.boot_interval == BootIntervalType_BCA) { + if(conf_info.boot_interval == BootIntervalType::BCA) { compute_cnt_stats_ci_bca(rng_ptr, pd, precip_flag, conf_info.rank_corr_flag, conf_info.n_boot_rep, diff --git a/src/tools/core/series_analysis/series_analysis_conf_info.cc b/src/tools/core/series_analysis/series_analysis_conf_info.cc index 6e79c25863..c4a9e2fa50 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -70,7 +70,7 @@ void SeriesAnalysisConfInfo::clear() { cnt_logic = SetLogic::None; cdf_info.clear(); ci_alpha.clear(); - boot_interval = BootIntervalType_None; + boot_interval = BootIntervalType::None; boot_rep_prop = bad_data_double; n_boot_rep = bad_data_int; boot_rng.clear(); diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 3ca4cfcaff..dd53c0a3e6 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -3927,7 +3927,7 @@ void mpr_to_cts(STATAnalysisJob &job, const AggrMPRInfo &info, // bootstrap confidence intervals // cts_info_ptr = &cts_info; - if(job.boot_interval == boot_bca_flag) { + if(job.boot_interval == BootIntervalType::BCA) { compute_cts_stats_ci_bca(rng_ptr, info.pd, job.n_boot_rep, cts_info_ptr, 1, 1, @@ -3997,7 +3997,7 @@ void mpr_to_mcts(STATAnalysisJob &job, const AggrMPRInfo &info, // Compute the counts, stats, normal confidence intervals, and // bootstrap confidence intervals // - if(job.boot_interval == boot_bca_flag) { + if(job.boot_interval == BootIntervalType::BCA) { compute_mcts_stats_ci_bca(rng_ptr, info.pd, job.n_boot_rep, mcts_info, 1, @@ -4064,14 +4064,12 @@ void mpr_to_cnt(STATAnalysisJob &job, const AggrMPRInfo &info, // Compute the stats, normal confidence intervals, and // bootstrap confidence intervals // - if(job.boot_interval == boot_bca_flag) { - + if(job.boot_interval == BootIntervalType::BCA) { compute_cnt_stats_ci_bca(rng_ptr, pd_thr, precip_flag, job.rank_corr_flag, job.n_boot_rep, cnt_info, tmp_dir); } else { - compute_cnt_stats_ci_perc(rng_ptr, pd_thr, precip_flag, job.rank_corr_flag, job.n_boot_rep, job.boot_rep_prop, cnt_info, tmp_dir); diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index da0807f2ec..d47c82c080 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -1130,7 +1130,7 @@ void write_job_summary(STATAnalysisJob &job, // // Compute a bootstrap confidence interval for the mean. // - if(job.boot_interval == boot_bca_flag) { + if(job.boot_interval == BootIntervalType::BCA) { compute_mean_stdev_ci_bca(rng_ptr, val_it->second, job.n_boot_rep, job.out_alpha, mean_ci, stdev_ci); From 98af717b10a4ecbc758c7bb0c31270b55da2d7fa Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 27 Mar 2024 08:31:03 -0600 Subject: [PATCH 33/72] Bugfix #2833 develop azimuth (#2840) * Per #2833, fix n-1 bug when defining the azimuth delta for range/azimuth grids. * Per #2833, when definng TcrmwData:range_max_km, divide by n_range - 1 since the range values start at 0. * Per #2833, remove max_range_km from the TC-RMW config file. Set the default rmw_scale to NA so that its not used by default. And update the documentation. Still actually need to make the logic of the code work as it should. * Per #2833, update tc_rmw to define the range as either a function of rmw or using explicit spacing in km. * Per #2833, update the TCRMW Config files to remove the max_range_km entry, and update the unit test for one call to use RMW ranges and the other to use ranges defined in kilometers. * Per #2833, just correct code comments. * Per #2833, divide by n - 1 when computing the range delta, rather than n. * Per #2833, correct the handling of the maximum range in the tc-rmw tool. For fixed delta km, need to define the max range when setting up the grid at the beginning. --------- Co-authored-by: MET Tools Test Account --- data/config/TCRMWConfig_default | 3 +- docs/Users_Guide/tc-rmw.rst | 14 +---- internal/test_unit/config/TCRMWConfig_gonzalo | 3 +- .../config/TCRMWConfig_pressure_lev_out | 3 +- src/basic/vx_config/config_constants.h | 1 - src/libcode/vx_grid/tcrmw_grid.cc | 5 +- src/libcode/vx_grid/tcrmw_grid.h | 4 +- src/tools/tc_utils/tc_diag/tc_diag.cc | 5 +- src/tools/tc_utils/tc_rmw/tc_rmw.cc | 63 ++++++++++++------- src/tools/tc_utils/tc_rmw/tc_rmw.h | 4 -- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc | 14 +++-- src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.h | 17 +++-- 12 files changed, 72 insertions(+), 64 deletions(-) diff --git a/data/config/TCRMWConfig_default b/data/config/TCRMWConfig_default index dfb18721ac..e27a4b2741 100644 --- a/data/config/TCRMWConfig_default +++ b/data/config/TCRMWConfig_default @@ -98,9 +98,8 @@ regrid = { // n_range = 100; n_azimuth = 180; -max_range_km = 1000.0; delta_range_km = 10.0; -rmw_scale = 0.2; +rmw_scale = NA; // // Optionally convert u/v winds to tangential/radial winds diff --git a/docs/Users_Guide/tc-rmw.rst b/docs/Users_Guide/tc-rmw.rst index a9e67ffbc1..82628c087c 100644 --- a/docs/Users_Guide/tc-rmw.rst +++ b/docs/Users_Guide/tc-rmw.rst @@ -101,27 +101,19 @@ The **n_azimuth** parameter is the number of equally spaced azimuth intervals in _______________________ -.. code-block:: none - - max_range_km = 100.0; - -The **max_range_km** parameter specifies the maximum range of the range-azimuth grid, in kilometers. If this parameter is specified and not **rmw_scale**, the radial grid spacing will be **max_range_km / n_range**. - -_______________________ - .. code-block:: none delta_range_km = 10.0; -The **delta_range_km** parameter specifies the spacing of the range rings, in kilometers. +The **delta_range_km** parameter specifies the spacing of the range rings, in kilometers. The range values start with 0 km and extend out to **n_range - 1** times this delta spacing. _______________________ .. code-block:: none - rmw_scale = 0.2; + rmw_scale = NA; -The **rmw_scale** parameter overrides the **max_range_km** parameter. When this is set the radial grid spacing will be **rmw_scale** in units of the RMW, which varies along the storm track. +If changed from its default value of **NA**, the **rmw_scale** parameter overrides the **delta_range_km** parameter. The radial grid spacing is defined using **rmw_scale** in units of the RMW, which varies along the storm track. For example, setting **rmw_scale** to 0.2 would define the delta range spacing as 20% of the radius of maximum winds around each point. Note that RMW is defined in nautical miles but is converted to kilometers for this computation. _______________________ diff --git a/internal/test_unit/config/TCRMWConfig_gonzalo b/internal/test_unit/config/TCRMWConfig_gonzalo index 32a6beb118..d2ff3a1c00 100644 --- a/internal/test_unit/config/TCRMWConfig_gonzalo +++ b/internal/test_unit/config/TCRMWConfig_gonzalo @@ -99,9 +99,8 @@ regrid = { // n_range = 50; n_azimuth = 90; -max_range_km = 1000.0; delta_range_km = 10.0; -rmw_scale = 0.2; +rmw_scale = NA; // // Optionally convert u/v winds to tangential/radial winds diff --git a/internal/test_unit/config/TCRMWConfig_pressure_lev_out b/internal/test_unit/config/TCRMWConfig_pressure_lev_out index 747d9fa9b5..aa8c7a2287 100644 --- a/internal/test_unit/config/TCRMWConfig_pressure_lev_out +++ b/internal/test_unit/config/TCRMWConfig_pressure_lev_out @@ -99,8 +99,7 @@ regrid = { // n_range = 100; n_azimuth = 180; -max_range_km = 1000.0; -delta_range_km = 10.0; +delta_range_km = NA; rmw_scale = 0.2; // diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index 56908edd31..065bc27db4 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -1213,7 +1213,6 @@ static const char conf_key_nc_pairs_grid[] = "nc_pairs_grid"; static const char conf_key_n_range[] = "n_range"; static const char conf_key_n_azimuth[] = "n_azimuth"; -static const char conf_key_max_range[] = "max_range_km"; static const char conf_key_delta_range[] = "delta_range_km"; static const char conf_key_rmw_scale[] = "rmw_scale"; static const char conf_key_compute_tangential_and_radial_winds[] = "compute_tangential_and_radial_winds"; diff --git a/src/libcode/vx_grid/tcrmw_grid.cc b/src/libcode/vx_grid/tcrmw_grid.cc index 507c1874b8..a2e1738e1b 100644 --- a/src/libcode/vx_grid/tcrmw_grid.cc +++ b/src/libcode/vx_grid/tcrmw_grid.cc @@ -213,8 +213,9 @@ RLLD.rot_lat_ll = 90.0 - range_max_deg; RLLD.rot_lon_ll = 0.0; RLLD.delta_rot_lat = range_max_deg/(Range_n - 1); -// RLLD.delta_rot_lon = 360.0/Azimuth_n; -RLLD.delta_rot_lon = 360.0/(Azimuth_n - 1); + +// MET #2833 divide by n rather than n-1 for the azimuth increment +RLLD.delta_rot_lon = 360.0/Azimuth_n; RLLD.Nlat = Range_n; RLLD.Nlon = Azimuth_n; diff --git a/src/libcode/vx_grid/tcrmw_grid.h b/src/libcode/vx_grid/tcrmw_grid.h index 010748bff9..8af34d9261 100644 --- a/src/libcode/vx_grid/tcrmw_grid.h +++ b/src/libcode/vx_grid/tcrmw_grid.h @@ -69,7 +69,7 @@ class TcrmwGrid : public RotatedLatLonGrid { int azimuth_n () const; double range_max_km () const; - double range_delta_km () const; // Range_Max_km/Range_n + double range_delta_km () const; // Range_max_km/(Range_n - 1) double azimuth_delta_deg () const; // 360.0/Azimuth_n @@ -117,7 +117,7 @@ inline int TcrmwGrid::azimuth_n () const { return ( Azimuth_n ); } inline double TcrmwGrid::range_max_km () const { return ( Range_max_km ); } -inline double TcrmwGrid::range_delta_km () const { return ( Range_max_km/Range_n ); } +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 ); } diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 23478fba79..e5815d30cb 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -17,6 +17,7 @@ // 000 09/27/22 Halley Gotway New // 001 08/17/23 Halley Gotway MET #2609 handle missing data // 002 10/24/23 Halley Gotway MET #2550 enhance diagnostics +// 003 03/11/24 Halley Gotway MET #2833 range/azimuth grid // //////////////////////////////////////////////////////////////////////// @@ -2203,7 +2204,9 @@ void TmpFileInfo::setup_nc_file(const DomainInfo &di, // Set grid center d.lat_center = pnt_ptr->lat(); d.lon_center = -1.0*pnt_ptr->lon(); // degrees east to west - d.range_max_km = di.delta_range_km * d.range_n; + + // MET #2833 multiply by n-1 since the ranges begin at 0 km + d.range_max_km = di.delta_range_km * (d.range_n - 1); // Instantiate the grid grid_out.set(d); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index c281b758e2..d32bc62d81 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -19,6 +19,7 @@ // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 003 09/28/22 Prestopnik MET #2227 Remove namspace std and netCDF from header files // 004 04/26/23 Halley Gotway MET #2523 Reorder NetCDF dimensions +// 005 03/11/24 Halley Gotway MET #2833 range/azimuth grid // //////////////////////////////////////////////////////////////////////// @@ -554,7 +555,13 @@ void setup_grid() { grid_data.name = "TCRMW"; grid_data.range_n = conf_info.n_range; grid_data.azimuth_n = conf_info.n_azimuth; - grid_data.range_max_km = conf_info.max_range_km; + + // Define the maximum range in km based on the fixed increment + if(is_bad_data(conf_info.rmw_scale)) { + grid_data.range_max_km = + conf_info.delta_range_km * + (conf_info.n_range - 1); + } tcrmw_grid.set_from_data(grid_data); grid.set(grid_data); @@ -593,8 +600,9 @@ void setup_nc_file() { lead_time_str_var, lead_time_sec_var); // Define range and azimuth dimensions - def_tc_range_azimuth(nc_out, range_dim, azimuth_dim, tcrmw_grid, - conf_info.rmw_scale); + def_tc_range_azimuth(nc_out, + range_dim, azimuth_dim, + tcrmw_grid, conf_info.rmw_scale); // Define latitude and longitude arrays def_tc_lat_lon(nc_out, @@ -606,11 +614,11 @@ void setup_nc_file() { // Get VarInfo data_info = conf_info.data_info[i_var]; mlog << Debug(4) << "Processing field: " << data_info->magic_str() << "\n"; - string fname = data_info->name_attr(); + string fname = data_info->name_attr(); variable_levels[fname].push_back(data_info->level_attr()); variable_long_names[fname] = data_info->long_name_attr(); variable_units[fname] = data_info->units_attr(); - wind_converter.update_input(fname, data_info->units_attr()); + wind_converter.update_input(fname, data_info->units_attr()); } // Define pressure levels @@ -644,7 +652,7 @@ void compute_lat_lon(TcrmwGrid& tcrmw_grid, ia * tcrmw_grid.azimuth_delta_deg(), lat, lon); lat_arr[i] = lat; - lon_arr[i] = - lon; + lon_arr[i] = -lon; } } } @@ -688,9 +696,15 @@ void process_fields(const TrackInfoArray& tracks) { grid_data.lat_center = point.lat(); grid_data.lon_center = -1.0*point.lon(); // internal sign change - // RMW is same as mrd() - grid_data.range_max_km = conf_info.rmw_scale * - point.mrd() * tc_km_per_nautical_miles * conf_info.n_range; + // Define the maximum range in km relative to the radius of maximum winds + if(!is_bad_data(conf_info.rmw_scale)) { + grid_data.range_max_km = + conf_info.rmw_scale * + point.mrd() * tc_km_per_nautical_miles * + (conf_info.n_range - 1); + } + + // Re-define the range/azimuth grid tcrmw_grid.clear(); tcrmw_grid.set_from_data(grid_data); grid.clear(); @@ -713,7 +727,7 @@ void process_fields(const TrackInfoArray& tracks) { for(int i_var = 0; i_var < conf_info.get_n_data(); i_var++) { - // Update the variable info with the valid time of the track point + // Update with the valid time of the track point data_info = conf_info.data_info[i_var]; string sname = data_info->name_attr().string(); @@ -731,24 +745,27 @@ void process_fields(const TrackInfoArray& tracks) { mlog << Debug(4) << "data_max:" << data_max << "\n"; // Regrid data - data_dp = met_regrid(data_dp, latlon_arr, grid, data_info->regrid()); + data_dp = met_regrid(data_dp, latlon_arr, grid, + data_info->regrid()); data_dp.data_range(data_min, data_max); mlog << Debug(4) << "data_min:" << data_min << "\n"; mlog << Debug(4) << "data_max:" << data_max << "\n"; - // if this is "U", setup everything for matching "V" and compute the radial/tangential - if(wind_converter.compute_winds_if_input_is_u(i_point, sname, slevel, valid_time, data_files, ftype, - latlon_arr, lat_arr, lon_arr, grid, data_dp, tcrmw_grid)) { - write_tc_pressure_level_data(nc_out, tcrmw_grid, - pressure_level_indices, data_info->level_attr(), i_point, - data_3d_vars[conf_info.radial_velocity_field_name.string()], - wind_converter.get_wind_r_arr()); - write_tc_pressure_level_data(nc_out, tcrmw_grid, - pressure_level_indices, data_info->level_attr(), i_point, - data_3d_vars[conf_info.tangential_velocity_field_name.string()], - wind_converter.get_wind_t_arr()); + // If this is "U", setup everything for matching "V" + // and compute the radial/tangential winds + if(wind_converter.compute_winds_if_input_is_u( + i_point, sname, slevel, valid_time, data_files, ftype, + latlon_arr, lat_arr, lon_arr, grid, data_dp, tcrmw_grid)) { + write_tc_pressure_level_data(nc_out, tcrmw_grid, + pressure_level_indices, data_info->level_attr(), i_point, + data_3d_vars[conf_info.radial_velocity_field_name.string()], + wind_converter.get_wind_r_arr()); + write_tc_pressure_level_data(nc_out, tcrmw_grid, + pressure_level_indices, data_info->level_attr(), i_point, + data_3d_vars[conf_info.tangential_velocity_field_name.string()], + wind_converter.get_wind_t_arr()); } - + // Write data if(variable_levels[data_info->name_attr()].size() > 1) { write_tc_pressure_level_data(nc_out, tcrmw_grid, diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index b97f136188..7691a2c012 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -146,10 +146,6 @@ static Grid grid; static double* lat_arr; static double* lon_arr; -// Wind arrays -/* static double* wind_r_arr; */ -/* static double* wind_t_arr; */ - //////////////////////////////////////////////////////////////////////// #endif // __TC_RMW_H__ diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 7f8537ef80..eaaeebafeb 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -72,7 +72,6 @@ void TCRMWConfInfo::clear() { n_range = bad_data_int; n_azimuth = bad_data_int; - max_range_km = bad_data_double; delta_range_km = bad_data_double; rmw_scale = bad_data_double; @@ -175,15 +174,21 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { // Conf: n_azimuth n_azimuth = Conf.lookup_int(conf_key_n_azimuth); - // Conf: max_range - max_range_km = Conf.lookup_double(conf_key_max_range); - // Conf: delta_range delta_range_km = Conf.lookup_double(conf_key_delta_range); // Conf: rmw_scale rmw_scale = Conf.lookup_double(conf_key_rmw_scale); + // Error check + if(is_bad_data(delta_range_km) && is_bad_data(rmw_scale)) { + mlog << Error << "\nTCRMWConfInfo::process_config() -> " + << "the \"" << conf_key_delta_range << "\" and \"" + << conf_key_rmw_scale << "\" configuration options " + << "cannot both be set to bad data.\n\n"; + exit(1); + } + compute_tangential_and_radial_winds = Conf.lookup_bool(conf_key_compute_tangential_and_radial_winds); u_wind_field_name = Conf.lookup_string(conf_key_u_wind_field_name); v_wind_field_name = Conf.lookup_string(conf_key_v_wind_field_name); @@ -192,7 +197,6 @@ void TCRMWConfInfo::process_config(GrdFileType ftype) { tangential_velocity_long_field_name = Conf.lookup_string(conf_key_tangential_velocity_long_field_name); radial_velocity_long_field_name = Conf.lookup_string(conf_key_radial_velocity_long_field_name); - // Conf: data.field fdict = Conf.lookup_array(conf_key_data_field); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.h b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.h index f1d8d52ec8..1e3bf5b3b2 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.h @@ -50,18 +50,17 @@ class TCRMWConfInfo { // Range/Azimuth information int n_range; int n_azimuth; - double max_range_km; double delta_range_km; double rmw_scale; - // Wind conversion information - bool compute_tangential_and_radial_winds; - ConcatString u_wind_field_name; - ConcatString v_wind_field_name; - ConcatString tangential_velocity_field_name; - ConcatString radial_velocity_field_name; - ConcatString tangential_velocity_long_field_name; - ConcatString radial_velocity_long_field_name; + // Wind conversion information + bool compute_tangential_and_radial_winds; + ConcatString u_wind_field_name; + ConcatString v_wind_field_name; + ConcatString tangential_velocity_field_name; + ConcatString radial_velocity_field_name; + ConcatString tangential_velocity_long_field_name; + ConcatString radial_velocity_long_field_name; // Variable information VarInfo** data_info; From 1c97607a52dea27257aac6032c231c01e90ec5e4 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 27 Mar 2024 18:50:32 +0000 Subject: [PATCH 34/72] #2830 Changed enum PadSize to enum class --- src/libcode/vx_pb_util/do_blocking.cc | 4 ++-- src/libcode/vx_pb_util/do_unblocking.cc | 8 ++++---- src/libcode/vx_pb_util/pblock.cc | 4 ++-- src/libcode/vx_pb_util/pblock.h | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc index 0a62342983..0e6df01b22 100644 --- a/src/libcode/vx_pb_util/do_blocking.cc +++ b/src/libcode/vx_pb_util/do_blocking.cc @@ -115,13 +115,13 @@ unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { - case padsize_4: + case PadSize::size_4: bytes = 4; b = (unsigned char *) (&I); I = (unsigned int) value; break; - case padsize_8: + case PadSize::size_8: bytes = 8; b = (unsigned char *) (&L); L = (unsigned long long) value; diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc index e0fa2ef90d..0a159c31e6 100644 --- a/src/libcode/vx_pb_util/do_unblocking.cc +++ b/src/libcode/vx_pb_util/do_unblocking.cc @@ -85,12 +85,12 @@ unsigned char * b = (unsigned char *) nullptr; switch ( padsize ) { - case padsize_4: + case PadSize::size_4: bytes = 4; b = (unsigned char *) (&I); break; - case padsize_8: + case PadSize::size_8: bytes = 8; b = (unsigned char *) (&L); break; @@ -119,11 +119,11 @@ if ( (n_read < 0) || ((n_read > 0) && (n_read != bytes)) ) { switch ( padsize ) { - case padsize_4: + case PadSize::size_4: value = I; break; - case padsize_8: + case PadSize::size_8: value = (int) L; break; diff --git a/src/libcode/vx_pb_util/pblock.cc b/src/libcode/vx_pb_util/pblock.cc index 0626c0ac39..057720e528 100644 --- a/src/libcode/vx_pb_util/pblock.cc +++ b/src/libcode/vx_pb_util/pblock.cc @@ -57,9 +57,9 @@ void pblock(const char *infile, const char *outfile, Action action) { // Set the block size for this compiler // #ifdef BLOCK4 - padsize = padsize_4; + padsize = PadSize::size_4; #else - padsize = padsize_8; + padsize = PadSize::size_8; #endif // diff --git a/src/libcode/vx_pb_util/pblock.h b/src/libcode/vx_pb_util/pblock.h index cab711e358..015daaa4c1 100644 --- a/src/libcode/vx_pb_util/pblock.h +++ b/src/libcode/vx_pb_util/pblock.h @@ -18,12 +18,12 @@ //////////////////////////////////////////////////////////////////////// -enum PadSize { +enum class PadSize { - padsize_4, - padsize_8, + size_4, + size_8, - no_padsize + no_pad }; From 40b67d4e22ffb40e2dbaf914d1d3252d8da536b3 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 27 Mar 2024 19:16:43 +0000 Subject: [PATCH 35/72] #2830 Removed redundant parantheses --- src/basic/vx_config/config_util.cc | 218 ++++++++++++++--------------- 1 file changed, 109 insertions(+), 109 deletions(-) diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 6f1bf64021..6c09051747 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -2618,51 +2618,51 @@ const char * statlinetype_to_string(const STATLineType t) { const char *s = (const char *) nullptr; switch(t) { - case(stat_sl1l2): s = stat_sl1l2_str; break; - case(stat_sal1l2): s = stat_sal1l2_str; break; - case(stat_vl1l2): s = stat_vl1l2_str; break; - case(stat_val1l2): s = stat_val1l2_str; break; - case(stat_vcnt): s = stat_vcnt_str; break; - - case(stat_fho): s = stat_fho_str; break; - case(stat_ctc): s = stat_ctc_str; break; - case(stat_cts): s = stat_cts_str; break; - case(stat_mctc): s = stat_mctc_str; break; - case(stat_mcts): s = stat_mcts_str; break; - - case(stat_cnt): s = stat_cnt_str; break; - case(stat_pct): s = stat_pct_str; break; - case(stat_pstd): s = stat_pstd_str; break; - case(stat_pjc): s = stat_pjc_str; break; - case(stat_prc): s = stat_prc_str; break; - - case(stat_eclv): s = stat_eclv_str; break; - case(stat_mpr): s = stat_mpr_str; break; - case(stat_seeps): s = stat_seeps_str; break; - case(stat_seeps_mpr): s = stat_seeps_mpr_str; break; - case(stat_nbrctc): s = stat_nbrctc_str; break; - - case(stat_nbrcts): s = stat_nbrcts_str; break; - case(stat_nbrcnt): s = stat_nbrcnt_str; break; - case(stat_grad): s = stat_grad_str; break; - case(stat_dmap): s = stat_dmap_str; break; - case(stat_isc): s = stat_isc_str; break; - - case(stat_wdir): s = stat_wdir_str; break; - case(stat_ecnt): s = stat_ecnt_str; break; - case(stat_rps): s = stat_rps_str; break; - case(stat_rhist): s = stat_rhist_str; break; - case(stat_phist): s = stat_phist_str; break; - - case(stat_orank): s = stat_orank_str; break; - case(stat_ssvar): s = stat_ssvar_str; break; - case(stat_relp): s = stat_relp_str; break; - case(stat_genmpr): s = stat_genmpr_str; break; - case(stat_ssidx): s = stat_ssidx_str; break; + case stat_sl1l2: s = stat_sl1l2_str; break; + case stat_sal1l2: s = stat_sal1l2_str; break; + case stat_vl1l2: s = stat_vl1l2_str; break; + case stat_val1l2: s = stat_val1l2_str; break; + case stat_vcnt: s = stat_vcnt_str; break; + + case stat_fho: s = stat_fho_str; break; + case stat_ctc: s = stat_ctc_str; break; + case stat_cts: s = stat_cts_str; break; + case stat_mctc: s = stat_mctc_str; break; + case stat_mcts: s = stat_mcts_str; break; + + case stat_cnt: s = stat_cnt_str; break; + case stat_pct: s = stat_pct_str; break; + case stat_pstd: s = stat_pstd_str; break; + case stat_pjc: s = stat_pjc_str; break; + case stat_prc: s = stat_prc_str; break; + + case stat_eclv: s = stat_eclv_str; break; + case stat_mpr: s = stat_mpr_str; break; + case stat_seeps: s = stat_seeps_str; break; + case stat_seeps_mpr: s = stat_seeps_mpr_str; break; + case stat_nbrctc: s = stat_nbrctc_str; break; + + case stat_nbrcts: s = stat_nbrcts_str; break; + case stat_nbrcnt: s = stat_nbrcnt_str; break; + case stat_grad: s = stat_grad_str; break; + case stat_dmap: s = stat_dmap_str; break; + case stat_isc: s = stat_isc_str; break; + + case stat_wdir: s = stat_wdir_str; break; + case stat_ecnt: s = stat_ecnt_str; break; + case stat_rps: s = stat_rps_str; break; + case stat_rhist: s = stat_rhist_str; break; + case stat_phist: s = stat_phist_str; break; + + case stat_orank: s = stat_orank_str; break; + case stat_ssvar: s = stat_ssvar_str; break; + case stat_relp: s = stat_relp_str; break; + case stat_genmpr: s = stat_genmpr_str; break; + case stat_ssidx: s = stat_ssidx_str; break; - case(stat_header): s = stat_header_str; break; + case stat_header: s = stat_header_str; break; - case(no_stat_line_type): + case no_stat_line_type: default: s = stat_na_str; break; } @@ -2736,12 +2736,12 @@ STATLineType string_to_statlinetype(const char *s) { /////////////////////////////////////////////////////////////////////////////// const char * bootintervaltype_to_string(const BootIntervalType t) { - const char *s = (const char *) nullptr; + const auto s = (const char *) nullptr; switch(t) { - case(BootIntervalType::BCA): s = conf_val_bca; break; - case(BootIntervalType::PCTile): s = conf_val_pctile; break; - default: s = conf_val_none; break; + case BootIntervalType::BCA: s = conf_val_bca; break; + case BootIntervalType::PCTile: s = conf_val_pctile; break; + default: s = conf_val_none; break; } return s; @@ -2806,10 +2806,10 @@ ConcatString fieldtype_to_string(FieldType type) { // Convert enumerated FieldType to string switch(type) { - case(FieldType::None): s = conf_val_none; break; - case(FieldType::Both): s = conf_val_both; break; - case(FieldType::Fcst): s = conf_val_fcst; break; - case(FieldType::Obs): s = conf_val_obs; break; + case FieldType::None: s = conf_val_none; break; + case FieldType::Both: s = conf_val_both; break; + case FieldType::Fcst: s = conf_val_fcst; break; + case FieldType::Obs: s = conf_val_obs; break; default: mlog << Error << "\nfieldtype_to_string() -> " << "Unexpected FieldType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -2875,10 +2875,10 @@ ConcatString setlogic_to_string(SetLogic type) { // Convert enumerated SetLogic to string switch(type) { - case(SetLogic::None): s = conf_val_none; break; - case(SetLogic::Union): s = conf_val_union; break; - case(SetLogic::Intersection): s = conf_val_intersection; break; - case(SetLogic::SymDiff): s = conf_val_symdiff; break; + case SetLogic::None: s = conf_val_none; break; + case SetLogic::Union: s = conf_val_union; break; + case SetLogic::Intersection: s = conf_val_intersection; break; + case SetLogic::SymDiff: s = conf_val_symdiff; break; default: mlog << Error << "\nsetlogic_to_string() -> " << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; @@ -2895,10 +2895,10 @@ ConcatString setlogic_to_abbr(SetLogic type) { // Convert enumerated SetLogic to an abbreviation switch(type) { - case(SetLogic::None): s = na_str; break; - case(SetLogic::Union): s = setlogic_abbr_union; break; - case(SetLogic::Intersection): s = setlogic_abbr_intersection; break; - case(SetLogic::SymDiff): s = setlogic_abbr_symdiff; break; + case SetLogic::None: s = na_str; break; + case SetLogic::Union: s = setlogic_abbr_union; break; + case SetLogic::Intersection: s = setlogic_abbr_intersection; break; + case SetLogic::SymDiff: s = setlogic_abbr_symdiff; break; default: mlog << Error << "\nsetlogic_to_abbr() -> " << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; @@ -2915,10 +2915,10 @@ ConcatString setlogic_to_symbol(SetLogic type) { // Convert enumerated SetLogic to a symbol switch(type) { - case(SetLogic::None): s = na_str; break; - case(SetLogic::Union): s = setlogic_symbol_union; break; - case(SetLogic::Intersection): s = setlogic_symbol_intersection; break; - case(SetLogic::SymDiff): s = setlogic_symbol_symdiff; break; + case SetLogic::None: s = na_str; break; + case SetLogic::Union: s = setlogic_symbol_union; break; + case SetLogic::Intersection: s = setlogic_symbol_intersection; break; + case SetLogic::SymDiff: s = setlogic_symbol_symdiff; break; default: mlog << Error << "\nsetlogic_to_symbol() -> " << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; @@ -2994,10 +2994,10 @@ ConcatString tracktype_to_string(TrackType type) { // Convert enumerated TrackType to string switch(type) { - case(TrackType::None): s = conf_val_none; break; - case(TrackType::Both): s = conf_val_both; break; - case(TrackType::ADeck): s = conf_val_adeck; break; - case(TrackType::BDeck): s = conf_val_bdeck; break; + case TrackType::None: s = conf_val_none; break; + case TrackType::Both: s = conf_val_both; break; + case TrackType::ADeck: s = conf_val_adeck; break; + case TrackType::BDeck: s = conf_val_bdeck; break; default: mlog << Error << "\ntracktype_to_string() -> " << "Unexpected TrackType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3030,11 +3030,11 @@ ConcatString diagtype_to_string(DiagType type) { // Convert enumerated DiagType to string switch(type) { - case(DiagType::None): s = conf_val_none; break; - case(DiagType::CIRA_RT): s = cira_diag_rt_str; break; - case(DiagType::CIRA_Dev): s = cira_diag_dev_str; break; - case(DiagType::SHIPS_RT): s = ships_diag_rt_str; break; - case(DiagType::SHIPS_Dev): s = ships_diag_dev_str; break; + case DiagType::None: s = conf_val_none; break; + case DiagType::CIRA_RT: s = cira_diag_rt_str; break; + case DiagType::CIRA_Dev: s = cira_diag_dev_str; break; + case DiagType::SHIPS_RT: s = ships_diag_rt_str; break; + case DiagType::SHIPS_Dev: s = ships_diag_dev_str; break; default: mlog << Error << "\ndiagtype_to_string() -> " << "Unexpected DiagType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3087,9 +3087,9 @@ ConcatString interp12type_to_string(Interp12Type type) { // Convert enumerated Interp12Type to string switch(type) { - case(Interp12Type::None): s = conf_val_none; break; - case(Interp12Type::Fill): s = conf_val_fill; break; - case(Interp12Type::Replace): s = conf_val_replace; break; + case Interp12Type::None: s = conf_val_none; break; + case Interp12Type::Fill: s = conf_val_fill; break; + case Interp12Type::Replace: s = conf_val_replace; break; default: mlog << Error << "\ninterp12type_to_string() -> " << "Unexpected Interp12Type value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3125,10 +3125,10 @@ ConcatString mergetype_to_string(MergeType type) { // Convert enumerated MergeType to string switch(type) { - case(MergeType::None): s = conf_val_none; break; - case(MergeType::Both): s = conf_val_both; break; - case(MergeType::Thresh): s = conf_val_thresh; break; - case(MergeType::Engine): s = conf_val_engine; break; + case MergeType::None: s = conf_val_none; break; + case MergeType::Both: s = conf_val_both; break; + case MergeType::Thresh: s = conf_val_thresh; break; + case MergeType::Engine: s = conf_val_engine; break; default: mlog << Error << "\nmergetype_to_string() -> " << "Unexpected MergeType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3145,14 +3145,14 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) { // Convert enumerated ObsSummary to string switch(type) { - case(ObsSummary::None): s = conf_val_none; break; - case(ObsSummary::Nearest): s = conf_val_nearest; break; - case(ObsSummary::Min): s = conf_val_min; break; - case(ObsSummary::Max): s = conf_val_max; break; - case(ObsSummary::UW_Mean): s = conf_val_uw_mean; break; - case(ObsSummary::DW_Mean): s = conf_val_dw_mean; break; - case(ObsSummary::Median): s = conf_val_median; break; - case(ObsSummary::Perc): + case ObsSummary::None: s = conf_val_none; break; + case ObsSummary::Nearest: s = conf_val_nearest; break; + case ObsSummary::Min: s = conf_val_min; break; + case ObsSummary::Max: s = conf_val_max; break; + case ObsSummary::UW_Mean: s = conf_val_uw_mean; break; + case ObsSummary::DW_Mean: s = conf_val_dw_mean; break; + case ObsSummary::Median: s = conf_val_median; break; + case ObsSummary::Perc: s << conf_val_perc << "(" << perc_val << ")"; break; default: @@ -3190,10 +3190,10 @@ ConcatString matchtype_to_string(MatchType type) { // Convert enumerated MatchType to string switch(type) { - case(MatchType::None): s = conf_val_none; break; - case(MatchType::MergeBoth): s = conf_val_merge_both; break; - case(MatchType::MergeFcst): s = conf_val_merge_fcst; break; - case(MatchType::NoMerge): s = conf_val_no_merge; break; + case MatchType::None: s = conf_val_none; break; + case MatchType::MergeBoth: s = conf_val_merge_both; break; + case MatchType::MergeFcst: s = conf_val_merge_fcst; break; + case MatchType::NoMerge: s = conf_val_no_merge; break; default: mlog << Error << "\nmatchtype_to_string() -> " << "Unexpected MatchType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3254,13 +3254,13 @@ ConcatString disttype_to_string(DistType type) { // Convert enumerated DistType to string switch(type) { - case(DistType_None): s = conf_val_none; break; - case(DistType_Normal): s = conf_val_normal; break; - case(DistType_Exponential): s = conf_val_exponential; break; - case(DistType_ChiSquared): s = conf_val_chisquared; break; - case(DistType_Gamma): s = conf_val_gamma; break; - case(DistType_Uniform): s = conf_val_uniform; break; - case(DistType_Beta): s = conf_val_beta; break; + case DistType_None: s = conf_val_none; break; + case DistType_Normal: s = conf_val_normal; break; + case DistType_Exponential: s = conf_val_exponential; break; + case DistType_ChiSquared: s = conf_val_chisquared; break; + case DistType_Gamma: s = conf_val_gamma; break; + case DistType_Uniform: s = conf_val_uniform; break; + case DistType_Beta: s = conf_val_beta; break; default: mlog << Error << "\ndisttype_to_string() -> " << "Unexpected DistType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3298,10 +3298,10 @@ ConcatString griddecomptype_to_string(GridDecompType type) { // Convert enumerated GridDecompType to string switch(type) { - case(GridDecompType::None): s = conf_val_none; break; - case(GridDecompType::Auto): s = conf_val_auto; break; - case(GridDecompType::Tile): s = conf_val_tile; break; - case(GridDecompType::Pad): s = conf_val_pad; break; + case GridDecompType::None: s = conf_val_none; break; + case GridDecompType::Auto: s = conf_val_auto; break; + case GridDecompType::Tile: s = conf_val_tile; break; + case GridDecompType::Pad: s = conf_val_pad; break; default: mlog << Error << "\ngriddecomptype_to_string() -> " << "Unexpected GridDecompType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3318,13 +3318,13 @@ ConcatString wavelettype_to_string(WaveletType type) { // Convert enumerated WaveletType to string switch(type) { - case(WaveletType::None): s = conf_val_none; break; - case(WaveletType::Haar): s = conf_val_haar; break; - case(WaveletType::Haar_Cntr): s = conf_val_haar_cntr; break; - case(WaveletType::Daub): s = conf_val_daub; break; - case(WaveletType::Daub_Cntr): s = conf_val_daub_cntr; break; - case(WaveletType::BSpline): s = conf_val_bspline; break; - case(WaveletType::BSpline_Cntr): s = conf_val_bspline_cntr; break; + case WaveletType::None: s = conf_val_none; break; + case WaveletType::Haar: s = conf_val_haar; break; + case WaveletType::Haar_Cntr: s = conf_val_haar_cntr; break; + case WaveletType::Daub: s = conf_val_daub; break; + case WaveletType::Daub_Cntr: s = conf_val_daub_cntr; break; + case WaveletType::BSpline: s = conf_val_bspline; break; + case WaveletType::BSpline_Cntr: s = conf_val_bspline_cntr; break; default: mlog << Error << "\nwavlettype_to_string() -> " << "Unexpected WaveletType value of " << enum_class_as_integer(type) << ".\n\n"; From 79f81af66deaa97a837bb4408970600f511608c7 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 27 Mar 2024 19:17:10 +0000 Subject: [PATCH 36/72] #2830 Removed commenyted out code --- src/basic/vx_config/config_util.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index 4ca142903d..e5cb69ce6e 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -157,16 +157,6 @@ template extern auto enum_class_as_integer(Enumeration const value) -> typename std::underlying_type::type; -//////////////////////////////////////////////////////////////////////// - -/* -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} -*/ /////////////////////////////////////////////////////////////////////////////// #endif /* __CONFIG_UTIL_H__ */ From 8cc667c80b94cb5ac3590f20e84b233fc715ea7a Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 27 Mar 2024 19:33:36 +0000 Subject: [PATCH 37/72] #2830 Use auto --- src/basic/vx_config/config_util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 6c09051747..aa57950ffd 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -2736,7 +2736,7 @@ STATLineType string_to_statlinetype(const char *s) { /////////////////////////////////////////////////////////////////////////////// const char * bootintervaltype_to_string(const BootIntervalType t) { - const auto s = (const char *) nullptr; + auto s = (const char *) nullptr; switch(t) { case BootIntervalType::BCA: s = conf_val_bca; break; From d6cba7d1c7cc58dcf461a6c18b0932ca4d97a03d Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 28 Mar 2024 01:15:45 +0000 Subject: [PATCH 38/72] #2830 Changed enum to enum class for DistType, InterpMthd, GridTemplates, and NormalizeType --- src/basic/vx_config/config_util.cc | 248 +++++++++--------- .../vx_config/configobjecttype_to_string.cc | 2 +- src/basic/vx_config/grdfiletype_to_string.cc | 1 - src/basic/vx_math/viewgravity_to_string.cc | 1 - src/basic/vx_util/GridTemplate.cc | 27 +- src/basic/vx_util/GridTemplate.h | 10 +- src/basic/vx_util/asciitablejust_to_string.cc | 2 +- src/basic/vx_util/data_plane_util.cc | 30 ++- src/basic/vx_util/interp_mthd.cc | 88 +++---- src/basic/vx_util/interp_mthd.h | 46 ++-- src/basic/vx_util/interp_util.cc | 98 +++---- src/basic/vx_util/normalize.cc | 34 ++- src/basic/vx_util/normalize.h | 12 +- src/libcode/vx_gsl_prob/gsl_randist.cc | 28 +- src/libcode/vx_gsl_prob/gsl_randist.h | 16 +- src/libcode/vx_regrid/vx_regrid.cc | 30 +-- src/libcode/vx_shapedata/shapedata.cc | 2 +- src/libcode/vx_stat_out/stat_columns.cc | 4 +- src/libcode/vx_stat_out/stat_hdr_columns.cc | 2 +- src/libcode/vx_stat_out/stat_hdr_columns.h | 4 +- src/libcode/vx_statistics/obs_error.cc | 16 +- src/libcode/vx_statistics/pair_base.cc | 8 +- .../vx_statistics/pair_data_ensemble.cc | 16 +- src/libcode/vx_statistics/pair_data_point.cc | 21 +- src/tools/core/ensemble_stat/ensemble_stat.cc | 12 +- .../ensemble_stat/ensemble_stat_conf_info.cc | 4 +- src/tools/core/grid_stat/grid_stat.cc | 8 +- .../core/grid_stat/grid_stat_conf_info.cc | 6 +- src/tools/core/point_stat/point_stat.cc | 10 +- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 20 +- .../gen_ens_prod/gen_ens_prod_conf_info.cc | 6 +- src/tools/other/point2grid/point2grid.cc | 24 +- .../regrid_data_plane/regrid_data_plane.cc | 6 +- .../shift_data_plane/shift_data_plane.cc | 4 +- src/tools/other/wwmca_tool/wwmca_ref.cc | 10 +- 35 files changed, 450 insertions(+), 406 deletions(-) diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index aa57950ffd..42e5972444 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -124,10 +124,10 @@ void RegridInfo::clear() { field = FieldType::None; vld_thresh = bad_data_double; name.clear(); - method = InterpMthd_None; + method = InterpMthd::None; width = bad_data_int; gaussian.clear(); - shape = GridTemplateFactory::GridTemplate_None; + shape = GridTemplateFactory::GridTemplates::None; convert_fx.clear(); censor_thresh.clear(); censor_val.clear(); @@ -144,10 +144,10 @@ RegridInfo::RegridInfo() { void RegridInfo::validate() { // Check for unsupported regridding options - if(method == InterpMthd_Best || - method == InterpMthd_Geog_Match || - method == InterpMthd_Gaussian || - method == InterpMthd_HiRA) { + if(method == InterpMthd::Best || + method == InterpMthd::Geog_Match || + method == InterpMthd::Gaussian || + method == InterpMthd::HiRA) { mlog << Error << "\nRegridInfo::validate() -> " << "\"" << interpmthd_to_string(method) << "\" not valid for regridding, only interpolating.\n\n"; @@ -156,31 +156,31 @@ void RegridInfo::validate() { // Check the nearest neighbor special case if(width == 1 && - method != InterpMthd_None && - method != InterpMthd_Nearest && - method != InterpMthd_Force && - method != InterpMthd_Upper_Left && - method != InterpMthd_Upper_Right && - method != InterpMthd_Lower_Right && - method != InterpMthd_Lower_Left && - method != InterpMthd_AW_Mean && - method != InterpMthd_MaxGauss) { + method != InterpMthd::None && + method != InterpMthd::Nearest && + method != InterpMthd::Force && + method != InterpMthd::Upper_Left && + method != InterpMthd::Upper_Right && + method != InterpMthd::Lower_Right && + method != InterpMthd::Lower_Left && + method != InterpMthd::AW_Mean && + method != InterpMthd::MaxGauss) { mlog << Warning << "\nRegridInfo::validate() -> " << "Resetting the regridding method from \"" << interpmthd_to_string(method) << "\" to \"" << interpmthd_nearest_str << "\" since the regridding width is 1.\n\n"; - method = InterpMthd_Nearest; + method = InterpMthd::Nearest; } // Check for some methods, that width is 1 - if((method == InterpMthd_Nearest || - method == InterpMthd_Force || - method == InterpMthd_Upper_Left || - method == InterpMthd_Upper_Right || - method == InterpMthd_Lower_Right || - method == InterpMthd_Lower_Left || - method == InterpMthd_AW_Mean) && + if((method == InterpMthd::Nearest || + method == InterpMthd::Force || + method == InterpMthd::Upper_Left || + method == InterpMthd::Upper_Right || + method == InterpMthd::Lower_Right || + method == InterpMthd::Lower_Left || + method == InterpMthd::AW_Mean) && width != 1) { mlog << Warning << "\nRegridInfo::validate() -> " << "Resetting regridding width from " @@ -190,8 +190,8 @@ void RegridInfo::validate() { } // Check the bilinear and budget special cases - if((method == InterpMthd_Bilin || - method == InterpMthd_Budget) && + if((method == InterpMthd::Bilin || + method == InterpMthd::Budget) && width != 2) { mlog << Warning << "\nRegridInfo::validate() -> " << "Resetting the regridding width from " @@ -201,7 +201,7 @@ void RegridInfo::validate() { } // Check the Gaussian filter - if(method == InterpMthd_MaxGauss && gaussian.radius < gaussian.dx) { + if(method == InterpMthd::MaxGauss && gaussian.radius < gaussian.dx) { mlog << Error << "\nRegridInfo::validate() -> " << "The radius of influence (" << gaussian.radius << ") is less than the delta distance (" << gaussian.dx @@ -226,20 +226,20 @@ void RegridInfo::validate() { void RegridInfo::validate_point() { // Check for unsupported regridding options - if(method != InterpMthd_Max && - method != InterpMthd_Min && - method != InterpMthd_Median && - method != InterpMthd_UW_Mean) { + if(method != InterpMthd::Max && + method != InterpMthd::Min && + method != InterpMthd::Median && + method != InterpMthd::UW_Mean) { mlog << Warning << "\nRegridInfo::validate_point() -> " << "Resetting the regridding method from \"" << interpmthd_to_string(method) << "\" to \"" << interpmthd_uw_mean_str << ".\n" << "\tAvailable methods: " - << interpmthd_to_string(InterpMthd_UW_Mean) << ", " - << interpmthd_to_string(InterpMthd_Max) << ", " - << interpmthd_to_string(InterpMthd_Min) << ", " - << interpmthd_to_string(InterpMthd_Median) << ".\n\n"; - method = InterpMthd_UW_Mean; + << interpmthd_to_string(InterpMthd::UW_Mean) << ", " + << interpmthd_to_string(InterpMthd::Max) << ", " + << interpmthd_to_string(InterpMthd::Min) << ", " + << interpmthd_to_string(InterpMthd::Median) << ".\n\n"; + method = InterpMthd::UW_Mean; } } @@ -1398,7 +1398,7 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) { } else { // If not specified, use the default square shape - info.shape = GridTemplateFactory::GridTemplate_Square; + info.shape = GridTemplateFactory::GridTemplates::Square; } // Conf: gaussian dx and radius @@ -1408,7 +1408,7 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) { info.gaussian.radius = (is_bad_data(conf_value) ? default_gaussian_radius : conf_value); conf_value = regrid_dict->lookup_double(conf_key_trunc_factor, false); info.gaussian.trunc_factor = (is_bad_data(conf_value) ? default_trunc_factor : conf_value); - if (info.method == InterpMthd_Gaussian || info.method == InterpMthd_MaxGauss) info.gaussian.compute(); + if (info.method == InterpMthd::Gaussian || info.method == InterpMthd::MaxGauss) info.gaussian.compute(); // MET#2437 Do not search the higher levels of config file context for convert, // censor_thresh, and censor_val. They must be specified within the @@ -1438,7 +1438,7 @@ void InterpInfo::clear() { method.clear(); width.clear(); gaussian.clear(); - shape = GridTemplateFactory::GridTemplate_None; + shape = GridTemplateFactory::GridTemplates::None; } /////////////////////////////////////////////////////////////////////////////// @@ -1451,15 +1451,15 @@ void InterpInfo::validate() { // Check the nearest neighbor special case if(width[i] == 1 && - methodi != InterpMthd_None && - methodi != InterpMthd_Nearest && - methodi != InterpMthd_Force && - methodi != InterpMthd_Upper_Left && - methodi != InterpMthd_Upper_Right && - methodi != InterpMthd_Lower_Right && - methodi != InterpMthd_Lower_Left && - methodi != InterpMthd_Gaussian && - methodi != InterpMthd_MaxGauss) { + methodi != InterpMthd::None && + methodi != InterpMthd::Nearest && + methodi != InterpMthd::Force && + methodi != InterpMthd::Upper_Left && + methodi != InterpMthd::Upper_Right && + methodi != InterpMthd::Lower_Right && + methodi != InterpMthd::Lower_Left && + methodi != InterpMthd::Gaussian && + methodi != InterpMthd::MaxGauss) { mlog << Warning << "\nInterpInfo::validate() -> " << "Resetting interpolation method " << (int) i << " from \"" << method[i] << "\" to \"" @@ -1469,11 +1469,11 @@ void InterpInfo::validate() { } // Check for some methods, that width is 1 - if((methodi == InterpMthd_Nearest || - methodi == InterpMthd_Upper_Left || - methodi == InterpMthd_Upper_Right || - methodi == InterpMthd_Lower_Right || - methodi == InterpMthd_Lower_Left) && + if((methodi == InterpMthd::Nearest || + methodi == InterpMthd::Upper_Left || + methodi == InterpMthd::Upper_Right || + methodi == InterpMthd::Lower_Right || + methodi == InterpMthd::Lower_Left) && width[i] != 1) { mlog << Warning << "\nInterpInfo::validate() -> " << "Resetting interpolation width " << (int) i << " from " @@ -1483,8 +1483,8 @@ void InterpInfo::validate() { } // Check the bilinear and budget special cases - if((methodi == InterpMthd_Bilin || - methodi == InterpMthd_Budget) && + if((methodi == InterpMthd::Bilin || + methodi == InterpMthd::Budget) && width[i] != 2) { mlog << Warning << "\nInterpInfo::validate() -> " << "Resetting interpolation width " << (int) i << " from " @@ -1494,8 +1494,8 @@ void InterpInfo::validate() { } // Check the Gaussian filter - if(methodi == InterpMthd_Gaussian || - methodi == InterpMthd_MaxGauss) { + if(methodi == InterpMthd::Gaussian || + methodi == InterpMthd::MaxGauss) { if (gaussian.radius < gaussian.dx) { mlog << Error << "\n" << "The radius of influence (" << gaussian.radius @@ -1591,7 +1591,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) { } else { // If not specified, use the default square shape - info.shape = GridTemplateFactory::GridTemplate_Square; + info.shape = GridTemplateFactory::GridTemplates::Square; } // Conf: gaussian dx and radius @@ -1645,8 +1645,8 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) { method = int_to_interpmthd(mthd_na[j]); // Check for unsupported interpolation options - if(method == InterpMthd_Budget || - method == InterpMthd_Force) { + if(method == InterpMthd::Budget || + method == InterpMthd::Force) { mlog << Error << "\nparse_conf_interp() -> " << "\"" << interpmthd_to_string(method) << "\" not valid for interpolating, only regridding.\n\n"; @@ -1666,7 +1666,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) { } // end for k - if(method == InterpMthd_Gaussian || method == InterpMthd_MaxGauss) { + if(method == InterpMthd::Gaussian || method == InterpMthd::MaxGauss) { info.gaussian.compute(); } } // end for j @@ -1861,7 +1861,7 @@ void NbrhdInfo::clear() { vld_thresh = bad_data_double; width.clear(); cov_ta.clear(); - shape = GridTemplateFactory::GridTemplate_None; + shape = GridTemplateFactory::GridTemplates::None; } /////////////////////////////////////////////////////////////////////////////// @@ -1949,7 +1949,7 @@ NbrhdInfo parse_conf_nbrhd(Dictionary *dict, const char *conf_key) { } else { // If not specified, use the default square shape - info.shape = GridTemplateFactory::GridTemplate_Square; + info.shape = GridTemplateFactory::GridTemplates::Square; } // Conf: cov_thresh @@ -1979,7 +1979,7 @@ void HiRAInfo::clear() { vld_thresh = bad_data_double; cov_ta.clear(); prob_cat_ta.clear(); - shape = GridTemplateFactory::GridTemplate_None; + shape = GridTemplateFactory::GridTemplates::None; } /////////////////////////////////////////////////////////////////////////////// @@ -2065,7 +2065,7 @@ HiRAInfo parse_conf_hira(Dictionary *dict) { } else { // If not specified, use the default square shape - info.shape = GridTemplateFactory::GridTemplate_Square; + info.shape = GridTemplateFactory::GridTemplates::Square; } // Conf: cov_thresh @@ -2552,30 +2552,30 @@ void check_climo_n_vx(Dictionary *dict, const int n_vx) { /////////////////////////////////////////////////////////////////////////////// InterpMthd int_to_interpmthd(int i) { - InterpMthd m = InterpMthd_None; - - if(i == conf_const.lookup_int(interpmthd_none_str)) m = InterpMthd_None; - else if(i == conf_const.lookup_int(interpmthd_min_str)) m = InterpMthd_Min; - else if(i == conf_const.lookup_int(interpmthd_max_str)) m = InterpMthd_Max; - else if(i == conf_const.lookup_int(interpmthd_median_str)) m = InterpMthd_Median; - else if(i == conf_const.lookup_int(interpmthd_uw_mean_str)) m = InterpMthd_UW_Mean; - else if(i == conf_const.lookup_int(interpmthd_dw_mean_str)) m = InterpMthd_DW_Mean; - else if(i == conf_const.lookup_int(interpmthd_aw_mean_str)) m = InterpMthd_AW_Mean; - else if(i == conf_const.lookup_int(interpmthd_ls_fit_str)) m = InterpMthd_LS_Fit; - else if(i == conf_const.lookup_int(interpmthd_bilin_str)) m = InterpMthd_Bilin; - else if(i == conf_const.lookup_int(interpmthd_nbrhd_str)) m = InterpMthd_Nbrhd; - else if(i == conf_const.lookup_int(interpmthd_nearest_str)) m = InterpMthd_Nearest; - else if(i == conf_const.lookup_int(interpmthd_budget_str)) m = InterpMthd_Budget; - else if(i == conf_const.lookup_int(interpmthd_force_str)) m = InterpMthd_Force; - else if(i == conf_const.lookup_int(interpmthd_best_str)) m = InterpMthd_Best; - else if(i == conf_const.lookup_int(interpmthd_upper_left_str)) m = InterpMthd_Upper_Left; - else if(i == conf_const.lookup_int(interpmthd_upper_right_str)) m = InterpMthd_Upper_Right; - else if(i == conf_const.lookup_int(interpmthd_lower_right_str)) m = InterpMthd_Lower_Right; - else if(i == conf_const.lookup_int(interpmthd_lower_left_str)) m = InterpMthd_Lower_Left; - else if(i == conf_const.lookup_int(interpmthd_gaussian_str)) m = InterpMthd_Gaussian; - else if(i == conf_const.lookup_int(interpmthd_maxgauss_str)) m = InterpMthd_MaxGauss; - else if(i == conf_const.lookup_int(interpmthd_geog_match_str)) m = InterpMthd_Geog_Match; - else if(i == conf_const.lookup_int(interpmthd_hira_str)) m = InterpMthd_HiRA; + InterpMthd m = InterpMthd::None; + + if(i == conf_const.lookup_int(interpmthd_none_str)) m = InterpMthd::None; + else if(i == conf_const.lookup_int(interpmthd_min_str)) m = InterpMthd::Min; + else if(i == conf_const.lookup_int(interpmthd_max_str)) m = InterpMthd::Max; + else if(i == conf_const.lookup_int(interpmthd_median_str)) m = InterpMthd::Median; + else if(i == conf_const.lookup_int(interpmthd_uw_mean_str)) m = InterpMthd::UW_Mean; + else if(i == conf_const.lookup_int(interpmthd_dw_mean_str)) m = InterpMthd::DW_Mean; + else if(i == conf_const.lookup_int(interpmthd_aw_mean_str)) m = InterpMthd::AW_Mean; + else if(i == conf_const.lookup_int(interpmthd_ls_fit_str)) m = InterpMthd::LS_Fit; + else if(i == conf_const.lookup_int(interpmthd_bilin_str)) m = InterpMthd::Bilin; + else if(i == conf_const.lookup_int(interpmthd_nbrhd_str)) m = InterpMthd::Nbrhd; + else if(i == conf_const.lookup_int(interpmthd_nearest_str)) m = InterpMthd::Nearest; + else if(i == conf_const.lookup_int(interpmthd_budget_str)) m = InterpMthd::Budget; + else if(i == conf_const.lookup_int(interpmthd_force_str)) m = InterpMthd::Force; + else if(i == conf_const.lookup_int(interpmthd_best_str)) m = InterpMthd::Best; + else if(i == conf_const.lookup_int(interpmthd_upper_left_str)) m = InterpMthd::Upper_Left; + else if(i == conf_const.lookup_int(interpmthd_upper_right_str)) m = InterpMthd::Upper_Right; + else if(i == conf_const.lookup_int(interpmthd_lower_right_str)) m = InterpMthd::Lower_Right; + else if(i == conf_const.lookup_int(interpmthd_lower_left_str)) m = InterpMthd::Lower_Left; + else if(i == conf_const.lookup_int(interpmthd_gaussian_str)) m = InterpMthd::Gaussian; + else if(i == conf_const.lookup_int(interpmthd_maxgauss_str)) m = InterpMthd::MaxGauss; + else if(i == conf_const.lookup_int(interpmthd_geog_match_str)) m = InterpMthd::Geog_Match; + else if(i == conf_const.lookup_int(interpmthd_hira_str)) m = InterpMthd::HiRA; else { mlog << Error << "\nconf_int_to_interpmthd() -> " << "Unexpected value of " << i @@ -2781,14 +2781,14 @@ FieldType int_to_fieldtype(int v) { /////////////////////////////////////////////////////////////////////////////// GridTemplateFactory::GridTemplates int_to_gridtemplate(int v) { - GridTemplateFactory::GridTemplates t = GridTemplateFactory::GridTemplate_Square; + GridTemplateFactory::GridTemplates t = GridTemplateFactory::GridTemplates::Square; // Convert integer to enumerated FieldType if(v == conf_const.lookup_int(conf_val_square)) { - t = GridTemplateFactory::GridTemplate_Square; + t = GridTemplateFactory::GridTemplates::Square; } else if(v == conf_const.lookup_int(conf_val_circle)) { - t = GridTemplateFactory::GridTemplate_Circle; + t = GridTemplateFactory::GridTemplates::Circle; } else { mlog << Error << "\nint_to_gridtemplate() -> " @@ -3206,16 +3206,16 @@ ConcatString matchtype_to_string(MatchType type) { /////////////////////////////////////////////////////////////////////////////// DistType int_to_disttype(int v) { - DistType t = DistType_None; + DistType t = DistType::None; // Convert integer to enumerated DistType - if(v == conf_const.lookup_int(conf_val_none)) t = DistType_None; - else if(v == conf_const.lookup_int(conf_val_normal)) t = DistType_Normal; - else if(v == conf_const.lookup_int(conf_val_exponential)) t = DistType_Exponential; - else if(v == conf_const.lookup_int(conf_val_chisquared)) t = DistType_ChiSquared; - else if(v == conf_const.lookup_int(conf_val_gamma)) t = DistType_Gamma; - else if(v == conf_const.lookup_int(conf_val_uniform)) t = DistType_Uniform; - else if(v == conf_const.lookup_int(conf_val_beta)) t = DistType_Beta; + if(v == conf_const.lookup_int(conf_val_none)) t = DistType::None; + else if(v == conf_const.lookup_int(conf_val_normal)) t = DistType::Normal; + else if(v == conf_const.lookup_int(conf_val_exponential)) t = DistType::Exponential; + else if(v == conf_const.lookup_int(conf_val_chisquared)) t = DistType::ChiSquared; + else if(v == conf_const.lookup_int(conf_val_gamma)) t = DistType::Gamma; + else if(v == conf_const.lookup_int(conf_val_uniform)) t = DistType::Uniform; + else if(v == conf_const.lookup_int(conf_val_beta)) t = DistType::Beta; else { mlog << Error << "\nint_to_disttype() -> " << "Unexpected value of " << v << ".\n\n"; @@ -3228,16 +3228,16 @@ DistType int_to_disttype(int v) { /////////////////////////////////////////////////////////////////////////////// DistType string_to_disttype(const char *s) { - DistType t = DistType_None; + DistType t = DistType::None; // Convert string to enumerated DistType - if(strcasecmp(s, conf_val_none) == 0) t = DistType_None; - else if(strcasecmp(s, conf_val_normal) == 0) t = DistType_Normal; - else if(strcasecmp(s, conf_val_exponential) == 0) t = DistType_Exponential; - else if(strcasecmp(s, conf_val_chisquared) == 0) t = DistType_ChiSquared; - else if(strcasecmp(s, conf_val_gamma) == 0) t = DistType_Gamma; - else if(strcasecmp(s, conf_val_uniform) == 0) t = DistType_Uniform; - else if(strcasecmp(s, conf_val_beta) == 0) t = DistType_Beta; + if(strcasecmp(s, conf_val_none) == 0) t = DistType::None; + else if(strcasecmp(s, conf_val_normal) == 0) t = DistType::Normal; + else if(strcasecmp(s, conf_val_exponential) == 0) t = DistType::Exponential; + else if(strcasecmp(s, conf_val_chisquared) == 0) t = DistType::ChiSquared; + else if(strcasecmp(s, conf_val_gamma) == 0) t = DistType::Gamma; + else if(strcasecmp(s, conf_val_uniform) == 0) t = DistType::Uniform; + else if(strcasecmp(s, conf_val_beta) == 0) t = DistType::Beta; else { mlog << Error << "\nstring_to_disttype() -> " << "Unexpected DistType string \"" << s << "\".\n\n"; @@ -3254,13 +3254,13 @@ ConcatString disttype_to_string(DistType type) { // Convert enumerated DistType to string switch(type) { - case DistType_None: s = conf_val_none; break; - case DistType_Normal: s = conf_val_normal; break; - case DistType_Exponential: s = conf_val_exponential; break; - case DistType_ChiSquared: s = conf_val_chisquared; break; - case DistType_Gamma: s = conf_val_gamma; break; - case DistType_Uniform: s = conf_val_uniform; break; - case DistType_Beta: s = conf_val_beta; break; + case DistType::None: s = conf_val_none; break; + case DistType::Normal: s = conf_val_normal; break; + case DistType::Exponential: s = conf_val_exponential; break; + case DistType::ChiSquared: s = conf_val_chisquared; break; + case DistType::Gamma: s = conf_val_gamma; break; + case DistType::Uniform: s = conf_val_uniform; break; + case DistType::Beta: s = conf_val_beta; break; default: mlog << Error << "\ndisttype_to_string() -> " << "Unexpected DistType value of " << enum_class_as_integer(type) << ".\n\n"; @@ -3278,11 +3278,11 @@ ConcatString dist_to_string(DistType type, const NumArray &parm) { s = disttype_to_string(type); // Append distribution parameters - if(type != DistType_None && parm.n() == 2) { + if(type != DistType::None && parm.n() == 2) { s << "(" << parm[0]; - if(type == DistType_Gamma || - type == DistType_Uniform || - type == DistType_Beta) { + if(type == DistType::Gamma || + type == DistType::Uniform || + type == DistType::Beta) { s << ", " << parm[1]; } s << ")"; @@ -3353,7 +3353,7 @@ StringArray parse_conf_ens_member_ids(Dictionary *dict) { /////////////////////////////////////////////////////////////////////////////// NormalizeType parse_conf_normalize(Dictionary *dict) { - NormalizeType t = NormalizeType_None; + NormalizeType t = NormalizeType::None; int v; if(!dict) { @@ -3366,11 +3366,11 @@ NormalizeType parse_conf_normalize(Dictionary *dict) { v = dict->lookup_int(conf_key_normalize); // Convert integer to enumerated NormalizeType - if(v == conf_const.lookup_int(normalizetype_none_str)) t = NormalizeType_None; - else if(v == conf_const.lookup_int(normalizetype_climo_anom_str)) t = NormalizeType_ClimoAnom; - else if(v == conf_const.lookup_int(normalizetype_climo_std_anom_str)) t = NormalizeType_ClimoStdAnom; - else if(v == conf_const.lookup_int(normalizetype_fcst_anom_str)) t = NormalizeType_FcstAnom; - else if(v == conf_const.lookup_int(normalizetype_fcst_std_anom_str)) t = NormalizeType_FcstStdAnom; + if(v == conf_const.lookup_int(normalizetype_none_str)) t = NormalizeType::None; + else if(v == conf_const.lookup_int(normalizetype_climo_anom_str)) t = NormalizeType::ClimoAnom; + else if(v == conf_const.lookup_int(normalizetype_climo_std_anom_str)) t = NormalizeType::ClimoStdAnom; + else if(v == conf_const.lookup_int(normalizetype_fcst_anom_str)) t = NormalizeType::FcstAnom; + else if(v == conf_const.lookup_int(normalizetype_fcst_std_anom_str)) t = NormalizeType::FcstStdAnom; else { mlog << Error << "\nparse_conf_normalize() -> " << "Unexpected value of " << v << ".\n\n"; diff --git a/src/basic/vx_config/configobjecttype_to_string.cc b/src/basic/vx_config/configobjecttype_to_string.cc index d8088d406c..8bb9f296b8 100644 --- a/src/basic/vx_config/configobjecttype_to_string.cc +++ b/src/basic/vx_config/configobjecttype_to_string.cc @@ -62,7 +62,7 @@ switch ( t ) { } // switch -return ConcatString (s); +return ConcatString(s); } diff --git a/src/basic/vx_config/grdfiletype_to_string.cc b/src/basic/vx_config/grdfiletype_to_string.cc index b5d2d4b6be..c9e89451c3 100644 --- a/src/basic/vx_config/grdfiletype_to_string.cc +++ b/src/basic/vx_config/grdfiletype_to_string.cc @@ -28,7 +28,6 @@ #include "grdfiletype_to_string.h" - using namespace std; diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc index 63e499533b..78e4e5aad4 100644 --- a/src/basic/vx_math/viewgravity_to_string.cc +++ b/src/basic/vx_math/viewgravity_to_string.cc @@ -28,7 +28,6 @@ #include "viewgravity_to_string.h" - using namespace std; diff --git a/src/basic/vx_util/GridTemplate.cc b/src/basic/vx_util/GridTemplate.cc index 9534c81015..58bc284741 100644 --- a/src/basic/vx_util/GridTemplate.cc +++ b/src/basic/vx_util/GridTemplate.cc @@ -40,6 +40,15 @@ using namespace std; /////////////////////////////////////////////////////////////////////////////// +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + +/////////////////////////////////////////////////////////////////////////////// + GridTemplate::GridTemplate(void) : _wrapLon(false) { // Do nothing @@ -591,11 +600,11 @@ void GridTemplate::_setEdgeOffsets() { /////////////////////////////////////////////////////////////////////////////// GridTemplateFactory::GridTemplateFactory() { - enum_to_string.resize(GridTemplate_NUM_TEMPLATES); + enum_to_string.resize(enum_class_as_integer(GridTemplates::NUM_TEMPLATES)); - enum_to_string[GridTemplate_None] = ""; - enum_to_string[GridTemplate_Square] = "SQUARE"; - enum_to_string[GridTemplate_Circle] = "CIRCLE"; + enum_to_string[enum_class_as_integer(GridTemplates::None)] = ""; + enum_to_string[enum_class_as_integer(GridTemplates::Square)] = "SQUARE"; + enum_to_string[enum_class_as_integer(GridTemplates::Circle)] = "CIRCLE"; } /////////////////////////////////////////////////////////////////////////////// @@ -612,7 +621,7 @@ GridTemplateFactory::~GridTemplateFactory() { GridTemplateFactory::GridTemplates GridTemplateFactory::string2Enum(string target) { - for(unsigned int ix = 0; ix < GridTemplate_NUM_TEMPLATES; ix++) { + for(unsigned int ix = 0; ix < enum_class_as_integer(GridTemplates::NUM_TEMPLATES); ix++) { if(enum_to_string[ix] == target) { return static_cast(ix); } @@ -632,7 +641,7 @@ string GridTemplateFactory::enum2String(GridTemplates target) { if(static_cast(target) > enum_to_string.size() - 1) { mlog << Error << "\nGridTemplateFactory::enum2String() -> " - << "target out of range " << target << " > " + << "target out of range " << enum_class_as_integer(target) << " > " << (static_cast(enum_to_string.size()) - 1) << ".\n\n"; exit(1); @@ -659,15 +668,15 @@ GridTemplate* GridTemplateFactory::buildGT(string gt, int width, bool wrap_lon) GridTemplate* GridTemplateFactory::buildGT(GridTemplates gt, int width, bool wrap_lon) { switch (gt) { - case(GridTemplate_Square): + case(GridTemplates::Square): return new RectangularTemplate(width, width, wrap_lon); - case(GridTemplate_Circle): + case(GridTemplates::Circle): return new CircularTemplate(width, wrap_lon); default: mlog << Error << "\nbuildGT() -> " - << "Unexpected GridTemplates value (" << gt << ").\n\n"; + << "Unexpected GridTemplates value (" << enum_class_as_integer(gt) << ").\n\n"; exit(1); } } diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index 6682cc10af..05df9ac644 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -159,11 +159,11 @@ class GridTemplateFactory { // do not assign specific values to these enumes. // other code requires them to start at zero and increase by 1 // make sure GridTemplate_NUM_TEMPLATES is always last. - enum GridTemplates { - GridTemplate_None, - GridTemplate_Square, - GridTemplate_Circle, - GridTemplate_NUM_TEMPLATES + enum class GridTemplates { + None, + Square, + Circle, + NUM_TEMPLATES }; // String corresponding to the enumerated values above diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc index fa89d3958e..6bdf630114 100644 --- a/src/basic/vx_util/asciitablejust_to_string.cc +++ b/src/basic/vx_util/asciitablejust_to_string.cc @@ -6,6 +6,7 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + //////////////////////////////////////////////////////////////////////// @@ -27,7 +28,6 @@ #include "asciitablejust_to_string.h" - using namespace std; diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc index 233b3b6293..16beac9e3c 100644 --- a/src/basic/vx_util/data_plane_util.cc +++ b/src/basic/vx_util/data_plane_util.cc @@ -18,6 +18,7 @@ #include "omp.h" #endif +#include "config_util.h" #include "data_plane_util.h" #include "interp_util.h" #include "two_to_one.h" @@ -36,6 +37,13 @@ using namespace std; // //////////////////////////////////////////////////////////////////////// +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + //////////////////////////////////////////////////////////////////////// // // Check the range of probability values and make sure it's either @@ -106,7 +114,7 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, smooth_dp = dp; // For nearest neighbor, no work to do. - if(width == 1 && mthd == InterpMthd_Nearest) return; + if(width == 1 && mthd == InterpMthd::Nearest) return; // build the grid template GridTemplateFactory gtf; @@ -125,27 +133,27 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, // Compute the smoothed value based on the interpolation method switch(mthd) { - case(InterpMthd_Min): // Minimum + case(InterpMthd::Min): // Minimum v = interp_min(dp, *gt, x, y, t); break; - case(InterpMthd_Max): // Maximum + case(InterpMthd::Max): // Maximum v = interp_max(dp, *gt, x, y, t); break; - case(InterpMthd_Median): // Median + case(InterpMthd::Median): // Median v = interp_median(dp, *gt, x, y, t); break; - case(InterpMthd_UW_Mean): // Unweighted Mean + case(InterpMthd::UW_Mean): // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, t); break; - case(InterpMthd_Gaussian): // For Gaussian, pass the data through + case(InterpMthd::Gaussian): // For Gaussian, pass the data through v = dp.get(x, y); break; - case(InterpMthd_MaxGauss): // For Max Gaussian, compute the max + case(InterpMthd::MaxGauss): // For Max Gaussian, compute the max v = interp_max(dp, *gt, x, y, 0); break; @@ -156,7 +164,7 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, default: mlog << Error << "\nsmooth_field() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << mthd + << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; exit(1); } @@ -168,8 +176,8 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, } // end for x // Apply the Gaussian smoother - if(mthd == InterpMthd_Gaussian || - mthd == InterpMthd_MaxGauss) { + if(mthd == InterpMthd::Gaussian || + mthd == InterpMthd::MaxGauss) { interp_gaussian_dp(smooth_dp, gaussian, t); } @@ -265,7 +273,7 @@ void fractional_coverage(const DataPlane &dp, DataPlane &frac_dp, mlog << Debug(3) << "Computing fractional coverage field using the " << t.get_str() << " threshold and the " - << interpmthd_to_string(InterpMthd_Nbrhd) << "(" << gt->size() + << interpmthd_to_string(InterpMthd::Nbrhd) << "(" << gt->size() << ") " << gt->getClassName() << " interpolation method.\n"; // Initialize the fractional coverage field diff --git a/src/basic/vx_util/interp_mthd.cc b/src/basic/vx_util/interp_mthd.cc index ba55b07da3..afb04be803 100644 --- a/src/basic/vx_util/interp_mthd.cc +++ b/src/basic/vx_util/interp_mthd.cc @@ -24,29 +24,29 @@ ConcatString interpmthd_to_string(const InterpMthd m) { ConcatString out; switch(m) { - case(InterpMthd_Min): out = interpmthd_min_str; break; - case(InterpMthd_Max): out = interpmthd_max_str; break; - case(InterpMthd_Median): out = interpmthd_median_str; break; - case(InterpMthd_UW_Mean): out = interpmthd_uw_mean_str; break; - case(InterpMthd_DW_Mean): out = interpmthd_dw_mean_str; break; - case(InterpMthd_AW_Mean): out = interpmthd_aw_mean_str; break; - case(InterpMthd_LS_Fit): out = interpmthd_ls_fit_str; break; - case(InterpMthd_Nbrhd): out = interpmthd_nbrhd_str; break; - case(InterpMthd_Bilin): out = interpmthd_bilin_str; break; - case(InterpMthd_Nearest): out = interpmthd_nearest_str; break; - case(InterpMthd_Budget): out = interpmthd_budget_str; break; - case(InterpMthd_Force): out = interpmthd_force_str; break; - case(InterpMthd_Best): out = interpmthd_best_str; break; - case(InterpMthd_Upper_Left): out = interpmthd_upper_left_str; break; - case(InterpMthd_Upper_Right): out = interpmthd_upper_right_str; break; - case(InterpMthd_Lower_Right): out = interpmthd_lower_right_str; break; - case(InterpMthd_Lower_Left): out = interpmthd_lower_left_str; break; - case(InterpMthd_Gaussian): out = interpmthd_gaussian_str; break; - case(InterpMthd_MaxGauss): out = interpmthd_maxgauss_str; break; - case(InterpMthd_Geog_Match): out = interpmthd_geog_match_str; break; - case(InterpMthd_HiRA): out = interpmthd_hira_str; break; + case InterpMthd::Min: out = interpmthd_min_str; break; + case InterpMthd::Max: out = interpmthd_max_str; break; + case InterpMthd::Median: out = interpmthd_median_str; break; + case InterpMthd::UW_Mean: out = interpmthd_uw_mean_str; break; + case InterpMthd::DW_Mean: out = interpmthd_dw_mean_str; break; + case InterpMthd::AW_Mean: out = interpmthd_aw_mean_str; break; + case InterpMthd::LS_Fit: out = interpmthd_ls_fit_str; break; + case InterpMthd::Nbrhd: out = interpmthd_nbrhd_str; break; + case InterpMthd::Bilin: out = interpmthd_bilin_str; break; + case InterpMthd::Nearest: out = interpmthd_nearest_str; break; + case InterpMthd::Budget: out = interpmthd_budget_str; break; + case InterpMthd::Force: out = interpmthd_force_str; break; + case InterpMthd::Best: out = interpmthd_best_str; break; + case InterpMthd::Upper_Left: out = interpmthd_upper_left_str; break; + case InterpMthd::Upper_Right: out = interpmthd_upper_right_str; break; + case InterpMthd::Lower_Right: out = interpmthd_lower_right_str; break; + case InterpMthd::Lower_Left: out = interpmthd_lower_left_str; break; + case InterpMthd::Gaussian: out = interpmthd_gaussian_str; break; + case InterpMthd::MaxGauss: out = interpmthd_maxgauss_str; break; + case InterpMthd::Geog_Match: out = interpmthd_geog_match_str; break; + case InterpMthd::HiRA: out = interpmthd_hira_str; break; - case(InterpMthd_None): + case InterpMthd::None: default: out = interpmthd_none_str; break; } // switch @@ -58,28 +58,28 @@ ConcatString interpmthd_to_string(const InterpMthd m) { InterpMthd string_to_interpmthd(const char *mthd_str) { InterpMthd m; - if(strcmp(mthd_str, interpmthd_min_str) == 0) m = InterpMthd_Min; - else if(strcmp(mthd_str, interpmthd_max_str) == 0) m = InterpMthd_Max; - else if(strcmp(mthd_str, interpmthd_median_str) == 0) m = InterpMthd_Median; - else if(strcmp(mthd_str, interpmthd_uw_mean_str) == 0) m = InterpMthd_UW_Mean; - else if(strcmp(mthd_str, interpmthd_dw_mean_str) == 0) m = InterpMthd_DW_Mean; - else if(strcmp(mthd_str, interpmthd_aw_mean_str) == 0) m = InterpMthd_AW_Mean; - else if(strcmp(mthd_str, interpmthd_ls_fit_str) == 0) m = InterpMthd_LS_Fit; - else if(strcmp(mthd_str, interpmthd_nbrhd_str) == 0) m = InterpMthd_Nbrhd; - else if(strcmp(mthd_str, interpmthd_bilin_str) == 0) m = InterpMthd_Bilin; - else if(strcmp(mthd_str, interpmthd_nearest_str) == 0) m = InterpMthd_Nearest; - else if(strcmp(mthd_str, interpmthd_budget_str) == 0) m = InterpMthd_Budget; - else if(strcmp(mthd_str, interpmthd_force_str) == 0) m = InterpMthd_Force; - else if(strcmp(mthd_str, interpmthd_best_str) == 0) m = InterpMthd_Best; - else if(strcmp(mthd_str, interpmthd_upper_left_str) == 0) m = InterpMthd_Upper_Left; - else if(strcmp(mthd_str, interpmthd_upper_right_str) == 0) m = InterpMthd_Upper_Right; - else if(strcmp(mthd_str, interpmthd_lower_right_str) == 0) m = InterpMthd_Lower_Right; - else if(strcmp(mthd_str, interpmthd_lower_left_str) == 0) m = InterpMthd_Lower_Left; - else if(strcmp(mthd_str, interpmthd_gaussian_str ) == 0) m = InterpMthd_Gaussian; - else if(strcmp(mthd_str, interpmthd_maxgauss_str ) == 0) m = InterpMthd_MaxGauss; - else if(strcmp(mthd_str, interpmthd_geog_match_str) == 0) m = InterpMthd_Geog_Match; - else if(strcmp(mthd_str, interpmthd_hira_str) == 0) m = InterpMthd_HiRA; - else m = InterpMthd_None; + if(strcmp(mthd_str, interpmthd_min_str) == 0) m = InterpMthd::Min; + else if(strcmp(mthd_str, interpmthd_max_str) == 0) m = InterpMthd::Max; + else if(strcmp(mthd_str, interpmthd_median_str) == 0) m = InterpMthd::Median; + else if(strcmp(mthd_str, interpmthd_uw_mean_str) == 0) m = InterpMthd::UW_Mean; + else if(strcmp(mthd_str, interpmthd_dw_mean_str) == 0) m = InterpMthd::DW_Mean; + else if(strcmp(mthd_str, interpmthd_aw_mean_str) == 0) m = InterpMthd::AW_Mean; + else if(strcmp(mthd_str, interpmthd_ls_fit_str) == 0) m = InterpMthd::LS_Fit; + else if(strcmp(mthd_str, interpmthd_nbrhd_str) == 0) m = InterpMthd::Nbrhd; + else if(strcmp(mthd_str, interpmthd_bilin_str) == 0) m = InterpMthd::Bilin; + else if(strcmp(mthd_str, interpmthd_nearest_str) == 0) m = InterpMthd::Nearest; + else if(strcmp(mthd_str, interpmthd_budget_str) == 0) m = InterpMthd::Budget; + else if(strcmp(mthd_str, interpmthd_force_str) == 0) m = InterpMthd::Force; + else if(strcmp(mthd_str, interpmthd_best_str) == 0) m = InterpMthd::Best; + else if(strcmp(mthd_str, interpmthd_upper_left_str) == 0) m = InterpMthd::Upper_Left; + else if(strcmp(mthd_str, interpmthd_upper_right_str) == 0) m = InterpMthd::Upper_Right; + else if(strcmp(mthd_str, interpmthd_lower_right_str) == 0) m = InterpMthd::Lower_Right; + else if(strcmp(mthd_str, interpmthd_lower_left_str) == 0) m = InterpMthd::Lower_Left; + else if(strcmp(mthd_str, interpmthd_gaussian_str ) == 0) m = InterpMthd::Gaussian; + else if(strcmp(mthd_str, interpmthd_maxgauss_str ) == 0) m = InterpMthd::MaxGauss; + else if(strcmp(mthd_str, interpmthd_geog_match_str) == 0) m = InterpMthd::Geog_Match; + else if(strcmp(mthd_str, interpmthd_hira_str) == 0) m = InterpMthd::HiRA; + else m = InterpMthd::None; return m; } diff --git a/src/basic/vx_util/interp_mthd.h b/src/basic/vx_util/interp_mthd.h index 0f061241e1..b5468168ed 100644 --- a/src/basic/vx_util/interp_mthd.h +++ b/src/basic/vx_util/interp_mthd.h @@ -21,29 +21,29 @@ // // Enumeration for interpolation methods // -enum InterpMthd { - InterpMthd_None, - InterpMthd_Min, - InterpMthd_Max, - InterpMthd_Median, - InterpMthd_UW_Mean, - InterpMthd_DW_Mean, - InterpMthd_AW_Mean, - InterpMthd_LS_Fit, - InterpMthd_Nbrhd, - InterpMthd_Bilin, - InterpMthd_Nearest, - InterpMthd_Budget, - InterpMthd_Force, - InterpMthd_Best, - InterpMthd_Upper_Left, - InterpMthd_Upper_Right, - InterpMthd_Lower_Right, - InterpMthd_Lower_Left, - InterpMthd_Gaussian, - InterpMthd_MaxGauss, - InterpMthd_Geog_Match, - InterpMthd_HiRA +enum class InterpMthd { + None, + Min, + Max, + Median, + UW_Mean, + DW_Mean, + AW_Mean, + LS_Fit, + Nbrhd, + Bilin, + Nearest, + Budget, + Force, + Best, + Upper_Left, + Upper_Right, + Lower_Right, + Lower_Left, + Gaussian, + MaxGauss, + Geog_Match, + HiRA }; // diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc index 826c396e1e..db776d737e 100644 --- a/src/basic/vx_util/interp_util.cc +++ b/src/basic/vx_util/interp_util.cc @@ -16,6 +16,7 @@ #include #include +#include "config_util.h" #include "interp_util.h" #include "GridTemplate.h" #include "RectangularTemplate.h" @@ -26,6 +27,15 @@ using namespace std; +//////////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + //////////////////////////////////////////////////////////////////////// // // Code for struct SurfaceInfo @@ -958,68 +968,68 @@ double compute_sfc_interp(const DataPlane &dp, // Compute the interpolated value for the fields above and below switch(mthd) { - case(InterpMthd_Min): // Minimum + case(InterpMthd::Min): // Minimum v = interp_min(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd_Max): // Maximum + case(InterpMthd::Max): // Maximum v = interp_max(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd_Median): // Median + case(InterpMthd::Median): // Median v = interp_median(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd_UW_Mean): // Unweighted Mean + case(InterpMthd::UW_Mean): // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd_DW_Mean): // Distance-Weighted Mean + case(InterpMthd::DW_Mean): // Distance-Weighted Mean v = interp_dw_mean(dp, *gt, obs_x, obs_y, dw_mean_pow, interp_thresh, &sfc_mask); break; - case(InterpMthd_LS_Fit): // Least-squares fit + case(InterpMthd::LS_Fit): // Least-squares fit v = interp_ls_fit(dp, *gt, obs_x, obs_y, interp_thresh, &sfc_mask); break; - case(InterpMthd_Bilin): // Bilinear interpolation + case(InterpMthd::Bilin): // Bilinear interpolation v = interp_bilin(dp, wrap_lon, obs_x, obs_y, &sfc_mask); break; - case(InterpMthd_Nearest): // Nearest Neighbor + case(InterpMthd::Nearest): // Nearest Neighbor v = interp_xy(dp, wrap_lon, x, y, &sfc_mask); break; - case(InterpMthd_Best): // Best Match + case(InterpMthd::Best): // Best Match v = interp_best(dp, *gt, x, y, obs_v, interp_thresh, &sfc_mask); break; - case(InterpMthd_Upper_Left): // Upper Left corner of the grid box + case(InterpMthd::Upper_Left): // Upper Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y), &sfc_mask); break; - case(InterpMthd_Upper_Right): // Upper Right corner of the grid box + case(InterpMthd::Upper_Right): // Upper Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y), &sfc_mask); break; - case(InterpMthd_Lower_Right): // Lower Right corner of the grid box + case(InterpMthd::Lower_Right): // Lower Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y), &sfc_mask); break; - case(InterpMthd_Lower_Left): // Lower Left corner of the grid box + case(InterpMthd::Lower_Left): // Lower Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y), &sfc_mask); break; - case(InterpMthd_Geog_Match): // Geography Match for surface point verification + case(InterpMthd::Geog_Match): // Geography Match for surface point verification v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v, &sfc_mask); break; default: mlog << Error << "\ncompute_sfc_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; exit(1); } @@ -1127,73 +1137,73 @@ double compute_horz_interp(const DataPlane &dp, // Compute the interpolated value for the fields above and below switch(mthd) { - case(InterpMthd_Min): // Minimum + case(InterpMthd::Min): // Minimum v = interp_min(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd_Max): // Maximum + case(InterpMthd::Max): // Maximum v = interp_max(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd_Median): // Median + case(InterpMthd::Median): // Median v = interp_median(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd_UW_Mean): // Unweighted Mean + case(InterpMthd::UW_Mean): // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd_DW_Mean): // Distance-Weighted Mean + case(InterpMthd::DW_Mean): // Distance-Weighted Mean v = interp_dw_mean(dp, *gt, obs_x, obs_y, dw_mean_pow, interp_thresh); break; - case(InterpMthd_LS_Fit): // Least-squares fit + case(InterpMthd::LS_Fit): // Least-squares fit v = interp_ls_fit(dp, *gt, obs_x, obs_y, interp_thresh); break; - case(InterpMthd_Nbrhd): // Neighborhood fractional coverage + case(InterpMthd::Nbrhd): // Neighborhood fractional coverage v = interp_nbrhd(dp, *gt, x, y, interp_thresh, cat_thresh, cmn, csd); break; - case(InterpMthd_Bilin): // Bilinear interpolation + case(InterpMthd::Bilin): // Bilinear interpolation v = interp_bilin(dp, wrap_lon, obs_x, obs_y); break; - case(InterpMthd_Nearest): // Nearest Neighbor + case(InterpMthd::Nearest): // Nearest Neighbor v = interp_xy(dp, wrap_lon, x, y); break; - case(InterpMthd_Best): // Best Match + case(InterpMthd::Best): // Best Match v = interp_best(dp, *gt, x, y, obs_v, interp_thresh); break; - case(InterpMthd_Upper_Left): // Upper Left corner of the grid box + case(InterpMthd::Upper_Left): // Upper Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y)); break; - case(InterpMthd_Upper_Right): // Upper Right corner of the grid box + case(InterpMthd::Upper_Right): // Upper Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y)); break; - case(InterpMthd_Lower_Right): // Lower Right corner of the grid box + case(InterpMthd::Lower_Right): // Lower Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y)); break; - case(InterpMthd_Lower_Left): // Lower Left corner of the grid box + case(InterpMthd::Lower_Left): // Lower Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y)); break; - case(InterpMthd_Geog_Match): // Geography Match for surface point verification + case(InterpMthd::Geog_Match): // Geography Match for surface point verification v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v); break; default: mlog << Error << "\ncompute_horz_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; exit(1); } @@ -1308,37 +1318,37 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, // Compute interpolation weights switch(mthd) { - case(InterpMthd_Min): // Minimum - case(InterpMthd_Max): // Maximum + case(InterpMthd::Min): // Minimum + case(InterpMthd::Max): // Maximum w1 = w2 = bad_data_double; break; - case(InterpMthd_UW_Mean): // Unweighted Mean + case(InterpMthd::UW_Mean): // Unweighted Mean w1 = w2 = 0.5; break; - case(InterpMthd_DW_Mean): // Distance-Weighted Mean + case(InterpMthd::DW_Mean): // Distance-Weighted Mean w1 = (double) (dp2.valid() - to_ut) / (dp2.valid() - dp1.valid()); w2 = (double) (to_ut - dp1.valid()) / (dp2.valid() - dp1.valid()); break; - case(InterpMthd_Nearest): // Nearest Neighbor + case(InterpMthd::Nearest): // Nearest Neighbor use_min = ((to_ut - dp1.valid()) <= (dp2.valid() - to_ut)); w1 = (use_min ? 1.0 : 0.0); w2 = (use_min ? 0.0 : 1.0); break; - case(InterpMthd_AW_Mean): // Area-Weighted Mean - case(InterpMthd_Median): // Median - case(InterpMthd_LS_Fit): // Least-squares fit - case(InterpMthd_Bilin): // Bilinear interpolation + case(InterpMthd::AW_Mean): // Area-Weighted Mean + case(InterpMthd::Median): // Median + case(InterpMthd::LS_Fit): // Least-squares fit + case(InterpMthd::Bilin): // Bilinear interpolation default: mlog << Error << "\nvalid_time_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; exit(1); } @@ -1360,11 +1370,11 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, if(!is_bad_data(v1) && !is_bad_data(v2)) { // Minimum - if(mthd == InterpMthd_Min) v = min(v1, v2); + if(mthd == InterpMthd::Min) v = min(v1, v2); // Maximum - else if(mthd == InterpMthd_Max) v = max(v1, v2); + else if(mthd == InterpMthd::Max) v = max(v1, v2); // Apply weights - else v = w1*v1 + w2*v2; + else v = w1*v1 + w2*v2; } // Store interpolated value diff --git a/src/basic/vx_util/normalize.cc b/src/basic/vx_util/normalize.cc index 11e8e9a7d2..5ad26ddfa3 100644 --- a/src/basic/vx_util/normalize.cc +++ b/src/basic/vx_util/normalize.cc @@ -14,10 +14,20 @@ #include #include +#include "config_util.h" #include "normalize.h" using namespace std; +//////////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + /////////////////////////////////////////////////////////////////////////////// ConcatString normalizetype_to_string(const NormalizeType type) { @@ -26,29 +36,29 @@ ConcatString normalizetype_to_string(const NormalizeType type) { // Convert enumerated NormalizeType to string switch(type) { - case NormalizeType_None: + case NormalizeType::None: s = normalizetype_none_str; break; - case NormalizeType_ClimoAnom: + case NormalizeType::ClimoAnom: s = normalizetype_climo_anom_str; break; - case NormalizeType_ClimoStdAnom: + case NormalizeType::ClimoStdAnom: s = normalizetype_climo_std_anom_str; break; - case NormalizeType_FcstAnom: + case NormalizeType::FcstAnom: s = normalizetype_fcst_anom_str; break; - case NormalizeType_FcstStdAnom: + case NormalizeType::FcstStdAnom: s = normalizetype_fcst_std_anom_str; break; default: mlog << Error << "\nnormalizetype_to_string() -> " - << "Unexpected NormalizeType value of " << type << ".\n\n"; + << "Unexpected NormalizeType value of " << enum_class_as_integer(type) << ".\n\n"; exit(1); } @@ -67,10 +77,10 @@ void normalize_data(DataPlane &dp, const NormalizeType type, // Supported types switch(type) { - case NormalizeType_None: + case NormalizeType::None: break; - case NormalizeType_ClimoAnom: + case NormalizeType::ClimoAnom: if(!cmn_ptr || dp.nxy() != cmn_ptr->nxy()) { mlog << Error << "\nnormalize_data() -> " << "the climatology mean is required for " @@ -80,7 +90,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type, dp.anomaly(*cmn_ptr); break; - case NormalizeType_ClimoStdAnom: + case NormalizeType::ClimoStdAnom: if(!cmn_ptr || dp.nxy() != cmn_ptr->nxy() || !csd_ptr || dp.nxy() != csd_ptr->nxy()) { mlog << Error << "\nnormalize_data() -> " @@ -91,7 +101,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type, dp.standard_anomaly(*cmn_ptr, *csd_ptr); break; - case NormalizeType_FcstAnom: + case NormalizeType::FcstAnom: if(!fmn_ptr || dp.nxy() != fmn_ptr->nxy()) { mlog << Error << "\nnormalize_data() -> " << "the forecast mean is required for " @@ -101,7 +111,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type, dp.anomaly(*fmn_ptr); break; - case NormalizeType_FcstStdAnom: + case NormalizeType::FcstStdAnom: if(!fmn_ptr || dp.nxy() != fmn_ptr->nxy() || !fsd_ptr || dp.nxy() != fsd_ptr->nxy()) { mlog << Error << "\nnormalize_data() -> " @@ -115,7 +125,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type, default: mlog << Error << "\nnormalize_data() -> " << "unexpected NormalizeType value (" - << type << ")\n\n"; + << enum_class_as_integer(type) << ")\n\n"; exit(1); } // end switch diff --git a/src/basic/vx_util/normalize.h b/src/basic/vx_util/normalize.h index b91fa45476..96fc32bc03 100644 --- a/src/basic/vx_util/normalize.h +++ b/src/basic/vx_util/normalize.h @@ -22,12 +22,12 @@ // Enumeration for normalization types // -enum NormalizeType { - NormalizeType_None, // No normalization - NormalizeType_ClimoAnom, // Subtract climo mean - NormalizeType_ClimoStdAnom, // Subtract climo mean and divide stdev - NormalizeType_FcstAnom, // Subtract fcst mean - NormalizeType_FcstStdAnom // Subtract fcst mean and divide stdev +enum class NormalizeType { + None, // No normalization + ClimoAnom, // Subtract climo mean + ClimoStdAnom, // Subtract climo mean and divide stdev + FcstAnom, // Subtract fcst mean + FcstStdAnom // Subtract fcst mean and divide stdev }; /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gsl_prob/gsl_randist.cc b/src/libcode/vx_gsl_prob/gsl_randist.cc index 3a9d87442d..956e912727 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; diff --git a/src/libcode/vx_gsl_prob/gsl_randist.h b/src/libcode/vx_gsl_prob/gsl_randist.h index e66c312230..1e8555e0d4 100644 --- a/src/libcode/vx_gsl_prob/gsl_randist.h +++ b/src/libcode/vx_gsl_prob/gsl_randist.h @@ -23,14 +23,14 @@ // Enumeration for distribution types // -enum DistType { - DistType_None, // No distribution - DistType_Normal, // Normal distribution - DistType_Exponential, // Exponential distribution - DistType_ChiSquared, // Chi-Squared distribution - DistType_Gamma, // Gamma distribution - DistType_Uniform, // Uniform distribution - DistType_Beta // Beta distribution +enum class DistType { + None, // No distribution + Normal, // Normal distribution + Exponential, // Exponential distribution + ChiSquared, // Chi-Squared distribution + Gamma, // Gamma distribution + Uniform, // Uniform distribution + Beta // Beta distribution }; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_regrid/vx_regrid.cc b/src/libcode/vx_regrid/vx_regrid.cc index 418cceb5c3..7abfee78b4 100644 --- a/src/libcode/vx_regrid/vx_regrid.cc +++ b/src/libcode/vx_regrid/vx_regrid.cc @@ -32,30 +32,30 @@ DataPlane out; switch ( info.method ) { - case InterpMthd_Min: - case InterpMthd_Max: - case InterpMthd_Median: - case InterpMthd_UW_Mean: - case InterpMthd_DW_Mean: - case InterpMthd_LS_Fit: - case InterpMthd_Bilin: - case InterpMthd_Nearest: + case InterpMthd::Min: + case InterpMthd::Max: + case InterpMthd::Median: + case InterpMthd::UW_Mean: + case InterpMthd::DW_Mean: + case InterpMthd::LS_Fit: + case InterpMthd::Bilin: + case InterpMthd::Nearest: out = met_regrid_generic (in, from_grid, to_grid, info); break; - case InterpMthd_Budget: + case InterpMthd::Budget: out = met_regrid_budget (in, from_grid, to_grid, info); break; - case InterpMthd_AW_Mean: + case InterpMthd::AW_Mean: out = met_regrid_area_weighted (in, from_grid, to_grid, info); break; - case InterpMthd_Force: + case InterpMthd::Force: out = met_regrid_force (in, from_grid, to_grid, info); break; - case InterpMthd_MaxGauss: + case InterpMthd::MaxGauss: out = met_regrid_maxgauss (in, from_grid, to_grid, info); break; @@ -97,9 +97,9 @@ DataPlane met_regrid_nearest (const DataPlane & from_data, const Grid & from_gri RegridInfo ri; ri.enable = true; -ri.method = InterpMthd_Nearest; +ri.method = InterpMthd::Nearest; ri.width = 1; -ri.shape = GridTemplateFactory::GridTemplate_Square; +ri.shape = GridTemplateFactory::GridTemplates::Square; return met_regrid_generic(from_data, from_grid, to_grid, ri); @@ -346,7 +346,7 @@ for (xt=0; xt<(to_grid.nx()); ++xt) { } else { value = compute_horz_interp(from_data, x_from, y_from, - bad_data_double, InterpMthd_Max, info.width, + bad_data_double, InterpMthd::Max, info.width, info.shape, from_grid.wrap_lon(), info.vld_thresh); } diff --git a/src/libcode/vx_shapedata/shapedata.cc b/src/libcode/vx_shapedata/shapedata.cc index ca2c6ead1c..94fed61cba 100644 --- a/src/libcode/vx_shapedata/shapedata.cc +++ b/src/libcode/vx_shapedata/shapedata.cc @@ -532,7 +532,7 @@ void ShapeData::conv_filter_circ(int diameter, double vld_thresh) { // Build the grid template with shape circle and wrap_lon false GridTemplateFactory gtf; - GridTemplate* gt = gtf.buildGT(GridTemplateFactory::GridTemplate_Circle, + GridTemplate* gt = gtf.buildGT(GridTemplateFactory::GridTemplates::Circle, diameter, false); #pragma omp single diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index 896d347ad4..07c4df90d6 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -1682,8 +1682,8 @@ void write_isc_row(StatHdrColumns &shc, const ISCInfo &isc_info, shc.set_line_type(stat_isc_str); // Not Applicable - shc.set_interp_mthd(InterpMthd_None, - GridTemplateFactory::GridTemplate_None); + shc.set_interp_mthd(InterpMthd::None, + GridTemplateFactory::GridTemplates::None); shc.set_interp_wdth(bad_data_int); shc.set_cov_thresh(na_str); shc.set_alpha(bad_data_double); diff --git a/src/libcode/vx_stat_out/stat_hdr_columns.cc b/src/libcode/vx_stat_out/stat_hdr_columns.cc index dab211c348..005499d8ed 100644 --- a/src/libcode/vx_stat_out/stat_hdr_columns.cc +++ b/src/libcode/vx_stat_out/stat_hdr_columns.cc @@ -221,7 +221,7 @@ void StatHdrColumns::set_interp_mthd(ConcatString s, ConcatString mthd = s; // Only append the interpolation shape when applicable - if(shape != GridTemplateFactory::GridTemplate_None && + if(shape != GridTemplateFactory::GridTemplates::None && mthd != interpmthd_none_str && mthd != interpmthd_bilin_str && mthd != interpmthd_nearest_str && diff --git a/src/libcode/vx_stat_out/stat_hdr_columns.h b/src/libcode/vx_stat_out/stat_hdr_columns.h index 7b40ff54ee..6a1c5da0fb 100644 --- a/src/libcode/vx_stat_out/stat_hdr_columns.h +++ b/src/libcode/vx_stat_out/stat_hdr_columns.h @@ -133,9 +133,9 @@ class StatHdrColumns { void set_mask (const char *); void set_interp_mthd (ConcatString s, - GridTemplateFactory::GridTemplates shape = GridTemplateFactory::GridTemplate_None); + GridTemplateFactory::GridTemplates shape = GridTemplateFactory::GridTemplates::None); void set_interp_mthd (const InterpMthd m, - GridTemplateFactory::GridTemplates shape = GridTemplateFactory::GridTemplate_None); + GridTemplateFactory::GridTemplates shape = GridTemplateFactory::GridTemplates::None); void set_interp_pnts (const int); void set_interp_wdth (const int); diff --git a/src/libcode/vx_statistics/obs_error.cc b/src/libcode/vx_statistics/obs_error.cc index 5b753346a3..6b2c95a906 100644 --- a/src/libcode/vx_statistics/obs_error.cc +++ b/src/libcode/vx_statistics/obs_error.cc @@ -108,7 +108,7 @@ void ObsErrorEntry::clear() { bias_scale = bias_offset = bad_data_double; - dist_type = DistType_None; + dist_type = DistType::None; dist_parm.clear(); v_min = bad_data_double; @@ -240,7 +240,7 @@ bool ObsErrorEntry::parse_line(const DataLine &dl) { bias_offset = (strcmp(dl[10], na_str) == 0 ? bad_data_double : atof(dl[10])); dist_type = string_to_disttype(dl[11]); - if(dist_type != DistType_None) dist_parm.add_css(dl[12]); + if(dist_type != DistType::None) dist_parm.add_css(dl[12]); // Range check if((hgt_range.n() != 0 && hgt_range.n() != 2) || @@ -320,13 +320,13 @@ void ObsErrorEntry::validate() { int n_req; // Number of distribution parameters - if(dist_type == DistType_Gamma || - dist_type == DistType_Uniform || - dist_type == DistType_Beta) n_req = 2; + if(dist_type == DistType::Gamma || + dist_type == DistType::Uniform || + dist_type == DistType::Beta) n_req = 2; else n_req = 1; // Make sure we have the expected number of parameters - if(dist_type != DistType_None && + if(dist_type != DistType::None && dist_parm.n() != n_req) { mlog << Error << "\nObsErrorEntry::validate() -> " << "expected " << n_req << " parameter(s) but got " @@ -714,7 +714,7 @@ double add_obs_error_inc(const gsl_rng *r, FieldType t, if(!e || is_bad_data(v)) return v; // Apply the specified random perturbation - if(e->dist_type != DistType_None) { + if(e->dist_type != DistType::None) { v_new += ran_draw(r, e->dist_type, e->dist_parm[0], e->dist_parm[1]); } @@ -727,7 +727,7 @@ double add_obs_error_inc(const gsl_rng *r, FieldType t, if(mlog.verbosity_level() >= 4) { // Check for no updates - if(e->dist_type == DistType_None) { + if(e->dist_type == DistType::None) { mlog << Debug(4) << "Applying no observation error update for " << fieldtype_to_string(t) << " value " << v diff --git a/src/libcode/vx_statistics/pair_base.cc b/src/libcode/vx_statistics/pair_base.cc index 99a14e97e3..f3ffaed3fb 100644 --- a/src/libcode/vx_statistics/pair_base.cc +++ b/src/libcode/vx_statistics/pair_base.cc @@ -74,8 +74,8 @@ void PairBase::clear() { msg_typ_vals.clear(); interp_wdth = 0; - interp_mthd = InterpMthd_None; - interp_shape = GridTemplateFactory::GridTemplate_None; + interp_mthd = InterpMthd::None; + interp_shape = GridTemplateFactory::GridTemplates::None; o_na.clear(); x_na.clear(); @@ -123,8 +123,8 @@ void PairBase::erase() { msg_typ.clear(); msg_typ_vals.clear(); - interp_mthd = InterpMthd_None; - interp_shape = GridTemplateFactory::GridTemplate_None; + interp_mthd = InterpMthd::None; + interp_shape = GridTemplateFactory::GridTemplates::None; o_na.erase(); x_na.erase(); diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index 173aa68d76..2cf41de138 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -1399,7 +1399,7 @@ void VxPairDataEnsemble::set_ens_size(int n) { for(int k=0; kflag) { // Use config file setting, if specified - if(obs_error_info->entry.dist_type != DistType_None) { + if(obs_error_info->entry.dist_type != DistType::None) { oerr_ptr = &(obs_error_info->entry); } // Otherwise, do a table lookup @@ -1692,10 +1692,10 @@ void VxPairDataEnsemble::add_point_obs(float *hdr_arr, int *hdr_typ_arr, // Check for valid interpolation options if(climo_sd_dpa.n_planes() > 0 && - (pd[0][0][k].interp_mthd == InterpMthd_Min || - pd[0][0][k].interp_mthd == InterpMthd_Max || - pd[0][0][k].interp_mthd == InterpMthd_Median || - pd[0][0][k].interp_mthd == InterpMthd_Best)) { + (pd[0][0][k].interp_mthd == InterpMthd::Min || + pd[0][0][k].interp_mthd == InterpMthd::Max || + pd[0][0][k].interp_mthd == InterpMthd::Median || + pd[0][0][k].interp_mthd == InterpMthd::Best)) { mlog << Warning << "\nVxPairDataEnsemble::add_point_obs() -> " << "applying the " << interpmthd_to_string(pd[0][0][k].interp_mthd) @@ -1752,7 +1752,7 @@ void VxPairDataEnsemble::add_ens(int member, bool mn, Grid &gr) { for(k=0; k " @@ -1785,7 +1785,7 @@ void VxPairDataEnsemble::add_ens(int member, bool mn, Grid &gr) { } // Extract the HiRA neighborhood of values - if(pd[0][0][k].interp_mthd == InterpMthd_HiRA) { + if(pd[0][0][k].interp_mthd == InterpMthd::HiRA) { // For HiRA, set the ensemble mean to bad data if(mn) { diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 0a99b81d0c..dd84a4e440 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -28,6 +28,15 @@ using namespace std; +//////////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + //////////////////////////////////////////////////////////////////////// // // Code for class PairDataPoint @@ -1081,8 +1090,8 @@ void VxPairDataPoint::add_point_obs(float *hdr_arr, const char *hdr_typ_str, // Interpolate model topography to observation location double topo = compute_horz_interp( *sfc_info.topo_ptr, obs_x, obs_y, hdr_elv, - InterpMthd_Bilin, 2, - GridTemplateFactory::GridTemplate_Square, + InterpMthd::Bilin, 2, + GridTemplateFactory::GridTemplates::Square, gr.wrap_lon(), 1.0); // Skip bad topography values @@ -1277,10 +1286,10 @@ void VxPairDataPoint::add_point_obs(float *hdr_arr, const char *hdr_typ_str, // Check for valid interpolation options if(climo_sd_dpa.n_planes() > 0 && - (pd[0][0][k].interp_mthd == InterpMthd_Min || - pd[0][0][k].interp_mthd == InterpMthd_Max || - pd[0][0][k].interp_mthd == InterpMthd_Median || - pd[0][0][k].interp_mthd == InterpMthd_Best)) { + (pd[0][0][k].interp_mthd == InterpMthd::Min || + pd[0][0][k].interp_mthd == InterpMthd::Max || + pd[0][0][k].interp_mthd == InterpMthd::Median || + pd[0][0][k].interp_mthd == InterpMthd::Best)) { mlog << Warning << "\nVxPairDataPoint::add_point_obs() -> " << "applying the " << interpmthd_to_string(pd[0][0][k].interp_mthd) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 6a069322d6..f00ca74bfd 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -1285,7 +1285,7 @@ void process_grid_vx() { if(conf_info.vx_opt[i].obs_error.flag) { // Use config file setting, if specified - if(conf_info.vx_opt[i].obs_error.entry.dist_type != DistType_None) { + if(conf_info.vx_opt[i].obs_error.entry.dist_type != DistType::None) { mlog << Debug(3) << "Observation error for gridded verification is " << "defined in the configuration file.\n"; @@ -1476,11 +1476,11 @@ void process_grid_vx() { FieldType field = conf_info.vx_opt[i].interp_info.field; // Check for allowable smoothing operation - if(mthd == InterpMthd_DW_Mean || - mthd == InterpMthd_LS_Fit || - mthd == InterpMthd_Bilin || - mthd == InterpMthd_Nbrhd || - mthd == InterpMthd_HiRA) { + if(mthd == InterpMthd::DW_Mean || + mthd == InterpMthd::LS_Fit || + mthd == InterpMthd::Bilin || + mthd == InterpMthd::Nbrhd || + mthd == InterpMthd::HiRA) { mlog << Warning << "\nprocess_grid_vx() -> " << mthd_str << " option not supported for " 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 479b1406dd..003057617f 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -284,7 +284,7 @@ void EnsembleStatConfInfo::process_config(GrdFileType etype, // Track the maximum HiRA size for(j=0; jwidth.n(); j++) { - shc.set_interp_mthd(InterpMthd_Nbrhd, nbrhd->shape); + shc.set_interp_mthd(InterpMthd::Nbrhd, nbrhd->shape); shc.set_interp_wdth(nbrhd->width[j]); // Loop through and apply each of the raw threshold values @@ -1727,7 +1727,7 @@ void process_scores() { cs << "-" << conf_info.vx_opt[i].wave_1d_end[j]; } - shc.set_interp_mthd(cs, GridTemplateFactory::GridTemplate_None); + shc.set_interp_mthd(cs, GridTemplateFactory::GridTemplates::None); shc.set_interp_pnts(bad_data_int); // Loop through the masks to be applied @@ -2592,7 +2592,7 @@ void write_nc(const ConcatString &field_name, const DataPlane &dp, // Append smoothing info for all but nearest neighbor if(interp_pnts > 1 || - interp_mthd == interpmthd_to_string(InterpMthd_Gaussian)) { + interp_mthd == interpmthd_to_string(InterpMthd::Gaussian)) { interp_str << "_" << interp_mthd << "_" << interp_pnts; } // Append Fourier decomposition info @@ -2882,7 +2882,7 @@ void write_nbrhd_nc(const DataPlane &fcst_dp, const DataPlane &obs_dp, NcVar obs_var; // Get the interpolation strings - mthd_str = interpmthd_to_string(InterpMthd_Nbrhd); + mthd_str = interpmthd_to_string(InterpMthd::Nbrhd); if(wdth > 1) nbrhd_str << "_" << mthd_str << "_" << wdth*wdth; int deflate_level = compress_level; 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 cd1a00b593..d277783684 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -804,9 +804,9 @@ void GridStatVxOpt::process_config( mthd = string_to_interpmthd(interp_info.method[i].c_str()); // Check for unsupported interpolation methods - if(mthd == InterpMthd_DW_Mean || - mthd == InterpMthd_LS_Fit || - mthd == InterpMthd_Bilin) { + if(mthd == InterpMthd::DW_Mean || + mthd == InterpMthd::LS_Fit || + mthd == InterpMthd::Bilin) { mlog << Error << "\nGridStatVxOpt::process_config() -> " << "Interpolation methods DW_MEAN, LS_FIT, and BILIN are " << "not supported in Grid-Stat.\n\n"; diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index c911779718..38cbc28f40 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -1805,7 +1805,7 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { bool spfh_flag = conf_info.vx_opt[i_vx].vx_pd.fcst_info->is_specific_humidity() && conf_info.vx_opt[i_vx].vx_pd.obs_info->is_specific_humidity(); - shc.set_interp_mthd(InterpMthd_Nbrhd, + shc.set_interp_mthd(InterpMthd::Nbrhd, conf_info.vx_opt[i_vx].hira_info.shape); // Loop over the HiRA widths @@ -1841,7 +1841,7 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { // Get the nearby forecast values get_interp_points(conf_info.vx_opt[i_vx].vx_pd.fcst_dpa, pd_ptr->x_na[j], pd_ptr->y_na[j], - InterpMthd_Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[i], + InterpMthd::Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[i], conf_info.vx_opt[i_vx].hira_info.shape, grid.wrap_lon(), conf_info.vx_opt[i_vx].hira_info.vld_thresh, spfh_flag, conf_info.vx_opt[i_vx].vx_pd.fcst_info->level().type(), @@ -1988,7 +1988,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { bool precip_flag = conf_info.vx_opt[i_vx].vx_pd.fcst_info->is_precipitation() && conf_info.vx_opt[i_vx].vx_pd.obs_info->is_precipitation(); - shc.set_interp_mthd(InterpMthd_Nbrhd, + shc.set_interp_mthd(InterpMthd::Nbrhd, conf_info.vx_opt[i_vx].hira_info.shape); // Loop over categorical thresholds and HiRA widths @@ -2019,7 +2019,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { f_cov = compute_interp(conf_info.vx_opt[i_vx].vx_pd.fcst_dpa, pd_ptr->x_na[k], pd_ptr->y_na[k], pd_ptr->o_na[k], pd_ptr->cmn_na[k], pd_ptr->csd_na[k], - InterpMthd_Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[j], + InterpMthd::Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[j], conf_info.vx_opt[i_vx].hira_info.shape, grid.wrap_lon(), conf_info.vx_opt[i_vx].hira_info.vld_thresh, spfh_flag, conf_info.vx_opt[i_vx].vx_pd.fcst_info->level().type(), @@ -2038,7 +2038,7 @@ void do_hira_prob(int i_vx, const PairDataPoint *pd_ptr) { cmn_cov = compute_interp(conf_info.vx_opt[i_vx].vx_pd.climo_mn_dpa, pd_ptr->x_na[k], pd_ptr->y_na[k], pd_ptr->o_na[k], pd_ptr->cmn_na[k], pd_ptr->csd_na[k], - InterpMthd_Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[j], + InterpMthd::Nbrhd, conf_info.vx_opt[i_vx].hira_info.width[j], conf_info.vx_opt[i_vx].hira_info.shape, grid.wrap_lon(), conf_info.vx_opt[i_vx].hira_info.vld_thresh, spfh_flag, conf_info.vx_opt[i_vx].vx_pd.fcst_info->level().type(), diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index 81a28634d2..4de6c2b2b8 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -303,12 +303,12 @@ void process_ensemble() { // read climatology separately for each member set_climo_ens_mem_id = (conf_info.ens_member_ids.n() > 1) && - ((*var_it)->normalize == NormalizeType_ClimoAnom || - (*var_it)->normalize == NormalizeType_ClimoStdAnom); + ((*var_it)->normalize == NormalizeType::ClimoAnom || + (*var_it)->normalize == NormalizeType::ClimoStdAnom); // Print out the normalization flag cs << cs_erase; - if((*var_it)->normalize != NormalizeType_None) { + if((*var_it)->normalize != NormalizeType::None) { cs << " with normalize = " << normalizetype_to_string((*var_it)->normalize); } @@ -359,8 +359,8 @@ void process_ensemble() { i_ens, cmn_dp, csd_dp); // Compute the ensemble summary data, if needed - if((*var_it)->normalize == NormalizeType_FcstAnom || - (*var_it)->normalize == NormalizeType_FcstStdAnom) { + if((*var_it)->normalize == NormalizeType::FcstAnom || + (*var_it)->normalize == NormalizeType::FcstStdAnom) { get_ens_mean_stdev((*var_it), emn_dp, esd_dp); } else { @@ -394,7 +394,7 @@ void process_ensemble() { } // Normalize, if requested - if((*var_it)->normalize != NormalizeType_None) { + if((*var_it)->normalize != NormalizeType::None) { normalize_data(ctrl_dp, (*var_it)->normalize, &cmn_dp, &csd_dp, &emn_dp, &esd_dp); } @@ -421,7 +421,7 @@ void process_ensemble() { } // Normalize, if requested - if((*var_it)->normalize != NormalizeType_None) { + if((*var_it)->normalize != NormalizeType::None) { normalize_data(ens_dp, (*var_it)->normalize, &cmn_dp, &csd_dp, &emn_dp, &esd_dp); } @@ -950,7 +950,7 @@ void write_ens_nc(GenEnsProdVarInfo *ens_info, int n_ens_vld, // Loop over the neighborhoods for(j=0; jcat_ta[i].get_abbr_str().contents().c_str(), - interpmthd_to_string(InterpMthd_Nbrhd).c_str(), + interpmthd_to_string(InterpMthd::Nbrhd).c_str(), conf_info.nbrhd_prob.width[j]*conf_info.nbrhd_prob.width[j]); write_ens_data_plane(ens_info, nbrhd_dp, ens_dp, type_str, "Neighborhood Ensemble Probability"); @@ -1001,7 +1001,7 @@ void write_ens_nc(GenEnsProdVarInfo *ens_info, int n_ens_vld, // Write neighborhood maximum ensemble probability snprintf(type_str, sizeof(type_str), "ENS_NMEP_%s_%s%i_%s%i", ens_info->cat_ta[i].get_abbr_str().contents().c_str(), - interpmthd_to_string(InterpMthd_Nbrhd).c_str(), + interpmthd_to_string(InterpMthd::Nbrhd).c_str(), conf_info.nbrhd_prob.width[j]*conf_info.nbrhd_prob.width[j], conf_info.nmep_smooth.method[k].c_str(), conf_info.nmep_smooth.width[k]*conf_info.nmep_smooth.width[k]); diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc index 81209ede28..52281061fd 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc @@ -304,9 +304,9 @@ void GenEnsProdConfInfo::process_config(GrdFileType etype, StringArray * ens_fil mthd = string_to_interpmthd(nmep_smooth.method[i].c_str()); // Check for unsupported neighborhood probability smoothing methods - if(mthd == InterpMthd_DW_Mean || - mthd == InterpMthd_LS_Fit || - mthd == InterpMthd_Bilin) { + if(mthd == InterpMthd::DW_Mean || + mthd == InterpMthd::LS_Fit || + mthd == InterpMthd::Bilin) { mlog << Error << "\nGenEnsProdConfInfo::process_config() -> " << "Neighborhood probability smoothing methods DW_MEAN, " << "LS_FIT, and BILIN are not supported for \"" diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 64b6690ecd..d11044dc5f 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -66,7 +66,7 @@ static const int TYPE_GOES = 5; static const int TYPE_GOES_ADP = 6; static const int TYPE_PYTHON = 7; // MET Point Obs NetCDF from PYTHON -static const InterpMthd DefaultInterpMthd = InterpMthd_UW_Mean; +static const InterpMthd DefaultInterpMthd = InterpMthd::UW_Mean; static const int DefaultInterpWdth = 2; static const double DefaultVldThresh = 0.5; @@ -995,9 +995,9 @@ void process_point_met_data(MetPointData *met_point_obs, MetConfig &config, VarI int data_count = dataArray.n(); if (0 < data_count) { float to_value; - if (RGInfo.method == InterpMthd_Min) to_value = dataArray.min(); - else if (RGInfo.method == InterpMthd_Max) to_value = dataArray.max(); - else if (RGInfo.method == InterpMthd_Median) { + if (RGInfo.method == InterpMthd::Min) to_value = dataArray.min(); + else if (RGInfo.method == InterpMthd::Max) to_value = dataArray.max(); + else if (RGInfo.method == InterpMthd::Median) { dataArray.sort_array(); to_value = dataArray[data_count/2]; if (0 == data_count % 2) @@ -1486,9 +1486,9 @@ void regrid_nc_variable(NcFile *nc_in, Met2dDataFile *fr_mtddf, float to_value; int data_cnt = dataArray.n(); if (1 == data_cnt) to_value = dataArray[0]; - else if (RGInfo.method == InterpMthd_Min) to_value = dataArray.min(); - else if (RGInfo.method == InterpMthd_Max) to_value = dataArray.max(); - else if (RGInfo.method == InterpMthd_Median) { + else if (RGInfo.method == InterpMthd::Min) to_value = dataArray.min(); + else if (RGInfo.method == InterpMthd::Max) to_value = dataArray.max(); + else if (RGInfo.method == InterpMthd::Median) { dataArray.sort_array(); to_value = dataArray[data_cnt/2]; if (0 == data_cnt % 2) @@ -2600,9 +2600,9 @@ void regrid_goes_variable(NcFile *nc_in, VarInfo *vinfo, if (0 < dataArray.n()) { int data_count = dataArray.n(); float to_value; - if (RGInfo.method == InterpMthd_Min) to_value = dataArray.min(); - else if (RGInfo.method == InterpMthd_Max) to_value = dataArray.max(); - else if (RGInfo.method == InterpMthd_Median) { + if (RGInfo.method == InterpMthd::Min) to_value = dataArray.min(); + else if (RGInfo.method == InterpMthd::Max) to_value = dataArray.max(); + else if (RGInfo.method == InterpMthd::Median) { dataArray.sort_array(); to_value = dataArray[data_count/2]; if (0 == data_count % 2) @@ -2847,9 +2847,9 @@ void set_field(const StringArray &a) { void set_method(const StringArray &a) { InterpMthd method_id = string_to_interpmthd(a[0].c_str()); - if (method_id == InterpMthd_Gaussian || method_id == InterpMthd_MaxGauss ) { + if (method_id == InterpMthd::Gaussian || method_id == InterpMthd::MaxGauss ) { do_gaussian_filter = true; - if (method_id == InterpMthd_MaxGauss) RGInfo.method = InterpMthd_Max; + if (method_id == InterpMthd::MaxGauss) RGInfo.method = InterpMthd::Max; } else RGInfo.method = method_id; opt_override_method = true; diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 396b30633c..28ec4704ea 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -65,7 +65,7 @@ using namespace netCDF; static ConcatString program_name; // Constants -static const InterpMthd DefaultInterpMthd = InterpMthd_Nearest; +static const InterpMthd DefaultInterpMthd = InterpMthd::Nearest; static const int DefaultInterpWdth = 1; static const double DefaultVldThresh = 0.5; @@ -146,7 +146,7 @@ void process_command_line(int argc, char **argv) { RGInfo.gaussian.radius = default_gaussian_radius; RGInfo.gaussian.trunc_factor = default_trunc_factor; RGInfo.vld_thresh = DefaultVldThresh; - RGInfo.shape = GridTemplateFactory::GridTemplate_Square; + RGInfo.shape = GridTemplateFactory::GridTemplates::Square; // Check for zero arguments if(argc == 1) usage(); @@ -204,7 +204,7 @@ void process_command_line(int argc, char **argv) { } RGInfo.validate(); - if (RGInfo.method == InterpMthd_Gaussian || RGInfo.method == InterpMthd_MaxGauss) + if (RGInfo.method == InterpMthd::Gaussian || RGInfo.method == InterpMthd::MaxGauss) RGInfo.gaussian.compute(); return; diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index b86ec79e76..40e2f742bc 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -72,9 +72,9 @@ static double ToLon = bad_data_double; static ConcatString InputFilename; static ConcatString OutputFilename; static ConcatString FieldString; -static InterpMthd Method = InterpMthd_DW_Mean; +static InterpMthd Method = InterpMthd::DW_Mean; static int Width = 2; -static GridTemplateFactory::GridTemplates Shape = GridTemplateFactory::GridTemplate_Square; +static GridTemplateFactory::GridTemplates Shape = GridTemplateFactory::GridTemplates::Square; static int compress_level = -1; // Static global variables diff --git a/src/tools/other/wwmca_tool/wwmca_ref.cc b/src/tools/other/wwmca_tool/wwmca_ref.cc index b8c2b2f810..f66515ca99 100644 --- a/src/tools/other/wwmca_tool/wwmca_ref.cc +++ b/src/tools/other/wwmca_tool/wwmca_ref.cc @@ -124,7 +124,7 @@ ConfigFilename.clear(); Width = 0; -Method = InterpMthd_None; +Method = InterpMthd::None; interp_func = 0; @@ -335,7 +335,7 @@ const RegridInfo regrid_info = parse_conf_regrid(Config); Width = regrid_info.width; -Method = InterpMthd_Nearest; +Method = InterpMthd::Nearest; Fraction = regrid_info.vld_thresh; @@ -367,15 +367,15 @@ if ( Width > 1 ) { switch ( Method ) { - case InterpMthd_Min: + case InterpMthd::Min: interp_func = &dp_interp_min; break; - case InterpMthd_Max: + case InterpMthd::Max: interp_func = &dp_interp_max; break; - case InterpMthd_UW_Mean: + case InterpMthd::UW_Mean: interp_func = &dp_interp_uw_mean; break; From 15987a1fa99a3b3cbbb899b35b399c79ee8baee4 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 28 Mar 2024 01:16:53 +0000 Subject: [PATCH 39/72] #2830 Moved enum_class_as_integer from header file to cc files --- src/basic/vx_config/config_util.h | 4 ---- src/libcode/vx_shapedata/engine.cc | 9 +++++++++ src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc | 9 +++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index e5cb69ce6e..3dae869b2b 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -153,10 +153,6 @@ extern int parse_conf_percentile(Dictionary *dict); extern void python_compile_error(const char *caller=nullptr); extern void ugrid_compile_error(const char *caller=nullptr); -template -extern auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type; - /////////////////////////////////////////////////////////////////////////////// #endif /* __CONFIG_UTIL_H__ */ diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index 06b767f579..008115bad9 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -31,6 +31,15 @@ static const int print_interest_log_level = 5; static inline double area_ratio_conf(double t) { return t; } +//////////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + /////////////////////////////////////////////////////////////////////// // // Code for class ModeFuzzyEngine 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 f8ad83eb9a..b644a3dc2f 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -24,6 +24,15 @@ using namespace std; +//////////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_integer(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + //////////////////////////////////////////////////////////////////////// // // Code for class WaveletStatConfInfo From 8a277fa9d4afb5dae82221ce92484465aab45f43 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 1 Apr 2024 21:21:54 +0000 Subject: [PATCH 40/72] #2830 Added enum_as_int.hpp --- src/basic/vx_log/Makefile.am | 2 +- src/basic/vx_log/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/vx_log/Makefile.am b/src/basic/vx_log/Makefile.am index 9e4ba32cf2..49f7f988ff 100644 --- a/src/basic/vx_log/Makefile.am +++ b/src/basic/vx_log/Makefile.am @@ -17,7 +17,7 @@ libvx_log_a_SOURCES = concat_string.cc concat_string.h \ logger.cc logger.h \ string_array.cc string_array.h \ str_wrappers.cc str_wrappers.h \ - vx_log.h + enum_as_int.hpp vx_log.h # Build the library when making a distribution so that # we can make enum_to_string and chk4copyright. diff --git a/src/basic/vx_log/Makefile.in b/src/basic/vx_log/Makefile.in index bfbfb1c4b6..272dddb3ca 100644 --- a/src/basic/vx_log/Makefile.in +++ b/src/basic/vx_log/Makefile.in @@ -350,7 +350,7 @@ libvx_log_a_SOURCES = concat_string.cc concat_string.h \ logger.cc logger.h \ string_array.cc string_array.h \ str_wrappers.cc str_wrappers.h \ - vx_log.h + enum_as_int.hpp vx_log.h all: all-am From fa41fa3a983dc73e7eaf56bef1b34dd849329cef Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 1 Apr 2024 21:22:01 +0000 Subject: [PATCH 41/72] #2830 Added enum_as_int.hpp --- src/basic/vx_log/enum_as_int.hpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/basic/vx_log/enum_as_int.hpp diff --git a/src/basic/vx_log/enum_as_int.hpp b/src/basic/vx_log/enum_as_int.hpp new file mode 100644 index 0000000000..ded32a2a09 --- /dev/null +++ b/src/basic/vx_log/enum_as_int.hpp @@ -0,0 +1,34 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + + +////////////////////////////////////////////////////////////////// + + +#ifndef __ENUM_CLASS_AS_INT_HPP__ +#define __ENUM_CLASS_AS_INT_HPP__ + + +////////////////////////////////////////////////////////////////// + +template +auto enum_class_as_int(Enumeration const value) + -> typename std::underlying_type::type +{ + return static_cast::type>(value); +} + +////////////////////////////////////////////////////////////////// + + +#endif // __ENUM_CLASS_AS_INT_HPP__ + + +////////////////////////////////////////////////////////////////// + + From 5c95525f803237477cfbe78fbbbdee658500a637 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 1 Apr 2024 21:24:17 +0000 Subject: [PATCH 42/72] Deleted enum_class_as_integer and renamed it to enum_class_as_int --- src/basic/vx_config/config_util.cc | 35 ++++++++++++------------------ 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 42e5972444..3885850a70 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -13,6 +13,7 @@ #include #include "config_util.h" +#include "enum_as_int.hpp" #include "vx_math.h" #include "vx_util.h" @@ -264,14 +265,6 @@ RegridInfo &RegridInfo::operator=(const RegridInfo &a) noexcept { return *this; } -/////////////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} /////////////////////////////////////////////////////////////////////////////// @@ -2812,7 +2805,7 @@ ConcatString fieldtype_to_string(FieldType type) { case FieldType::Obs: s = conf_val_obs; break; default: mlog << Error << "\nfieldtype_to_string() -> " - << "Unexpected FieldType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected FieldType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -2881,7 +2874,7 @@ ConcatString setlogic_to_string(SetLogic type) { case SetLogic::SymDiff: s = conf_val_symdiff; break; default: mlog << Error << "\nsetlogic_to_string() -> " - << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -2901,7 +2894,7 @@ ConcatString setlogic_to_abbr(SetLogic type) { case SetLogic::SymDiff: s = setlogic_abbr_symdiff; break; default: mlog << Error << "\nsetlogic_to_abbr() -> " - << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -2921,7 +2914,7 @@ ConcatString setlogic_to_symbol(SetLogic type) { case SetLogic::SymDiff: s = setlogic_symbol_symdiff; break; default: mlog << Error << "\nsetlogic_to_symbol() -> " - << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3000,7 +2993,7 @@ ConcatString tracktype_to_string(TrackType type) { case TrackType::BDeck: s = conf_val_bdeck; break; default: mlog << Error << "\ntracktype_to_string() -> " - << "Unexpected TrackType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected TrackType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3037,7 +3030,7 @@ ConcatString diagtype_to_string(DiagType type) { case DiagType::SHIPS_Dev: s = ships_diag_dev_str; break; default: mlog << Error << "\ndiagtype_to_string() -> " - << "Unexpected DiagType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected DiagType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3092,7 +3085,7 @@ ConcatString interp12type_to_string(Interp12Type type) { case Interp12Type::Replace: s = conf_val_replace; break; default: mlog << Error << "\ninterp12type_to_string() -> " - << "Unexpected Interp12Type value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected Interp12Type value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3131,7 +3124,7 @@ ConcatString mergetype_to_string(MergeType type) { case MergeType::Engine: s = conf_val_engine; break; default: mlog << Error << "\nmergetype_to_string() -> " - << "Unexpected MergeType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected MergeType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3157,7 +3150,7 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) { break; default: mlog << Error << "\nobssummary_to_string() -> " - << "Unexpected ObsSummary value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected ObsSummary value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3196,7 +3189,7 @@ ConcatString matchtype_to_string(MatchType type) { case MatchType::NoMerge: s = conf_val_no_merge; break; default: mlog << Error << "\nmatchtype_to_string() -> " - << "Unexpected MatchType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected MatchType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3263,7 +3256,7 @@ ConcatString disttype_to_string(DistType type) { case DistType::Beta: s = conf_val_beta; break; default: mlog << Error << "\ndisttype_to_string() -> " - << "Unexpected DistType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected DistType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3304,7 +3297,7 @@ ConcatString griddecomptype_to_string(GridDecompType type) { case GridDecompType::Pad: s = conf_val_pad; break; default: mlog << Error << "\ngriddecomptype_to_string() -> " - << "Unexpected GridDecompType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected GridDecompType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -3327,7 +3320,7 @@ ConcatString wavelettype_to_string(WaveletType type) { case WaveletType::BSpline_Cntr: s = conf_val_bspline_cntr; break; default: mlog << Error << "\nwavlettype_to_string() -> " - << "Unexpected WaveletType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected WaveletType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } From 62acda76cab025b02929efa23acb99e13c6f3d51 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 1 Apr 2024 21:24:17 +0000 Subject: [PATCH 43/72] Removed redundant paranthese --- src/basic/vx_log/logger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/vx_log/logger.h b/src/basic/vx_log/logger.h index 7f0e2ca95a..d88333e98b 100644 --- a/src/basic/vx_log/logger.h +++ b/src/basic/vx_log/logger.h @@ -79,9 +79,9 @@ class MsgLevel ////////////////////////////////////////////////////////////////// -inline int MsgLevel::value() const { return (Value); } +inline int MsgLevel::value() const { return Value; } -inline MsgLevel::operator const int & () const { return (Value); } +inline MsgLevel::operator const int & () const { return Value; } ////////////////////////////////////////////////////////////////// From 6ac387f8a6761e3380d58cf6e03576a518f2b972 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Mon, 1 Apr 2024 21:37:46 +0000 Subject: [PATCH 44/72] #2830 Changed enum to enumclass --- src/basic/vx_util/GridTemplate.h | 2 +- src/libcode/vx_analysis_util/stat_job.cc | 4 +- src/libcode/vx_analysis_util/stat_job.h | 2 +- src/libcode/vx_tc_util/atcf_line_base.cc | 66 ++++----- src/libcode/vx_tc_util/atcf_line_base.h | 28 ++-- src/libcode/vx_tc_util/atcf_offsets.h | 6 +- src/libcode/vx_tc_util/atcf_prob_line.cc | 4 +- src/libcode/vx_tc_util/atcf_track_line.cc | 68 ++++----- src/libcode/vx_tc_util/atcf_track_line.h | 4 +- src/libcode/vx_tc_util/prob_gen_info.cc | 2 +- src/libcode/vx_tc_util/prob_info_array.cc | 8 +- src/libcode/vx_tc_util/prob_info_base.cc | 8 +- src/libcode/vx_tc_util/prob_rirw_info.cc | 2 +- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 2 +- src/libcode/vx_tc_util/tc_stat_line.cc | 28 ++-- src/libcode/vx_tc_util/tc_stat_line.h | 12 +- src/libcode/vx_tc_util/track_pair_info.cc | 8 +- .../vx_time_series/time_series_util.cc | 12 +- src/libcode/vx_time_series/time_series_util.h | 8 +- src/tools/core/mode/mode_exec.cc | 40 +++--- src/tools/core/mode/mode_exec.h | 14 +- src/tools/core/mode/mode_ps_file.cc | 20 +-- src/tools/core/mode/mode_ps_file.h | 2 +- src/tools/core/mode/page_1.cc | 4 +- src/tools/core/mode/plot_engine.cc | 12 +- src/tools/core/pcp_combine/pcp_combine.cc | 36 ++--- .../core/series_analysis/series_analysis.cc | 21 +-- .../core/series_analysis/series_analysis.h | 14 +- .../core/stat_analysis/stat_analysis_job.cc | 14 +- src/tools/other/ascii2nc/ascii2nc.cc | 78 +++++----- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 135 +++++++++--------- src/tools/other/gen_vx_mask/gen_vx_mask.h | 32 ++--- src/tools/other/ioda2nc/ioda2nc.cc | 14 +- src/tools/other/madis2nc/madis2nc.cc | 61 ++++---- src/tools/other/madis2nc/madis2nc.h | 38 ++--- .../mode_graphics/mode_nc_output_file.cc | 16 +-- .../other/mode_graphics/mode_nc_output_file.h | 10 +- .../other/mode_graphics/plot_mode_field.cc | 38 ++--- src/tools/tc_utils/tc_gen/tc_gen.cc | 4 +- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 4 +- src/tools/tc_utils/tc_stat/tc_stat_files.cc | 10 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 52 +++---- src/tools/tc_utils/tc_stat/tc_stat_job.h | 22 +-- 43 files changed, 484 insertions(+), 481 deletions(-) diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index 05df9ac644..ed58165f4d 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -158,7 +158,7 @@ class GridTemplateFactory { // do not assign specific values to these enumes. // other code requires them to start at zero and increase by 1 - // make sure GridTemplate_NUM_TEMPLATES is always last. + // make sure GridTemplate::NUM_TEMPLATES is always last. enum class GridTemplates { None, Square, diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index e65db03548..858d93a6e8 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -2743,7 +2743,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { // ramp_type js << "-ramp_type " << timeseriestype_to_string(ramp_type) << " "; - if(ramp_type == TimeSeriesType_DyDt) { + if(ramp_type == TimeSeriesType::DyDt) { // ramp_time if(ramp_time_fcst == ramp_time_obs) { @@ -2767,7 +2767,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } } - if(ramp_type == TimeSeriesType_Swing) { + if(ramp_type == TimeSeriesType::Swing) { // swing_width js << "-swing_width " << swing_width << " "; diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 36d00c8dfa..12002ec447 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -37,7 +37,7 @@ static const bool default_column_union = false; // // Ramp job type defaults // -static const TimeSeriesType default_ramp_type = TimeSeriesType_DyDt; +static const TimeSeriesType default_ramp_type = TimeSeriesType::DyDt; static const char default_ramp_line_type[] = "MPR"; static const char default_ramp_out_line_type[] = "CTC,CTS"; static const char default_ramp_fcst_col[] = "FCST"; diff --git a/src/libcode/vx_tc_util/atcf_line_base.cc b/src/libcode/vx_tc_util/atcf_line_base.cc index d49ffbb7f5..ff0aa402d8 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.cc +++ b/src/libcode/vx_tc_util/atcf_line_base.cc @@ -146,7 +146,7 @@ void ATCFLineBase::clear() { // Do not reset pointers: // BasinMap, BestTechnique, OperTechnique, TechSuffix - Type = NoATCFLineType; + Type = ATCFLineType::None; Basin.clear(); Technique.clear(); IsBestTrack = false; @@ -210,14 +210,14 @@ ConcatString ATCFLineBase::get_item(int i) const { ConcatString cs; int i_col = i; - // For ATCFLineType_GenTrack: + // For ATCFLineType::GenTrack: // Columns 1 and 2 are consistent: // Use offsets 0 and 1 // Column 3 for is an EXTRA column for this line type: // Add special handling in storm_id() - // Columns 4-20 are the same as columns 3-19 of ATCFLineType_Track: + // Columns 4-20 are the same as columns 3-19 of ATCFLineType::Track: // Shift those column indices by 1. - if(Type == ATCFLineType_GenTrack && i >= 2 && i <= 18) i_col++; + if(Type == ATCFLineType::GenTrack && i >= 2 && i <= 18) i_col++; cs = DataLine::get_item(i_col); @@ -361,9 +361,9 @@ int ATCFLineBase::lead() const { ConcatString ATCFLineBase::storm_id() const { ConcatString cs; - // For ATCFLineType_GenTrack, use the contents of the extra 3rd column + // For ATCFLineType::GenTrack, use the contents of the extra 3rd column // Call DataLine::get_item() to avoid the column shifting logic - if(Type == ATCFLineType_GenTrack) { + if(Type == ATCFLineType::GenTrack) { cs = DataLine::get_item(GenStormIdOffset); } else { @@ -481,21 +481,21 @@ int parse_int_check_zero(const char *s) { ATCFLineType string_to_atcflinetype(const char *s) { ATCFLineType t; - if(!s) t = NoATCFLineType; + if(!s) t = ATCFLineType::None; // YYYYMMDDHH in the 4th column for Genesis Tracks - else if(is_yyyymmddhh(s)) t = ATCFLineType_GenTrack; - else if(is_number(s)) t = ATCFLineType_Track; // ADECK - else if(m_strlen(s) == 0) t = ATCFLineType_Track; // BDECK - else if(strcasecmp(s, "TR") == 0) t = ATCFLineType_ProbTR; - else if(strcasecmp(s, "IN") == 0) t = ATCFLineType_ProbIN; - else if(strcasecmp(s, "RI") == 0) t = ATCFLineType_ProbRI; - else if(strcasecmp(s, "RW") == 0) t = ATCFLineType_ProbRW; - else if(strcasecmp(s, "WR") == 0) t = ATCFLineType_ProbWR; - else if(strcasecmp(s, "PR") == 0) t = ATCFLineType_ProbPR; - else if(strcasecmp(s, "GN") == 0) t = ATCFLineType_ProbGN; - else if(strcasecmp(s, "GS") == 0) t = ATCFLineType_ProbGS; - else if(strcasecmp(s, "ER") == 0) t = ATCFLineType_ProbER; - else t = NoATCFLineType; + else if(is_yyyymmddhh(s)) t = ATCFLineType::GenTrack; + else if(is_number(s)) t = ATCFLineType::Track; // ADECK + else if(m_strlen(s) == 0) t = ATCFLineType::Track; // BDECK + else if(strcasecmp(s, "TR") == 0) t = ATCFLineType::ProbTR; + else if(strcasecmp(s, "IN") == 0) t = ATCFLineType::ProbIN; + else if(strcasecmp(s, "RI") == 0) t = ATCFLineType::ProbRI; + else if(strcasecmp(s, "RW") == 0) t = ATCFLineType::ProbRW; + else if(strcasecmp(s, "WR") == 0) t = ATCFLineType::ProbWR; + else if(strcasecmp(s, "PR") == 0) t = ATCFLineType::ProbPR; + else if(strcasecmp(s, "GN") == 0) t = ATCFLineType::ProbGN; + else if(strcasecmp(s, "GS") == 0) t = ATCFLineType::ProbGS; + else if(strcasecmp(s, "ER") == 0) t = ATCFLineType::ProbER; + else t = ATCFLineType::None; return t; } @@ -506,19 +506,19 @@ ConcatString atcflinetype_to_string(const ATCFLineType t) { const char *s = (const char *) nullptr; switch(t) { - case ATCFLineType_Track: s = "Track"; break; - case ATCFLineType_GenTrack: s = "GenTrack"; break; - case ATCFLineType_ProbTR: s = "ProbTR"; break; - case ATCFLineType_ProbIN: s = "ProbIN"; break; - case ATCFLineType_ProbRI: s = "ProbRI"; break; - case ATCFLineType_ProbRW: s = "ProbRW"; break; - case ATCFLineType_ProbWR: s = "ProbWR"; break; - case ATCFLineType_ProbPR: s = "ProbPR"; break; - case ATCFLineType_ProbGN: s = "ProbGN"; break; - case ATCFLineType_ProbGS: s = "ProbGS"; break; - case ATCFLineType_ProbER: s = "ProbER"; break; - case NoATCFLineType: s = na_str; break; - default: s = na_str; break; + case ATCFLineType::Track: s = "Track"; break; + case ATCFLineType::GenTrack: s = "GenTrack"; break; + case ATCFLineType::ProbTR: s = "ProbTR"; break; + case ATCFLineType::ProbIN: s = "ProbIN"; break; + case ATCFLineType::ProbRI: s = "ProbRI"; break; + case ATCFLineType::ProbRW: s = "ProbRW"; break; + case ATCFLineType::ProbWR: s = "ProbWR"; break; + case ATCFLineType::ProbPR: s = "ProbPR"; break; + case ATCFLineType::ProbGN: s = "ProbGN"; break; + case ATCFLineType::ProbGS: s = "ProbGS"; break; + case ATCFLineType::ProbER: s = "ProbER"; break; + case ATCFLineType::None: s = na_str; break; + default: s = na_str; break; } return ConcatString(s); diff --git a/src/libcode/vx_tc_util/atcf_line_base.h b/src/libcode/vx_tc_util/atcf_line_base.h index d7c04863d1..8b1141ffad 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.h +++ b/src/libcode/vx_tc_util/atcf_line_base.h @@ -29,20 +29,20 @@ //////////////////////////////////////////////////////////////////////// -enum ATCFLineType { - ATCFLineType_Track, // Track and intensity line type (numeric) - ATCFLineType_GenTrack, // Genesis Track and intensity line type (numeric) - ATCFLineType_ProbTR, // Track probability (TR) - ATCFLineType_ProbIN, // Intensity probability (IN) - ATCFLineType_ProbRI, // Rapid intensification probability (RI) - ATCFLineType_ProbRW, // Rapid weakening probability (RW) - ATCFLineType_ProbWR, // Wind radii probability (WR) - ATCFLineType_ProbPR, // Pressure probability (PR) - ATCFLineType_ProbGN, // TC genesis probability (GN) - ATCFLineType_ProbGS, // TC genesis shape probability (GS) - ATCFLineType_ProbER, // Eyewall replacement probability (ER) - - NoATCFLineType +enum class ATCFLineType { + Track, // Track and intensity line type (numeric) + GenTrack, // Genesis Track and intensity line type (numeric) + ProbTR, // Track probability (TR) + ProbIN, // Intensity probability (IN) + ProbRI, // Rapid intensification probability (RI) + ProbRW, // Rapid weakening probability (RW) + ProbWR, // Wind radii probability (WR) + ProbPR, // Pressure probability (PR) + ProbGN, // TC genesis probability (GN) + ProbGS, // TC genesis shape probability (GS) + ProbER, // Eyewall replacement probability (ER) + + None }; extern ATCFLineType string_to_atcflinetype(const char *); diff --git a/src/libcode/vx_tc_util/atcf_offsets.h b/src/libcode/vx_tc_util/atcf_offsets.h index deb4758cb8..50f2df28e2 100644 --- a/src/libcode/vx_tc_util/atcf_offsets.h +++ b/src/libcode/vx_tc_util/atcf_offsets.h @@ -30,7 +30,7 @@ static const int LonTenthsOffset = 7; // // Offsets specific to the ADECK and BDECK track lines // http://www.nrlmry.navy.mil/atcf_web/docs/database/new/abrdeck.html -// Offsets for columns common to ATCFLineType_Track and ATCFLineType_GenTrack +// Offsets for columns common to ATCFLineType::Track and ATCFLineType::GenTrack // static const int VMaxOffset = 8; @@ -49,7 +49,7 @@ static const int IsobarRadiusOffset = 18; static const int MaxWindRadiusOffset = 19; // -// Offsets for columns specific to the ATCFLineType_Track +// Offsets for columns specific to the ATCFLineType::Track // static const int GustsOffset = 20; @@ -76,7 +76,7 @@ static const int WarmCoreOffset = 39; static const char ThermoParams_Str[] = "THERMO PARARMS"; // -// Offsets for columns specific to the ATCFLineType_GenTrack +// Offsets for columns specific to the ATCFLineType::GenTrack // Reference: https://dtcenter.org/HurrWRF/users/docs/users_guide/HWRF-UG-2018.pdf // diff --git a/src/libcode/vx_tc_util/atcf_prob_line.cc b/src/libcode/vx_tc_util/atcf_prob_line.cc index c5cc659a9d..8b320eb912 100644 --- a/src/libcode/vx_tc_util/atcf_prob_line.cc +++ b/src/libcode/vx_tc_util/atcf_prob_line.cc @@ -120,11 +120,11 @@ int ATCFProbLine::read_line(LineDataFile * ldf) { // Check the line type switch(Type) { - case ATCFLineType_ProbRI: + case ATCFLineType::ProbRI: n_expect = MinATCFProbRIRWElements; break; - case ATCFLineType_ProbGN: + case ATCFLineType::ProbGN: n_expect = MinATCFProbGNElements; break; diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index d6368e38a3..ae9806b64b 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -143,8 +143,8 @@ int ATCFTrackLine::read_line(LineDataFile * ldf) { if(!status) return 0; // Check the line type - if(Type != ATCFLineType_Track && - Type != ATCFLineType_GenTrack) { + if(Type != ATCFLineType::Track && + Type != ATCFLineType::GenTrack) { mlog << Warning << "\nint ATCFTrackLine::read_line(LineDataFile * ldf) -> " << "unexpected ATCF line type (" @@ -153,9 +153,9 @@ int ATCFTrackLine::read_line(LineDataFile * ldf) { } // Check for the minumum number of track line elements - if((Type == ATCFLineType_Track && + if((Type == ATCFLineType::Track && n_items() < MinATCFTrackElements) || - (Type == ATCFLineType_GenTrack && + (Type == ATCFLineType::GenTrack && n_items() < MinATCFGenTrackElements)) { mlog << Warning << "\nint ATCFTrackLine::read_line(LineDataFile * ldf) -> " @@ -267,11 +267,11 @@ int ATCFTrackLine::max_wind_radius() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::storm_direction() const { - if(Type == ATCFLineType_Track && + if(Type == ATCFLineType::Track && StormDirectionOffset < N_items) { return parse_int(get_item(StormDirectionOffset).c_str()); } - else if(Type == ATCFLineType_GenTrack && + else if(Type == ATCFLineType::GenTrack && StormDirectionOffset < N_items) { return parse_int(get_item(GenStormDirectionOffset).c_str()); } @@ -281,11 +281,11 @@ int ATCFTrackLine::storm_direction() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::storm_speed() const { - if(Type == ATCFLineType_Track && + if(Type == ATCFLineType::Track && StormSpeedOffset < N_items) { return parse_int(get_item(StormSpeedOffset).c_str()); } - else if(Type == ATCFLineType_GenTrack && + else if(Type == ATCFLineType::GenTrack && StormSpeedOffset < N_items) { return parse_int(get_item(GenStormSpeedOffset).c_str()); } @@ -294,18 +294,18 @@ int ATCFTrackLine::storm_speed() const { //////////////////////////////////////////////////////////////////////// // -// For ATCFLineType_Track, only valid when UserDefined = THERMO PARAMS -// For ATCFLineType_GenTrack, get the warm core column +// For ATCFLineType::Track, only valid when UserDefined = THERMO PARAMS +// For ATCFLineType::GenTrack, get the warm core column // //////////////////////////////////////////////////////////////////////// bool ATCFTrackLine::warm_core() const { - if(Type == ATCFLineType_Track && + if(Type == ATCFLineType::Track && WarmCoreOffset < N_items) { return(get_item(UserDefinedOffset).comparecase(ThermoParams_Str) == 0 && get_item(WarmCoreOffset).comparecase("Y") == 0); } - else if(Type == ATCFLineType_GenTrack && + else if(Type == ATCFLineType::GenTrack && GenWarmCoreOffset < N_items) { return(get_item(GenWarmCoreOffset).comparecase("Y") == 0); } @@ -314,12 +314,12 @@ bool ATCFTrackLine::warm_core() const { //////////////////////////////////////////////////////////////////////// // -// Specific to ATCFLineType_Track +// Specific to ATCFLineType::Track // //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::gusts() const { - return(Type == ATCFLineType_Track && GustsOffset < N_items ? + return(Type == ATCFLineType::Track && GustsOffset < N_items ? parse_int_check_zero(get_item(GustsOffset).c_str()) : bad_data_int); } @@ -327,7 +327,7 @@ int ATCFTrackLine::gusts() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::eye_diameter() const { - return(Type == ATCFLineType_Track && EyeDiameterOffset < N_items ? + return(Type == ATCFLineType::Track && EyeDiameterOffset < N_items ? parse_int_check_zero(get_item(EyeDiameterOffset).c_str()) : bad_data_int); } @@ -335,7 +335,7 @@ int ATCFTrackLine::eye_diameter() const { //////////////////////////////////////////////////////////////////////// SubregionCode ATCFTrackLine::subregion() const { - return(Type == ATCFLineType_Track && SubRegionOffset < N_items ? + return(Type == ATCFLineType::Track && SubRegionOffset < N_items ? string_to_subregioncode(get_item(SubRegionOffset).c_str()) : NoSubregionCode); } @@ -343,7 +343,7 @@ SubregionCode ATCFTrackLine::subregion() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::max_seas() const { - return(Type == ATCFLineType_Track && MaxSeasOffset < N_items ? + return(Type == ATCFLineType::Track && MaxSeasOffset < N_items ? parse_int_check_zero(get_item(MaxSeasOffset).c_str()) : bad_data_int); } @@ -351,7 +351,7 @@ int ATCFTrackLine::max_seas() const { //////////////////////////////////////////////////////////////////////// ConcatString ATCFTrackLine::initials() const { - return(Type == ATCFLineType_Track && InitialsOffset < N_items ? + return(Type == ATCFLineType::Track && InitialsOffset < N_items ? (string) get_item(InitialsOffset) : (string) ""); } @@ -359,7 +359,7 @@ ConcatString ATCFTrackLine::initials() const { //////////////////////////////////////////////////////////////////////// ConcatString ATCFTrackLine::storm_name() const { - return(Type == ATCFLineType_Track && StormNameOffset < N_items ? + return(Type == ATCFLineType::Track && StormNameOffset < N_items ? (string) get_item(StormNameOffset) : (string) ""); } @@ -367,7 +367,7 @@ ConcatString ATCFTrackLine::storm_name() const { //////////////////////////////////////////////////////////////////////// SystemsDepth ATCFTrackLine::depth() const { - return(Type == ATCFLineType_Track && DepthOffset < N_items ? + return(Type == ATCFLineType::Track && DepthOffset < N_items ? string_to_systemsdepth(get_item(DepthOffset).c_str()) : NoSystemsDepth); } @@ -375,7 +375,7 @@ SystemsDepth ATCFTrackLine::depth() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::wave_height() const { - return(Type == ATCFLineType_Track && WaveHeightOffset < N_items ? + return(Type == ATCFLineType::Track && WaveHeightOffset < N_items ? parse_int_check_zero(get_item(WaveHeightOffset).c_str()) : bad_data_int); } @@ -383,7 +383,7 @@ int ATCFTrackLine::wave_height() const { //////////////////////////////////////////////////////////////////////// QuadrantType ATCFTrackLine::seas_code() const { - return(Type == ATCFLineType_Track && SeasCodeOffset < N_items ? + return(Type == ATCFLineType::Track && SeasCodeOffset < N_items ? string_to_quadranttype(get_item(SeasCodeOffset).c_str()) : NoQuadrantType); } @@ -391,7 +391,7 @@ QuadrantType ATCFTrackLine::seas_code() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::seas_radius1() const { - return(Type == ATCFLineType_Track && SeasRadius1Offset < N_items ? + return(Type == ATCFLineType::Track && SeasRadius1Offset < N_items ? parse_int_check_zero(get_item(SeasRadius1Offset).c_str()) : bad_data_int); } @@ -399,7 +399,7 @@ int ATCFTrackLine::seas_radius1() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::seas_radius2() const { - return(Type == ATCFLineType_Track && SeasRadius2Offset < N_items ? + return(Type == ATCFLineType::Track && SeasRadius2Offset < N_items ? parse_int_check_zero(get_item(SeasRadius2Offset).c_str()) : bad_data_int); } @@ -407,7 +407,7 @@ int ATCFTrackLine::seas_radius2() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::seas_radius3() const { - return(Type == ATCFLineType_Track && SeasRadius3Offset < N_items ? + return(Type == ATCFLineType::Track && SeasRadius3Offset < N_items ? parse_int_check_zero(get_item(SeasRadius3Offset).c_str()) : bad_data_int); } @@ -415,19 +415,19 @@ int ATCFTrackLine::seas_radius3() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::seas_radius4() const { - return(Type == ATCFLineType_Track && SeasRadius4Offset < N_items ? + return(Type == ATCFLineType::Track && SeasRadius4Offset < N_items ? parse_int_check_zero(get_item(SeasRadius4Offset).c_str()) : bad_data_int); } //////////////////////////////////////////////////////////////////////// // -// Specific to ATCFLineType_Track +// Specific to ATCFLineType::Track // //////////////////////////////////////////////////////////////////////// double ATCFTrackLine::parameter_b() const { - int v = (Type == ATCFLineType_GenTrack && GenParameterBOffset < N_items ? + int v = (Type == ATCFLineType::GenTrack && GenParameterBOffset < N_items ? parse_int(get_item(GenParameterBOffset).c_str(), -999) : bad_data_int); return(!is_bad_data(v) ? v/10.0 : bad_data_double); @@ -436,7 +436,7 @@ double ATCFTrackLine::parameter_b() const { //////////////////////////////////////////////////////////////////////// double ATCFTrackLine::therm_wind_lower() const { - int v = (Type == ATCFLineType_GenTrack && GenThermWindLowerOffset < N_items ? + int v = (Type == ATCFLineType::GenTrack && GenThermWindLowerOffset < N_items ? parse_int(get_item(GenThermWindLowerOffset).c_str(), -9999) : bad_data_int); return(!is_bad_data(v) ? v/10.0 : bad_data_double); @@ -445,7 +445,7 @@ double ATCFTrackLine::therm_wind_lower() const { //////////////////////////////////////////////////////////////////////// double ATCFTrackLine::therm_wind_upper() const { - int v = (Type == ATCFLineType_GenTrack && GenThermWindUpperOffset < N_items ? + int v = (Type == ATCFLineType::GenTrack && GenThermWindUpperOffset < N_items ? parse_int(get_item(GenThermWindUpperOffset).c_str(), -9999) : bad_data_int); return(!is_bad_data(v) ? v/10.0 : bad_data_double); @@ -454,7 +454,7 @@ double ATCFTrackLine::therm_wind_upper() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::mean_850_vort() const { - return(Type == ATCFLineType_GenTrack && GenMean850VortOffset < N_items ? + return(Type == ATCFLineType::GenTrack && GenMean850VortOffset < N_items ? parse_int(get_item(GenThermWindUpperOffset).c_str(), -9999) : bad_data_int); } @@ -462,7 +462,7 @@ int ATCFTrackLine::mean_850_vort() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::max_850_vort() const { - return(Type == ATCFLineType_GenTrack && GenMax850VortOffset < N_items ? + return(Type == ATCFLineType::GenTrack && GenMax850VortOffset < N_items ? parse_int(get_item(GenThermWindUpperOffset).c_str(), -9999) : bad_data_int); } @@ -470,7 +470,7 @@ int ATCFTrackLine::max_850_vort() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::mean_700_vort() const { - return(Type == ATCFLineType_GenTrack && GenMean700VortOffset < N_items ? + return(Type == ATCFLineType::GenTrack && GenMean700VortOffset < N_items ? parse_int(get_item(GenThermWindUpperOffset).c_str(), -9999) : bad_data_int); } @@ -478,7 +478,7 @@ int ATCFTrackLine::mean_700_vort() const { //////////////////////////////////////////////////////////////////////// int ATCFTrackLine::max_700_vort() const { - return(Type == ATCFLineType_GenTrack && GenMax700VortOffset < N_items ? + return(Type == ATCFLineType::GenTrack && GenMax700VortOffset < N_items ? parse_int(get_item(GenThermWindUpperOffset).c_str(), -9999) : bad_data_int); } diff --git a/src/libcode/vx_tc_util/atcf_track_line.h b/src/libcode/vx_tc_util/atcf_track_line.h index d5ebb5555b..9fc3896071 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.h +++ b/src/libcode/vx_tc_util/atcf_track_line.h @@ -177,7 +177,7 @@ class ATCFTrackLine : public ATCFLineBase { bool warm_core () const; // - // specific to ATCFLineType_Track + // specific to ATCFLineType::Track // int gusts () const; @@ -198,7 +198,7 @@ class ATCFTrackLine : public ATCFLineBase { int seas_radius4 () const; // - // specific to ATCFLineType_GenTrack + // specific to ATCFLineType::GenTrack // double parameter_b () const; diff --git a/src/libcode/vx_tc_util/prob_gen_info.cc b/src/libcode/vx_tc_util/prob_gen_info.cc index 900142610a..7f3f37b83a 100644 --- a/src/libcode/vx_tc_util/prob_gen_info.cc +++ b/src/libcode/vx_tc_util/prob_gen_info.cc @@ -200,7 +200,7 @@ bool ProbGenInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { } // Initialize the header information, if necessary - if(Type == NoATCFLineType) initialize(l, dland); + if(Type == ATCFLineType::None) initialize(l, dland); // Check for matching header information if(!is_match(l)) return false; diff --git a/src/libcode/vx_tc_util/prob_info_array.cc b/src/libcode/vx_tc_util/prob_info_array.cc index 9cfa6196a1..35a37708e2 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 && @@ -276,14 +276,14 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { if(gi.gen_or_dis() != "genFcst") { mlog << Debug(4) << "bool ProbInfoArray::add() -> " - << "skipping ATCF " << atcflinetype_to_string(ATCFLineType_ProbGN) + << "skipping ATCF " << atcflinetype_to_string(ATCFLineType::ProbGN) << " line with non-genesis probability type (" << gi.gen_or_dis() << " != genFcst).\n"; } else if(is_bad_data(gi.lat()) || is_bad_data(gi.lon())) { mlog << Debug(4) << "bool ProbInfoArray::add() -> " - << "skipping ATCF " << atcflinetype_to_string(ATCFLineType_ProbGN) + << "skipping ATCF " << atcflinetype_to_string(ATCFLineType::ProbGN) << " line with no predicted genesis location.\n"; } else { diff --git a/src/libcode/vx_tc_util/prob_info_base.cc b/src/libcode/vx_tc_util/prob_info_base.cc index 65e1a1abdc..762a9bfd88 100644 --- a/src/libcode/vx_tc_util/prob_info_base.cc +++ b/src/libcode/vx_tc_util/prob_info_base.cc @@ -71,7 +71,7 @@ void ProbInfoBase::init_from_scratch() { void ProbInfoBase::clear() { - Type = NoATCFLineType; + Type = ATCFLineType::None; StormId.clear(); Basin.clear(); Cyclone.clear(); @@ -266,7 +266,7 @@ bool ProbInfoBase::add(const ATCFProbLine &l, double dland, bool check_dup) { } // Initialize the header information, if necessary - if(Type == NoATCFLineType) initialize(l, dland); + if(Type == ATCFLineType::None) initialize(l, dland); // Check for matching header information if(!is_match(l)) return false; @@ -292,8 +292,8 @@ void ProbInfoBase::set(const TCStatLine &l) { // Store column information switch(l.type()) { - case TCStatLineType_ProbRIRW: - Type = ATCFLineType_ProbRI; + case TCStatLineType::ProbRIRW: + Type = ATCFLineType::ProbRI; break; default: diff --git a/src/libcode/vx_tc_util/prob_rirw_info.cc b/src/libcode/vx_tc_util/prob_rirw_info.cc index 8c31b24f87..ea662ef4c3 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_info.cc @@ -191,7 +191,7 @@ bool ProbRIRWInfo::add(const ATCFProbLine &l, double dland, bool check_dup) { } // Initialize the header information, if necessary - if(Type == NoATCFLineType) initialize(l, dland); + if(Type == ATCFLineType::None) initialize(l, dland); // Check for matching header information if(!is_match(l)) return false; diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index fe2f5f07a4..3bd91a89af 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -268,7 +268,7 @@ void ProbRIRWPairInfo::set(const TCStatLine &l) { clear(); // Check the line type - if(l.type() != TCStatLineType_ProbRIRW) return; + if(l.type() != TCStatLineType::ProbRIRW) return; // Parse ProbRIRWInfo ProbRIRW.set(l); diff --git a/src/libcode/vx_tc_util/tc_stat_line.cc b/src/libcode/vx_tc_util/tc_stat_line.cc index b8aa0c8b5d..a8556a7dd2 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.cc +++ b/src/libcode/vx_tc_util/tc_stat_line.cc @@ -99,7 +99,7 @@ void TCStatLine::clear() { DataLine::clear(); - Type = NoTCStatLineType; + Type = TCStatLineType::None; HdrLine = (AsciiHeaderLine *) nullptr; return; @@ -126,7 +126,7 @@ int TCStatLine::read_line(LineDataFile * ldf) { // Check for a header line // if(strcmp(get_item(0), "VERSION") == 0) { - Type = TCStatLineType_Header; + Type = TCStatLineType::Header; return 1; } @@ -136,7 +136,7 @@ int TCStatLine::read_line(LineDataFile * ldf) { offset = METHdrTable.col_offset(get_item(0), "TCST", na_str, "LINE_TYPE"); if(is_bad_data(offset) || n_items() < (offset + 1)) { - Type = NoTCStatLineType; + Type = TCStatLineType::None; return 0; } @@ -159,7 +159,7 @@ bool TCStatLine::is_ok() const { //////////////////////////////////////////////////////////////////////// bool TCStatLine::is_header() const { - return(Type == TCStatLineType_Header); + return(Type == TCStatLineType::Header); } //////////////////////////////////////////////////////////////////////// @@ -370,11 +370,11 @@ ConcatString TCStatLine::header() const { TCStatLineType string_to_tcstatlinetype(const char *s) { TCStatLineType t; - if(strcmp(s, TCStatLineType_TCMPR_Str) == 0) t = TCStatLineType_TCMPR; - else if(strcmp(s, TCStatLineType_TCDIAG_Str) == 0) t = TCStatLineType_TCDIAG; - else if(strcmp(s, TCStatLineType_ProbRIRW_Str) == 0) t = TCStatLineType_ProbRIRW; - else if(strcmp(s, TCStatLineType_Header_Str) == 0) t = TCStatLineType_Header; - else t = NoTCStatLineType; + if(strcmp(s, TCStatLineType_TCMPR_Str) == 0) t = TCStatLineType::TCMPR; + else if(strcmp(s, TCStatLineType_TCDIAG_Str) == 0) t = TCStatLineType::TCDIAG; + else if(strcmp(s, TCStatLineType_ProbRIRW_Str) == 0) t = TCStatLineType::ProbRIRW; + else if(strcmp(s, TCStatLineType_Header_Str) == 0) t = TCStatLineType::Header; + else t = TCStatLineType::None; return t; } @@ -385,11 +385,11 @@ ConcatString tcstatlinetype_to_string(const TCStatLineType t) { const char *s = (const char *) nullptr; switch(t) { - case TCStatLineType_TCMPR: s = TCStatLineType_TCMPR_Str; break; - case TCStatLineType_TCDIAG: s = TCStatLineType_TCDIAG_Str; break; - case TCStatLineType_ProbRIRW: s = TCStatLineType_ProbRIRW_Str; break; - case TCStatLineType_Header: s = TCStatLineType_Header_Str; break; - default: s = na_str; break; + case TCStatLineType::TCMPR: s = TCStatLineType_TCMPR_Str; break; + case TCStatLineType::TCDIAG: s = TCStatLineType_TCDIAG_Str; break; + case TCStatLineType::ProbRIRW: s = TCStatLineType_ProbRIRW_Str; break; + case TCStatLineType::Header: s = TCStatLineType_Header_Str; break; + default: s = na_str; break; } return ConcatString(s); diff --git a/src/libcode/vx_tc_util/tc_stat_line.h b/src/libcode/vx_tc_util/tc_stat_line.h index 6c3ead9365..2e75fda869 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.h +++ b/src/libcode/vx_tc_util/tc_stat_line.h @@ -24,11 +24,11 @@ // Enumerate all the possible line types enum TCStatLineType { - TCStatLineType_TCMPR, - TCStatLineType_TCDIAG, - TCStatLineType_ProbRIRW, - TCStatLineType_Header, - NoTCStatLineType + TCMPR, + TCDIAG, + ProbRIRW, + Header, + None }; @@ -103,7 +103,7 @@ class TCStatLine : public DataLine { //////////////////////////////////////////////////////////////////////// -inline TCStatLineType TCStatLine::type() const { return(Type); } +inline TCStatLineType TCStatLine::type() const { return Type; } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index 8206db0bc7..0a807f2862 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -311,8 +311,8 @@ void TrackPairInfo::add(const TrackPoint &a, const TrackPoint &b, void TrackPairInfo::add(const TCStatLine &l) { // Check the line type - if(l.type() == TCStatLineType_TCMPR) add_tcmpr_line(l); - else if(l.type() == TCStatLineType_TCDIAG) add_tcdiag_line(l); + if(l.type() == TCStatLineType::TCMPR) add_tcmpr_line(l); + else if(l.type() == TCStatLineType::TCDIAG) add_tcdiag_line(l); return; } @@ -327,7 +327,7 @@ void TrackPairInfo::add_tcmpr_line(const TCStatLine &l) { int i, j; // Check the line type - if(l.type() != TCStatLineType_TCMPR) return; + if(l.type() != TCStatLineType::TCMPR) return; // Store the input TCMPR line and TCDIAG placeholder TCMPRLine.push_back(l); @@ -439,7 +439,7 @@ void TrackPairInfo::add_tcdiag_line(const TCStatLine &l) { ConcatString cs; // Check the line type - if(l.type() != TCStatLineType_TCDIAG) return; + if(l.type() != TCStatLineType::TCDIAG) return; // Should have already parsed TCMPR if(NPoints == 0) { diff --git a/src/libcode/vx_time_series/time_series_util.cc b/src/libcode/vx_time_series/time_series_util.cc index 145de93009..d3e40c1201 100644 --- a/src/libcode/vx_time_series/time_series_util.cc +++ b/src/libcode/vx_time_series/time_series_util.cc @@ -27,9 +27,9 @@ using namespace std; TimeSeriesType string_to_timeseriestype(const char *s) { TimeSeriesType t; - if(strcasecmp(s, timeseriestype_dydt_str) == 0) t = TimeSeriesType_DyDt; - else if(strcasecmp(s, timeseriestype_swing_str) == 0) t = TimeSeriesType_Swing; - else t = TimeSeriesType_None; + if(strcasecmp(s, timeseriestype_dydt_str) == 0) t = TimeSeriesType::DyDt; + else if(strcasecmp(s, timeseriestype_swing_str) == 0) t = TimeSeriesType::Swing; + else t = TimeSeriesType::None; return t; } @@ -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/libcode/vx_time_series/time_series_util.h b/src/libcode/vx_time_series/time_series_util.h index a03176afcc..92adbe0ae2 100644 --- a/src/libcode/vx_time_series/time_series_util.h +++ b/src/libcode/vx_time_series/time_series_util.h @@ -21,10 +21,10 @@ // Enumeration for time-series analysis types // -enum TimeSeriesType { - TimeSeriesType_None, // Default - TimeSeriesType_DyDt, // Threshold change over time window - TimeSeriesType_Swing // Apply swinging door algorithm +enum class TimeSeriesType { + None, // Default + DyDt, // Threshold change over time window + Swing // Apply swinging door algorithm }; static const char timeseriestype_dydt_str[] = "DYDT"; diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index fde469e92f..fb783ead42 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -2155,16 +2155,16 @@ void ModeExecutive::write_poly_netcdf(NcFile * f_out) // present. // if(engine.n_fcst > 0) { - write_poly_netcdf(f_out, FcstSimpBdyPoly); - write_poly_netcdf(f_out, FcstSimpHullPoly); + write_poly_netcdf(f_out, ObjPolyType::FcstSimpBdy); + write_poly_netcdf(f_out, ObjPolyType::FcstSimpHull); } if(engine.n_obs > 0) { - write_poly_netcdf(f_out, ObsSimpBdyPoly); - write_poly_netcdf(f_out, ObsSimpHullPoly); + write_poly_netcdf(f_out, ObjPolyType::ObsSimpBdy); + write_poly_netcdf(f_out, ObjPolyType::ObsSimpHull); } if(engine.n_clus > 0) { - write_poly_netcdf(f_out, FcstClusHullPoly); - write_poly_netcdf(f_out, ObsClusHullPoly); + write_poly_netcdf(f_out, ObjPolyType::FcstClusHull); + write_poly_netcdf(f_out, ObjPolyType::ObsClusHull); } return; @@ -2217,7 +2217,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) // and set up strings switch(poly_type) { - case FcstSimpBdyPoly: + case ObjPolyType::FcstSimpBdy: n_poly = engine.n_fcst; field_name = "fcst"; field_long = "Forecast"; @@ -2225,7 +2225,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) poly_long = "Simple Boundary"; break; - case ObsSimpBdyPoly: + case ObjPolyType::ObsSimpBdy: n_poly = engine.n_obs; field_name = "obs"; field_long = "Observation"; @@ -2233,7 +2233,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) poly_long = "Simple Boundary"; break; - case FcstSimpHullPoly: + case ObjPolyType::FcstSimpHull: n_poly = engine.n_fcst; field_name = "fcst"; field_long = "Forecast"; @@ -2241,7 +2241,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) poly_long = "Simple Convex Hull"; break; - case ObsSimpHullPoly: + case ObjPolyType::ObsSimpHull: n_poly = engine.n_obs; field_name = "obs"; field_long = "Observation"; @@ -2249,7 +2249,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) poly_long = "Simple Convex Hull"; break; - case FcstClusHullPoly: + case ObjPolyType::FcstClusHull: n_poly = engine.n_clus; field_name = "fcst"; field_long = "Forecast"; @@ -2257,7 +2257,7 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) poly_long = "Cluster Convex Hull"; break; - case ObsClusHullPoly: + case ObjPolyType::ObsClusHull: n_poly = engine.n_clus; field_name = "obs"; field_long = "Observation"; @@ -2270,8 +2270,8 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) } // Setup dimension name strings - if(poly_type == FcstClusHullPoly || - poly_type == ObsClusHullPoly) { + if(poly_type == ObjPolyType::FcstClusHull || + poly_type == ObjPolyType::ObsClusHull) { obj_dim_name << cs_erase << field_name << "_clus"; } else { @@ -2301,27 +2301,27 @@ void ModeExecutive::write_poly_netcdf(NcFile *f_out, ObjPolyType poly_type) switch(poly_type) { - case FcstSimpBdyPoly: + case ObjPolyType::FcstSimpBdy: poly[i] = &engine.fcst_single[i].boundary[0]; break; - case ObsSimpBdyPoly: + case ObjPolyType::ObsSimpBdy: poly[i] = &engine.obs_single[i].boundary[0]; break; - case FcstSimpHullPoly: + case ObjPolyType::FcstSimpHull: poly[i] = &engine.fcst_single[i].convex_hull; break; - case ObsSimpHullPoly: + case ObjPolyType::ObsSimpHull: poly[i] = &engine.obs_single[i].convex_hull; break; - case FcstClusHullPoly: + case ObjPolyType::FcstClusHull: poly[i] = &engine.fcst_cluster[i].convex_hull; break; - case ObsClusHullPoly: + case ObjPolyType::ObsClusHull: poly[i] = &engine.obs_cluster[i].convex_hull; break; diff --git a/src/tools/core/mode/mode_exec.h b/src/tools/core/mode/mode_exec.h index e2ad110dda..184a2e0a74 100644 --- a/src/tools/core/mode/mode_exec.h +++ b/src/tools/core/mode/mode_exec.h @@ -51,13 +51,13 @@ static const int n_cts = 2; //////////////////////////////////////////////////////////////////////// -enum ObjPolyType { - FcstSimpBdyPoly = 0, - ObsSimpBdyPoly = 1, - FcstSimpHullPoly = 2, - ObsSimpHullPoly = 3, - FcstClusHullPoly = 4, - ObsClusHullPoly = 5 +enum class ObjPolyType { + FcstSimpBdy = 0, + ObsSimpBdy = 1, + FcstSimpHull = 2, + ObsSimpHull = 3, + FcstClusHull = 4, + ObsClusHull = 5 }; diff --git a/src/tools/core/mode/mode_ps_file.cc b/src/tools/core/mode/mode_ps_file.cc index 605fea24e5..3daa7427ae 100644 --- a/src/tools/core/mode/mode_ps_file.cc +++ b/src/tools/core/mode/mode_ps_file.cc @@ -552,7 +552,7 @@ void ModePsFile::make_plot(bool isMultivarSuper) << ConfInfo->Obs->var_info->level_attr(); } - plot_engine(*Engine, FOEng, s.c_str()); + plot_engine(*Engine, EngineType::FOEng, s.c_str()); if ( (fcst_merge_flag == MergeType::Both) || (fcst_merge_flag == MergeType::Thresh) ) { @@ -562,7 +562,7 @@ void ModePsFile::make_plot(bool isMultivarSuper) if ( (fcst_merge_flag == MergeType::Both) || (fcst_merge_flag == MergeType::Engine) ) { - plot_engine(*(Engine->fcst_engine), FFEng, "Forecast: ModeFuzzyEngine Merging"); + plot_engine(*(Engine->fcst_engine), EngineType::FFEng, "Forecast: ModeFuzzyEngine Merging"); } @@ -574,7 +574,7 @@ void ModePsFile::make_plot(bool isMultivarSuper) if ( (obs_merge_flag == MergeType::Both) || (obs_merge_flag == MergeType::Engine) ) { - plot_engine(*(Engine->obs_engine), OOEng, "Observation: ModeFuzzyEngine Merging"); + plot_engine(*(Engine->obs_engine), EngineType::OOEng, "Observation: ModeFuzzyEngine Merging"); } @@ -633,12 +633,12 @@ void ModePsFile::plot_threshold_merging (ModeFuzzyEngine & eng, const char * tit if ( fcst ) { comment("threshold merging page: fcst raw"); - render_ppm(eng, FOEng, *(eng.fcst_raw), fcst, 0); + render_ppm(eng, EngineType::FOEng, *(eng.fcst_raw), fcst, 0); } else { comment("threshold merging page: obs raw"); - render_ppm(eng, FOEng, *(eng.obs_raw), fcst, 0); + render_ppm(eng, EngineType::FOEng, *(eng.obs_raw), fcst, 0); } @@ -661,12 +661,12 @@ void ModePsFile::plot_threshold_merging (ModeFuzzyEngine & eng, const char * tit if ( fcst ) { comment("threshold merging page: fcst raw"); - render_ppm(eng, FOEng, *(eng.fcst_split), fcst, 2); + render_ppm(eng, EngineType::FOEng, *(eng.fcst_split), fcst, 2); } else { comment("threshold merging page: obs split"); - render_ppm(eng, FOEng, *(eng.obs_split), fcst, 2); + render_ppm(eng, EngineType::FOEng, *(eng.obs_split), fcst, 2); } @@ -1021,17 +1021,17 @@ void ModePsFile::render_ppm(ModeFuzzyEngine & eng, EngineType eng_type, const Sh // Set up pointers to the appropriate colortable and fill color values // - if ( eng_type == FFEng ) { + if ( eng_type == EngineType::FFEng ) { ct = &FcstRawCtable; fill_color = FcstFillColor; - } else if ( eng_type == OOEng ) { + } else if ( eng_type == EngineType::OOEng ) { ct = &ObsRawCtable; fill_color = ObsFillColor; - } else { // eng_type == FOEng + } else { // eng_type == EngineType::FOEng if ( fcst ) { diff --git a/src/tools/core/mode/mode_ps_file.h b/src/tools/core/mode/mode_ps_file.h index 6b9318a827..284a45484b 100644 --- a/src/tools/core/mode/mode_ps_file.h +++ b/src/tools/core/mode/mode_ps_file.h @@ -36,7 +36,7 @@ static const bool use_zlib = true; //////////////////////////////////////////////////////////////////////// -enum EngineType { +enum class EngineType { NoEng = 0, FOEng = 1, FFEng = 2, diff --git a/src/tools/core/mode/page_1.cc b/src/tools/core/mode/page_1.cc index 74b757f734..9c1f3d0079 100644 --- a/src/tools/core/mode/page_1.cc +++ b/src/tools/core/mode/page_1.cc @@ -576,8 +576,8 @@ void ModePsFile::do_page_1(ModeFuzzyEngine & eng, EngineType eng_type, const cha Htab_b = Htab_a + 5.0*TextSep; Htab_c = Htab_a + 10.0*TextSep; - if ( eng_type == FOEng ) do_page_1_FOEng (eng, eng_type, title); - else do_page_1_other (eng, eng_type, title); + if ( eng_type == EngineType::FOEng ) do_page_1_FOEng (eng, eng_type, title); + else do_page_1_other (eng, eng_type, title); showpage(); diff --git a/src/tools/core/mode/plot_engine.cc b/src/tools/core/mode/plot_engine.cc index 5a92e5643c..50a839a869 100644 --- a/src/tools/core/mode/plot_engine.cc +++ b/src/tools/core/mode/plot_engine.cc @@ -38,21 +38,21 @@ void ModePsFile::plot_engine(ModeFuzzyEngine & eng, EngineType eng_type, const c // setup fcst & obs strings // - if ( eng_type == FOEng ) { // Plot forecast versus observation + if ( eng_type == EngineType::FOEng ) { // Plot forecast versus observation FcstString = "Forecast"; FcstShortString = "Fcst"; ObsString = "Observation"; ObsShortString = "Obs"; - } else if ( eng_type == FFEng ) { // Plot forecast versus forecast + } else if ( eng_type == EngineType::FFEng ) { // Plot forecast versus forecast FcstString = "Forecast"; FcstShortString = "Fcst"; ObsString = "Forecast"; ObsShortString = "Fcst"; - } else if ( eng_type == OOEng ) { // Plot observation versus observation + } else if ( eng_type == EngineType::OOEng ) { // Plot observation versus observation FcstString = "Observation"; FcstShortString = "Obs"; @@ -67,11 +67,11 @@ void ModePsFile::plot_engine(ModeFuzzyEngine & eng, EngineType eng_type, const c do_page_1(eng, eng_type, title); - if ( (eng_type == FOEng) || (eng_type == FFEng) ) do_fcst_enlarge_page(eng, eng_type, title); + if ( (eng_type == EngineType::FOEng) || (eng_type == EngineType::FFEng) ) do_fcst_enlarge_page(eng, eng_type, title); - if ( (eng_type == FOEng) || (eng_type == OOEng) ) do_obs_enlarge_page(eng, eng_type, title); + if ( (eng_type == EngineType::FOEng) || (eng_type == EngineType::OOEng) ) do_obs_enlarge_page(eng, eng_type, title); - if ( eng_type == FOEng ) { + if ( eng_type == EngineType::FOEng ) { do_overlap_page(eng, eng_type, title); do_cluster_page(eng, eng_type, title); diff --git a/src/tools/core/pcp_combine/pcp_combine.cc b/src/tools/core/pcp_combine/pcp_combine.cc index 7adf584e07..8ff4742b68 100644 --- a/src/tools/core/pcp_combine/pcp_combine.cc +++ b/src/tools/core/pcp_combine/pcp_combine.cc @@ -119,10 +119,10 @@ static const char derive_options [] = "sum, min, max, range, mean, stdev, vld_count"; // Run Command enumeration -enum RunCommand { sum = 0, add = 1, sub = 2, der = 3 }; +enum class RunCommand { sum = 0, add = 1, sub = 2, der = 3 }; // Variables for top-level command line arguments -static RunCommand run_command = sum; +static RunCommand run_command = RunCommand::sum; // Variables common to all commands static int n_files; @@ -232,8 +232,8 @@ int met_main(int argc, char *argv[]) { // Perform the requested run or subtract command. // Derive handles add and derive. // - if(run_command == sum) do_sum_command(); - else if(run_command == sub) do_sub_command(); + if(run_command == RunCommand::sum) do_sum_command(); + else if(run_command == RunCommand::sub) do_sub_command(); else do_derive_command(); } @@ -264,7 +264,7 @@ void process_command_line(int argc, char **argv) { // // Default to running the sum command // - run_command = sum; + run_command = RunCommand::sum; derive_list.add("sum"); // @@ -305,8 +305,8 @@ void process_command_line(int argc, char **argv) { // // Process the specific command arguments. // - if(run_command == sum) process_sum_args(cline); - else process_add_sub_derive_args(cline); + if(run_command == RunCommand::sum) process_sum_args(cline); + else process_add_sub_derive_args(cline); // // If -field not set, set to a list of length 1 with an empty string. @@ -1295,21 +1295,21 @@ void open_nc(const Grid &grid) { // Add global attributes. write_netcdf_global(nc_out, out_filename.c_str(), program_name.c_str()); - if(run_command == sum) { + if(run_command == RunCommand::sum) { command_str << cs_erase << "Sum: " << n_files << " files with accumulations of " << sec_to_hhmmss(in_accum) << '.'; - } else if(run_command == add) { + } else if(run_command == RunCommand::add) { command_str << cs_erase << "Addition: " << n_files << " files."; } - else if(run_command == sub) { + else if(run_command == RunCommand::sub) { command_str << cs_erase << "Subtraction: " << file_list[0] << " minus " << file_list[1]; } - else { // run_command = der + else { // run_command = RunCommand::der command_str << cs_erase << "Derive: " << write_css(derive_list) << " of " << n_files << " files."; @@ -1391,7 +1391,7 @@ void write_nc_data(unixtime nc_init, unixtime nc_valid, int nc_accum, // // Append the derivation string. // - if(run_command == der) var_str << "_" << derive_str; + if(run_command == RunCommand::der) var_str << "_" << derive_str; } mlog << Debug(2) @@ -1408,8 +1408,8 @@ void write_nc_data(unixtime nc_init, unixtime nc_valid, int nc_accum, // Add variable attributes. add_att(&nc_var, "name", var_str.c_str()); - if(run_command == der) cs = long_name_prefix; - else cs.clear(); + if(run_command == RunCommand::der) cs = long_name_prefix; + else cs.clear(); cs << var_info->long_name_attr(); add_att(&nc_var, "long_name", cs.c_str()); @@ -1624,7 +1624,7 @@ void usage() { //////////////////////////////////////////////////////////////////////// void set_sum(const StringArray &) { - run_command = sum; + run_command = RunCommand::sum; derive_list.clear(); derive_list.add("sum"); } @@ -1632,7 +1632,7 @@ void set_sum(const StringArray &) { //////////////////////////////////////////////////////////////////////// void set_add(const StringArray &) { - run_command = add; + run_command = RunCommand::add; derive_list.clear(); derive_list.add("sum"); } @@ -1640,7 +1640,7 @@ void set_add(const StringArray &) { //////////////////////////////////////////////////////////////////////// void set_subtract(const StringArray &) { - run_command = sub; + run_command = RunCommand::sub; derive_list.clear(); derive_list.add("diff"); } @@ -1648,7 +1648,7 @@ void set_subtract(const StringArray &) { //////////////////////////////////////////////////////////////////////// void set_derive(const StringArray & a) { - run_command = der; + run_command = RunCommand::der; derive_list.clear(); StringArray sa; diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 3b1108b709..2aa3b73945 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -59,6 +59,7 @@ #include "vx_nc_util.h" #include "vx_regrid.h" #include "vx_log.h" +#include "enum_as_int.hpp" using namespace std; using namespace netCDF; @@ -262,35 +263,35 @@ void process_command_line(int argc, char **argv) { // - Forecast file list // - Observation file list if(conf_info.get_n_fcst() > 1) { - series_type = SeriesType_Fcst_Conf; + series_type = SeriesType::Fcst_Conf; n_series = conf_info.get_n_fcst(); mlog << Debug(1) << "Series defined by the \"fcst.field\" configuration entry " << "of length " << n_series << ".\n"; } else if(conf_info.get_n_obs() > 1) { - series_type = SeriesType_Obs_Conf; + series_type = SeriesType::Obs_Conf; n_series = conf_info.get_n_obs(); mlog << Debug(1) << "Series defined by the \"obs.field\" configuration entry " << "of length " << n_series << ".\n"; } else if(fcst_files.n() > 1) { - series_type = SeriesType_Fcst_Files; + series_type = SeriesType::Fcst_Files; n_series = fcst_files.n(); mlog << Debug(1) << "Series defined by the forecast file list of length " << n_series << ".\n"; } else if(obs_files.n() > 1) { - series_type = SeriesType_Obs_Files; + series_type = SeriesType::Obs_Files; n_series = obs_files.n(); mlog << Debug(1) << "Series defined by the observation file list of length " << n_series << ".\n"; } else { - series_type = SeriesType_Fcst_Conf; + series_type = SeriesType::Fcst_Conf; n_series = 1; mlog << Debug(1) << "The \"fcst.field\" and \"obs.field\" configuration entries " @@ -424,7 +425,7 @@ void get_series_data(int i_series, // Switch on the series type switch(series_type) { - case SeriesType_Fcst_Conf: + case SeriesType::Fcst_Conf: get_series_entry(i_series, fcst_info, fcst_files, ftype, found_fcst_files, fcst_dp, fcst_grid); if(conf_info.get_n_obs() == 1) { @@ -438,7 +439,7 @@ void get_series_data(int i_series, otype, found_obs_files, obs_dp, obs_grid); break; - case SeriesType_Obs_Conf: + case SeriesType::Obs_Conf: get_series_entry(i_series, obs_info, obs_files, otype, found_obs_files, obs_dp, obs_grid); if(conf_info.get_n_fcst() == 1) { @@ -452,7 +453,7 @@ void get_series_data(int i_series, ftype, found_fcst_files, fcst_dp, fcst_grid); break; - case SeriesType_Fcst_Files: + case SeriesType::Fcst_Files: found_fcst_files.set(i_series, fcst_files[i_series]); get_series_entry(i_series, fcst_info, fcst_files, ftype, found_fcst_files, fcst_dp, fcst_grid); @@ -470,7 +471,7 @@ void get_series_data(int i_series, otype, found_obs_files, obs_dp, obs_grid); break; - case SeriesType_Obs_Files: + case SeriesType::Obs_Files: found_obs_files.set(i_series, obs_files[i_series]); get_series_entry(i_series, obs_info, obs_files, otype, found_obs_files, obs_dp, obs_grid); @@ -491,7 +492,7 @@ void get_series_data(int i_series, default: mlog << Error << "\nget_series_data() -> " << "unexpected SeriesType value: " - << series_type << "\n\n"; + << enum_class_as_int(series_type) << "\n\n"; exit(1); } diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index d50df6cb94..2540540015 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -120,14 +120,14 @@ static Met2dDataFile *obs_mtddf = (Met2dDataFile *) nullptr; static gsl_rng *rng_ptr = (gsl_rng *) nullptr; // Enumeration of ways that a series can be defined -enum SeriesType { - SeriesType_None, // Undefined series type - SeriesType_Fcst_Conf, // Defined by fcst.field configuration - SeriesType_Obs_Conf, // Defined by obs.field configuration - SeriesType_Fcst_Files, // Defined by -fcst command line option - SeriesType_Obs_Files // Defined by -obs command line option +enum class SeriesType { + None, // Undefined series type + Fcst_Conf, // Defined by fcst.field configuration + Obs_Conf, // Defined by obs.field configuration + Fcst_Files, // Defined by -fcst command line option + Obs_Files // Defined by -obs command line option }; -static SeriesType series_type = SeriesType_None; +static SeriesType series_type = SeriesType::None; // Series length static int n_series = 0; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index d47c82c080..a1c875bf80 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -3794,7 +3794,7 @@ void write_job_ramp(STATAnalysisJob &job, vals_part = it->second.f_na.subset(ts.index(beg[i]), ts.index(end[i])); - if(job.ramp_type == TimeSeriesType_DyDt) { + if(job.ramp_type == TimeSeriesType::DyDt) { compute_dydt_ramps(cs.c_str(), vals_part, ts_part, job.ramp_time_fcst, job.ramp_exact_fcst, job.ramp_thresh_fcst, ramp_part, dat_part); @@ -3823,7 +3823,7 @@ void write_job_ramp(STATAnalysisJob &job, vals_part = it->second.o_na.subset(ts.index(beg[i]), ts.index(end[i])); - if(job.ramp_type == TimeSeriesType_DyDt) { + if(job.ramp_type == TimeSeriesType::DyDt) { compute_dydt_ramps(cs.c_str(), vals_part, ts_part, job.ramp_time_obs, job.ramp_exact_obs, job.ramp_thresh_obs, ramp_part, dat_part); @@ -3948,7 +3948,7 @@ void write_job_ramp(STATAnalysisJob &job, mpr_at.set_entry(r_mpr, c++, unix_to_yyyymmdd_hhmmss(init_ut)); mpr_at.set_entry(r_mpr, c++, sec_to_hhmmss((int) valid_ut - init_ut)); mpr_at.set_entry(r_mpr, c++, unix_to_yyyymmdd_hhmmss(valid_ut)); - if(job.ramp_type == TimeSeriesType_DyDt) { + if(job.ramp_type == TimeSeriesType::DyDt) { mpr_at.set_entry(r_mpr, c++, fdat[k]); mpr_at.set_entry(r_mpr, c++, it->second.f_na[k]); mpr_at.set_entry(r_mpr, c++, (is_bad_data(fdat[k]) || is_bad_data(it->second.f_na[k]) ? @@ -3960,7 +3960,7 @@ void write_job_ramp(STATAnalysisJob &job, mpr_at.set_entry(r_mpr, c++, fdat[k]); } mpr_at.set_entry(r_mpr, c++, (is_bad_data(f) ? na_str : bool_to_string(f))); - if(job.ramp_type == TimeSeriesType_DyDt) { + if(job.ramp_type == TimeSeriesType::DyDt) { mpr_at.set_entry(r_mpr, c++, odat[k]); mpr_at.set_entry(r_mpr, c++, it->second.o_na[k]); mpr_at.set_entry(r_mpr, c++, (is_bad_data(odat[k]) || is_bad_data(it->second.o_na[k]) ? @@ -4329,8 +4329,8 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, // // Check the ramp type // - if(job.ramp_type != TimeSeriesType_DyDt && - job.ramp_type != TimeSeriesType_Swing) { + if(job.ramp_type != TimeSeriesType::DyDt && + job.ramp_type != TimeSeriesType::Swing) { mlog << Error << "\ndo_job_ramp() -> " << "unsupported \"-ramp_type\" option: " << jobstring << "\n\n"; @@ -4340,7 +4340,7 @@ void do_job_ramp(const ConcatString &jobstring, LineDataFile &f, // // Check swing_width for the swinging door algorithm // - if(job.ramp_type == TimeSeriesType_Swing && + if(job.ramp_type == TimeSeriesType::Swing && is_bad_data(job.swing_width)) { mlog << Error << "\ndo_job_ramp() -> " << "the \"-swing_width\" option is required for \"-ramp_type SWING\": " diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index d3ef7062d7..a0c76e0082 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -106,22 +106,22 @@ static const char *DEFAULT_CONFIG_FILENAME = //////////////////////////////////////////////////////////////////////// // Supported input ASCII formats -enum ASCIIFormat { - ASCIIFormat_None, - ASCIIFormat_MET, - ASCIIFormat_Little_R, - ASCIIFormat_SurfRad, - ASCIIFormat_WWSIS, - ASCIIFormat_Airnow_dailyv2, - ASCIIFormat_Airnow_hourlyaqobs, - ASCIIFormat_Airnow_hourly, - ASCIIFormat_NDBC_standard, - ASCIIFormat_ISMN, - ASCIIFormat_Aeronet_v2, - ASCIIFormat_Aeronet_v3, - ASCIIFormat_Python, +enum class ASCIIFormat { + None, + MET, + Little_R, + SurfRad, + WWSIS, + Airnow_dailyv2, + Airnow_hourlyaqobs, + Airnow_hourly, + NDBC_standard, + ISMN, + Aeronet_v2, + Aeronet_v3, + Python, }; -static ASCIIFormat ascii_format = ASCIIFormat_None; +static ASCIIFormat ascii_format = ASCIIFormat::None; //////////////////////////////////////////////////////////////////////// @@ -286,63 +286,63 @@ FileHandler *create_file_handler(const ASCIIFormat format, const ConcatString &a // file to guess the format. // switch(format) { - case ASCIIFormat_MET: { + case ASCIIFormat::MET: { return (FileHandler *) new MetHandler(program_name); } - case ASCIIFormat_Little_R: { + case ASCIIFormat::Little_R: { return (FileHandler *) new LittleRHandler(program_name); } - case ASCIIFormat_SurfRad: { + case ASCIIFormat::SurfRad: { return (FileHandler *) new SurfradHandler(program_name); } - case ASCIIFormat_WWSIS: { + case ASCIIFormat::WWSIS: { return (FileHandler *) new WwsisHandler(program_name); } - case ASCIIFormat_Airnow_dailyv2: { + case ASCIIFormat::Airnow_dailyv2: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_DAILYV2); return (FileHandler *) handler; } - case ASCIIFormat_Airnow_hourlyaqobs: { + case ASCIIFormat::Airnow_hourlyaqobs: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_HOURLYAQOBS); return (FileHandler *) handler; } - case ASCIIFormat_Airnow_hourly: { + case ASCIIFormat::Airnow_hourly: { AirnowHandler *handler = new AirnowHandler(program_name); handler->setFormatVersion(AirnowHandler::AIRNOW_FORMAT_VERSION_HOURLY); return (FileHandler *) handler; } - case ASCIIFormat_NDBC_standard: { + case ASCIIFormat::NDBC_standard: { NdbcHandler *handler = new NdbcHandler(program_name); handler->setFormatVersion(NdbcHandler::NDBC_FORMAT_VERSION_STANDARD); return (FileHandler *) handler; } - case ASCIIFormat_ISMN: { + case ASCIIFormat::ISMN: { return (FileHandler *) new IsmnHandler(program_name); } - case ASCIIFormat_Aeronet_v2: { + case ASCIIFormat::Aeronet_v2: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(2); return (FileHandler *) handler; } - case ASCIIFormat_Aeronet_v3: { + case ASCIIFormat::Aeronet_v3: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(3); return (FileHandler *) handler; } #ifdef ENABLE_PYTHON - case ASCIIFormat_Python: { + case ASCIIFormat::Python: { setup_wrapper_path(); ph = new PythonHandler(program_name, ascii_filename.text()); return (FileHandler *) ph; @@ -583,42 +583,42 @@ void usage() { void set_format(const StringArray & a) { if(MetHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_MET; + ascii_format = ASCIIFormat::MET; } else if(LittleRHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_Little_R; + ascii_format = ASCIIFormat::Little_R; } else if(SurfradHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_SurfRad; + ascii_format = ASCIIFormat::SurfRad; } else if(WwsisHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_WWSIS; + ascii_format = ASCIIFormat::WWSIS; } else if(AirnowHandler::getFormatStringDailyV2() == a[0]) { - ascii_format = ASCIIFormat_Airnow_dailyv2; + ascii_format = ASCIIFormat::Airnow_dailyv2; } else if(AirnowHandler::getFormatStringHourlyAqObs() == a[0]) { - ascii_format = ASCIIFormat_Airnow_hourlyaqobs; + ascii_format = ASCIIFormat::Airnow_hourlyaqobs; } else if(AirnowHandler::getFormatStringHourly() == a[0]) { - ascii_format = ASCIIFormat_Airnow_hourly; + ascii_format = ASCIIFormat::Airnow_hourly; } else if(NdbcHandler::getFormatStringStandard() == a[0]) { - ascii_format = ASCIIFormat_NDBC_standard; + ascii_format = ASCIIFormat::NDBC_standard; } else if(IsmnHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_ISMN; + ascii_format = ASCIIFormat::ISMN; } else if(AeronetHandler::getFormatString() == a[0] || AeronetHandler::getFormatString_v2() == a[0]) { - ascii_format = ASCIIFormat_Aeronet_v2; + ascii_format = ASCIIFormat::Aeronet_v2; } else if(AeronetHandler::getFormatString_v3() == a[0]) { - ascii_format = ASCIIFormat_Aeronet_v3; + ascii_format = ASCIIFormat::Aeronet_v3; } #ifdef ENABLE_PYTHON else if(PythonHandler::getFormatString() == a[0]) { - ascii_format = ASCIIFormat_Python; + ascii_format = ASCIIFormat::Python; } #endif else if("python" == a[0]) { diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 4f1fbd4837..621a48ec92 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -53,6 +53,7 @@ #include "grib_classes.h" +#include "enum_as_int.hpp" #include "vx_log.h" #include "nav.h" #include "vx_math.h" @@ -82,11 +83,11 @@ int met_main(int argc, char *argv[]) { process_mask_file(dp_mask); // Apply combination logic if the current mask is binary - if(mask_type == MaskType_Poly || - mask_type == MaskType_Poly_XY || - mask_type == MaskType_Shape || - mask_type == MaskType_Box || - mask_type == MaskType_Grid || + if(mask_type == MaskType::Poly || + mask_type == MaskType::Poly_XY || + mask_type == MaskType::Shape || + mask_type == MaskType::Box || + mask_type == MaskType::Grid || thresh.get_type() != thresh_na) { dp_out = combine(dp_data, dp_mask, set_logic); } @@ -155,7 +156,7 @@ void process_command_line(int argc, char **argv) { out_filename = cline[2]; // Check for the mask type (from -type string) - if(mask_type == MaskType_None) { + if(mask_type == MaskType::None) { mlog << Error << "\n" << program_name << " -> " << "the -type command line requirement must be set to a specific masking type!\n" << "\t\t \"poly\", \"box\", \"circle\", \"track\", \"grid\", " @@ -223,11 +224,11 @@ void process_mask_file(DataPlane &dp) { solar_ut = (unixtime) 0; // Process the mask file as a lat/lon polyline file - if(mask_type == MaskType_Poly || - mask_type == MaskType_Poly_XY || - mask_type == MaskType_Box || - mask_type == MaskType_Circle || - mask_type == MaskType_Track) { + if(mask_type == MaskType::Poly || + mask_type == MaskType::Poly_XY || + mask_type == MaskType::Box || + mask_type == MaskType::Circle || + mask_type == MaskType::Track) { poly_mask.clear(); poly_mask.load(mask_filename.c_str()); @@ -238,7 +239,7 @@ void process_mask_file(DataPlane &dp) { } // Process the mask from a shapefile - else if(mask_type == MaskType_Shape) { + else if(mask_type == MaskType::Shape) { // If -shape_str was specified, find the matching records if(shape_str_map.size() > 0) get_shapefile_strings(); @@ -272,8 +273,8 @@ void process_mask_file(DataPlane &dp) { } // Nothing to do for Lat/Lon masking types - else if(mask_type == MaskType_Lat || - mask_type == MaskType_Lon) { + else if(mask_type == MaskType::Lat || + mask_type == MaskType::Lon) { } // Otherwise, process the mask file as a named grid, grid specification @@ -282,7 +283,7 @@ void process_mask_file(DataPlane &dp) { // For the grid mask type, support named grids and grid // specification strings - if(mask_type == MaskType_Grid) { + if(mask_type == MaskType::Grid) { // Parse the mask file as a white-space separated string StringArray sa; @@ -311,7 +312,7 @@ void process_mask_file(DataPlane &dp) { // Read the mask grid and data plane, if requested get_data_plane(mask_filename, mask_field_str, - mask_type == MaskType_Data, + mask_type == MaskType::Data, dp, grid_mask); } @@ -320,7 +321,7 @@ void process_mask_file(DataPlane &dp) { << " (" << grid_mask.nx() << " x " << grid_mask.ny() << ")\n"; // Check for matching grids - if(mask_type == MaskType_Data && grid != grid_mask) { + if(mask_type == MaskType::Data && grid != grid_mask) { mlog << Error << "\nprocess_mask_file() -> " << "The input grid and mask grid must be identical for " << "\"data\" masking.\n" @@ -348,7 +349,7 @@ void process_mask_file(DataPlane &dp) { } // Check that mask_field has been set for data masking - if(mask_type == MaskType_Data && mask_field_str.length() == 0) { + if(mask_type == MaskType::Data && mask_field_str.length() == 0) { mlog << Error << "\nprocess_mask_file() -> " << "use \"-mask_field\" to specify the field for " << "\"data\" masking.\n\n"; @@ -361,51 +362,51 @@ void process_mask_file(DataPlane &dp) { // Construct the mask switch(mask_type) { - case MaskType_Poly: + case MaskType::Poly: apply_poly_mask(dp); break; - case MaskType_Poly_XY: + case MaskType::Poly_XY: apply_poly_xy_mask(dp); break; - case MaskType_Box: + case MaskType::Box: apply_box_mask(dp); break; - case MaskType_Circle: + case MaskType::Circle: apply_circle_mask(dp); break; - case MaskType_Track: + case MaskType::Track: apply_track_mask(dp); break; - case MaskType_Grid: + case MaskType::Grid: apply_grid_mask(dp); break; - case MaskType_Data: + case MaskType::Data: apply_data_mask(dp); break; - case MaskType_Solar_Alt: - case MaskType_Solar_Azi: + case MaskType::Solar_Alt: + case MaskType::Solar_Azi: apply_solar_mask(dp); break; - case MaskType_Lat: - case MaskType_Lon: + case MaskType::Lat: + case MaskType::Lon: apply_lat_lon_mask(dp); break; - case MaskType_Shape: + case MaskType::Shape: apply_shape_mask(dp); break; default: mlog << Error << "\nprocess_mask_file() -> " - << "Unxpected MaskType value (" << mask_type << ")\n\n"; + << "Unxpected MaskType value (" << enum_class_as_int(mask_type) << ")\n\n"; exit(1); } @@ -1135,7 +1136,7 @@ void apply_solar_mask(DataPlane &dp) { // Compute the solar altitude and azimuth solar_altaz(solar_ut, lat, lon, alt, azi); - v = (mask_type == MaskType_Solar_Alt ? alt : azi); + v = (mask_type == MaskType::Solar_Alt ? alt : azi); // Apply threshold, if specified if(thresh.get_type() != thresh_na) { @@ -1162,7 +1163,7 @@ void apply_solar_mask(DataPlane &dp) { << masktype_to_string(mask_type) << " mask.\n"; } - const char *mask_str = (mask_type == MaskType_Solar_Alt ? + const char *mask_str = (mask_type == MaskType::Solar_Alt ? "Altitude" : "Azimuth"); // List the number of points inside the mask @@ -1205,7 +1206,7 @@ void apply_lat_lon_mask(DataPlane &dp) { // Lat/Lon value for the current grid point grid.xy_to_latlon(x, y, lat, lon); - v = (mask_type == MaskType_Lat ? lat : + v = (mask_type == MaskType::Lat ? lat : rescale_deg(-1.0*lon, -180.0, 180.0)); // Apply threshold, if specified @@ -1233,7 +1234,7 @@ void apply_lat_lon_mask(DataPlane &dp) { << masktype_to_string(mask_type) << " mask.\n"; } - const char *mask_str = (mask_type == MaskType_Lat ? + const char *mask_str = (mask_type == MaskType::Lat ? "Latitude" : "Longitude"); // List the number of points inside the mask @@ -1426,10 +1427,10 @@ void write_netcdf(const DataPlane &dp) { // Set the mask_name, if not already set if(mask_name.length() == 0) { - if(mask_type == MaskType_Poly || - mask_type == MaskType_Poly_XY || - mask_type == MaskType_Circle || - mask_type == MaskType_Track) { + if(mask_type == MaskType::Poly || + mask_type == MaskType::Poly_XY || + mask_type == MaskType::Circle || + mask_type == MaskType::Track) { mask_name = poly_mask.name(); } else { @@ -1495,26 +1496,26 @@ void write_netcdf(const DataPlane &dp) { //////////////////////////////////////////////////////////////////////// bool is_solar_masktype(MaskType t) { - return(t == MaskType_Solar_Alt || t == MaskType_Solar_Azi); + return(t == MaskType::Solar_Alt || t == MaskType::Solar_Azi); } //////////////////////////////////////////////////////////////////////// MaskType string_to_masktype(const char *s) { - MaskType t = MaskType_None; - - if(strcasecmp(s, "poly") == 0) t = MaskType_Poly; - else if(strcasecmp(s, "poly_xy") == 0) t = MaskType_Poly_XY; - else if(strcasecmp(s, "box") == 0) t = MaskType_Box; - else if(strcasecmp(s, "circle") == 0) t = MaskType_Circle; - else if(strcasecmp(s, "track") == 0) t = MaskType_Track; - else if(strcasecmp(s, "grid") == 0) t = MaskType_Grid; - else if(strcasecmp(s, "data") == 0) t = MaskType_Data; - else if(strcasecmp(s, "solar_alt") == 0) t = MaskType_Solar_Alt; - else if(strcasecmp(s, "solar_azi") == 0) t = MaskType_Solar_Azi; - else if(strcasecmp(s, "lat") == 0) t = MaskType_Lat; - else if(strcasecmp(s, "lon") == 0) t = MaskType_Lon; - else if(strcasecmp(s, "shape") == 0) t = MaskType_Shape; + MaskType t = MaskType::None; + + if(strcasecmp(s, "poly") == 0) t = MaskType::Poly; + else if(strcasecmp(s, "poly_xy") == 0) t = MaskType::Poly_XY; + else if(strcasecmp(s, "box") == 0) t = MaskType::Box; + else if(strcasecmp(s, "circle") == 0) t = MaskType::Circle; + else if(strcasecmp(s, "track") == 0) t = MaskType::Track; + else if(strcasecmp(s, "grid") == 0) t = MaskType::Grid; + else if(strcasecmp(s, "data") == 0) t = MaskType::Data; + else if(strcasecmp(s, "solar_alt") == 0) t = MaskType::Solar_Alt; + else if(strcasecmp(s, "solar_azi") == 0) t = MaskType::Solar_Azi; + else if(strcasecmp(s, "lat") == 0) t = MaskType::Lat; + else if(strcasecmp(s, "lon") == 0) t = MaskType::Lon; + else if(strcasecmp(s, "shape") == 0) t = MaskType::Shape; else { mlog << Error << "\nstring_to_masktype() -> " << "unsupported masking type \"" << s << "\"\n\n"; @@ -1530,19 +1531,19 @@ const char * masktype_to_string(const MaskType t) { const char *s = (const char *) nullptr; switch(t) { - case MaskType_Poly: s = "poly"; break; - case MaskType_Poly_XY: s = "poly_xy"; break; - case MaskType_Box: s = "box"; break; - case MaskType_Circle: s = "circle"; break; - case MaskType_Track: s = "track"; break; - case MaskType_Grid: s = "grid"; break; - case MaskType_Data: s = "data"; break; - case MaskType_Solar_Alt: s = "solar_alt"; break; - case MaskType_Solar_Azi: s = "solar_azi"; break; - case MaskType_Lat: s = "lat"; break; - case MaskType_Lon: s = "lon"; break; - case MaskType_Shape: s = "shape"; break; - case MaskType_None: s = na_str; break; + case MaskType::Poly: s = "poly"; break; + case MaskType::Poly_XY: s = "poly_xy"; break; + case MaskType::Box: s = "box"; break; + case MaskType::Circle: s = "circle"; break; + case MaskType::Track: s = "track"; break; + case MaskType::Grid: s = "grid"; break; + case MaskType::Data: s = "data"; break; + case MaskType::Solar_Alt: s = "solar_alt"; break; + case MaskType::Solar_Azi: s = "solar_azi"; break; + case MaskType::Lat: s = "lat"; break; + case MaskType::Lon: s = "lon"; break; + case MaskType::Shape: s = "shape"; break; + case MaskType::None: s = na_str; break; default: s = (const char *) nullptr; break; } diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.h b/src/tools/other/gen_vx_mask/gen_vx_mask.h index e6f985808c..962693f0c4 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.h +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.h @@ -17,7 +17,7 @@ // 000 12/09/14 Halley Gotway New // 001 06/02/16 Halley Gotway Add box masking type. // 002 11/15/16 Halley Gotway Add solar masking types. -// 003 06/03/21 Seth Linden Changed default mask type to MaskType_None. +// 003 06/03/21 Seth Linden Changed default mask type to MaskType::None. // 004 08/30/21 Halley Gotway MET #1891 fix input and mask fields. // 005 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. // 006 09/29/22 Prestopnik MET #2227 Remove namespace std from header files @@ -47,27 +47,27 @@ static const char *program_name = "gen_vx_mask"; //////////////////////////////////////////////////////////////////////// -enum MaskType { +enum class MaskType { - MaskType_Poly, // Polyline masking in lat/lon space - MaskType_Poly_XY, // Polyline masking in grid x/y space + Poly, // Polyline masking in lat/lon space + Poly_XY, // Polyline masking in grid x/y space - MaskType_Box, // Box masking type - MaskType_Circle, // Circle masking region + Box, // Box masking type + Circle, // Circle masking region - MaskType_Track, // Track masking region - MaskType_Grid, // Grid masking type - MaskType_Data, // Data masking type + Track, // Track masking region + Grid, // Grid masking type + Data, // Data masking type - MaskType_Solar_Alt, // Solar altitude masking type - MaskType_Solar_Azi, // Solar azimuth masking type + Solar_Alt, // Solar altitude masking type + Solar_Azi, // Solar azimuth masking type - MaskType_Lat, // Latitude masking type - MaskType_Lon, // Longitude masking type + Lat, // Latitude masking type + Lon, // Longitude masking type - MaskType_Shape, // Shapefile + Shape, // Shapefile - MaskType_None + None }; @@ -81,7 +81,7 @@ extern const char * masktype_to_string(MaskType); // //////////////////////////////////////////////////////////////////////// -static const MaskType default_mask_type = MaskType_None; +static const MaskType default_mask_type = MaskType::None; static const double default_mask_val = 1.0; //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/ioda2nc/ioda2nc.cc b/src/tools/other/ioda2nc/ioda2nc.cc index 9c4233ded4..da466c79d2 100644 --- a/src/tools/other/ioda2nc/ioda2nc.cc +++ b/src/tools/other/ioda2nc/ioda2nc.cc @@ -73,7 +73,7 @@ static const char *qc_postfix = "PreQC"; static const char *obs_group_name = "ObsValue"; static const char *derived_obs_group_name = "DerivedObsValue"; -enum e_ioda_format { ioda_v1, ioda_v2 }; +enum class e_ioda_format { v1, v2 }; //////////////////////////////////////////////////////////////////////// @@ -439,7 +439,7 @@ void process_ioda_file(int i_pb) { StringArray metadata_vars; StringArray obs_value_vars; bool error_out = true; - e_ioda_format ioda_format = ioda_v2; + e_ioda_format ioda_format = e_ioda_format::v2; get_dim_names(f_in, &dim_names); ConcatString nlocs_name = find_meta_name("nlocs", dim_names); @@ -447,9 +447,9 @@ void process_ioda_file(int i_pb) { nvars = bad_data_int ; nstring = string_data_len; - if (! has_nc_group(f_in, obs_group_name)) ioda_format = ioda_v1; + if (! has_nc_group(f_in, obs_group_name)) ioda_format = e_ioda_format::v1; - if ( ioda_format == ioda_v1 ) { + if ( ioda_format == e_ioda_format::v1 ) { StringArray var_names; get_var_names(f_in, &var_names); for(idx=0; idx " @@ -1349,7 +1349,7 @@ bool get_obs_data_float(NcFile *f_in, const ConcatString var_name, if(var_name.length() > 0) { ConcatString qc_name = var_name; ConcatString qc_group = qc_postfix; - if (ioda_format == ioda_v2) { + if (ioda_format == e_ioda_format::v2) { NcGroup nc_grp = get_nc_group(f_in, qc_postfix); if (IS_INVALID_NC(nc_grp)) qc_group = qc_group_name; StringArray qc_names = conf_info.obs_to_qc_map[var_name]; diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index 7e026610b9..2c2c4f3853 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -59,6 +59,7 @@ #include "vx_cal.h" #include "vx_math.h" #include "vx_log.h" +#include "enum_as_int.hpp" #include "nc_point_obs_out.h" using namespace std; @@ -300,45 +301,45 @@ void process_madis_file(const char *madis_file) { exit(1); } // If the MADIS type is not already set, try to guess. - if(my_mtype == madis_none) my_mtype = get_madis_type(f_in); + if(my_mtype == MadisType::none) my_mtype = get_madis_type(f_in); // Switch on the MADIS type and process accordingly. switch(my_mtype) { - case(madis_metar): + case(MadisType::metar): process_madis_metar(f_in); break; - case(madis_raob): + case(MadisType::raob): process_madis_raob(f_in); break; - case (madis_profiler): + case (MadisType::profiler): process_madis_profiler(f_in); break; - case(madis_maritime): + case(MadisType::maritime): process_madis_maritime(f_in); break; - case(madis_mesonet): + case(MadisType::mesonet): process_madis_mesonet(f_in); break; - case(madis_acarsProfiles): + case(MadisType::acarsProfiles): process_madis_acarsProfiles(f_in); break; - case(madis_coop): - case(madis_HDW): - case(madis_HDW1h): - case(madis_hydro): - case(madis_POES): - case(madis_acars): - case(madis_radiometer): - case(madis_sao): - case(madis_satrad): - case(madis_snow): - case(madis_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 (" << my_mtype + << "MADIS type (" << enum_class_as_int(my_mtype) << ") not currently supported.\n\n"; exit(1); } @@ -662,18 +663,18 @@ int process_obs(const int in_gc, const float conversion, //////////////////////////////////////////////////////////////////////// MadisType get_madis_type(NcFile *&f_in) { - MadisType madis_type = madis_none; + MadisType madis_type = MadisType::none; ConcatString attr_value; // // FUTURE WORK: Interrogate the MADIS file and determine it's type. // if (get_global_att(f_in, (string)"id", attr_value)) { - if (attr_value == "MADIS_MARITIME") madis_type = madis_maritime; - else if (attr_value == "MADIS_MESONET") madis_type = madis_mesonet; - else if (attr_value == "MADIS_METAR") madis_type = madis_metar; + if (attr_value == "MADIS_MARITIME") madis_type = MadisType::maritime; + else if (attr_value == "MADIS_MESONET") madis_type = MadisType::mesonet; + else if (attr_value == "MADIS_METAR") madis_type = MadisType::metar; } else if (get_global_att(f_in, (string)"title", attr_value)) { - if (attr_value.contents("MADIS ACARS") != "") madis_type = madis_acarsProfiles; + if (attr_value.contents("MADIS ACARS") != "") madis_type = MadisType::acarsProfiles; } return madis_type; } @@ -3629,22 +3630,22 @@ void set_type(const StringArray & a) // Parse the MADIS type // if(strcasecmp(a[0].c_str(), metar_str) == 0) { - mtype = madis_metar; + mtype = MadisType::metar; } else if(strcasecmp(a[0].c_str(), raob_str) == 0) { - mtype = madis_raob; + mtype = MadisType::raob; } else if(strcasecmp(a[0].c_str(), profiler_str) == 0) { - mtype = madis_profiler; + mtype = MadisType::profiler; } else if(strcasecmp(a[0].c_str(), maritime_str) == 0) { - mtype = madis_maritime; + mtype = MadisType::maritime; } else if(strcasecmp(a[0].c_str(), mesonet_str) == 0) { - mtype = madis_mesonet; + mtype = MadisType::mesonet; } else if(strcasecmp(a[0].c_str(), acarsProfiles_str) == 0) { - mtype = madis_acarsProfiles; + mtype = MadisType::acarsProfiles; } else { mlog << Error << "\nprocess_command_line() -> " diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index aea7ec5b48..e397d5ba2b 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -47,24 +47,24 @@ // Enumeration of possible MADIS observation types -enum MadisType { - madis_none, - madis_coop, - madis_HDW, - madis_HDW1h, - madis_hydro, - madis_POES, - madis_acars, - madis_acarsProfiles, - madis_maritime, - madis_metar, - madis_mesonet, - madis_profiler, - madis_radiometer, - madis_raob, - madis_sao, - madis_satrad, - madis_snow +enum class MadisType { + none, + coop, + HDW, + HDW1h, + hydro, + POES, + acars, + acarsProfiles, + maritime, + metar, + mesonet, + profiler, + radiometer, + raob, + sao, + satrad, + snow }; // Constants @@ -103,7 +103,7 @@ static const char *in_recNum_str = "recNum"; static ConcatString mdfile; static ConcatString ncfile; -static MadisType mtype = madis_none; +static MadisType mtype = MadisType::none; static StringArray qc_dd_sa; static StringArray lvl_dim_sa; static int rec_beg = 0; diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.cc b/src/tools/other/mode_graphics/mode_nc_output_file.cc index c39ca2465a..3247be997a 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.cc +++ b/src/tools/other/mode_graphics/mode_nc_output_file.cc @@ -719,19 +719,19 @@ for (x=0; xtype() == ATCFLineType_ProbRI) probs.add(p.prob_rirw(i)); + if(p[i]->type() == ATCFLineType::ProbRI) probs.add(p.prob_rirw(i)); } // Print summary filtering info diff --git a/src/tools/tc_utils/tc_stat/tc_stat_files.cc b/src/tools/tc_utils/tc_stat/tc_stat_files.cc index 77a6b9d11b..a8c63c592c 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_files.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_files.cc @@ -165,8 +165,8 @@ bool TCStatFiles::operator>>(TrackPairInfo &pair) { // Skip header and non-TCMPR/TCDIAG lines if(line.is_header() || - (line.type() != TCStatLineType_TCMPR && - line.type() != TCStatLineType_TCDIAG)) continue; + (line.type() != TCStatLineType::TCMPR && + line.type() != TCStatLineType::TCDIAG)) continue; // Add the current point pair.add(line); @@ -177,7 +177,7 @@ bool TCStatFiles::operator>>(TrackPairInfo &pair) { // Check for a trailing TCDIAG line if(CurLDF.peek_line(line)) { - if(line.type() == TCStatLineType_TCDIAG) { + if(line.type() == TCStatLineType::TCDIAG) { pair.add(line); CurLDF >> line; } @@ -231,7 +231,7 @@ bool TCStatFiles::operator>>(ProbRIRWPairInfo &pair) { while((status = (CurLDF >> line))) { // Skip header and non-PROBRIRW lines - if(line.is_header() || line.type() != TCStatLineType_ProbRIRW) continue; + if(line.is_header() || line.type() != TCStatLineType::ProbRIRW) continue; // Add the current point pair.set(line); @@ -280,7 +280,7 @@ bool TCStatFiles::operator>>(TCStatLine &line) { while((status = (CurLDF >> line))) { // Skip header and invalid line types - if(line.is_header() || line.type() == NoTCStatLineType) continue; + if(line.is_header() || line.type() == TCStatLineType::None) continue; break; diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index d09dcd52f3..4fb93c24ef 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -54,7 +54,7 @@ static bool check_masks (const MaskPoly &, const Grid &, const Ma TCStatJob *TCStatJobFactory::new_tc_stat_job_type(const char *type_str) { TCStatJob *job = (TCStatJob *) nullptr; - TCStatJobType type = NoTCStatJobType; + TCStatJobType type = TCStatJobType::None; // Determine the TCStatJobType type = string_to_tcstatjobtype((string)type_str); @@ -63,23 +63,23 @@ TCStatJob *TCStatJobFactory::new_tc_stat_job_type(const char *type_str) { // The TCStatJob object is allocated and needs to be deleted by caller. switch(type) { - case TCStatJobType_Filter: + case TCStatJobType::Filter: job = new TCStatJobFilter; break; - case TCStatJobType_Summary: + case TCStatJobType::Summary: job = new TCStatJobSummary; break; - case TCStatJobType_RIRW: + case TCStatJobType::RIRW: job = new TCStatJobRIRW; break; - case TCStatJobType_ProbRIRW: + case TCStatJobType::ProbRIRW: job = new TCStatJobProbRIRW; break; - case NoTCStatJobType: + case TCStatJobType::None: default: mlog << Error << "\nTCStatJobFactory::new_tc_stat_job_type() -> " << "unsupported job type \"" << type_str << "\"\n\n"; @@ -196,7 +196,7 @@ void TCStatJob::clear() { Precision = default_precision; - JobType = NoTCStatJobType; + JobType = TCStatJobType::None; AModel.clear(); BModel.clear(); @@ -712,7 +712,7 @@ bool TCStatJob::is_keeper_line(const TCStatLine &line, TCPointCounts &n) const { // Does not apply to TCDIAG lines - if(line.type() == TCStatLineType_TCDIAG) return true; + if(line.type() == TCStatLineType::TCDIAG) return true; bool keep = true; double v_dbl, alat, alon, blat, blon; @@ -767,7 +767,7 @@ bool TCStatJob::is_keeper_line(const TCStatLine &line, !LineType.has(line.line_type())) { keep = false; n.RejLineType++; } // Check that PROBRIRW lines include the requested probability type - else if(line.type() == TCStatLineType_ProbRIRW && + else if(line.type() == TCStatLineType::ProbRIRW && !is_bad_data(ProbRIRWThresh) && is_bad_data(get_probrirw_value(line, ProbRIRWThresh))) { keep = false; @@ -885,7 +885,7 @@ double TCStatJob::get_column_double(const TCStatLine &line, // Check for PROBRIRW_PROB special case if(strcasecmp(column.c_str(), "PROBRIRW_PROB") == 0 && - line.type() == TCStatLineType_ProbRIRW) { + line.type() == TCStatLineType::ProbRIRW) { v = get_probrirw_value(line, ProbRIRWThresh); return v; } @@ -1289,7 +1289,7 @@ ConcatString TCStatJob::serialize() const { s.clear(); s.set_precision(get_precision()); - if(JobType != NoTCStatJobType) + if(JobType != TCStatJobType::None) s << "-job " << tcstatjobtype_to_string(JobType) << " "; for(i=0; i Date: Mon, 1 Apr 2024 21:41:44 +0000 Subject: [PATCH 45/72] #2830 Changed enum_class_as_integer to enum_class_as_int --- src/basic/vx_util/GridTemplate.cc | 24 +++++++------------ src/basic/vx_util/data_plane_util.cc | 9 ++----- src/basic/vx_util/interp_util.cc | 16 ++++--------- src/basic/vx_util/normalize.cc | 14 +++-------- src/libcode/vx_shapedata/engine.cc | 12 ++-------- src/libcode/vx_statistics/pair_data_point.cc | 12 ++-------- .../wavelet_stat/wavelet_stat_conf_info.cc | 16 ++++--------- 7 files changed, 25 insertions(+), 78 deletions(-) diff --git a/src/basic/vx_util/GridTemplate.cc b/src/basic/vx_util/GridTemplate.cc index 58bc284741..58ea643be5 100644 --- a/src/basic/vx_util/GridTemplate.cc +++ b/src/basic/vx_util/GridTemplate.cc @@ -29,6 +29,7 @@ #include "vx_log.h" #include "nint.h" +#include "enum_as_int.hpp" #include "GridTemplate.h" #include "GridOffset.h" @@ -40,15 +41,6 @@ using namespace std; /////////////////////////////////////////////////////////////////////////////// -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - -/////////////////////////////////////////////////////////////////////////////// - GridTemplate::GridTemplate(void) : _wrapLon(false) { // Do nothing @@ -600,11 +592,11 @@ void GridTemplate::_setEdgeOffsets() { /////////////////////////////////////////////////////////////////////////////// GridTemplateFactory::GridTemplateFactory() { - enum_to_string.resize(enum_class_as_integer(GridTemplates::NUM_TEMPLATES)); + enum_to_string.resize(enum_class_as_int(GridTemplates::NUM_TEMPLATES)); - enum_to_string[enum_class_as_integer(GridTemplates::None)] = ""; - enum_to_string[enum_class_as_integer(GridTemplates::Square)] = "SQUARE"; - enum_to_string[enum_class_as_integer(GridTemplates::Circle)] = "CIRCLE"; + enum_to_string[enum_class_as_int(GridTemplates::None)] = ""; + enum_to_string[enum_class_as_int(GridTemplates::Square)] = "SQUARE"; + enum_to_string[enum_class_as_int(GridTemplates::Circle)] = "CIRCLE"; } /////////////////////////////////////////////////////////////////////////////// @@ -621,7 +613,7 @@ GridTemplateFactory::~GridTemplateFactory() { GridTemplateFactory::GridTemplates GridTemplateFactory::string2Enum(string target) { - for(unsigned int ix = 0; ix < enum_class_as_integer(GridTemplates::NUM_TEMPLATES); ix++) { + for(unsigned int ix = 0; ix < enum_class_as_int(GridTemplates::NUM_TEMPLATES); ix++) { if(enum_to_string[ix] == target) { return static_cast(ix); } @@ -641,7 +633,7 @@ string GridTemplateFactory::enum2String(GridTemplates target) { if(static_cast(target) > enum_to_string.size() - 1) { mlog << Error << "\nGridTemplateFactory::enum2String() -> " - << "target out of range " << enum_class_as_integer(target) << " > " + << "target out of range " << enum_class_as_int(target) << " > " << (static_cast(enum_to_string.size()) - 1) << ".\n\n"; exit(1); @@ -676,7 +668,7 @@ GridTemplate* GridTemplateFactory::buildGT(GridTemplates gt, int width, bool wra default: mlog << Error << "\nbuildGT() -> " - << "Unexpected GridTemplates value (" << enum_class_as_integer(gt) << ").\n\n"; + << "Unexpected GridTemplates value (" << enum_class_as_int(gt) << ").\n\n"; exit(1); } } diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc index 16beac9e3c..6b15ed7b88 100644 --- a/src/basic/vx_util/data_plane_util.cc +++ b/src/basic/vx_util/data_plane_util.cc @@ -26,6 +26,7 @@ #include "vx_gsl_prob.h" #include "vx_math.h" #include "vx_log.h" +#include "enum_as_int.hpp" #include "GridTemplate.h" @@ -37,12 +38,6 @@ using namespace std; // //////////////////////////////////////////////////////////////////////// -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} //////////////////////////////////////////////////////////////////////// // @@ -164,7 +159,7 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, default: mlog << Error << "\nsmooth_field() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) + << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n"; exit(1); } diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc index db776d737e..aeb08d31ae 100644 --- a/src/basic/vx_util/interp_util.cc +++ b/src/basic/vx_util/interp_util.cc @@ -23,19 +23,11 @@ #include "vx_math.h" #include "vx_log.h" +#include "enum_as_int.hpp" using namespace std; -//////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - //////////////////////////////////////////////////////////////////////// // // Code for struct SurfaceInfo @@ -1029,7 +1021,7 @@ double compute_sfc_interp(const DataPlane &dp, default: mlog << Error << "\ncompute_sfc_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n"; exit(1); } @@ -1203,7 +1195,7 @@ double compute_horz_interp(const DataPlane &dp, default: mlog << Error << "\ncompute_horz_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n"; exit(1); } @@ -1348,7 +1340,7 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, default: mlog << Error << "\nvalid_time_interp() -> " << "unsupported interpolation method encountered: " - << interpmthd_to_string(mthd) << "(" << enum_class_as_integer(mthd) << ")\n\n"; + << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n"; exit(1); } diff --git a/src/basic/vx_util/normalize.cc b/src/basic/vx_util/normalize.cc index 5ad26ddfa3..ab9669e0b8 100644 --- a/src/basic/vx_util/normalize.cc +++ b/src/basic/vx_util/normalize.cc @@ -16,18 +16,10 @@ #include "config_util.h" #include "normalize.h" +#include "enum_as_int.hpp" using namespace std; -//////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - /////////////////////////////////////////////////////////////////////////////// ConcatString normalizetype_to_string(const NormalizeType type) { @@ -58,7 +50,7 @@ ConcatString normalizetype_to_string(const NormalizeType type) { default: mlog << Error << "\nnormalizetype_to_string() -> " - << "Unexpected NormalizeType value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected NormalizeType value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } @@ -125,7 +117,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type, default: mlog << Error << "\nnormalize_data() -> " << "unexpected NormalizeType value (" - << enum_class_as_integer(type) << ")\n\n"; + << enum_class_as_int(type) << ")\n\n"; exit(1); } // end switch diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index 008115bad9..0bafe99679 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -17,6 +17,7 @@ #include #include +#include "enum_as_int.hpp" #include "engine.h" #include "mode_columns.h" #include "vx_util.h" @@ -31,15 +32,6 @@ static const int print_interest_log_level = 5; static inline double area_ratio_conf(double t) { return t; } -//////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - /////////////////////////////////////////////////////////////////////// // // Code for class ModeFuzzyEngine @@ -1062,7 +1054,7 @@ void ModeFuzzyEngine::do_matching() { } else { mlog << Error << "\nModeFuzzyEngine::do_matching() -> " - << "invalid match_flag value of " << enum_class_as_integer(conf_info.match_flag) + << "invalid match_flag value of " << enum_class_as_int(conf_info.match_flag) << " specified.\n\n"; exit(1); } diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index dd84a4e440..cac91ea6c1 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -25,18 +25,10 @@ #include "vx_grid.h" #include "vx_math.h" #include "vx_log.h" +#include "enum_as_int.hpp" using namespace std; -//////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - //////////////////////////////////////////////////////////////////////// // // Code for class PairDataPoint @@ -1619,7 +1611,7 @@ bool check_fo_thresh(double f, double o, double cmn, double csd, default: mlog << Error << "\ncheck_fo_thresh() -> " - << "Unexpected SetLogic value of " << enum_class_as_integer(type) << ".\n\n"; + << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n"; exit(1); } 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 b644a3dc2f..68b2c670d7 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.cc @@ -21,18 +21,10 @@ #include "vx_data2d_factory.h" #include "vx_log.h" +#include "enum_as_int.hpp" using namespace std; -//////////////////////////////////////////////////////////////////////// - -template -auto enum_class_as_integer(Enumeration const value) - -> typename std::underlying_type::type -{ - return static_cast::type>(value); -} - //////////////////////////////////////////////////////////////////////// // // Code for class WaveletStatConfInfo @@ -349,7 +341,7 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, case(WaveletType::None): default: mlog << Error << "\nWaveletStatConfInfo::process_config() -> " - << "Unsupported wavelet type value of " << enum_class_as_integer(wvlt_type) << ".\n\n"; + << "Unsupported wavelet type value of " << enum_class_as_int(wvlt_type) << ".\n\n"; exit(1); } @@ -395,7 +387,7 @@ void WaveletStatConfInfo::process_config(GrdFileType ftype, case(WaveletType::None): default: mlog << Error << "\nWaveletStatConfInfo::process_config() -> " - << "Unsupported wavelet type value of " << enum_class_as_integer(wvlt_type) << ".\n\n"; + << "Unsupported wavelet type value of " << enum_class_as_int(wvlt_type) << ".\n\n"; exit(1); } @@ -574,7 +566,7 @@ void WaveletStatConfInfo::process_tiles(const Grid &grid) { default: mlog << Error << "\nWaveletStatConfInfo::process_tiles() -> " << "Unsupported grid decomposition type of " - << enum_class_as_integer(grid_decomp_flag) << ".\n\n"; + << enum_class_as_int(grid_decomp_flag) << ".\n\n"; exit(1); } // end switch From 2c72a1bf844ad48ff4ba01ad88ebfcbed2179d42 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 2 Apr 2024 15:16:02 -0600 Subject: [PATCH 46/72] Feature #2379 sonarqube gha (#2847) * Per #2379, testing initial GHA SonarQube setup. * Per #2379, switch to only analyzing the src directory. * Per #2379, move more config logic from sonar-project.properties into the workflow. #ci-skip-all * Per #2379, try removing + symbols * Per #2379, move projectKey into xml workflow and remove sonar-project.properties. * Per #2379, try following the instructions at https://github.com/sonarsource-cfamily-examples/linux-autotools-gh-actions-sq/blob/main/.github/workflows/build.yml ci-skip-all * Per #2379, see details of progress described in this issue comment: https://github.com/dtcenter/MET/issues/2379#issuecomment-2000242425 * Unrelated to #2379, just removing spurious space that gets flagged as a diff when re-running enum_to_string on seneca. * Per #2379, try running SonarQube through GitHub. * Per #2379, remove empty env section and also disable the testing workflow temporarily during sonarqube development. * Per #2379, fix docker image name. * Per #2379, delete unneeded script. * Per #2379, update GHA to scan Python code and push to the correct SonarQube projects. * Per #2379, update GHA SonarQube project names * Per #2379, update the build job name * Per #2379, update the comile step name * Per #2379, switch to consistent SONAR variable names. * Per #2379, fix type in sed expressions. * Per #2379, just rename the log artifact * Per #2379, use time_command wrapper instead of run_command. * Per #2379, fix bad env var name * Per #2379, switch from egrep to grep. * Per #2379, just try cat-ting the logfile * Per #2379, test whether cat-ting the log file actually works. * Per #2379, revert back * Per #2379, mention SonarQube in the PR template. Make workflow name more succinct. * Per #2379, add SONAR_REFERENCE_BRANCH setting to define the sonar.newCode.referenceBranch property. The goal is to define the comparison reference branch for each SonarQube scan. * Per #2379, have the sonarqube.yml job print the reference branch it's using * Per #2379, intentionally introduce a new code smell to see if SonarQube correctly flag it as appearing in new code. * Per #2379, trying adding the SonarQube quality gate check. * Per #2379, add logic for using the report-task.txt output files to check the quality gate status for both the python and cxx scans. * Per #2379 must use unique GHA id's * Per #2379, working on syntax for quality gate checks * Per #2379, try again. * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try again * Per #2379, try yet again * Per #2379 * Per #2379, add more debug * Per #2379, remove -it option from docker run commands * Per #2379, again * Per #2379, now that the scan works as expected, remove the intentional SonarQube code smell as well as debug logging. --- .github/jobs/build_docker_image.sh | 2 +- .github/jobs/build_sonarqube_image.sh | 46 ++++++ .github/pull_request_template.md | 3 + .github/workflows/sonarqube.yml | 103 +++++++++++++ internal/scripts/docker/Dockerfile.sonarqube | 95 ++++++++++++ .../scripts/docker/build_met_sonarqube.sh | 136 ++++++++++++++++++ .../sonarqube/python.sonar-project.properties | 12 +- internal/scripts/sonarqube/run_sonarqube.sh | 30 ++-- .../sonarqube/sonar-project.properties | 12 +- .../vx_config/configobjecttype_to_string.cc | 2 +- 10 files changed, 415 insertions(+), 26 deletions(-) create mode 100755 .github/jobs/build_sonarqube_image.sh create mode 100644 .github/workflows/sonarqube.yml create mode 100644 internal/scripts/docker/Dockerfile.sonarqube create mode 100755 internal/scripts/docker/build_met_sonarqube.sh diff --git a/.github/jobs/build_docker_image.sh b/.github/jobs/build_docker_image.sh index 47dc46e20a..f216c0aa0e 100755 --- a/.github/jobs/build_docker_image.sh +++ b/.github/jobs/build_docker_image.sh @@ -15,7 +15,7 @@ time_command docker build -t ${DOCKERHUB_TAG} \ --build-arg MET_CONFIG_OPTS \ -f $DOCKERFILE_PATH ${GITHUB_WORKSPACE} if [ $? != 0 ]; then - cat ${GITHUB_WORKSPACE}/docker_build.log + cat ${CMD_LOGFILE} exit 1 fi diff --git a/.github/jobs/build_sonarqube_image.sh b/.github/jobs/build_sonarqube_image.sh new file mode 100755 index 0000000000..9cdeea3395 --- /dev/null +++ b/.github/jobs/build_sonarqube_image.sh @@ -0,0 +1,46 @@ +#! /bin/bash + +source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh + +DOCKERHUB_TAG=met-sonarqube-gha + +DOCKERFILE_PATH=${GITHUB_WORKSPACE}/internal/scripts/docker/Dockerfile.sonarqube + +CMD_LOGFILE=${GITHUB_WORKSPACE}/sonarqube_build.log + +# +# Define the $SONAR_REFERENCE_BRANCH as the +# - Target of any requests +# - Manual setting for workflow dispatch +# - Source branch for any pushes (e.g. develop) +# +if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then + export SONAR_REFERENCE_BRANCH=${GITHUB_BASE_REF} +elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then + export SONAR_REFERENCE_BRANCH=${WD_REFERENCE_BRANCH} +else + export SONAR_REFERENCE_BRANCH=${SOURCE_BRANCH} +fi + +echo SONAR_REFERENCE_BRANCH=${SONAR_REFERENCE_BRANCH} + +time_command docker build -t ${DOCKERHUB_TAG} \ + --build-arg MET_BASE_REPO \ + --build-arg MET_BASE_TAG \ + --build-arg SOURCE_BRANCH \ + --build-arg MET_CONFIG_OPTS \ + --build-arg SONAR_SCANNER_VERSION \ + --build-arg SONAR_HOST_URL \ + --build-arg SONAR_TOKEN \ + --build-arg SONAR_REFERENCE_BRANCH \ + -f $DOCKERFILE_PATH ${GITHUB_WORKSPACE} +if [ $? != 0 ]; then + cat ${CMD_LOGFILE} + exit 1 +fi + +# Copy the .scannerwork directory from the image +id=$(docker create ${DOCKERHUB_TAG}) +time_command docker cp $id:/met/.scannerwork /tmp/met_scannerwork +docker rm -v $id + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d3a97c7a05..0ed1004546 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -22,6 +22,9 @@ If **yes**, describe the new output and/or changes to the existing output:
- [ ] Will this PR result in changes to existing METplus Use Cases? **[Yes or No]**
If **yes**, create a new **Update Truth** [METplus issue](https://github.com/dtcenter/METplus/issues/new/choose) to describe them. +- [ ] Do these changes introduce new SonarQube findings? **[Yes or No]**
+If **yes**, please describe: + - [ ] Please complete this pull request review by **[Fill in date]**.
## Pull Request Checklist ## diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000000..36c2ccc02d --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,103 @@ +name: SonarQube Scan + +# Run SonarQube for Pull Requests and changes to the develop and main_vX.Y branches + +on: + + # Trigger analysis for pushes to develop and main_vX.Y branches + push: + branches: + - develop + - 'main_v**' + paths-ignore: + - 'docs/**' + - '.github/pull_request_template.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/labels/**' + - '**/README.md' + - '**/LICENSE.md' + + # Trigger analysis for pull requests to develop and main_vX.Y branches + pull_request: + types: [opened, synchronize, reopened] + branches: + - develop + - 'main_v**' + paths-ignore: + - 'docs/**' + - '.github/pull_request_template.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/labels/**' + - '**/README.md' + - '**/LICENSE.md' + + workflow_dispatch: + inputs: + reference_branch: + description: 'Reference Branch' + default: develop + type: string + +jobs: + build: + name: SonarQube Scan + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v4 + with: + # Disable shallow clones for better analysis + fetch-depth: 0 + + - name: Create output directories + run: mkdir -p ${RUNNER_WORKSPACE}/logs + + - name: Get branch name + id: get_branch_name + run: echo branch_name=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT + + - name: SonarQube Scan in Docker + run: .github/jobs/build_sonarqube_image.sh + env: + MET_BASE_REPO: met-base + MET_BASE_TAG: v3.2 + SOURCE_BRANCH: ${{ steps.get_branch_name.outputs.branch_name }} + WD_REFERENCE_BRANCH: ${{ github.event.inputs.reference_branch }} + MET_CONFIG_OPTS: '--enable-all' + SONAR_SCANNER_VERSION: 5.0.1.3006 + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: SonarQube Python Quality Gate check + id: sonarqube-python-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + with: + scanMetadataReportFile: /tmp/met_scannerwork/python-report-task.txt + timeout-minutes: 5 + env: + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: SonarQube CXX Quality Gate check + id: sonarqube-cxx-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + with: + scanMetadataReportFile: /tmp/met_scannerwork/cxx-report-task.txt + timeout-minutes: 5 + env: + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Copy log files into logs directory + if: always() + run: cp ${GITHUB_WORKSPACE}/*.log ${RUNNER_WORKSPACE}/logs/ + + - name: Upload logs as artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: logs_sonarqube + path: ${{ runner.workspace }}/logs + if-no-files-found: ignore + diff --git a/internal/scripts/docker/Dockerfile.sonarqube b/internal/scripts/docker/Dockerfile.sonarqube new file mode 100644 index 0000000000..156fa14bf7 --- /dev/null +++ b/internal/scripts/docker/Dockerfile.sonarqube @@ -0,0 +1,95 @@ +ARG MET_BASE_REPO=met-base +ARG MET_BASE_TAG=v3.2 + +FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG} +MAINTAINER John Halley Gotway + +# +# This Dockerfile checks out MET from GitHub and runs the +# SonarQube static code analysis on the specified branch or tag. +# https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/ +# +ARG SONAR_SCANNER_VERSION=5.0.1.3006 +ARG SONAR_HOST_URL +ARG SONAR_TOKEN +ARG SOURCE_BRANCH +ARG SONAR_REFERENCE_BRANCH + +# +# SONAR_HOST_URL is required. +# +RUN if [ "x${SONAR_HOST_URL}" = "x" ]; then \ + echo "ERROR: SONAR_HOST_URL undefined! Rebuild with \"--build-arg SONAR_HOST_URL={url}\""; \ + exit 1; \ + fi + +# +# SONAR_TOKEN is required. +# +RUN if [ "x${SONAR_TOKEN}" = "x" ]; then \ + echo "ERROR: SONAR_TOKEN undefined! Rebuild with \"--build-arg SONAR_TOKEN={token}\""; \ + exit 1; \ + fi + +# +# SOURCE_BRANCH is the branch name of the MET source code. +# +RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \ + echo "ERROR: SOURCE_BRANCH undefined! Rebuild with \"--build-arg SOURCE_BRANCH={branch name}\""; \ + exit 1; \ + else \ + echo "Build Argument SOURCE_BRANCH=${SOURCE_BRANCH}"; \ + fi + +# +# SONAR_REFERENCE_BRANCH defines to the version against which this scan should be compared. +# +RUN if [ "x${SONAR_REFERENCE_BRANCH}" = "x" ]; then \ + echo "ERROR: SONAR_REFERENCE_BRANCH undefined! Rebuild with \"--build-arg SONAR_REFERENCE_BRANCH={branch name}\""; \ + exit 1; \ + else \ + echo "Build Argument SONAR_REFERENCE_BRANCH=${SONAR_REFERENCE_BRANCH}"; \ + fi + +ENV MET_GIT_NAME ${SOURCE_BRANCH} +ENV MET_REPO_DIR /met/MET-${MET_GIT_NAME} +ENV MET_GIT_URL https://github.com/dtcenter/MET + +# +# Download and install the Sonar software. +# +RUN echo "Installing SonarQube into $HOME/.sonar" \ + && mkdir -p $HOME/.sonar \ + && curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip \ + && unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \ + && echo export PATH="$HOME/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin:\$PATH" >> $HOME/.bashrc \ + && curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip \ + && unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \ + && echo export PATH="$HOME/.sonar/build-wrapper-linux-x86:\$PATH" >> $HOME/.bashrc + +# +# Update the OS, as needed. +# +RUN apt update + +# +# Set the working directory. +# +WORKDIR /met + +# +# Copy MET Download and install MET. +# +RUN echo "Copying MET into ${MET_REPO_DIR}" \ + && mkdir -p ${MET_REPO_DIR} + +COPY . ${MET_REPO_DIR} + +RUN if [ ! -e "${MET_REPO_DIR}/configure.ac" ]; then \ + echo "ERROR: docker build must be run from the MET directory: `ls`"; \ + exit 1; \ + fi + +RUN cd ${MET_REPO_DIR} \ + && internal/scripts/docker/build_met_sonarqube.sh + diff --git a/internal/scripts/docker/build_met_sonarqube.sh b/internal/scripts/docker/build_met_sonarqube.sh new file mode 100755 index 0000000000..5f3c13aecc --- /dev/null +++ b/internal/scripts/docker/build_met_sonarqube.sh @@ -0,0 +1,136 @@ +#!/bin/bash +# +# Run SonarQube Source Code Analyzer within a Docker container +#======================================================================= +# +# This build_met_sonarqube.sh script must be run from the top-level +# directory of the MET repository to be analyzed. It runs SonarQube to +# scan both the Python and C/C++ MET source code. +# +# Usage: internal/scripts/docker/build_met_sonarqube.sh +# +# Required Enviornment Variables: +# SONAR_HOST_URL +# SONAR_TOKEN +# MET_GIT_NAME +# SONAR_REFERENCE_BRANCH +# +#======================================================================= + +# Check that this is being run from the top-level MET directory +if [ ! -e internal/scripts/docker/build_met_sonarqube.sh ]; then + echo "ERROR: ${0} -> must be run from the top-level MET directory" + exit 1 +fi + +echo "Running script to scan MET with SonarQube in Docker" + +# Source the docker build environment +source ~/.bashrc +source internal/scripts/environment/development.docker +source .github/jobs/bash_functions.sh + +# Check required environment variables +if [ -z ${SONAR_HOST_URL+x} ]; then + echo "ERROR: ${0} -> \$SONAR_HOST_URL not defined!" + exit 1 +fi +if [ -z ${SONAR_TOKEN+x} ]; then + echo "ERROR: ${0} -> \$SONAR_TOKEN not defined!" + exit 1 +fi +if [ -z ${MET_GIT_NAME+x} ]; then + echo "ERROR: ${0} -> \$MET_GIT_NAME not defined!" + exit 1 +fi +if [ -z ${SONAR_REFERENCE_BRANCH+x} ]; then + echo "ERROR: ${0} -> \$SONAR_REFERENCE_BRANCH not defined!" + exit 1 +fi + +# Check whether MET_CONFIG_OPTS is defined +if [ -z ${MET_CONFIG_OPTS+x} ]; then + MET_CONFIG_OPTS='--enable-all' + echo "Setting MET_CONFIG_OPTS=${MET_CONFIG_OPTS} to scan all available options." +fi + +# Locate the wrapper +WRAPPER_NAME=build-wrapper-linux-x86-64 +SONAR_WRAPPER=$(which $WRAPPER_NAME 2> /dev/null) + +if [ ! -e $SONAR_WRAPPER ]; then + echo "ERROR: ${0} -> $WRAPPER_NAME not found in the path" + exit 1 +else + echo "SONAR_WRAPPER=$SONAR_WRAPPER" +fi + +# Locate the scanner +SCANNER_NAME=sonar-scanner +SONAR_SCANNER=$(which $SCANNER_NAME 2> /dev/null) + +if [ ! -e $SONAR_SCANNER ]; then + echo "ERROR: ${0} -> $SCANNER_NAME not found in the path" + exit 1 +else + echo "SONAR_SCANNER=$SONAR_SCANNER" +fi + +# Set output directory name +if [ -z ${SONARQUBE_OUT_DIR} ]; then + export SONARQUBE_OUT_DIR=bw-outputs +fi + +# Store the full path to the scripts directory +SONAR_PROPERTIES_DIR=internal/scripts/sonarqube +SONAR_PROPERTIES=sonar-project.properties + +# Copy sonar-project.properties for Python code +[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES +sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ + -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ + -e "s|SONAR_PROJECT_KEY|MET-GHA-Python|" \ + -e "s|SONAR_PROJECT_NAME|MET GHA Python|" \ + -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \ + -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ + $SONAR_PROPERTIES_DIR/python.sonar-project.properties > $SONAR_PROPERTIES + +# Run SonarQube scan for Python code +time_command $SONAR_SCANNER + +# Copy the Python scan report-task.txt file +mkdir -p /met/.scannerwork +cp .scannerwork/report-task.txt /met/.scannerwork/python-report-task.txt + +# Copy sonar-project.properties for C/C++ code +[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES +sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ + -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ + -e "s|SONAR_PROJECT_KEY|MET-GHA-CXX|" \ + -e "s|SONAR_PROJECT_NAME|MET GHA CXX|" \ + -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \ + -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ + $SONAR_PROPERTIES_DIR/sonar-project.properties > $SONAR_PROPERTIES + +# Run the configure script +time_command ./configure \ + BUFRLIB_NAME=${BUFRLIB_NAME} \ + GRIB2CLIB_NAME=${GRIB2CLIB_NAME} \ + ${MET_CONFIG_OPTS} \ + CPPFLAGS="-I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/cairo" \ + LIBS="-ltirpc" + +# Run make clean +time_command make clean + +# Run SonarQube make +time_command $SONAR_WRAPPER --out-dir $SONARQUBE_OUT_DIR make + +# Run SonarQube scan for C/C++ code +time_command $SONAR_SCANNER + +# Copy the C/C++ scan report-task.txt file +mkdir -p /met/.scannerwork +cp .scannerwork/report-task.txt /met/.scannerwork/cxx-report-task.txt + +[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES diff --git a/internal/scripts/sonarqube/python.sonar-project.properties b/internal/scripts/sonarqube/python.sonar-project.properties index f304a07204..98b30436d7 100644 --- a/internal/scripts/sonarqube/python.sonar-project.properties +++ b/internal/scripts/sonarqube/python.sonar-project.properties @@ -1,5 +1,5 @@ -sonar.projectKey=MET_python_NB -sonar.projectName=MET python Nightly Build +sonar.projectKey=SONAR_PROJECT_KEY +sonar.projectName=SONAR_PROJECT_NAME sonar.projectVersion=1.0 sonar.sources=scripts/python,data/wrappers @@ -11,8 +11,8 @@ sonar.python.version=3.6.3 sonar.sourceEncoding=UTF-8 #----- Default SonarQube server -#sonar.host.url=http://localhost:9000 -sonar.host.url=SONAR_SERVER_URL +sonar.host.url=SONAR_HOST_URL -sonar.token=SONAR_TOKEN_VALUE -sonar.branch.name=develop +sonar.token=SONAR_TOKEN +sonar.branch.name=SONAR_BRANCH_NAME +sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh index 31264f2f9b..0509a4a86d 100755 --- a/internal/scripts/sonarqube/run_sonarqube.sh +++ b/internal/scripts/sonarqube/run_sonarqube.sh @@ -111,13 +111,7 @@ run_command "git checkout ${1}" export MET_DEVELOPMENT=true # Run the configure script -run_command "./configure --prefix=`pwd` \ - --enable-grib2 \ - --enable-modis \ - --enable-mode_graphics \ - --enable-lidar2nc \ - --enable-python \ - --enable-ugrid" +run_command "./configure --prefix=`pwd` --enable-all" # Set the build id #BUILD_ID="MET-${1}" @@ -126,19 +120,31 @@ SONAR_PROPERTIES=sonar-project.properties # Copy sonar-project.properties for Python code [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES -[ -z "$SONAR_SERVER_URL" ] && SONAR_SERVER_URL="http://localhost:9000" -if [ -z "$SONAR_TOKEN_VALUE" ]; then - echo " == ERROR == SONAR_TOKEN_VALUE is not defined" +[ -z "$SONAR_HOST_URL" ] && SONAR_HOST_URL="http://localhost:9000" +if [ -z "$SONAR_TOKEN" ]; then + echo " == ERROR == SONAR_TOKEN is not defined" exit 1 else - sed -e "s|SONAR_TOKEN_VALUE|$SONAR_TOKEN_VALUE|" -e "s|SONAR_SERVER_URL|$SONAR_SERVER_URL|" $SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES + sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ + -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ + -e "s|SONAR_PROJECT_KEY|MET_python_NB|" \ + -e "s|SONAR_PROJECT_NAME|MET python Nightly Build|" \ + -e "s|SONAR_BRANCH_NAME|develop|" \ + -e "s|SONAR_REFERENCE_BRANCH|develop|" \ + $SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES # Run SonarQube scan for Python code run_command "$SONAR_SCANNER" # Copy sonar-project.properties for C/C++ code [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES - sed -e "s|SONAR_TOKEN_VALUE|$SONAR_TOKEN_VALUE|" -e "s|SONAR_SERVER_URL|$SONAR_SERVER_URL|" $SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES + sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ + -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ + -e "s|SONAR_PROJECT_KEY|MET_develop_NB|" \ + -e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \ + -e "s|SONAR_BRANCH_NAME|develop|" \ + -e "s|SONAR_REFERENCE_BRANCH|develop|" \ + $SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES # Run SonarQube clean run_command "make clean" diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index ec39576c4f..f486654e21 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -1,5 +1,5 @@ -sonar.projectKey=MET_develop_NB -sonar.projectName=MET Nightly Build +sonar.projectKey=SONAR_PROJECT_KEY +sonar.projectName=SONAR_PROJECT_NAME sonar.projectVersion=1.0 sonar.sources=src @@ -11,8 +11,8 @@ sonar.cfamily.build-wrapper-output=bw-outputs sonar.sourceEncoding=UTF-8 #----- Default SonarQube server -#sonar.host.url=http://localhost:9000 -sonar.host.url=SONAR_SERVER_URL +sonar.host.url=SONAR_HOST_URL -sonar.token=SONAR_TOKEN_VALUE -sonar.branch.name=develop +sonar.token=SONAR_TOKEN +sonar.branch.name=SONAR_BRANCH_NAME +sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH diff --git a/src/basic/vx_config/configobjecttype_to_string.cc b/src/basic/vx_config/configobjecttype_to_string.cc index d8088d406c..8bb9f296b8 100644 --- a/src/basic/vx_config/configobjecttype_to_string.cc +++ b/src/basic/vx_config/configobjecttype_to_string.cc @@ -62,7 +62,7 @@ switch ( t ) { } // switch -return ConcatString (s); +return ConcatString(s); } From a72e8c56745bc3b500ff2c088363060c70222e0c Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 2 Apr 2024 15:56:19 -0600 Subject: [PATCH 47/72] Hotfix related to #2379. The sonar.newCode.referenceBranch and sonar.branch.name cannot be set to the same string! Only add the newCode definition when they differ. --- internal/scripts/docker/build_met_sonarqube.sh | 10 ++++++++++ .../scripts/sonarqube/python.sonar-project.properties | 1 - internal/scripts/sonarqube/run_sonarqube.sh | 2 -- internal/scripts/sonarqube/sonar-project.properties | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/scripts/docker/build_met_sonarqube.sh b/internal/scripts/docker/build_met_sonarqube.sh index 5f3c13aecc..f726d8b3b9 100755 --- a/internal/scripts/docker/build_met_sonarqube.sh +++ b/internal/scripts/docker/build_met_sonarqube.sh @@ -95,6 +95,11 @@ sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ $SONAR_PROPERTIES_DIR/python.sonar-project.properties > $SONAR_PROPERTIES +# The source and reference branches must differ to define new code +if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then + echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES +fi + # Run SonarQube scan for Python code time_command $SONAR_SCANNER @@ -112,6 +117,11 @@ sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ $SONAR_PROPERTIES_DIR/sonar-project.properties > $SONAR_PROPERTIES +# The source and reference branches must differ to define new code +if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then + echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES +fi + # Run the configure script time_command ./configure \ BUFRLIB_NAME=${BUFRLIB_NAME} \ diff --git a/internal/scripts/sonarqube/python.sonar-project.properties b/internal/scripts/sonarqube/python.sonar-project.properties index 98b30436d7..71b6b36b71 100644 --- a/internal/scripts/sonarqube/python.sonar-project.properties +++ b/internal/scripts/sonarqube/python.sonar-project.properties @@ -15,4 +15,3 @@ sonar.host.url=SONAR_HOST_URL sonar.token=SONAR_TOKEN sonar.branch.name=SONAR_BRANCH_NAME -sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh index 0509a4a86d..917158b461 100755 --- a/internal/scripts/sonarqube/run_sonarqube.sh +++ b/internal/scripts/sonarqube/run_sonarqube.sh @@ -130,7 +130,6 @@ else -e "s|SONAR_PROJECT_KEY|MET_python_NB|" \ -e "s|SONAR_PROJECT_NAME|MET python Nightly Build|" \ -e "s|SONAR_BRANCH_NAME|develop|" \ - -e "s|SONAR_REFERENCE_BRANCH|develop|" \ $SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES # Run SonarQube scan for Python code @@ -143,7 +142,6 @@ else -e "s|SONAR_PROJECT_KEY|MET_develop_NB|" \ -e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \ -e "s|SONAR_BRANCH_NAME|develop|" \ - -e "s|SONAR_REFERENCE_BRANCH|develop|" \ $SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES # Run SonarQube clean diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index f486654e21..c09f1d31b1 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -15,4 +15,3 @@ sonar.host.url=SONAR_HOST_URL sonar.token=SONAR_TOKEN sonar.branch.name=SONAR_BRANCH_NAME -sonar.newCode.referenceBranch=SONAR_REFERENCE_BRANCH From 2bef141691011a6ecaa614ed9ee742a7ced6bc1a Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 3 Apr 2024 17:13:56 +0000 Subject: [PATCH 48/72] #2830 Changed enum STATJobType to enum class --- src/libcode/vx_analysis_util/stat_job.cc | 41 ++++++++++--------- src/libcode/vx_analysis_util/stat_job.h | 36 ++++++++-------- .../core/stat_analysis/aggr_stat_line.cc | 2 +- src/tools/core/stat_analysis/stat_analysis.cc | 14 +++---- .../core/stat_analysis/stat_analysis_job.cc | 34 +++++++-------- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 858d93a6e8..ba4f325e17 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -22,6 +22,7 @@ #include "vx_statistics.h" #include "vx_math.h" #include "vx_log.h" +#include "enum_as_int.hpp" using namespace std; @@ -110,7 +111,7 @@ void STATAnalysisJob::clear() { precision = default_precision; - job_type = no_stat_job_type; + job_type = STATJobType::None; model.clear(); desc.clear(); @@ -1704,7 +1705,7 @@ int STATAnalysisJob::set_job_type(const char *c) { job_type = string_to_statjobtype(c); - if(job_type == no_stat_job_type) return 1; + if(job_type == STATJobType::None) return 1; else return 0; } @@ -2347,7 +2348,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { js.clear(); // job type - if(job_type != no_stat_job_type) { + if(job_type != STATJobType::None) { js << "-job " << statjobtype_to_string(job_type) << " "; } @@ -2690,7 +2691,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // out_cnt_logic - if(job_type == stat_job_aggr_stat && + if(job_type == STATJobType::aggr_stat && line_type.has(stat_mpr_str) && (out_line_type.has(stat_cnt_str) || out_line_type.has(stat_sl1l2_str)) && (out_fcst_thresh.n() > 0 || out_obs_thresh.n() > 0)) { @@ -2716,7 +2717,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // out_wind_logic - if(job_type == stat_job_aggr_stat && + if(job_type == STATJobType::aggr_stat && line_type.has(stat_mpr_str) && out_line_type.has(stat_wdir_str) && (out_fcst_wind_thresh.get_type() != thresh_na || @@ -2725,7 +2726,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // Jobs which use out_alpha - if(job_type == stat_job_summary || + if(job_type == STATJobType::summary || out_line_type.has(stat_cts_str) || out_line_type.has(stat_mcts_str) || out_line_type.has(stat_cnt_str) || @@ -2738,7 +2739,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // Ramp jobs - if(job_type == stat_job_ramp) { + if(job_type == STATJobType::ramp) { // ramp_type js << "-ramp_type " << timeseriestype_to_string(ramp_type) << " "; @@ -2837,9 +2838,9 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // Jobs which compute the skill score index - if(job_type == stat_job_go_index || - job_type == stat_job_cbs_index || - job_type == stat_job_ss_index) { + if(job_type == STATJobType::go_index || + job_type == STATJobType::cbs_index || + job_type == STATJobType::ss_index) { // ss_index_name js << "-ss_index_name " << ss_index_name << " "; @@ -2937,7 +2938,7 @@ int STATAnalysisJob::is_in_mask_sid(const char *sid) const { //////////////////////////////////////////////////////////////////////// const char * statjobtype_to_string(const STATJobType t) { - return statjobtype_str[t]; + return statjobtype_str[enum_class_as_int(t)]; } //////////////////////////////////////////////////////////////////////// @@ -2956,23 +2957,23 @@ STATJobType string_to_statjobtype(const char *str) { STATJobType t; if( strcasecmp(str, statjobtype_str[0]) == 0) - t = stat_job_filter; + t = STATJobType::filter; else if(strcasecmp(str, statjobtype_str[1]) == 0) - t = stat_job_summary; + t = STATJobType::summary; else if(strcasecmp(str, statjobtype_str[2]) == 0) - t = stat_job_aggr; + t = STATJobType::aggr; else if(strcasecmp(str, statjobtype_str[3]) == 0) - t = stat_job_aggr_stat; + t = STATJobType::aggr_stat; else if(strcasecmp(str, statjobtype_str[4]) == 0) - t = stat_job_go_index; + t = STATJobType::go_index; else if(strcasecmp(str, statjobtype_str[5]) == 0) - t = stat_job_cbs_index; + t = STATJobType::cbs_index; else if(strcasecmp(str, statjobtype_str[6]) == 0) - t = stat_job_ss_index; + t = STATJobType::ss_index; else if(strcasecmp(str, statjobtype_str[7]) == 0) - t = stat_job_ramp; + t = STATJobType::ramp; else - t = no_stat_job_type; + t = STATJobType::None; return t; } diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 12002ec447..0916056e19 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -57,30 +57,30 @@ static const int dump_stat_buffer_cols = 512; // // Enumerate all the possible STAT Analysis Job Types // -enum STATJobType { +enum class STATJobType { - stat_job_filter = 0, // Filter out the STAT data and write the - // lines to the filename specified. + filter = 0, /* Filter out the STAT data and write the + lines to the filename specified. */ - stat_job_summary = 1, // Compute min, max, mean, stdev and - // percentiles for a column of data. + summary = 1, /* Compute min, max, mean, stdev and + percentiles for a column of data. */ - stat_job_aggr = 2, // Aggregate the input counts/scores and - // generate the same output line type - // containing the aggregated counts/scores. + aggr = 2, /* Aggregate the input counts/scores and + generate the same output line type + containing the aggregated counts/scores. */ - stat_job_aggr_stat = 3, // Aggregate the input counts/scores and - // generate the requested output line type. + aggr_stat = 3, /* Aggregate the input counts/scores and + // generate the requested output line type. */ - stat_job_go_index = 4, // Compute the GO Index. + go_index = 4, /* Compute the GO Index. */ - stat_job_cbs_index = 5, // Compute the CBS Index. + cbs_index = 5, /* Compute the CBS Index. */ - stat_job_ss_index = 6, // Compute the Skill Score Index. + ss_index = 6, /* Compute the Skill Score Index. */ - stat_job_ramp = 7, // Time-series ramp evaluation. + ramp = 7, /* Time-series ramp evaluation. */ - no_stat_job_type = 8 // Default value + None = 8 /* Default value */ }; static const int n_statjobtypes = 9; @@ -267,14 +267,14 @@ class STATAnalysisJob { NumArray out_eclv_points; // output ECLV points // - // Variables used for the stat_job_summary job type + // Variables used for the STATJobType::summary job type // bool do_derive; StringArray wmo_sqrt_stats; StringArray wmo_fisher_stats; // - // Variables used for the stat_job_aggr_mpr job type + // Variables used for the STATJobType::aggr_mpr job type // ConcatString mask_grid_str; ConcatString mask_poly_str; @@ -286,7 +286,7 @@ class STATAnalysisJob { StringArray mask_sid; // - // Variables used for the stat_job_ramp job type + // Variables used for the STATJobType::ramp job type // TimeSeriesType ramp_type; int ramp_time_fcst; // stored in seconds diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index dd53c0a3e6..69804173cf 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -3769,7 +3769,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, // and set the type to aggregation // fcst_term = job; - fcst_term.set_job_type(stat_job_aggr); + fcst_term.set_job_type(STATJobType::aggr); // // line_type diff --git a/src/tools/core/stat_analysis/stat_analysis.cc b/src/tools/core/stat_analysis/stat_analysis.cc index 42fba3bf5e..19918c2845 100644 --- a/src/tools/core/stat_analysis/stat_analysis.cc +++ b/src/tools/core/stat_analysis/stat_analysis.cc @@ -193,7 +193,7 @@ int met_main(int argc, char * argv []) { // // If a job was specified on the command line, run it. // - if(default_job.job_type != no_stat_job_type) { + if(default_job.job_type != STATJobType::None) { process_job(command_line_job_options.c_str(), 1); } // @@ -470,14 +470,14 @@ void process_search_dirs() { // // Apply the GO Index or CBS Index filtering criteria. // - if(default_job.job_type == stat_job_go_index || - default_job.job_type == stat_job_cbs_index) { + if(default_job.job_type == STATJobType::go_index || + default_job.job_type == STATJobType::cbs_index) { MetConfig ss_index_conf; STATAnalysisJob ss_index_job; ConcatString config_file = - (default_job.job_type == stat_job_go_index ? + (default_job.job_type == STATJobType::go_index ? replace_path(go_index_config_file) : replace_path(cbs_index_config_file)); @@ -677,14 +677,14 @@ void process_job(const char * jobstring, int n_job) { // // Special processing for the GO Index and CBS Index jobs. // - if(job.job_type == stat_job_go_index || - job.job_type == stat_job_cbs_index) { + if(job.job_type == STATJobType::go_index || + job.job_type == STATJobType::cbs_index) { MetConfig ss_index_conf; STATAnalysisJob ss_index_job; ConcatString config_file = - (job.job_type == stat_job_go_index ? + (job.job_type == STATJobType::go_index ? replace_path(go_index_config_file) : replace_path(cbs_index_config_file)); diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index a1c875bf80..06959f819f 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -201,13 +201,13 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, // Print warning for by_column option // if(job.by_column.n() > 0 && - job.job_type != stat_job_summary && - job.job_type != stat_job_aggr && - job.job_type != stat_job_aggr_stat && - job.job_type != stat_job_ramp && - job.job_type != stat_job_go_index && - job.job_type != stat_job_cbs_index && - job.job_type != stat_job_ss_index) { + job.job_type != STATJobType::summary && + job.job_type != STATJobType::aggr && + job.job_type != STATJobType::aggr_stat && + job.job_type != STATJobType::ramp && + job.job_type != STATJobType::go_index && + job.job_type != STATJobType::cbs_index && + job.job_type != STATJobType::ss_index) { mlog << Warning << "\nThe -by option is ignored for the \"" << statjobtype_to_string(job.job_type) << "\" job type.\n\n"; } @@ -216,8 +216,8 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, // Set up the random number generator and seed value // for the summary and aggregate stat jobs. // - if(job.job_type == stat_job_summary || - job.job_type == stat_job_aggr_stat) { + if(job.job_type == STATJobType::summary || + job.job_type == STATJobType::aggr_stat) { rng_set(rng_ptr, job.boot_rng, job.boot_seed); } @@ -226,29 +226,29 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, // switch(job.job_type) { - case(stat_job_filter): + case(STATJobType::filter): do_job_filter(jobstring, f, job, n_in, n_out, sa_out); break; - case(stat_job_summary): + case(STATJobType::summary): do_job_summary(jobstring, f, job, n_in, n_out, sa_out, rng_ptr); break; - case(stat_job_aggr): + case(STATJobType::aggr): do_job_aggr(jobstring, f, job, n_in, n_out, sa_out); break; - case(stat_job_aggr_stat): + case(STATJobType::aggr_stat): do_job_aggr_stat(jobstring, f, job, n_in, n_out, sa_out, tmp_dir, rng_ptr); break; - case(stat_job_go_index): - case(stat_job_cbs_index): - case(stat_job_ss_index): + case(STATJobType::go_index): + case(STATJobType::cbs_index): + case(STATJobType::ss_index): do_job_ss_index(jobstring, f, job, n_in, n_out, sa_out); break; - case(stat_job_ramp): + case(STATJobType::ramp): do_job_ramp(jobstring, f, job, n_in, n_out, sa_out); break; From 9e0cd6db43975d7742b47f43a7e3a611af1ab36b Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 04:42:12 +0000 Subject: [PATCH 49/72] #2830 Changed STATLineType to enum class --- src/basic/vx_config/config_constants.h | 84 +-- src/basic/vx_config/config_util.cc | 178 +++--- src/basic/vx_util/GridTemplate.cc | 4 +- src/basic/vx_util/data_plane_util.cc | 12 +- src/libcode/vx_analysis_util/stat_job.cc | 202 +++---- src/libcode/vx_analysis_util/stat_line.cc | 8 +- src/libcode/vx_plot_util/vx_plot_util.h | 2 +- .../ensemble_stat/ensemble_stat_conf_info.h | 6 +- .../core/grid_stat/grid_stat_conf_info.h | 56 +- .../core/point_stat/point_stat_conf_info.h | 52 +- .../core/series_analysis/series_analysis.cc | 68 +-- .../series_analysis_conf_info.cc | 28 +- .../core/stat_analysis/aggr_stat_line.cc | 72 +-- .../stat_analysis/skill_score_index_job.cc | 12 +- src/tools/core/stat_analysis/stat_analysis.cc | 4 +- .../core/stat_analysis/stat_analysis_job.cc | 518 +++++++++--------- .../wavelet_stat/wavelet_stat_conf_info.h | 2 +- src/tools/tc_utils/tc_gen/tc_gen.cc | 44 +- src/tools/tc_utils/tc_gen/tc_gen_conf_info.h | 16 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 38 +- 20 files changed, 703 insertions(+), 703 deletions(-) diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h index 3081357d5d..deb9a425fe 100644 --- a/src/basic/vx_config/config_constants.h +++ b/src/basic/vx_config/config_constants.h @@ -129,48 +129,48 @@ enum class Interp12Type { // Enumeration for all the possible STAT line types // -enum STATLineType { - - stat_sl1l2, - stat_sal1l2, - stat_vl1l2, - stat_val1l2, - - stat_vcnt, - - stat_fho, - stat_ctc, - stat_cts, - stat_mctc, - stat_mcts, - stat_cnt, - stat_pct, - stat_pstd, - stat_pjc, - stat_prc, - stat_mpr, - stat_seeps, - stat_seeps_mpr, - stat_nbrctc, - stat_nbrcts, - stat_nbrcnt, - stat_isc, - stat_wdir, - stat_ecnt, - stat_rps, - stat_rhist, - stat_phist, - stat_orank, - stat_ssvar, - stat_relp, - stat_eclv, - stat_grad, - stat_dmap, - stat_genmpr, - stat_ssidx, - stat_header, - - no_stat_line_type +enum class STATLineType { + + sl1l2, + sal1l2, + vl1l2, + val1l2, + + vcnt, + + fho, + ctc, + cts, + mctc, + mcts, + cnt, + pct, + pstd, + pjc, + prc, + mpr, + seeps, + seeps_mpr, + nbrctc, + nbrcts, + nbrcnt, + isc, + wdir, + ecnt, + rps, + rhist, + phist, + orank, + ssvar, + relp, + eclv, + grad, + dmap, + genmpr, + ssidx, + header, + + none }; diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index 3885850a70..344f997bea 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -2611,52 +2611,52 @@ const char * statlinetype_to_string(const STATLineType t) { const char *s = (const char *) nullptr; switch(t) { - case stat_sl1l2: s = stat_sl1l2_str; break; - case stat_sal1l2: s = stat_sal1l2_str; break; - case stat_vl1l2: s = stat_vl1l2_str; break; - case stat_val1l2: s = stat_val1l2_str; break; - case stat_vcnt: s = stat_vcnt_str; break; - - case stat_fho: s = stat_fho_str; break; - case stat_ctc: s = stat_ctc_str; break; - case stat_cts: s = stat_cts_str; break; - case stat_mctc: s = stat_mctc_str; break; - case stat_mcts: s = stat_mcts_str; break; - - case stat_cnt: s = stat_cnt_str; break; - case stat_pct: s = stat_pct_str; break; - case stat_pstd: s = stat_pstd_str; break; - case stat_pjc: s = stat_pjc_str; break; - case stat_prc: s = stat_prc_str; break; - - case stat_eclv: s = stat_eclv_str; break; - case stat_mpr: s = stat_mpr_str; break; - case stat_seeps: s = stat_seeps_str; break; - case stat_seeps_mpr: s = stat_seeps_mpr_str; break; - case stat_nbrctc: s = stat_nbrctc_str; break; - - case stat_nbrcts: s = stat_nbrcts_str; break; - case stat_nbrcnt: s = stat_nbrcnt_str; break; - case stat_grad: s = stat_grad_str; break; - case stat_dmap: s = stat_dmap_str; break; - case stat_isc: s = stat_isc_str; break; - - case stat_wdir: s = stat_wdir_str; break; - case stat_ecnt: s = stat_ecnt_str; break; - case stat_rps: s = stat_rps_str; break; - case stat_rhist: s = stat_rhist_str; break; - case stat_phist: s = stat_phist_str; break; - - case stat_orank: s = stat_orank_str; break; - case stat_ssvar: s = stat_ssvar_str; break; - case stat_relp: s = stat_relp_str; break; - case stat_genmpr: s = stat_genmpr_str; break; - case stat_ssidx: s = stat_ssidx_str; break; + case STATLineType::sl1l2: s = stat_sl1l2_str; break; + case STATLineType::sal1l2: s = stat_sal1l2_str; break; + case STATLineType::vl1l2: s = stat_vl1l2_str; break; + case STATLineType::val1l2: s = stat_val1l2_str; break; + case STATLineType::vcnt: s = stat_vcnt_str; break; + + case STATLineType::fho: s = stat_fho_str; break; + case STATLineType::ctc: s = stat_ctc_str; break; + case STATLineType::cts: s = stat_cts_str; break; + case STATLineType::mctc: s = stat_mctc_str; break; + case STATLineType::mcts: s = stat_mcts_str; break; + + case STATLineType::cnt: s = stat_cnt_str; break; + case STATLineType::pct: s = stat_pct_str; break; + case STATLineType::pstd: s = stat_pstd_str; break; + case STATLineType::pjc: s = stat_pjc_str; break; + case STATLineType::prc: s = stat_prc_str; break; + + case STATLineType::eclv: s = stat_eclv_str; break; + case STATLineType::mpr: s = stat_mpr_str; break; + case STATLineType::seeps: s = stat_seeps_str; break; + case STATLineType::seeps_mpr: s = stat_seeps_mpr_str; break; + case STATLineType::nbrctc: s = stat_nbrctc_str; break; + + case STATLineType::nbrcts: s = stat_nbrcts_str; break; + case STATLineType::nbrcnt: s = stat_nbrcnt_str; break; + case STATLineType::grad: s = stat_grad_str; break; + case STATLineType::dmap: s = stat_dmap_str; break; + case STATLineType::isc: s = stat_isc_str; break; + + case STATLineType::wdir: s = stat_wdir_str; break; + case STATLineType::ecnt: s = stat_ecnt_str; break; + case STATLineType::rps: s = stat_rps_str; break; + case STATLineType::rhist: s = stat_rhist_str; break; + case STATLineType::phist: s = stat_phist_str; break; + + case STATLineType::orank: s = stat_orank_str; break; + case STATLineType::ssvar: s = stat_ssvar_str; break; + case STATLineType::relp: s = stat_relp_str; break; + case STATLineType::genmpr: s = stat_genmpr_str; break; + case STATLineType::ssidx: s = stat_ssidx_str; break; - case stat_header: s = stat_header_str; break; + case STATLineType::header: s = stat_header_str; break; - case no_stat_line_type: - default: s = stat_na_str; break; + /*case STATLineType::none:*/ + default: s = stat_na_str; break; } return s; @@ -2677,51 +2677,51 @@ void statlinetype_to_string(const STATLineType t, char *out) { STATLineType string_to_statlinetype(const char *s) { STATLineType t; - if(strcasecmp(s, stat_sl1l2_str) == 0) t = stat_sl1l2; - else if(strcasecmp(s, stat_sal1l2_str) == 0) t = stat_sal1l2; - else if(strcasecmp(s, stat_vl1l2_str) == 0) t = stat_vl1l2; - else if(strcasecmp(s, stat_val1l2_str) == 0) t = stat_val1l2; - else if(strcasecmp(s, stat_vcnt_str) == 0) t = stat_vcnt; - - else if(strcasecmp(s, stat_fho_str) == 0) t = stat_fho; - else if(strcasecmp(s, stat_ctc_str) == 0) t = stat_ctc; - else if(strcasecmp(s, stat_cts_str) == 0) t = stat_cts; - else if(strcasecmp(s, stat_mctc_str) == 0) t = stat_mctc; - else if(strcasecmp(s, stat_mcts_str) == 0) t = stat_mcts; - - else if(strcasecmp(s, stat_cnt_str) == 0) t = stat_cnt; - else if(strcasecmp(s, stat_pct_str) == 0) t = stat_pct; - else if(strcasecmp(s, stat_pstd_str) == 0) t = stat_pstd; - else if(strcasecmp(s, stat_pjc_str) == 0) t = stat_pjc; - else if(strcasecmp(s, stat_prc_str) == 0) t = stat_prc; - - else if(strcasecmp(s, stat_eclv_str) == 0) t = stat_eclv; - else if(strcasecmp(s, stat_mpr_str) == 0) t = stat_mpr; - else if(strcasecmp(s, stat_seeps_str) == 0) t = stat_seeps; - else if(strcasecmp(s, stat_seeps_mpr_str) == 0) t = stat_seeps_mpr; - else if(strcasecmp(s, stat_nbrctc_str) == 0) t = stat_nbrctc; - - else if(strcasecmp(s, stat_nbrcts_str) == 0) t = stat_nbrcts; - else if(strcasecmp(s, stat_nbrcnt_str) == 0) t = stat_nbrcnt; - else if(strcasecmp(s, stat_grad_str) == 0) t = stat_grad; - else if(strcasecmp(s, stat_dmap_str) == 0) t = stat_dmap; - else if(strcasecmp(s, stat_isc_str) == 0) t = stat_isc; - - else if(strcasecmp(s, stat_wdir_str) == 0) t = stat_wdir; - else if(strcasecmp(s, stat_ecnt_str) == 0) t = stat_ecnt; - else if(strcasecmp(s, stat_rps_str) == 0) t = stat_rps; - else if(strcasecmp(s, stat_rhist_str) == 0) t = stat_rhist; - else if(strcasecmp(s, stat_phist_str) == 0) t = stat_phist; - - else if(strcasecmp(s, stat_orank_str) == 0) t = stat_orank; - else if(strcasecmp(s, stat_ssvar_str) == 0) t = stat_ssvar; - else if(strcasecmp(s, stat_relp_str) == 0) t = stat_relp; - else if(strcasecmp(s, stat_genmpr_str) == 0) t = stat_genmpr; - else if(strcasecmp(s, stat_ssidx_str) == 0) t = stat_ssidx; - - else if(strcasecmp(s, stat_header_str) == 0) t = stat_header; - - else t = no_stat_line_type; + if(strcasecmp(s, stat_sl1l2_str) == 0) t = STATLineType::sl1l2; + else if(strcasecmp(s, stat_sal1l2_str) == 0) t = STATLineType::sal1l2; + else if(strcasecmp(s, stat_vl1l2_str) == 0) t = STATLineType::vl1l2; + else if(strcasecmp(s, stat_val1l2_str) == 0) t = STATLineType::val1l2; + else if(strcasecmp(s, stat_vcnt_str) == 0) t = STATLineType::vcnt; + + else if(strcasecmp(s, stat_fho_str) == 0) t = STATLineType::fho; + else if(strcasecmp(s, stat_ctc_str) == 0) t = STATLineType::ctc; + else if(strcasecmp(s, stat_cts_str) == 0) t = STATLineType::cts; + else if(strcasecmp(s, stat_mctc_str) == 0) t = STATLineType::mctc; + else if(strcasecmp(s, stat_mcts_str) == 0) t = STATLineType::mcts; + + else if(strcasecmp(s, stat_cnt_str) == 0) t = STATLineType::cnt; + else if(strcasecmp(s, stat_pct_str) == 0) t = STATLineType::pct; + else if(strcasecmp(s, stat_pstd_str) == 0) t = STATLineType::pstd; + else if(strcasecmp(s, stat_pjc_str) == 0) t = STATLineType::pjc; + else if(strcasecmp(s, stat_prc_str) == 0) t = STATLineType::prc; + + else if(strcasecmp(s, stat_eclv_str) == 0) t = STATLineType::eclv; + else if(strcasecmp(s, stat_mpr_str) == 0) t = STATLineType::mpr; + else if(strcasecmp(s, stat_seeps_str) == 0) t = STATLineType::seeps; + else if(strcasecmp(s, stat_seeps_mpr_str) == 0) t = STATLineType::seeps_mpr; + else if(strcasecmp(s, stat_nbrctc_str) == 0) t = STATLineType::nbrctc; + + else if(strcasecmp(s, stat_nbrcts_str) == 0) t = STATLineType::nbrcts; + else if(strcasecmp(s, stat_nbrcnt_str) == 0) t = STATLineType::nbrcnt; + else if(strcasecmp(s, stat_grad_str) == 0) t = STATLineType::grad; + else if(strcasecmp(s, stat_dmap_str) == 0) t = STATLineType::dmap; + else if(strcasecmp(s, stat_isc_str) == 0) t = STATLineType::isc; + + else if(strcasecmp(s, stat_wdir_str) == 0) t = STATLineType::wdir; + else if(strcasecmp(s, stat_ecnt_str) == 0) t = STATLineType::ecnt; + else if(strcasecmp(s, stat_rps_str) == 0) t = STATLineType::rps; + else if(strcasecmp(s, stat_rhist_str) == 0) t = STATLineType::rhist; + else if(strcasecmp(s, stat_phist_str) == 0) t = STATLineType::phist; + + else if(strcasecmp(s, stat_orank_str) == 0) t = STATLineType::orank; + else if(strcasecmp(s, stat_ssvar_str) == 0) t = STATLineType::ssvar; + else if(strcasecmp(s, stat_relp_str) == 0) t = STATLineType::relp; + else if(strcasecmp(s, stat_genmpr_str) == 0) t = STATLineType::genmpr; + else if(strcasecmp(s, stat_ssidx_str) == 0) t = STATLineType::ssidx; + + else if(strcasecmp(s, stat_header_str) == 0) t = STATLineType::header; + + else t = STATLineType::none; return t; } diff --git a/src/basic/vx_util/GridTemplate.cc b/src/basic/vx_util/GridTemplate.cc index 58ea643be5..c2c21bf038 100644 --- a/src/basic/vx_util/GridTemplate.cc +++ b/src/basic/vx_util/GridTemplate.cc @@ -660,10 +660,10 @@ GridTemplate* GridTemplateFactory::buildGT(string gt, int width, bool wrap_lon) GridTemplate* GridTemplateFactory::buildGT(GridTemplates gt, int width, bool wrap_lon) { switch (gt) { - case(GridTemplates::Square): + case GridTemplates::Square: return new RectangularTemplate(width, width, wrap_lon); - case(GridTemplates::Circle): + case GridTemplates::Circle: return new CircularTemplate(width, wrap_lon); default: diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc index 6b15ed7b88..f07da09913 100644 --- a/src/basic/vx_util/data_plane_util.cc +++ b/src/basic/vx_util/data_plane_util.cc @@ -128,27 +128,27 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp, // Compute the smoothed value based on the interpolation method switch(mthd) { - case(InterpMthd::Min): // Minimum + case InterpMthd::Min: // Minimum v = interp_min(dp, *gt, x, y, t); break; - case(InterpMthd::Max): // Maximum + case InterpMthd::Max: // Maximum v = interp_max(dp, *gt, x, y, t); break; - case(InterpMthd::Median): // Median + case InterpMthd::Median: // Median v = interp_median(dp, *gt, x, y, t); break; - case(InterpMthd::UW_Mean): // Unweighted Mean + case InterpMthd::UW_Mean: // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, t); break; - case(InterpMthd::Gaussian): // For Gaussian, pass the data through + case InterpMthd::Gaussian: // For Gaussian, pass the data through v = dp.get(x, y); break; - case(InterpMthd::MaxGauss): // For Max Gaussian, compute the max + case InterpMthd::MaxGauss: // For Max Gaussian, compute the max v = interp_max(dp, *gt, x, y, 0); break; diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index ba4f325e17..df2335067a 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -1004,7 +1004,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const { // // For MPR lines, check mask_grid, mask_poly, and mask_sid // - if(string_to_statlinetype(L.line_type()) == stat_mpr) { + if(string_to_statlinetype(L.line_type()) == STATLineType::mpr) { double lat = atof(L.get_item("OBS_LAT")); double lon = atof(L.get_item("OBS_LON")); @@ -1965,7 +1965,7 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) { out_sa = (out_line_type.n() > 0 ? out_line_type : line_type); out_lt = (out_sa.n() == 1 ? - string_to_statlinetype(out_sa[0].c_str()) : no_stat_line_type); + string_to_statlinetype(out_sa[0].c_str()) : STATLineType::none); // // Loop through the output line types and determine the number of @@ -1974,38 +1974,38 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) { for(i=0, c=0, n_col=0; i " << "unexpected stat line type \"" << statlinetype_to_string(cur_lt) @@ -2045,44 +2045,44 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) { // Write the STAT header row // switch(out_lt) { - case stat_sl1l2: write_header_row (sl1l2_columns, n_sl1l2_columns, 1, stat_at, 0, 0); break; - case stat_sal1l2: write_header_row (sal1l2_columns, n_sal1l2_columns, 1, stat_at, 0, 0); break; - case stat_vl1l2: write_header_row (vl1l2_columns, n_vl1l2_columns, 1, stat_at, 0, 0); break; - case stat_val1l2: write_header_row (val1l2_columns, n_val1l2_columns, 1, stat_at, 0, 0); break; - case stat_fho: write_header_row (fho_columns, n_fho_columns, 1, stat_at, 0, 0); break; - case stat_ctc: write_header_row (ctc_columns, n_ctc_columns, 1, stat_at, 0, 0); break; - case stat_cts: write_header_row (cts_columns, n_cts_columns, 1, stat_at, 0, 0); break; - case stat_mctc: write_mctc_header_row (1, n, stat_at, 0, 0); break; - case stat_mcts: write_header_row (mcts_columns, n_mcts_columns, 1, stat_at, 0, 0); break; - case stat_cnt: write_header_row (cnt_columns, n_cnt_columns, 1, stat_at, 0, 0); break; - case stat_vcnt: write_header_row (vcnt_columns, n_vcnt_columns, 1, stat_at, 0, 0); break; - case stat_pct: write_pct_header_row (1, n, stat_at, 0, 0); break; - case stat_pstd: write_pstd_header_row (1, n, stat_at, 0, 0); break; - case stat_pjc: write_pjc_header_row (1, n, stat_at, 0, 0); break; - case stat_prc: write_prc_header_row (1, n, stat_at, 0, 0); break; - case stat_eclv: write_eclv_header_row (1, n, stat_at, 0, 0); break; - case stat_mpr: write_header_row (mpr_columns, n_mpr_columns, 1, stat_at, 0, 0); break; - case stat_nbrctc: write_header_row (nbrctc_columns, n_nbrctc_columns, 1, stat_at, 0, 0); break; - case stat_nbrcts: write_header_row (nbrcts_columns, n_nbrcts_columns, 1, stat_at, 0, 0); break; - case stat_nbrcnt: write_header_row (nbrcnt_columns, n_nbrcnt_columns, 1, stat_at, 0, 0); break; - case stat_grad: write_header_row (grad_columns, n_grad_columns, 1, stat_at, 0, 0); break; - case stat_isc: write_header_row (isc_columns, n_isc_columns, 1, stat_at, 0, 0); break; - case stat_wdir: write_header_row (job_wdir_columns, n_job_wdir_columns, 1, stat_at, 0, 0); break; - case stat_ecnt: write_header_row (ecnt_columns, n_ecnt_columns, 1, stat_at, 0, 0); break; - case stat_rps: write_header_row (rps_columns, n_rps_columns, 1, stat_at, 0, 0); break; - case stat_rhist: write_rhist_header_row (1, n, stat_at, 0, 0); break; - case stat_phist: write_phist_header_row (1, n, stat_at, 0, 0); break; - case stat_relp: write_relp_header_row (1, n, stat_at, 0, 0); break; - case stat_orank: write_header_row (orank_columns, n_orank_columns, 1, stat_at, 0, 0); break; - case stat_ssvar: write_header_row (ssvar_columns, n_ssvar_columns, 1, stat_at, 0, 0); break; - case stat_genmpr: write_header_row (genmpr_columns, n_genmpr_columns, 1, stat_at, 0, 0); break; - case stat_ssidx: write_header_row (ssidx_columns, n_ssidx_columns, 1, stat_at, 0, 0); break; + case STATLineType::sl1l2: write_header_row (sl1l2_columns, n_sl1l2_columns, 1, stat_at, 0, 0); break; + case STATLineType::sal1l2: write_header_row (sal1l2_columns, n_sal1l2_columns, 1, stat_at, 0, 0); break; + case STATLineType::vl1l2: write_header_row (vl1l2_columns, n_vl1l2_columns, 1, stat_at, 0, 0); break; + case STATLineType::val1l2: write_header_row (val1l2_columns, n_val1l2_columns, 1, stat_at, 0, 0); break; + case STATLineType::fho: write_header_row (fho_columns, n_fho_columns, 1, stat_at, 0, 0); break; + case STATLineType::ctc: write_header_row (ctc_columns, n_ctc_columns, 1, stat_at, 0, 0); break; + case STATLineType::cts: write_header_row (cts_columns, n_cts_columns, 1, stat_at, 0, 0); break; + case STATLineType::mctc: write_mctc_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::mcts: write_header_row (mcts_columns, n_mcts_columns, 1, stat_at, 0, 0); break; + case STATLineType::cnt: write_header_row (cnt_columns, n_cnt_columns, 1, stat_at, 0, 0); break; + case STATLineType::vcnt: write_header_row (vcnt_columns, n_vcnt_columns, 1, stat_at, 0, 0); break; + case STATLineType::pct: write_pct_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::pstd: write_pstd_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::pjc: write_pjc_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::prc: write_prc_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::eclv: write_eclv_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::mpr: write_header_row (mpr_columns, n_mpr_columns, 1, stat_at, 0, 0); break; + case STATLineType::nbrctc: write_header_row (nbrctc_columns, n_nbrctc_columns, 1, stat_at, 0, 0); break; + case STATLineType::nbrcts: write_header_row (nbrcts_columns, n_nbrcts_columns, 1, stat_at, 0, 0); break; + case STATLineType::nbrcnt: write_header_row (nbrcnt_columns, n_nbrcnt_columns, 1, stat_at, 0, 0); break; + case STATLineType::grad: write_header_row (grad_columns, n_grad_columns, 1, stat_at, 0, 0); break; + case STATLineType::isc: write_header_row (isc_columns, n_isc_columns, 1, stat_at, 0, 0); break; + case STATLineType::wdir: write_header_row (job_wdir_columns, n_job_wdir_columns, 1, stat_at, 0, 0); break; + case STATLineType::ecnt: write_header_row (ecnt_columns, n_ecnt_columns, 1, stat_at, 0, 0); break; + case STATLineType::rps: write_header_row (rps_columns, n_rps_columns, 1, stat_at, 0, 0); break; + case STATLineType::rhist: write_rhist_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::phist: write_phist_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::relp: write_relp_header_row (1, n, stat_at, 0, 0); break; + case STATLineType::orank: write_header_row (orank_columns, n_orank_columns, 1, stat_at, 0, 0); break; + case STATLineType::ssvar: write_header_row (ssvar_columns, n_ssvar_columns, 1, stat_at, 0, 0); break; + case STATLineType::genmpr: write_header_row (genmpr_columns, n_genmpr_columns, 1, stat_at, 0, 0); break; + case STATLineType::ssidx: write_header_row (ssidx_columns, n_ssidx_columns, 1, stat_at, 0, 0); break; // // Write only header columns for unspecified line type // - case no_stat_line_type: - write_header_row ((const char **) 0, 0, 1, stat_at, 0, 0); break; + case STATLineType::none: + write_header_row ((const char **) 0, 0, 1, stat_at, 0, 0); break; default: mlog << Error << "\nSTATAnalysisJob::setup_stat_file() -> " @@ -2176,91 +2176,91 @@ void STATAnalysisJob::dump_stat_line(const STATLine &line, if(line_type.n() == 1) { switch(string_to_statlinetype(line_type[0].c_str())) { - case(stat_fho): + case STATLineType::fho: write_header_row(fho_columns, n_fho_columns, 1, dump_at, 0, 0); break; - case(stat_ctc): + case STATLineType::ctc: write_header_row(ctc_columns, n_ctc_columns, 1, dump_at, 0, 0); break; - case(stat_cts): + case STATLineType::cts: write_header_row(cts_columns, n_cts_columns, 1, dump_at, 0, 0); break; - case(stat_cnt): + case STATLineType::cnt: write_header_row(cnt_columns, n_cnt_columns, 1, dump_at, 0, 0); break; - case(stat_sl1l2): + case STATLineType::sl1l2: write_header_row(sl1l2_columns, n_sl1l2_columns, 1, dump_at, 0, 0); break; - case(stat_sal1l2): + case STATLineType::sal1l2: write_header_row(sal1l2_columns, n_sal1l2_columns, 1, dump_at, 0, 0); break; - case(stat_vl1l2): + case STATLineType::vl1l2: write_header_row(vl1l2_columns, n_vl1l2_columns, 1, dump_at, 0, 0); break; - case(stat_val1l2): + case STATLineType::val1l2: write_header_row(val1l2_columns, n_val1l2_columns, 1, dump_at, 0, 0); break; - case(stat_mpr): + case STATLineType::mpr: write_header_row(mpr_columns, n_mpr_columns, 1, dump_at, 0, 0); break; - case(stat_nbrctc): + case STATLineType::nbrctc: write_header_row(nbrctc_columns, n_nbrctc_columns, 1, dump_at, 0, 0); break; - case(stat_nbrcts): + case STATLineType::nbrcts: write_header_row(nbrcts_columns, n_nbrcts_columns, 1, dump_at, 0, 0); break; - case(stat_nbrcnt): + case STATLineType::nbrcnt: write_header_row(nbrcnt_columns, n_nbrcnt_columns, 1, dump_at, 0, 0); break; - case(stat_grad): + case STATLineType::grad: write_header_row(grad_columns, n_grad_columns, 1, dump_at, 0, 0); break; - case(stat_ecnt): + case STATLineType::ecnt: write_header_row(ecnt_columns, n_ecnt_columns, 1, dump_at, 0, 0); break; - case(stat_isc): + case STATLineType::isc: write_header_row(isc_columns, n_isc_columns, 1, dump_at, 0, 0); break; - case(stat_ssvar): + case STATLineType::ssvar: write_header_row(ssvar_columns, n_ssvar_columns, 1, dump_at, 0, 0); break; - case(stat_seeps): + case STATLineType::seeps: write_header_row(seeps_columns, n_seeps_columns, 1, dump_at, 0, 0); break; - case(stat_seeps_mpr): + case STATLineType::seeps_mpr: write_header_row(seeps_mpr_columns, n_seeps_mpr_columns, 1, dump_at, 0, 0); break; // Just write a STAT header line for indeterminant line types - case(stat_mctc): - case(stat_mcts): - case(stat_pct): - case(stat_pstd): - case(stat_pjc): - case(stat_prc): - case(stat_eclv): - case(stat_rhist): - case(stat_phist): - case(stat_relp): - case(stat_orank): - case(stat_genmpr): + case STATLineType::mctc: + case STATLineType::mcts: + case STATLineType::pct: + case STATLineType::pstd: + case STATLineType::pjc: + case STATLineType::prc: + case STATLineType::eclv: + case STATLineType::rhist: + case STATLineType::phist: + case STATLineType::relp: + case STATLineType::orank: + case STATLineType::genmpr: write_header_row((const char **) 0, 0, 1, dump_at, 0, 0); break; @@ -2790,7 +2790,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { // Jobs which use out_bin_size if(line_type.n() > 0) { - if(string_to_statlinetype(line_type[0].c_str()) == stat_orank && + if(string_to_statlinetype(line_type[0].c_str()) == STATLineType::orank && (out_line_type.has(stat_phist_str) || out_line_type.has(stat_ecnt_str))) { @@ -2801,7 +2801,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { // Jobs which use out_eclv_points if(line_type.n() > 0) { - if(string_to_statlinetype(line_type[0].c_str()) == stat_mpr && + if(string_to_statlinetype(line_type[0].c_str()) == STATLineType::mpr && out_line_type.has(stat_eclv_str)) { // out_eclv_points @@ -2814,7 +2814,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { // Jobs which perform bootstrapping if(line_type.n() > 0) { type = string_to_statlinetype(line_type[0].c_str()); - if(type == stat_mpr && + if(type == STATLineType::mpr && (out_line_type.has(stat_cts_str) || out_line_type.has(stat_mcts_str) || out_line_type.has(stat_cnt_str) || diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc index 9ea8949eda..c3006b5189 100644 --- a/src/libcode/vx_analysis_util/stat_line.cc +++ b/src/libcode/vx_analysis_util/stat_line.cc @@ -140,7 +140,7 @@ void STATLine::clear() DataLine::clear(); -Type = no_stat_line_type; +Type = STATLineType::none; HdrLine = (AsciiHeaderLine *) nullptr; return; @@ -265,7 +265,7 @@ if ( !status || n_items() == 0 ) { if ( strcmp(get_item(0), "VERSION") == 0 ) { - Type = stat_header; + Type = STATLineType::header; return 1; } @@ -278,7 +278,7 @@ offset = METHdrTable.col_offset(get_item(0), "STAT", na_str, "LINE_TYPE"); if( is_bad_data(offset) || n_items() < (offset + 1) ) { - Type = no_stat_line_type; + Type = STATLineType::none; return 0; } @@ -315,7 +315,7 @@ bool STATLine::is_header() const { -return ( Type == stat_header ); +return ( Type == STATLineType::header ); } diff --git a/src/libcode/vx_plot_util/vx_plot_util.h b/src/libcode/vx_plot_util/vx_plot_util.h index 5ba9a597bb..f6aee66625 100644 --- a/src/libcode/vx_plot_util/vx_plot_util.h +++ b/src/libcode/vx_plot_util/vx_plot_util.h @@ -37,7 +37,7 @@ //////////////////////////////////////////////////////////////////////////////// -typedef enum {satellite, lambert, mercator} Projection; +//enum Projection {satellite, lambert, mercator} Projection; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h index 83183eddd4..9d9177cdab 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h @@ -43,9 +43,9 @@ static const int n_txt = 12; // Text file type static const STATLineType txt_file_type[n_txt] = { - stat_ecnt, stat_rps, stat_rhist, stat_phist, - stat_orank, stat_ssvar, stat_relp, stat_pct, - stat_pstd, stat_pjc, stat_prc, stat_eclv + STATLineType::ecnt, STATLineType::rps, STATLineType::rhist, STATLineType::phist, + STATLineType::orank, STATLineType::ssvar, STATLineType::relp, STATLineType::pct, + STATLineType::pstd, STATLineType::pjc, STATLineType::prc, STATLineType::eclv }; //////////////////////////////////////////////////////////////////////// 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 c2efe1cd54..33418fbfbb 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.h +++ b/src/tools/core/grid_stat/grid_stat_conf_info.h @@ -66,34 +66,34 @@ static const int n_txt = 22; // Text file type static const STATLineType txt_file_type[n_txt] = { - stat_fho, // 0 - stat_ctc, // 1 - stat_cts, // 2 - - stat_mctc, // 3 - stat_mcts, // 4 - stat_cnt, // 5 - - stat_sl1l2, // 6 - stat_sal1l2, // 7 - stat_vl1l2, // 8 - - stat_val1l2, // 9 - stat_pct, // 10 - stat_pstd, // 11 - - stat_pjc, // 12 - stat_prc, // 13 - stat_eclv, // 14 - - stat_nbrctc, // 15 - stat_nbrcts, // 16 - stat_nbrcnt, // 17 - - stat_grad, // 18 - stat_vcnt, // 19 - stat_dmap, // 20 - stat_seeps // 21 + STATLineType::fho, // 0 + STATLineType::ctc, // 1 + STATLineType::cts, // 2 + + STATLineType::mctc, // 3 + STATLineType::mcts, // 4 + STATLineType::cnt, // 5 + + STATLineType::sl1l2, // 6 + STATLineType::sal1l2, // 7 + STATLineType::vl1l2, // 8 + + STATLineType::val1l2, // 9 + STATLineType::pct, // 10 + STATLineType::pstd, // 11 + + STATLineType::pjc, // 12 + STATLineType::prc, // 13 + STATLineType::eclv, // 14 + + STATLineType::nbrctc, // 15 + STATLineType::nbrcts, // 16 + STATLineType::nbrcnt, // 17 + + STATLineType::grad, // 18 + STATLineType::vcnt, // 19 + STATLineType::dmap, // 20 + STATLineType::seeps // 21 }; 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 365f9c64fc..5e3db2184a 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -59,32 +59,32 @@ static const int n_txt = 22; // Text file type static const STATLineType txt_file_type[n_txt] = { - stat_fho, // 0 - stat_ctc, // 1 - stat_cts, // 2 - stat_mctc, // 3 - stat_mcts, // 4 - - stat_cnt, // 5 - stat_sl1l2, // 6 - stat_sal1l2, // 7 - stat_vl1l2, // 8 - stat_val1l2, // 9 - - stat_pct, // 10 - stat_pstd, // 11 - stat_pjc, // 12 - stat_prc, // 13 - stat_ecnt, // 14 - - stat_orank, // 15 - stat_rps, // 16 - stat_eclv, // 17 - stat_mpr, // 18 - stat_vcnt, // 19 - - stat_seeps_mpr, // 20 - stat_seeps // 21 + STATLineType::fho, // 0 + STATLineType::ctc, // 1 + STATLineType::cts, // 2 + STATLineType::mctc, // 3 + STATLineType::mcts, // 4 + + STATLineType::cnt, // 5 + STATLineType::sl1l2, // 6 + STATLineType::sal1l2, // 7 + STATLineType::vl1l2, // 8 + STATLineType::val1l2, // 9 + + STATLineType::pct, // 10 + STATLineType::pstd, // 11 + STATLineType::pjc, // 12 + STATLineType::prc, // 13 + STATLineType::ecnt, // 14 + + STATLineType::orank, // 15 + STATLineType::rps, // 16 + STATLineType::eclv, // 17 + STATLineType::mpr, // 18 + STATLineType::vcnt, // 19 + + STATLineType::seeps_mpr, // 20 + STATLineType::seeps // 21 }; //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index 2aa3b73945..ebbb43e27a 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -820,38 +820,38 @@ void process_scores() { // Compute contingency table counts and statistics if(!conf_info.fcst_info[0]->is_prob() && - (conf_info.output_stats[stat_fho].n() + - conf_info.output_stats[stat_ctc].n() + - conf_info.output_stats[stat_cts].n()) > 0) { + (conf_info.output_stats[STATLineType::fho].n() + + conf_info.output_stats[STATLineType::ctc].n() + + conf_info.output_stats[STATLineType::cts].n()) > 0) { do_cts(i_point+i, &pd_ptr[i]); } // Compute multi-category contingency table counts and statistics if(!conf_info.fcst_info[0]->is_prob() && - (conf_info.output_stats[stat_mctc].n() + - conf_info.output_stats[stat_mcts].n()) > 0) { + (conf_info.output_stats[STATLineType::mctc].n() + + conf_info.output_stats[STATLineType::mcts].n()) > 0) { do_mcts(i_point+i, &pd_ptr[i]); } // Compute continuous statistics if(!conf_info.fcst_info[0]->is_prob() && - conf_info.output_stats[stat_cnt].n() > 0) { + conf_info.output_stats[STATLineType::cnt].n() > 0) { do_cnt(i_point+i, &pd_ptr[i]); } // Compute partial sums if(!conf_info.fcst_info[0]->is_prob() && - (conf_info.output_stats[stat_sl1l2].n() > 0 || - conf_info.output_stats[stat_sal1l2].n() > 0)) { + (conf_info.output_stats[STATLineType::sl1l2].n() > 0 || + conf_info.output_stats[STATLineType::sal1l2].n() > 0)) { do_sl1l2(i_point+i, &pd_ptr[i]); } // Compute probabilistics counts and statistics if(conf_info.fcst_info[0]->is_prob() && - (conf_info.output_stats[stat_pct].n() + - conf_info.output_stats[stat_pstd].n() + - conf_info.output_stats[stat_pjc].n() + - conf_info.output_stats[stat_prc].n()) > 0) { + (conf_info.output_stats[STATLineType::pct].n() + + conf_info.output_stats[STATLineType::pstd].n() + + conf_info.output_stats[STATLineType::pjc].n() + + conf_info.output_stats[STATLineType::prc].n()) > 0) { do_pct(i_point+i, &pd_ptr[i]); } } // end for i @@ -948,20 +948,20 @@ void do_cts(int n, const PairDataPoint *pd_ptr) { for(i=0; i 0; - bool do_cnt = (output_stats[stat_sl1l2].n() + - output_stats[stat_sal1l2].n() + - output_stats[stat_cnt].n()) > 0; + bool do_cat = (output_stats[STATLineType::fho].n() + + output_stats[STATLineType::ctc].n() + + output_stats[STATLineType::cts].n() + + output_stats[STATLineType::mctc].n() + + output_stats[STATLineType::mcts].n() + + output_stats[STATLineType::pct].n() + + output_stats[STATLineType::pstd].n() + + output_stats[STATLineType::pjc].n() + + output_stats[STATLineType::prc].n()) > 0; + bool do_cnt = (output_stats[STATLineType::sl1l2].n() + + output_stats[STATLineType::sal1l2].n() + + output_stats[STATLineType::cnt].n()) > 0; // Conf: fcst.field and obs.field fdict = conf.lookup_array(conf_key_fcst_field); @@ -384,8 +384,8 @@ void SeriesAnalysisConfInfo::process_config(GrdFileType ftype, // Verifying with multi-category contingency tables if(!fcst_info[0]->is_prob() && - (output_stats[stat_mctc].n() > 0 || - output_stats[stat_mcts].n() > 0)) { + (output_stats[STATLineType::mctc].n() > 0 || + output_stats[STATLineType::mcts].n() > 0)) { check_mctc_thresh(fcat_ta); check_mctc_thresh(ocat_ta); } diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 69804173cf..7f3c16af10 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -783,18 +783,18 @@ void aggr_summary_lines(LineDataFile &f, STATAnalysisJob &job, // // Derive categorical statistics // - if(do_cts && line.type() == stat_fho) { + if(do_cts && line.type() == STATLineType::fho) { parse_fho_ctable(line, cts_info.cts); } - else if(do_cts && line.type() == stat_ctc) { + else if(do_cts && line.type() == STATLineType::ctc) { parse_ctc_ctable(line, cts_info.cts); } // // Derive continuous statistics // - else if(do_cnt && (line.type() == stat_sl1l2 || - line.type() == stat_sal1l2)) { + else if(do_cnt && (line.type() == STATLineType::sl1l2 || + line.type() == STATLineType::sal1l2)) { parse_sl1l2_line(line, sl1l2_info); compute_cntinfo(sl1l2_info, 0, cnt_info); } @@ -802,7 +802,7 @@ void aggr_summary_lines(LineDataFile &f, STATAnalysisJob &job, // // Derive vector continuous statistics // - else if(do_vcnt && line.type() == stat_vl1l2) { + else if(do_vcnt && line.type() == STATLineType::vl1l2) { parse_vl1l2_line(line, vl1l2_info); } @@ -819,20 +819,20 @@ void aggr_summary_lines(LineDataFile &f, STATAnalysisJob &job, // // Retrieve the column value, checking dervied stats // - if((line.type() == stat_fho || - line.type() == stat_ctc) && lty == stat_cts) { + if((line.type() == STATLineType::fho || + line.type() == STATLineType::ctc) && lty == STATLineType::cts) { v = cts_info.get_stat(req_col[i].c_str()); w = cts_info.cts.n(); } - else if(line.type() == stat_sl1l2 && lty == stat_cnt) { + else if(line.type() == STATLineType::sl1l2 && lty == STATLineType::cnt) { v = cnt_info.get_stat(req_col[i].c_str()); w = cnt_info.n; } - else if(line.type() == stat_sal1l2 && lty == stat_cnt) { + else if(line.type() == STATLineType::sal1l2 && lty == STATLineType::cnt) { v = cnt_info.get_stat(req_col[i].c_str()); w = cnt_info.n; } - else if(line.type() == stat_vl1l2 && lty == stat_vcnt) { + else if(line.type() == STATLineType::vl1l2 && lty == STATLineType::vcnt) { v = vl1l2_info.get_stat(req_col[i].c_str()); w = vl1l2_info.vcount; } @@ -923,15 +923,15 @@ void aggr_ctc_lines(LineDataFile &f, STATAnalysisJob &job, // switch(line.type()) { - case(stat_fho): + case STATLineType::fho: parse_fho_ctable(line, cur.cts); break; - case(stat_ctc): + case STATLineType::ctc: parse_ctc_ctable(line, cur.cts); break; - case(stat_nbrctc): + case STATLineType::nbrctc: parse_nbrctc_ctable(line, cur.cts); break; @@ -1126,7 +1126,7 @@ void aggr_mctc_lines(LineDataFile &f, STATAnalysisJob &job, // // Check for expected line type // - if(line.type() != stat_mctc) { + if(line.type() != STATLineType::mctc) { mlog << Error << "\naggr_mctc_lines() -> " << "should only encounter multi-category contingency table count " << "(MCTC) line types.\n" @@ -1306,7 +1306,7 @@ void aggr_pct_lines(LineDataFile &f, STATAnalysisJob &job, // // Check for expected line type // - if(line.type() != stat_pct) { + if(line.type() != STATLineType::pct) { mlog << Error << "\naggr_pct_lines() -> " << "should only encounter probability contingency table (PCT) " << "line types.\n" @@ -1523,23 +1523,23 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, // switch(line.type()) { - case(stat_sl1l2): + case STATLineType::sl1l2: parse_sl1l2_line(line, cur_sl1l2); break; - case(stat_sal1l2): + case STATLineType::sal1l2: parse_sal1l2_line(line, cur_sl1l2); break; - case(stat_vl1l2): + case STATLineType::vl1l2: parse_vl1l2_line(line, cur_vl1l2); break; - case(stat_val1l2): + case STATLineType::val1l2: parse_val1l2_line(line, cur_vl1l2); break; - case(stat_nbrcnt): + case STATLineType::nbrcnt: parse_nbrcnt_line(line, cur_nbrcnt); break; @@ -1584,7 +1584,7 @@ void aggr_psum_lines(LineDataFile &f, STATAnalysisJob &job, // // Keep track of scores for each time step for VIF // - if(line.type() == stat_sl1l2 && job.vif_flag) { + if(line.type() == STATLineType::sl1l2 && job.vif_flag) { // // Cannot compute VIF when the times are not unique @@ -1701,7 +1701,7 @@ void aggr_grad_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_grad) { + if(line.type() != STATLineType::grad) { mlog << Error << "\naggr_grad_lines() -> " << "should only encounter gradient (GRAD) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; @@ -1809,13 +1809,13 @@ void aggr_wind_lines(LineDataFile &f, STATAnalysisJob &job, // switch(line.type()) { - case(stat_vl1l2): + case STATLineType::vl1l2: parse_vl1l2_line(line, cur); convert_u_v_to_unit(cur.uf_bar, cur.vf_bar, uf, vf); convert_u_v_to_unit(cur.uo_bar, cur.vo_bar, uo, vo); break; - case(stat_val1l2): + case STATLineType::val1l2: parse_val1l2_line(line, cur); convert_u_v_to_unit(cur.ufa_bar, cur.vfa_bar, uf, vf); convert_u_v_to_unit(cur.uoa_bar, cur.voa_bar, uo, vo); @@ -2228,7 +2228,7 @@ void aggr_mpr_lines(LineDataFile &f, STATAnalysisJob &job, // // Check for expected line type // - if(line.type() != stat_mpr) { + if(line.type() != STATLineType::mpr) { mlog << Error << "\naggr_mpr_lines() -> " << "should only encounter matched pair (MPR) line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; @@ -2351,7 +2351,7 @@ void aggr_isc_lines(LineDataFile &ldf, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_isc) { + if(line.type() != STATLineType::isc) { mlog << Error << "\naggr_isc_lines() -> " << "should only encounter intensity-scale " << "(ISC) line types.\n" @@ -2609,7 +2609,7 @@ void aggr_ecnt_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_ecnt) { + if(line.type() != STATLineType::ecnt) { mlog << Error << "\naggr_ecnt_lines() -> " << "should only encounter ensemble continuous statistics " << "(ECNT) line types.\n" @@ -2760,7 +2760,7 @@ void aggr_rps_lines(LineDataFile &f, STATAnalysisJob &job, // // Check for expected line type // - if(line.type() != stat_rps) { + if(line.type() != STATLineType::rps) { mlog << Error << "\naggr_rps_lines() -> " << "should only encounter ranked probability score " << "(RPS) line types.\n" @@ -2852,7 +2852,7 @@ void aggr_rhist_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_rhist) { + if(line.type() != STATLineType::rhist) { mlog << Error << "\naggr_rhist_lines() -> " << "should only encounter ranked histogram " << "(RHIST) line types.\n" @@ -2942,7 +2942,7 @@ void aggr_phist_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_phist) { + if(line.type() != STATLineType::phist) { mlog << Error << "\naggr_phist_lines() -> " << "should only encounter probability integral " << "transform histogram (PHIST) line types.\n" @@ -3033,7 +3033,7 @@ void aggr_relp_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_relp) { + if(line.type() != STATLineType::relp) { mlog << Error << "\naggr_relp_lines() -> " << "should only encounter relative position (RELP) " << "line types.\n" @@ -3125,7 +3125,7 @@ void aggr_orank_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_orank) { + if(line.type() != STATLineType::orank) { mlog << Error << "\naggr_orank_lines() -> " << "should only encounter observation rank " << "(ORANK) line types.\n" @@ -3314,7 +3314,7 @@ void aggr_ssvar_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_ssvar) { + if(line.type() != STATLineType::ssvar) { mlog << Error << "\naggr_ssvar_lines() -> " << "should only encounter spread-skill variance " << "(SSVAR) line types.\n" @@ -3419,7 +3419,7 @@ void aggr_seeps_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_seeps) { + if(line.type() != STATLineType::seeps) { mlog << Error << "\naggr_seeps_lines() -> " << "should only encounter SEEPS line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; @@ -3503,7 +3503,7 @@ void aggr_seeps_mpr_lines(LineDataFile &f, STATAnalysisJob &job, job.dump_stat_line(line); - if(line.type() != stat_seeps_mpr) { + if(line.type() != STATLineType::seeps_mpr) { mlog << Error << "\naggr_seeps_mpr_lines() -> " << "should only encounter SEEPS_MPR line types.\n" << "ERROR occurred on STAT line:\n" << line << "\n\n"; @@ -3778,7 +3778,7 @@ void aggr_ss_index(LineDataFile &f, STATAnalysisJob &job, fcst_term.line_type.set(job.line_type[i]); STATLineType lt = string_to_statlinetype(job.line_type[i].c_str()); - if(lt != stat_sl1l2 && lt != stat_ctc) { + if(lt != STATLineType::sl1l2 && lt != STATLineType::ctc) { mlog << Error << "\naggr_ss_index() -> " << "a skill score index can only be computed using " << "statistics derived from SL1L2 or CTC line types." diff --git a/src/tools/core/stat_analysis/skill_score_index_job.cc b/src/tools/core/stat_analysis/skill_score_index_job.cc index c82d71763d..9651e50a0d 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.cc +++ b/src/tools/core/stat_analysis/skill_score_index_job.cc @@ -187,12 +187,12 @@ bool SSIndexJobInfo::add(STATLine &line) { n_fcst_lines.inc(i, 1); // Aggregate SL1L2 - if(job_lt[i] == stat_sl1l2) { + if(job_lt[i] == STATLineType::sl1l2) { parse_sl1l2_line(line, sl1l2); fcst_sl1l2[i] += sl1l2; } // Aggregate CTC - else if(job_lt[i] == stat_ctc) { + else if(job_lt[i] == STATLineType::ctc) { parse_ctc_ctable(line, ctc); fcst_cts[i].cts += ctc; } @@ -204,12 +204,12 @@ bool SSIndexJobInfo::add(STATLine &line) { n_ref_lines.inc(i, 1); // Aggregate SL1L2 - if(job_lt[i] == stat_sl1l2) { + if(job_lt[i] == STATLineType::sl1l2) { parse_sl1l2_line(line, sl1l2); ref_sl1l2[i] += sl1l2; } // Aggregate CTC - else if(job_lt[i] == stat_ctc) { + else if(job_lt[i] == STATLineType::ctc) { parse_ctc_ctable(line, ctc); ref_cts[i].cts += ctc; } @@ -244,14 +244,14 @@ SSIDXData SSIndexJobInfo::compute_ss_index() { for(i=0, n_vld=0, n_diff=0, ss_sum=weight_sum=0.0; i> line) { // Continue if the line is not a valid STAT line. // - if(line.type() == no_stat_line_type) continue; + if(line.type() == STATLineType::none) continue; // // Pass header lines through to the output diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index 06959f819f..5c22c39d5a 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -226,29 +226,29 @@ void do_job(const ConcatString &jobstring, STATAnalysisJob &job, // switch(job.job_type) { - case(STATJobType::filter): + case STATJobType::filter: do_job_filter(jobstring, f, job, n_in, n_out, sa_out); break; - case(STATJobType::summary): + case STATJobType::summary: do_job_summary(jobstring, f, job, n_in, n_out, sa_out, rng_ptr); break; - case(STATJobType::aggr): + case STATJobType::aggr: do_job_aggr(jobstring, f, job, n_in, n_out, sa_out); break; - case(STATJobType::aggr_stat): + case STATJobType::aggr_stat: do_job_aggr_stat(jobstring, f, job, n_in, n_out, sa_out, tmp_dir, rng_ptr); break; - case(STATJobType::go_index): - case(STATJobType::cbs_index): - case(STATJobType::ss_index): + case STATJobType::go_index: + case STATJobType::cbs_index: + case STATJobType::ss_index: do_job_ss_index(jobstring, f, job, n_in, n_out, sa_out); break; - case(STATJobType::ramp): + case STATJobType::ramp: do_job_ramp(jobstring, f, job, n_in, n_out, sa_out); break; @@ -444,16 +444,16 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Check that a valid line type has been selected // - if(lt != stat_fho && lt != stat_ctc && - lt != stat_mctc && lt != stat_sl1l2 && - lt != stat_sal1l2 && lt != stat_vl1l2 && - lt != stat_val1l2 && lt != stat_pct && - lt != stat_nbrctc && lt != stat_nbrcnt && - lt != stat_grad && lt != stat_ecnt && - lt != stat_rps && lt != stat_rhist && - lt != stat_phist && lt != stat_relp && - lt != stat_ssvar && lt != stat_isc && - lt != stat_seeps) { + if(lt != STATLineType::fho && lt != STATLineType::ctc && + lt != STATLineType::mctc && lt != STATLineType::sl1l2 && + lt != STATLineType::sal1l2 && lt != STATLineType::vl1l2 && + lt != STATLineType::val1l2 && lt != STATLineType::pct && + lt != STATLineType::nbrctc && lt != STATLineType::nbrcnt && + lt != STATLineType::grad && lt != STATLineType::ecnt && + lt != STATLineType::rps && lt != STATLineType::rhist && + lt != STATLineType::phist && lt != STATLineType::relp && + lt != STATLineType::ssvar && lt != STATLineType::isc && + lt != STATLineType::seeps) { mlog << Error << "\ndo_job_aggr() -> " << "the \"-line_type\" option must be set to one of:\n" << "\tFHO, CTC, MCTC,\n" @@ -472,9 +472,9 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // Sum up the contingency table type lines: // FHO, CTC, NBRCTC // - if(lt == stat_fho || - lt == stat_ctc || - lt == stat_nbrctc) { + if(lt == STATLineType::fho || + lt == STATLineType::ctc || + lt == STATLineType::nbrctc) { aggr_ctc_lines(f, job, ctc_map, n_in, n_out); write_job_aggr_ctc(job, lt, ctc_map, out_at); } @@ -483,7 +483,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // Sum up the multi-category contingency table type lines: // MCTC // - else if(lt == stat_mctc) { + else if(lt == STATLineType::mctc) { aggr_mctc_lines(f, job, mctc_map, n_in, n_out); write_job_aggr_mctc(job, lt, mctc_map, out_at); } @@ -492,7 +492,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // Sum up the Nx2 contingency table lines: // PCT // - else if(lt == stat_pct) { + else if(lt == STATLineType::pct) { aggr_pct_lines(f, job, pct_map, n_in, n_out); write_job_aggr_pct(job, lt, pct_map, out_at); } @@ -501,11 +501,11 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // Sum the partial sum line types: // SL1L2, SAL1L2, VL1L2, VAL1L2, NBRCNT // - else if(lt == stat_sl1l2 || - lt == stat_sal1l2 || - lt == stat_vl1l2 || - lt == stat_val1l2 || - lt == stat_nbrcnt) { + else if(lt == STATLineType::sl1l2 || + lt == STATLineType::sal1l2 || + lt == STATLineType::vl1l2 || + lt == STATLineType::val1l2 || + lt == STATLineType::nbrcnt) { aggr_psum_lines(f, job, psum_map, n_in, n_out); write_job_aggr_psum(job, lt, psum_map, out_at); } @@ -514,7 +514,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // Sum the gradient line type: // GRAD // - else if(lt == stat_grad) { + else if(lt == STATLineType::grad) { aggr_grad_lines(f, job, grad_map, n_in, n_out); write_job_aggr_grad(job, lt, grad_map, out_at); } @@ -522,7 +522,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the ISC line types // - else if(lt == stat_isc) { + else if(lt == STATLineType::isc) { aggr_isc_lines(f, job, isc_map, n_in, n_out); write_job_aggr_isc(job, lt, isc_map, out_at); } @@ -530,7 +530,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the ECNT line types // - else if(lt == stat_ecnt) { + else if(lt == STATLineType::ecnt) { aggr_ecnt_lines(f, job, ens_map, n_in, n_out); write_job_aggr_ecnt(job, lt, ens_map, out_at); } @@ -538,7 +538,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the RPS line types // - else if(lt == stat_rps) { + else if(lt == STATLineType::rps) { aggr_rps_lines(f, job, rps_map, n_in, n_out); write_job_aggr_rps(job, lt, rps_map, out_at); } @@ -546,7 +546,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the RHIST line types // - else if(lt == stat_rhist) { + else if(lt == STATLineType::rhist) { aggr_rhist_lines(f, job, ens_map, n_in, n_out); write_job_aggr_rhist(job, lt, ens_map, out_at); } @@ -554,7 +554,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the PHIST line types // - else if(lt == stat_phist) { + else if(lt == STATLineType::phist) { aggr_phist_lines(f, job, ens_map, n_in, n_out); write_job_aggr_phist(job, lt, ens_map, out_at); } @@ -562,7 +562,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the RELP line types // - else if(lt == stat_relp) { + else if(lt == STATLineType::relp) { aggr_relp_lines(f, job, ens_map, n_in, n_out); write_job_aggr_relp(job, lt, ens_map, out_at); } @@ -570,7 +570,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the SSVAR line types // - else if(lt == stat_ssvar) { + else if(lt == STATLineType::ssvar) { aggr_ssvar_lines(f, job, ssvar_map, n_in, n_out); write_job_aggr_ssvar(job, lt, ssvar_map, out_at); } @@ -578,7 +578,7 @@ void do_job_aggr(const ConcatString &jobstring, LineDataFile &f, // // Sum the SEEPS line types // - else if(lt == stat_seeps) { + else if(lt == STATLineType::seeps) { aggr_seeps_lines(f, job, seeps_map, n_in, n_out); write_job_aggr_seeps(job, lt, seeps_map, out_at); } @@ -679,12 +679,12 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // FHO, CTC -> CTS, ECLV // NBRCTC -> NBRCTS // - if(((in_lt == stat_fho || - in_lt == stat_ctc) && - (has_line_type(out_lt, stat_cts) || - has_line_type(out_lt, stat_eclv))) || - (in_lt == stat_nbrctc && - has_line_type(out_lt, stat_nbrcts))) { + if(((in_lt == STATLineType::fho || + in_lt == STATLineType::ctc) && + (has_line_type(out_lt, STATLineType::cts) || + has_line_type(out_lt, STATLineType::eclv))) || + (in_lt == STATLineType::nbrctc && + has_line_type(out_lt, STATLineType::nbrcts))) { aggr_ctc_lines(f, job, ctc_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_ctc(job, *it, ctc_map, out_at); @@ -696,8 +696,8 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum up the multi-category contingency table type lines: // MCTC -> MCTS // - else if(in_lt == stat_mctc && - has_line_type(out_lt, stat_mcts)) { + else if(in_lt == STATLineType::mctc && + has_line_type(out_lt, STATLineType::mcts)) { aggr_mctc_lines(f, job, mctc_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_mctc(job, *it, mctc_map, out_at); @@ -709,11 +709,11 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum up the Nx2 contingency table lines: // PCT -> PSTD, PJC, PRC, ECLV // - else if(in_lt == stat_pct && - (has_line_type(out_lt, stat_pstd) || - has_line_type(out_lt, stat_pjc) || - has_line_type(out_lt, stat_prc) || - has_line_type(out_lt, stat_eclv))) { + else if(in_lt == STATLineType::pct && + (has_line_type(out_lt, STATLineType::pstd) || + has_line_type(out_lt, STATLineType::pjc) || + has_line_type(out_lt, STATLineType::prc) || + has_line_type(out_lt, STATLineType::eclv))) { aggr_pct_lines(f, job, pct_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_pct(job, *it, pct_map, out_at); @@ -726,9 +726,9 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // SL1L2, SAL1L2 -> CNT // NBRCTC -> NBRCNT // - else if((in_lt == stat_sl1l2 || - in_lt == stat_sal1l2) && - has_line_type(out_lt, stat_cnt)) { + else if((in_lt == STATLineType::sl1l2 || + in_lt == STATLineType::sal1l2) && + has_line_type(out_lt, STATLineType::cnt)) { aggr_psum_lines(f, job, psum_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_psum(job, *it, psum_map, out_at); @@ -740,9 +740,9 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum the vector partial sum line types: // VL1L2, VAL1L2 -> VCNT // - else if((in_lt == stat_vl1l2 || - in_lt == stat_val1l2) && - has_line_type(out_lt, stat_vcnt)) { + else if((in_lt == STATLineType::vl1l2 || + in_lt == STATLineType::val1l2) && + has_line_type(out_lt, STATLineType::vcnt)) { aggr_psum_lines(f, job, psum_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_psum(job, *it, psum_map, out_at); @@ -754,9 +754,9 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum the vector partial sum line types: // VL1L2, VAL1L2 -> WDIR // - else if((in_lt == stat_vl1l2 || - in_lt == stat_val1l2) && - has_line_type(out_lt, stat_wdir)) { + else if((in_lt == STATLineType::vl1l2 || + in_lt == STATLineType::val1l2) && + has_line_type(out_lt, STATLineType::wdir)) { aggr_wind_lines(f, job, wind_map, n_in, n_out); write_job_aggr_wind(job, in_lt, wind_map, out_at); if(!job.stat_out) write_table(out_at, sa_out); @@ -766,10 +766,10 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum the UGRD and VGRD matched pair lines: // MPR -> WDIR // - else if(in_lt == stat_mpr && - (has_line_type(out_lt, stat_wdir) || - has_line_type(out_lt, stat_vl1l2) || - has_line_type(out_lt, stat_vcnt))) { + else if(in_lt == STATLineType::mpr && + (has_line_type(out_lt, STATLineType::wdir) || + has_line_type(out_lt, STATLineType::vl1l2) || + has_line_type(out_lt, STATLineType::vcnt))) { mlog << Debug(4) << "do_job_aggr_stat() -> " << "For MPR wind aggregation, searching for UGRD and VGRD MPR lines.\n"; @@ -780,7 +780,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, aggr_mpr_wind_lines(f, job, wind_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { - if(*it == stat_wdir) { + if(*it == STATLineType::wdir) { write_job_aggr_wind(job, in_lt, wind_map, out_at); if(!job.stat_out) write_table(out_at, sa_out); } @@ -795,18 +795,18 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum the observation rank line types: // ORANK -> ECNT, RPS, RHIST, PHIST, RELP, SSVAR // - else if(in_lt == stat_orank && - (has_line_type(out_lt, stat_ecnt) || - has_line_type(out_lt, stat_rps) || - has_line_type(out_lt, stat_rhist) || - has_line_type(out_lt, stat_phist) || - has_line_type(out_lt, stat_relp) || - has_line_type(out_lt, stat_ssvar))) { + else if(in_lt == STATLineType::orank && + (has_line_type(out_lt, STATLineType::ecnt) || + has_line_type(out_lt, STATLineType::rps) || + has_line_type(out_lt, STATLineType::rhist) || + has_line_type(out_lt, STATLineType::phist) || + has_line_type(out_lt, STATLineType::relp) || + has_line_type(out_lt, STATLineType::ssvar))) { // // Check forecast thresholds for RPS // - if(has_line_type(out_lt, stat_rps)) { + if(has_line_type(out_lt, STATLineType::rps)) { if(job.out_fcst_thresh.n() == 0) { mlog << Error << "\ndo_job_aggr_stat() -> " @@ -828,8 +828,8 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // Sum the SEEPS_MPR lines: // SEEPS_MPR -> SEEPS // - else if(in_lt == stat_seeps_mpr && - has_line_type(out_lt, stat_seeps)) { + else if(in_lt == STATLineType::seeps_mpr && + has_line_type(out_lt, STATLineType::seeps)) { aggr_seeps_mpr_lines(f, job, seeps_mpr_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { @@ -844,27 +844,27 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // MPR -> FHO, CTC, CTS, MCTC, MCTS, CNT, // SL1L2, SAL1L2, PCT, PSTD, PJC, PRC, ECLV // - else if(in_lt == stat_mpr && - (has_line_type(out_lt, stat_fho) || - has_line_type(out_lt, stat_ctc) || - has_line_type(out_lt, stat_cts) || - has_line_type(out_lt, stat_mctc) || - has_line_type(out_lt, stat_mcts) || - has_line_type(out_lt, stat_cnt) || - has_line_type(out_lt, stat_sl1l2) || - has_line_type(out_lt, stat_sal1l2) || - has_line_type(out_lt, stat_pct) || - has_line_type(out_lt, stat_pstd) || - has_line_type(out_lt, stat_pjc) || - has_line_type(out_lt, stat_prc) || - has_line_type(out_lt, stat_eclv))) { + else if(in_lt == STATLineType::mpr && + (has_line_type(out_lt, STATLineType::fho) || + has_line_type(out_lt, STATLineType::ctc) || + has_line_type(out_lt, STATLineType::cts) || + has_line_type(out_lt, STATLineType::mctc) || + has_line_type(out_lt, STATLineType::mcts) || + has_line_type(out_lt, STATLineType::cnt) || + has_line_type(out_lt, STATLineType::sl1l2) || + has_line_type(out_lt, STATLineType::sal1l2) || + has_line_type(out_lt, STATLineType::pct) || + has_line_type(out_lt, STATLineType::pstd) || + has_line_type(out_lt, STATLineType::pjc) || + has_line_type(out_lt, STATLineType::prc) || + has_line_type(out_lt, STATLineType::eclv))) { // // Check output thresholds for continuous line types // - if(has_line_type(out_lt, stat_cnt) || - has_line_type(out_lt, stat_sl1l2) || - has_line_type(out_lt, stat_sal1l2)) { + if(has_line_type(out_lt, STATLineType::cnt) || + has_line_type(out_lt, STATLineType::sl1l2) || + has_line_type(out_lt, STATLineType::sal1l2)) { if(job.out_fcst_thresh.n() != job.out_obs_thresh.n()) { mlog << Error << "\ndo_job_aggr_stat() -> " @@ -885,10 +885,10 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // // Check output threshold values for 2x2 contingency table // - if(has_line_type(out_lt, stat_fho) || - has_line_type(out_lt, stat_ctc) || - has_line_type(out_lt, stat_cts) || - has_line_type(out_lt, stat_eclv)) { + if(has_line_type(out_lt, STATLineType::fho) || + has_line_type(out_lt, STATLineType::ctc) || + has_line_type(out_lt, STATLineType::cts) || + has_line_type(out_lt, STATLineType::eclv)) { if(job.out_fcst_thresh.n() == 0 || job.out_obs_thresh.n() == 0 || @@ -906,8 +906,8 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // // Check output threshold values for NxN contingency table // - if(has_line_type(out_lt, stat_mctc) || - has_line_type(out_lt, stat_mcts)) { + if(has_line_type(out_lt, STATLineType::mctc) || + has_line_type(out_lt, STATLineType::mcts)) { if(job.out_fcst_thresh.n() <= 1 || job.out_fcst_thresh.n() != job.out_obs_thresh.n()) { @@ -943,10 +943,10 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // // Check for output threshold values // - if(has_line_type(out_lt, stat_pct) || - has_line_type(out_lt, stat_pstd) || - has_line_type(out_lt, stat_pjc) || - has_line_type(out_lt, stat_prc)) { + if(has_line_type(out_lt, STATLineType::pct) || + has_line_type(out_lt, STATLineType::pstd) || + has_line_type(out_lt, STATLineType::pjc) || + has_line_type(out_lt, STATLineType::prc)) { if(job.out_obs_thresh.n() != 1) { mlog << Error << "\ndo_job_aggr_stat() -> " @@ -1255,24 +1255,24 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // n_row = 1 + m.size(); n_col = 1 + job.by_column.n(); - if(lt == stat_fho) n_col += n_fho_columns; - else if(lt == stat_ctc) n_col += n_ctc_columns; - else if(lt == stat_cts) n_col += n_cts_columns; - else if(lt == stat_eclv) n_col += get_n_eclv_columns(n_pnt); - else if(lt == stat_nbrctc) n_col += n_nbrctc_columns; - else if(lt == stat_nbrcts) n_col += n_nbrcts_columns; + if(lt == STATLineType::fho) n_col += n_fho_columns; + else if(lt == STATLineType::ctc) n_col += n_ctc_columns; + else if(lt == STATLineType::cts) n_col += n_cts_columns; + else if(lt == STATLineType::eclv) n_col += get_n_eclv_columns(n_pnt); + else if(lt == STATLineType::nbrctc) n_col += n_nbrctc_columns; + else if(lt == STATLineType::nbrcts) n_col += n_nbrcts_columns; write_job_aggr_hdr(job, n_row, n_col, at); // // Write the output header row // c = 1 + job.by_column.n(); - if(lt == stat_fho) write_header_row(fho_columns, n_fho_columns, 0, at, 0, c); - else if(lt == stat_ctc) write_header_row(ctc_columns, n_ctc_columns, 0, at, 0, c); - else if(lt == stat_cts) write_header_row(cts_columns, n_cts_columns, 0, at, 0, c); - else if(lt == stat_eclv) write_eclv_header_row( 0, n_pnt, at, 0, c); - else if(lt == stat_nbrctc) write_header_row(nbrctc_columns, n_nbrctc_columns, 0, at, 0, c); - else if(lt == stat_nbrcts) write_header_row(nbrcts_columns, n_nbrcts_columns, 0, at, 0, c); + if(lt == STATLineType::fho) write_header_row(fho_columns, n_fho_columns, 0, at, 0, c); + else if(lt == STATLineType::ctc) write_header_row(ctc_columns, n_ctc_columns, 0, at, 0, c); + else if(lt == STATLineType::cts) write_header_row(cts_columns, n_cts_columns, 0, at, 0, c); + else if(lt == STATLineType::eclv) write_eclv_header_row( 0, n_pnt, at, 0, c); + else if(lt == STATLineType::nbrctc) write_header_row(nbrctc_columns, n_nbrctc_columns, 0, at, 0, c); + else if(lt == STATLineType::nbrcts) write_header_row(nbrcts_columns, n_nbrcts_columns, 0, at, 0, c); // // Setup the output STAT file @@ -1293,7 +1293,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_cts || lt == stat_nbrcts) shc.set_alpha(job.out_alpha); + if(lt == STATLineType::cts || lt == STATLineType::nbrcts) shc.set_alpha(job.out_alpha); write_header_cols(shc, job.stat_at, job.stat_row); } @@ -1305,7 +1305,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // FHO output line // - if(lt == stat_fho) { + if(lt == STATLineType::fho) { if(job.stat_out) { write_fho_cols(it->second.cts_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1319,7 +1319,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // CTC output line // - else if(lt == stat_ctc) { + else if(lt == STATLineType::ctc) { if(job.stat_out) { write_ctc_cols(it->second.cts_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1333,7 +1333,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // CTS output line // - else if(lt == stat_cts) { + else if(lt == STATLineType::cts) { // // Store the alpha information in the CTSInfo object @@ -1364,7 +1364,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // ECLV output line // - else if(lt == stat_eclv) { + else if(lt == STATLineType::eclv) { if(job.stat_out) { write_eclv_cols(it->second.cts_info.cts, job.out_eclv_points, job.stat_at, @@ -1379,7 +1379,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // NBRCTC output line // - else if(lt == stat_nbrctc) { + else if(lt == STATLineType::nbrctc) { nbrcts_info.clear(); nbrcts_info.cts_info = it->second.cts_info; @@ -1397,7 +1397,7 @@ void write_job_aggr_ctc(STATAnalysisJob &job, STATLineType lt, // // NBRCTS output line // - else if(lt == stat_nbrcts) { + else if(lt == STATLineType::nbrcts) { nbrcts_info.clear(); nbrcts_info.cts_info = it->second.cts_info; @@ -1463,16 +1463,16 @@ void write_job_aggr_mctc(STATAnalysisJob &job, STATLineType lt, // n_row = 1 + m.size(); n_col = 1 + job.by_column.n(); - if(lt == stat_mctc) n_col += get_n_mctc_columns(n); - else if(lt == stat_mcts) n_col += n_mcts_columns; + if(lt == STATLineType::mctc) n_col += get_n_mctc_columns(n); + else if(lt == STATLineType::mcts) n_col += n_mcts_columns; write_job_aggr_hdr(job, n_row, n_col, at); // // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_mctc) write_mctc_header_row(0, n, at, 0, c); - else if(lt == stat_mcts) write_header_row(mcts_columns, n_mcts_columns, 0, at, 0, c); + if(lt == STATLineType::mctc) write_mctc_header_row(0, n, at, 0, c); + else if(lt == STATLineType::mcts) write_header_row(mcts_columns, n_mcts_columns, 0, at, 0, c); // // Setup the output STAT file @@ -1493,7 +1493,7 @@ void write_job_aggr_mctc(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_mcts) shc.set_alpha(job.out_alpha); + if(lt == STATLineType::mcts) shc.set_alpha(job.out_alpha); write_header_cols(shc, job.stat_at, job.stat_row); } @@ -1505,7 +1505,7 @@ void write_job_aggr_mctc(STATAnalysisJob &job, STATLineType lt, // // MCTC output line // - if(lt == stat_mctc) { + if(lt == STATLineType::mctc) { if(job.stat_out) { write_mctc_cols(it->second.mcts_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1519,7 +1519,7 @@ void write_job_aggr_mctc(STATAnalysisJob &job, STATLineType lt, // // MCTS output line // - else if(lt == stat_mcts) { + else if(lt == STATLineType::mcts) { // // Store the alpha information in the CTSInfo object @@ -1582,31 +1582,31 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // Setup the output table // - if(lt == stat_eclv) n_row = 1 + m.size() * n; - else n_row = 1 + m.size(); + if(lt == STATLineType::eclv) n_row = 1 + m.size() * n; + else n_row = 1 + m.size(); n_col = 1 + job.by_column.n(); - if(lt == stat_pct) n_col += get_n_pct_columns(n); - else if(lt == stat_pstd) n_col += get_n_pstd_columns(n); - else if(lt == stat_pjc) n_col += get_n_pjc_columns(n); - else if(lt == stat_prc) n_col += get_n_prc_columns(n); - else if(lt == stat_eclv) n_col += get_n_eclv_columns(n_pnt); + if(lt == STATLineType::pct) n_col += get_n_pct_columns(n); + else if(lt == STATLineType::pstd) n_col += get_n_pstd_columns(n); + else if(lt == STATLineType::pjc) n_col += get_n_pjc_columns(n); + else if(lt == STATLineType::prc) n_col += get_n_prc_columns(n); + else if(lt == STATLineType::eclv) n_col += get_n_eclv_columns(n_pnt); write_job_aggr_hdr(job, n_row, n_col, at); // // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_pct) write_pct_header_row (0, n, at, 0, c); - else if(lt == stat_pstd) write_pstd_header_row(0, n, at, 0, c); - else if(lt == stat_pjc) write_pjc_header_row (0, n, at, 0, c); - else if(lt == stat_prc) write_prc_header_row (0, n, at, 0, c); - else if(lt == stat_eclv) write_eclv_header_row(0, n_pnt, at, 0, c); + if(lt == STATLineType::pct) write_pct_header_row (0, n, at, 0, c); + else if(lt == STATLineType::pstd) write_pstd_header_row(0, n, at, 0, c); + else if(lt == STATLineType::pjc) write_pjc_header_row (0, n, at, 0, c); + else if(lt == STATLineType::prc) write_prc_header_row (0, n, at, 0, c); + else if(lt == STATLineType::eclv) write_eclv_header_row(0, n_pnt, at, 0, c); // // Setup the output STAT file // - if(lt == stat_eclv) job.setup_stat_file(n_row, n_pnt); - else job.setup_stat_file(n_row, n); + if(lt == STATLineType::eclv) job.setup_stat_file(n_row, n_pnt); + else job.setup_stat_file(n_row, n); mlog << Debug(2) << "Computing output for " << (int) m.size() << " case(s).\n"; @@ -1622,7 +1622,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_pstd) shc.set_alpha(job.out_alpha); + if(lt == STATLineType::pstd) shc.set_alpha(job.out_alpha); write_header_cols(shc, job.stat_at, job.stat_row); } @@ -1634,7 +1634,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // PCT output line // - if(lt == stat_pct) { + if(lt == STATLineType::pct) { if(job.stat_out) { write_pct_cols(it->second.pct_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1648,7 +1648,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // PSTD output line // - else if(lt == stat_pstd) { + else if(lt == STATLineType::pstd) { // // Store the alpha information in the PCTInfo object @@ -1679,7 +1679,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // PJC output line // - else if(lt == stat_pjc) { + else if(lt == STATLineType::pjc) { if(job.stat_out) { write_pjc_cols(it->second.pct_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1693,7 +1693,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // PRC output line // - else if(lt == stat_prc) { + else if(lt == STATLineType::prc) { if(job.stat_out) { write_prc_cols(it->second.pct_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1707,7 +1707,7 @@ void write_job_aggr_pct(STATAnalysisJob &job, STATLineType lt, // // ECLV output lines // - else if(lt == stat_eclv) { + else if(lt == STATLineType::eclv) { ThreshArray prob_ta = string_to_prob_thresh(shc.get_fcst_thresh_str().c_str()); for(i=0; isecond.pct_info.pct.nrows(); i++) { if(job.stat_out) { @@ -1753,26 +1753,26 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // n_row = 1 + m.size(); n_col = 1 + job.by_column.n(); - if(lt == stat_sl1l2) n_col += n_sl1l2_columns; - else if(lt == stat_sal1l2) n_col += n_sal1l2_columns; - else if(lt == stat_vl1l2) n_col += n_vl1l2_columns; - else if(lt == stat_val1l2) n_col += n_val1l2_columns; - else if(lt == stat_cnt) n_col += n_cnt_columns; - else if(lt == stat_vcnt) n_col += n_vcnt_columns; - else if(lt == stat_nbrcnt) n_col += n_nbrcnt_columns; + if(lt == STATLineType::sl1l2) n_col += n_sl1l2_columns; + else if(lt == STATLineType::sal1l2) n_col += n_sal1l2_columns; + else if(lt == STATLineType::vl1l2) n_col += n_vl1l2_columns; + else if(lt == STATLineType::val1l2) n_col += n_val1l2_columns; + else if(lt == STATLineType::cnt) n_col += n_cnt_columns; + else if(lt == STATLineType::vcnt) n_col += n_vcnt_columns; + else if(lt == STATLineType::nbrcnt) n_col += n_nbrcnt_columns; write_job_aggr_hdr(job, n_row, n_col, at); // // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_sl1l2) write_header_row(sl1l2_columns, n_sl1l2_columns, 0, at, 0, c); - else if(lt == stat_sal1l2) write_header_row(sal1l2_columns, n_sal1l2_columns, 0, at, 0, c); - else if(lt == stat_vl1l2) write_header_row(vl1l2_columns, n_vl1l2_columns, 0, at, 0, c); - else if(lt == stat_val1l2) write_header_row(val1l2_columns, n_val1l2_columns, 0, at, 0, c); - else if(lt == stat_cnt) write_header_row(cnt_columns, n_cnt_columns, 0, at, 0, c); - else if(lt == stat_vcnt) write_header_row(vcnt_columns, n_vcnt_columns, 0, at, 0, c); - else if(lt == stat_nbrcnt) write_header_row(nbrcnt_columns, n_nbrcnt_columns, 0, at, 0, c); + if(lt == STATLineType::sl1l2) write_header_row(sl1l2_columns, n_sl1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::sal1l2) write_header_row(sal1l2_columns, n_sal1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::vl1l2) write_header_row(vl1l2_columns, n_vl1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::val1l2) write_header_row(val1l2_columns, n_val1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::cnt) write_header_row(cnt_columns, n_cnt_columns, 0, at, 0, c); + else if(lt == STATLineType::vcnt) write_header_row(vcnt_columns, n_vcnt_columns, 0, at, 0, c); + else if(lt == STATLineType::nbrcnt) write_header_row(nbrcnt_columns, n_nbrcnt_columns, 0, at, 0, c); // // Setup the output STAT file @@ -1793,7 +1793,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_cnt || lt == stat_vcnt || lt == stat_nbrcnt) { + if(lt == STATLineType::cnt || lt == STATLineType::vcnt || lt == STATLineType::nbrcnt) { shc.set_alpha(job.out_alpha); } write_header_cols(shc, job.stat_at, job.stat_row); @@ -1807,7 +1807,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // SL1L2 output line // - if(lt == stat_sl1l2) { + if(lt == STATLineType::sl1l2) { if(job.stat_out) { write_sl1l2_cols(it->second.sl1l2_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1821,7 +1821,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // SAL1L2 output line // - else if(lt == stat_sal1l2) { + else if(lt == STATLineType::sal1l2) { if(job.stat_out) { write_sal1l2_cols(it->second.sl1l2_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1835,7 +1835,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // VL1L2 output line // - else if(lt == stat_vl1l2) { + else if(lt == STATLineType::vl1l2) { if(job.stat_out) { write_vl1l2_cols(it->second.vl1l2_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1849,7 +1849,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // VAL1L2 output line // - else if(lt == stat_val1l2) { + else if(lt == STATLineType::val1l2) { if(job.stat_out) { write_val1l2_cols(it->second.vl1l2_info, job.stat_at, job.stat_row++, n_header_columns); @@ -1863,7 +1863,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // CNT output line // - else if(lt == stat_cnt) { + else if(lt == STATLineType::cnt) { it->second.cnt_info.clear(); @@ -1894,7 +1894,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // VCNT output line // - else if(lt == stat_vcnt) { + else if(lt == STATLineType::vcnt) { if(job.stat_out) { write_vcnt_cols(it->second.vl1l2_info, 0, job.stat_at, job.stat_row++, n_header_columns); @@ -1908,7 +1908,7 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // // NBRCNT output line // - else if(lt == stat_nbrcnt) { + else if(lt == STATLineType::nbrcnt) { // // Allocate space for confidence intervals @@ -2126,14 +2126,14 @@ void write_job_aggr_wind(STATAnalysisJob &job, STATLineType lt, // r++; - if(lt == stat_vl1l2 || lt == stat_mpr) { + if(lt == STATLineType::vl1l2 || lt == STATLineType::mpr) { uf = it->second.vl1l2_info.uf_bar; vf = it->second.vl1l2_info.vf_bar; uo = it->second.vl1l2_info.uo_bar; vo = it->second.vl1l2_info.vo_bar; count = it->second.vl1l2_info.vcount; } - else if(lt == stat_val1l2) { + else if(lt == STATLineType::val1l2) { uf = it->second.vl1l2_info.ufa_bar; vf = it->second.vl1l2_info.vfa_bar; uo = it->second.vl1l2_info.uoa_bar; @@ -2859,10 +2859,10 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // - Ensemble members for RELP // for(it = m.begin(), n = 0; it != m.end(); it++) { - if(lt == stat_rhist) n = max(it->second.ens_pd.rhist_na.n(), n); - else if(lt == stat_phist) n = max(it->second.ens_pd.phist_na.n(), n); - else if(lt == stat_relp) n = max(it->second.ens_pd.n_ens, n); - else if(lt == stat_ssvar) { + if(lt == STATLineType::rhist) n = max(it->second.ens_pd.rhist_na.n(), n); + else if(lt == STATLineType::phist) n = max(it->second.ens_pd.phist_na.n(), n); + else if(lt == STATLineType::relp) n = max(it->second.ens_pd.n_ens, n); + else if(lt == STATLineType::ssvar) { it->second.ens_pd.compute_ssvar(); if(it->second.ens_pd.ssvar_bins) n += it->second.ens_pd.ssvar_bins[0].n_bin; } @@ -2873,27 +2873,27 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // n_row = 0; n_col = 1 + job.by_column.n(); - if(lt == stat_ecnt) { + if(lt == STATLineType::ecnt) { n_row = 1 + m.size(); n_col += n_ecnt_columns; } - if(lt == stat_rps) { + if(lt == STATLineType::rps) { n_row = 1 + m.size(); n_col += n_rps_columns; } - else if(lt == stat_rhist) { + else if(lt == STATLineType::rhist) { n_row = 1 + m.size(); n_col += get_n_rhist_columns(n); } - else if(lt == stat_phist) { + else if(lt == STATLineType::phist) { n_row = 1 + m.size(); n_col += get_n_phist_columns(n); } - else if(lt == stat_relp) { + else if(lt == STATLineType::relp) { n_row = 1 + m.size(); n_col += get_n_relp_columns(n); } - else if(lt == stat_ssvar) { + else if(lt == STATLineType::ssvar) { n_row = 1 + n; n_col += n_ssvar_columns; } @@ -2903,22 +2903,22 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_ecnt) write_header_row(ecnt_columns, n_ecnt_columns, 0, at, 0, c); - else if(lt == stat_rps) write_header_row(rps_columns, n_rps_columns, 0, at, 0, c); - else if(lt == stat_rhist) write_rhist_header_row(0, n, at, 0, c); - else if(lt == stat_phist) write_phist_header_row(0, n, at, 0, c); - else if(lt == stat_relp) write_relp_header_row (0, n, at, 0, c); - else if(lt == stat_ssvar) write_header_row(ssvar_columns, n_ssvar_columns, 0, at, 0, c); + if(lt == STATLineType::ecnt) write_header_row(ecnt_columns, n_ecnt_columns, 0, at, 0, c); + else if(lt == STATLineType::rps) write_header_row(rps_columns, n_rps_columns, 0, at, 0, c); + else if(lt == STATLineType::rhist) write_rhist_header_row(0, n, at, 0, c); + else if(lt == STATLineType::phist) write_phist_header_row(0, n, at, 0, c); + else if(lt == STATLineType::relp) write_relp_header_row (0, n, at, 0, c); + else if(lt == STATLineType::ssvar) write_header_row(ssvar_columns, n_ssvar_columns, 0, at, 0, c); // // Setup the output STAT file // - if(lt == stat_ecnt) job.setup_stat_file(n_row, 0); - else if(lt == stat_rps) job.setup_stat_file(n_row, 0); - else if(lt == stat_rhist) job.setup_stat_file(n_row, n); - else if(lt == stat_phist) job.setup_stat_file(n_row, n); - else if(lt == stat_relp) job.setup_stat_file(n_row, n); - else if(lt == stat_ssvar) job.setup_stat_file(n_row, 0); + if(lt == STATLineType::ecnt) job.setup_stat_file(n_row, 0); + else if(lt == STATLineType::rps) job.setup_stat_file(n_row, 0); + else if(lt == STATLineType::rhist) job.setup_stat_file(n_row, n); + else if(lt == STATLineType::phist) job.setup_stat_file(n_row, n); + else if(lt == STATLineType::relp) job.setup_stat_file(n_row, n); + else if(lt == STATLineType::ssvar) job.setup_stat_file(n_row, 0); mlog << Debug(2) << "Computing output for " << (int) m.size() << " case(s).\n"; @@ -2937,7 +2937,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // Set SSVAR alpha value // - if(lt == stat_ssvar) shc.set_alpha(job.out_alpha); + if(lt == STATLineType::ssvar) shc.set_alpha(job.out_alpha); // // Initialize @@ -2947,7 +2947,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // ECNT output line // - if(lt == stat_ecnt) { + if(lt == STATLineType::ecnt) { ECNTInfo ecnt_info; ecnt_info.set(it->second.ens_pd); @@ -2965,7 +2965,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // RPS output line // - else if(lt == stat_rps) { + else if(lt == STATLineType::rps) { RPSInfo rps_info; rps_info.fthresh = job.out_fcst_thresh; rps_info.set(it->second.ens_pd); @@ -2985,7 +2985,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // RHIST output line // - else if(lt == stat_rhist) { + else if(lt == STATLineType::rhist) { it->second.ens_pd.compute_rhist(); if(job.stat_out) { @@ -3002,7 +3002,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // PHIST output line // - else if(lt == stat_phist) { + else if(lt == STATLineType::phist) { if(job.stat_out) { write_header_cols(shc, job.stat_at, job.stat_row); write_phist_cols(&(it->second.ens_pd), job.stat_at, @@ -3017,7 +3017,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // RELP output line // - else if(lt == stat_relp) { + else if(lt == STATLineType::relp) { it->second.ens_pd.compute_relp(); if(job.stat_out) { @@ -3034,7 +3034,7 @@ void write_job_aggr_orank(STATAnalysisJob &job, STATLineType lt, // // SSVAR output lines // - else if(lt == stat_ssvar) { + else if(lt == STATLineType::ssvar) { if(!it->second.ens_pd.ssvar_bins) continue; @@ -3160,10 +3160,10 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // Number of rows n_row = 1; - if(lt == stat_fho || lt == stat_ctc || - lt == stat_cts || lt == stat_eclv || - lt == stat_cnt || lt == stat_sl1l2 || - lt == stat_sal1l2) { + if(lt == STATLineType::fho || lt == STATLineType::ctc || + lt == STATLineType::cts || lt == STATLineType::eclv || + lt == STATLineType::cnt || lt == STATLineType::sl1l2 || + lt == STATLineType::sal1l2) { n_row += job.out_fcst_thresh.n() * m.size(); } else { @@ -3172,44 +3172,44 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // Number of columns n_col = 1 + job.by_column.n(); - if(lt == stat_fho) { n_col += n_fho_columns; } - else if(lt == stat_ctc) { n_col += n_ctc_columns; } - else if(lt == stat_cts) { n_col += n_cts_columns; } - else if(lt == stat_eclv) { n = job.out_eclv_points.n(); - n_col += get_n_eclv_columns(n); } - else if(lt == stat_mctc) { n = job.out_fcst_thresh.n()+1; - n_col += get_n_mctc_columns(n); } - else if(lt == stat_mcts) { n_col += n_mcts_columns; } - else if(lt == stat_cnt) { n_col += n_cnt_columns; } - else if(lt == stat_sl1l2) { n_col += n_sl1l2_columns; } - else if(lt == stat_sal1l2) { n_col += n_sal1l2_columns; } - else if(lt == stat_pct) { n = job.out_fcst_thresh.n(); - n_col += get_n_pct_columns(n); } - else if(lt == stat_pstd) { n = job.out_fcst_thresh.n(); - n_col += get_n_pstd_columns(n); } - else if(lt == stat_pjc) { n = job.out_fcst_thresh.n(); - n_col += get_n_pjc_columns(n); } - else if(lt == stat_prc) { n = job.out_fcst_thresh.n(); - n_col += get_n_prc_columns(n); } + if(lt == STATLineType::fho) { n_col += n_fho_columns; } + else if(lt == STATLineType::ctc) { n_col += n_ctc_columns; } + else if(lt == STATLineType::cts) { n_col += n_cts_columns; } + else if(lt == STATLineType::eclv) { n = job.out_eclv_points.n(); + n_col += get_n_eclv_columns(n); } + else if(lt == STATLineType::mctc) { n = job.out_fcst_thresh.n()+1; + n_col += get_n_mctc_columns(n); } + else if(lt == STATLineType::mcts) { n_col += n_mcts_columns; } + else if(lt == STATLineType::cnt) { n_col += n_cnt_columns; } + else if(lt == STATLineType::sl1l2) { n_col += n_sl1l2_columns; } + else if(lt == STATLineType::sal1l2) { n_col += n_sal1l2_columns; } + else if(lt == STATLineType::pct) { n = job.out_fcst_thresh.n(); + n_col += get_n_pct_columns(n); } + else if(lt == STATLineType::pstd) { n = job.out_fcst_thresh.n(); + n_col += get_n_pstd_columns(n); } + else if(lt == STATLineType::pjc) { n = job.out_fcst_thresh.n(); + n_col += get_n_pjc_columns(n); } + else if(lt == STATLineType::prc) { n = job.out_fcst_thresh.n(); + n_col += get_n_prc_columns(n); } write_job_aggr_hdr(job, n_row, n_col, at); // // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_fho) write_header_row(fho_columns, n_fho_columns, 0, at, 0, c); - else if(lt == stat_ctc) write_header_row(ctc_columns, n_ctc_columns, 0, at, 0, c); - else if(lt == stat_cts) write_header_row(cts_columns, n_cts_columns, 0, at, 0, c); - else if(lt == stat_eclv) write_eclv_header_row(0, n, at, 0, c); - else if(lt == stat_mctc) write_mctc_header_row(0, n, at, 0, c); - else if(lt == stat_mcts) write_header_row(mcts_columns, n_mcts_columns, 0, at, 0, c); - else if(lt == stat_cnt) write_header_row(cnt_columns, n_cnt_columns, 0, at, 0, c); - else if(lt == stat_sl1l2) write_header_row(sl1l2_columns, n_sl1l2_columns, 0, at, 0, c); - else if(lt == stat_sal1l2) write_header_row(sal1l2_columns, n_sal1l2_columns, 0, at, 0, c); - else if(lt == stat_pct) write_pct_header_row (0, n, at, 0, c); - else if(lt == stat_pstd) write_pstd_header_row(0, n, at, 0, c); - else if(lt == stat_pjc) write_pjc_header_row (0, n, at, 0, c); - else if(lt == stat_prc) write_prc_header_row (0, n, at, 0, c); + if(lt == STATLineType::fho) write_header_row(fho_columns, n_fho_columns, 0, at, 0, c); + else if(lt == STATLineType::ctc) write_header_row(ctc_columns, n_ctc_columns, 0, at, 0, c); + else if(lt == STATLineType::cts) write_header_row(cts_columns, n_cts_columns, 0, at, 0, c); + else if(lt == STATLineType::eclv) write_eclv_header_row(0, n, at, 0, c); + else if(lt == STATLineType::mctc) write_mctc_header_row(0, n, at, 0, c); + else if(lt == STATLineType::mcts) write_header_row(mcts_columns, n_mcts_columns, 0, at, 0, c); + else if(lt == STATLineType::cnt) write_header_row(cnt_columns, n_cnt_columns, 0, at, 0, c); + else if(lt == STATLineType::sl1l2) write_header_row(sl1l2_columns, n_sl1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::sal1l2) write_header_row(sal1l2_columns, n_sal1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::pct) write_pct_header_row (0, n, at, 0, c); + else if(lt == STATLineType::pstd) write_pstd_header_row(0, n, at, 0, c); + else if(lt == STATLineType::pjc) write_pjc_header_row (0, n, at, 0, c); + else if(lt == STATLineType::prc) write_prc_header_row (0, n, at, 0, c); // // Setup the output STAT file @@ -3238,7 +3238,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // FHO output line // - if(lt == stat_fho) { + if(lt == STATLineType::fho) { for(i=0; isecond, i, cts_info); if(job.stat_out) { @@ -3259,7 +3259,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // CTC output line // - else if(lt == stat_ctc) { + else if(lt == STATLineType::ctc) { for(i=0; isecond, i, cts_info); if(job.stat_out) { @@ -3280,7 +3280,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // CTS output line // - else if(lt == stat_cts) { + else if(lt == STATLineType::cts) { for(i=0; isecond, i, cts_info, tmp_dir, rng_ptr); if(job.stat_out) { @@ -3302,7 +3302,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // ECLV output line // - else if(lt == stat_eclv) { + else if(lt == STATLineType::eclv) { for(i=0; isecond, i, cts_info); if(job.stat_out) { @@ -3323,7 +3323,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // MCTC output line // - else if(lt == stat_mctc) { + else if(lt == STATLineType::mctc) { mpr_to_mctc(job, it->second, mcts_info); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3342,7 +3342,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // MCTS output line // - else if(lt == stat_mcts) { + else if(lt == STATLineType::mcts) { mpr_to_mcts(job, it->second, mcts_info, tmp_dir, rng_ptr); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3362,7 +3362,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // CNT output line // - else if(lt == stat_cnt) { + else if(lt == STATLineType::cnt) { for(i=0; isecond, i, cnt_info, tmp_dir, rng_ptr); if(cnt_info.n == 0) continue; @@ -3386,7 +3386,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // SL1L2 output line // - else if(lt == stat_sl1l2) { + else if(lt == STATLineType::sl1l2) { for(i=0; isecond, i, sl1l2_info); if(sl1l2_info.scount == 0) continue; @@ -3409,7 +3409,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // SAL1L2 output line // - else if(lt == stat_sal1l2) { + else if(lt == STATLineType::sal1l2) { for(i=0; isecond, i, sl1l2_info); if(sl1l2_info.sacount == 0) continue; @@ -3432,7 +3432,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // PCT output line // - else if(lt == stat_pct) { + else if(lt == STATLineType::pct) { mpr_to_pct(job, it->second, pct_info); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3451,7 +3451,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // PSTD output line // - else if(lt == stat_pstd) { + else if(lt == STATLineType::pstd) { mpr_to_pct(job, it->second, pct_info); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3471,7 +3471,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // PJC output line // - else if(lt == stat_pjc) { + else if(lt == STATLineType::pjc) { mpr_to_pct(job, it->second, pct_info); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3491,7 +3491,7 @@ void write_job_aggr_mpr(STATAnalysisJob &job, STATLineType lt, // // PRC output line // - else if(lt == stat_prc) { + else if(lt == STATLineType::prc) { mpr_to_pct(job, it->second, pct_info); if(job.stat_out) { shc.set_fcst_thresh(job.out_fcst_thresh); @@ -3541,16 +3541,16 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, // n_row = 1 + m.size(); n_col = 1 + job.by_column.n(); - if(lt == stat_vl1l2) n_col += n_vl1l2_columns; - else if(lt == stat_vcnt) n_col += n_vcnt_columns; + if(lt == STATLineType::vl1l2) n_col += n_vl1l2_columns; + else if(lt == STATLineType::vcnt) n_col += n_vcnt_columns; write_job_aggr_hdr(job, n_row, n_col, at); // // Write the rest of the header row // c = 1 + job.by_column.n(); - if(lt == stat_vl1l2) write_header_row(vl1l2_columns, n_vl1l2_columns, 0, at, 0, c); - else if(lt == stat_vcnt) write_header_row(vcnt_columns, n_vcnt_columns, 0, at, 0, c); + if(lt == STATLineType::vl1l2) write_header_row(vl1l2_columns, n_vl1l2_columns, 0, at, 0, c); + else if(lt == STATLineType::vcnt) write_header_row(vcnt_columns, n_vcnt_columns, 0, at, 0, c); // // Setup the output STAT file @@ -3571,7 +3571,7 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_cnt || lt == stat_nbrcnt) shc.set_alpha(job.out_alpha); + if(lt == STATLineType::cnt || lt == STATLineType::nbrcnt) shc.set_alpha(job.out_alpha); write_header_cols(shc, job.stat_at, job.stat_row); } @@ -3583,7 +3583,7 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, // // VL1L2 output line // - if(lt == stat_vl1l2) { + if(lt == STATLineType::vl1l2) { if(job.stat_out) { write_vl1l2_cols(it->second.vl1l2_info, job.stat_at, job.stat_row++, n_header_columns); @@ -3597,7 +3597,7 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, // // VCNT output line // - else if(lt == stat_vcnt) { + else if(lt == STATLineType::vcnt) { if(job.stat_out) { write_vcnt_cols(it->second.vl1l2_info, 0, job.stat_at, job.stat_row++, n_header_columns); @@ -3992,7 +3992,7 @@ void write_job_ramp(STATAnalysisJob &job, // ctc_shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, - stat_ctc); + STATLineType::ctc); // // Compute contingency table statistics, if requested @@ -4000,7 +4000,7 @@ void write_job_ramp(STATAnalysisJob &job, if(job.out_line_type.has(stat_cts_str)) { cts_shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, - stat_cts); + STATLineType::cts); cts_shc.set_alpha(job.out_alpha); cts_info.compute_stats(); cts_info.compute_ci(); @@ -4160,7 +4160,7 @@ void write_job_ss_index(STATAnalysisJob &job, // Format the output STAT header columns // shc = it->second.hdr.get_shc(it->first, job.by_column, - job.hdr_name, job.hdr_value, stat_ssidx); + job.hdr_name, job.hdr_value, STATLineType::ssidx); // // Set FCST/OBS_VAR = skill score index type 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 238ec65629..1380ecc6b3 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h +++ b/src/tools/core/wavelet_stat/wavelet_stat_conf_info.h @@ -34,7 +34,7 @@ static const int n_txt = 1; // Text file type static const STATLineType txt_file_type[n_txt] = { - stat_isc + STATLineType::isc }; //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index 1ac8d60822..b2ca4dc124 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -1734,7 +1734,7 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) { int i, n_rows, n_cols, stat_rows, stat_cols, n_prob; // Check to see if the stat file stream has already been setup - bool init_from_scratch = (stat_out == (ofstream *) 0); + bool init_from_scratch = (stat_out == (ofstream *) nullptr); // Get the maximum number of probability thresholds n_prob = conf_info.get_max_n_prob_thresh(); @@ -1970,13 +1970,13 @@ void write_ctc_stats(const PairDataGenesis &gpd, na_str : gci.VxOpt->VxMaskName.c_str()); // Write out FHO - if(gci.VxOpt->output_map(stat_fho) != STATOutputType::None) { + if(gci.VxOpt->output_map(STATLineType::fho) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { shc.set_fcst_var(genesis_dev_name); shc.set_obs_var (genesis_dev_name); write_fho_row(shc, gci.CTSDev, - gci.VxOpt->output_map(stat_fho), + gci.VxOpt->output_map(STATLineType::fho), stat_at, i_stat_row, txt_at[i_fho], i_txt_row[i_fho]); } @@ -1985,20 +1985,20 @@ void write_ctc_stats(const PairDataGenesis &gpd, shc.set_fcst_var(genesis_ops_name); shc.set_obs_var (genesis_ops_name); write_fho_row(shc, gci.CTSOps, - gci.VxOpt->output_map(stat_fho), + gci.VxOpt->output_map(STATLineType::fho), stat_at, i_stat_row, txt_at[i_fho], i_txt_row[i_fho]); } } // Write out CTC - if(gci.VxOpt->output_map(stat_ctc) != STATOutputType::None) { + if(gci.VxOpt->output_map(STATLineType::ctc) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { shc.set_fcst_var(genesis_dev_name); shc.set_obs_var (genesis_dev_name); write_ctc_row(shc, gci.CTSDev, - gci.VxOpt->output_map(stat_ctc), + gci.VxOpt->output_map(STATLineType::ctc), stat_at, i_stat_row, txt_at[i_ctc], i_txt_row[i_ctc]); } @@ -2007,14 +2007,14 @@ void write_ctc_stats(const PairDataGenesis &gpd, shc.set_fcst_var(genesis_ops_name); shc.set_obs_var (genesis_ops_name); write_ctc_row(shc, gci.CTSOps, - gci.VxOpt->output_map(stat_ctc), + gci.VxOpt->output_map(STATLineType::ctc), stat_at, i_stat_row, txt_at[i_ctc], i_txt_row[i_ctc]); } } // Write out CTS - if(gci.VxOpt->output_map(stat_cts) != STATOutputType::None) { + if(gci.VxOpt->output_map(STATLineType::cts) != STATOutputType::None) { if(gci.VxOpt->DevFlag) { gci.CTSDev.compute_stats(); @@ -2023,7 +2023,7 @@ void write_ctc_stats(const PairDataGenesis &gpd, shc.set_fcst_var(genesis_dev_name); shc.set_obs_var (genesis_dev_name); write_cts_row(shc, gci.CTSDev, - gci.VxOpt->output_map(stat_cts), + gci.VxOpt->output_map(STATLineType::cts), stat_at, i_stat_row, txt_at[i_cts], i_txt_row[i_cts]); } @@ -2035,18 +2035,18 @@ void write_ctc_stats(const PairDataGenesis &gpd, shc.set_fcst_var(genesis_ops_name); shc.set_obs_var (genesis_ops_name); write_cts_row(shc, gci.CTSOps, - gci.VxOpt->output_map(stat_cts), + gci.VxOpt->output_map(STATLineType::cts), stat_at, i_stat_row, txt_at[i_cts], i_txt_row[i_cts]); } } // Write out GENMPR - if(gci.VxOpt->output_map(stat_genmpr) != STATOutputType::None) { + if(gci.VxOpt->output_map(STATLineType::genmpr) != STATOutputType::None) { shc.set_fcst_var(genesis_name); shc.set_obs_var (genesis_name); write_ctc_genmpr_row(shc, gpd, - gci.VxOpt->output_map(stat_genmpr), + gci.VxOpt->output_map(STATLineType::genmpr), stat_at, i_stat_row, txt_at[i_genmpr], i_txt_row[i_genmpr]); } @@ -2219,43 +2219,43 @@ void write_pct_stats(ProbGenPCTInfo &pgi) { shc.set_obs_valid_end(pgi.BestEnd); // Write PCT output - if(pgi.VxOpt->output_map(stat_pct) != STATOutputType::None) { + if(pgi.VxOpt->output_map(STATLineType::pct) != STATOutputType::None) { write_pct_row(shc, pgi.PCTMap[lead_hr], - pgi.VxOpt->output_map(stat_pct), + pgi.VxOpt->output_map(STATLineType::pct), 1, 1, stat_at, i_stat_row, txt_at[i_pct], i_txt_row[i_pct]); } // Write PSTD output - if(pgi.VxOpt->output_map(stat_pstd) != STATOutputType::None) { + if(pgi.VxOpt->output_map(STATLineType::pstd) != STATOutputType::None) { pgi.PCTMap[lead_hr].compute_stats(); pgi.PCTMap[lead_hr].compute_ci(); write_pstd_row(shc, pgi.PCTMap[lead_hr], - pgi.VxOpt->output_map(stat_pstd), + pgi.VxOpt->output_map(STATLineType::pstd), 1, 1, stat_at, i_stat_row, txt_at[i_pstd], i_txt_row[i_pstd]); } // Write PJC output - if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType::None) { + if(pgi.VxOpt->output_map(STATLineType::pjc) != STATOutputType::None) { write_pjc_row(shc, pgi.PCTMap[lead_hr], - pgi.VxOpt->output_map(stat_pjc), + pgi.VxOpt->output_map(STATLineType::pjc), 1, 1, stat_at, i_stat_row, txt_at[i_pjc], i_txt_row[i_pjc]); } // Write PRC output - if(pgi.VxOpt->output_map(stat_pjc) != STATOutputType::None) { + if(pgi.VxOpt->output_map(STATLineType::pjc) != STATOutputType::None) { write_prc_row(shc, pgi.PCTMap[lead_hr], - pgi.VxOpt->output_map(stat_prc), + pgi.VxOpt->output_map(STATLineType::prc), 1, 1, stat_at, i_stat_row, txt_at[i_prc], i_txt_row[i_prc]); } // Write out GENMPR - if(pgi.VxOpt->output_map(stat_genmpr) != STATOutputType::None) { + if(pgi.VxOpt->output_map(STATLineType::genmpr) != STATOutputType::None) { write_pct_genmpr_row(shc, pgi, lead_hr, - pgi.VxOpt->output_map(stat_genmpr), + pgi.VxOpt->output_map(STATLineType::genmpr), stat_at, i_stat_row, txt_at[i_genmpr], i_txt_row[i_genmpr]); } diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h index 65ddd1b3de..900745f43b 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.h @@ -39,14 +39,14 @@ static const int n_txt = 8; // Text file type static const STATLineType txt_file_type[n_txt] = { - stat_fho, // 0 - stat_ctc, // 1 - stat_cts, // 2 - stat_pct, // 3 - stat_pstd, // 4 - stat_pjc, // 5 - stat_prc, // 6 - stat_genmpr // 7 + STATLineType::fho, // 0 + STATLineType::ctc, // 1 + STATLineType::cts, // 2 + STATLineType::pct, // 3 + STATLineType::pstd, // 4 + STATLineType::pjc, // 5 + STATLineType::prc, // 6 + STATLineType::genmpr // 7 }; // Output data type names diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 4fb93c24ef..0c29ff4c9d 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -3689,7 +3689,7 @@ void TCStatJobRIRW::setup_stat_file(int n_row) { OutLineType : LineType); out_lt = (out_sa.n() == 1 ? - string_to_statlinetype(out_sa[0].c_str()) : no_stat_line_type); + string_to_statlinetype(out_sa[0].c_str()) : STATLineType::none); // // Loop through the output line types and determine the number of @@ -3698,8 +3698,8 @@ void TCStatJobRIRW::setup_stat_file(int n_row) { for(i=0, c=0, n_col=0; i " << "unexpected stat line type \"" << statlinetype_to_string(cur_lt) @@ -3741,16 +3741,16 @@ void TCStatJobRIRW::setup_stat_file(int n_row) { // Write the STAT header row // switch(out_lt) { - case stat_ctc: + case STATLineType::ctc: write_header_row(ctc_columns, n_ctc_columns, 1, stat_at, 0, 0); break; - case stat_cts: + case STATLineType::cts: write_header_row(cts_columns, n_cts_columns, 1, stat_at, 0, 0); break; // Write only header columns for unspecified line type - case no_stat_line_type: + case STATLineType::none: write_header_row((const char **) 0, 0, 1, stat_at, 0, 0); break; @@ -4337,10 +4337,10 @@ void TCStatJobProbRIRW::do_output(ostream &out) { out_lt = string_to_statlinetype(OutLineType[i].c_str()); // Write the header columns - if(out_lt == stat_pct) lt_cols = get_n_pct_columns (n); - else if(out_lt == stat_pstd) lt_cols = get_n_pstd_columns(n); - else if(out_lt == stat_prc) lt_cols = get_n_prc_columns (n); - else if(out_lt == stat_pjc) lt_cols = get_n_pjc_columns (n); + if(out_lt == STATLineType::pct) lt_cols = get_n_pct_columns (n); + else if(out_lt == STATLineType::pstd) lt_cols = get_n_pstd_columns(n); + else if(out_lt == STATLineType::prc) lt_cols = get_n_prc_columns (n); + else if(out_lt == STATLineType::pjc) lt_cols = get_n_pjc_columns (n); else { mlog << Error << "\nvoid TCStatJobProbRIRW::do_output(ostream &out) -> " << "unsupported output line type \"" << OutLineType[i] << "\"\n\n"; @@ -4371,10 +4371,10 @@ void TCStatJobProbRIRW::do_output(ostream &out) { out_at.set_entry(r, c++, ByColumn[j]); // Write the header columns - if(out_lt == stat_pct) write_pct_header_row (0, n, out_at, r, c); - else if(out_lt == stat_pstd) write_pstd_header_row(0, n, out_at, r, c); - else if(out_lt == stat_prc) write_prc_header_row (0, n, out_at, r, c); - else if(out_lt == stat_pjc) write_pjc_header_row (0, n, out_at, r, c); + if(out_lt == STATLineType::pct) write_pct_header_row (0, n, out_at, r, c); + else if(out_lt == STATLineType::pstd) write_pstd_header_row(0, n, out_at, r, c); + else if(out_lt == STATLineType::prc) write_prc_header_row (0, n, out_at, r, c); + else if(out_lt == STATLineType::pjc) write_pjc_header_row (0, n, out_at, r, c); // Loop over the map entries and populate the output table for(it=ProbRIRWMap.begin(),r=1; it!=ProbRIRWMap.end(); it++,r++) { @@ -4399,7 +4399,7 @@ void TCStatJobProbRIRW::do_output(ostream &out) { out_at.set_entry(r, c++, sa[j]); // Compute PSTD statistics - if(out_lt == stat_pstd) { + if(out_lt == STATLineType::pstd) { it->second.Info.allocate_n_alpha(1); it->second.Info.alpha[0] = OutAlpha; it->second.Info.compute_stats(); @@ -4407,10 +4407,10 @@ void TCStatJobProbRIRW::do_output(ostream &out) { } // Write output columns - if(out_lt == stat_pct) write_pct_cols (it->second.Info, out_at, r, c); - else if(out_lt == stat_pstd) write_pstd_cols(it->second.Info, 0, out_at, r, c); - else if(out_lt == stat_prc) write_prc_cols (it->second.Info, out_at, r, c); - else if(out_lt == stat_pjc) write_pjc_cols (it->second.Info, out_at, r, c); + if(out_lt == STATLineType::pct) write_pct_cols (it->second.Info, out_at, r, c); + else if(out_lt == STATLineType::pstd) write_pstd_cols(it->second.Info, 0, out_at, r, c); + else if(out_lt == STATLineType::prc) write_prc_cols (it->second.Info, out_at, r, c); + else if(out_lt == STATLineType::pjc) write_pjc_cols (it->second.Info, out_at, r, c); } // end for it // Write the table for the current output line type From 8fad8f24e6ef09bf197f099ed97d42834d7ccbfe Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 05:17:58 +0000 Subject: [PATCH 50/72] #2830 Changed Action to enum class --- src/libcode/vx_pb_util/pblock.cc | 4 ++-- src/libcode/vx_pb_util/pblock.h | 2 +- src/tools/dev_utils/pbtime.cc | 2 +- src/tools/other/pb2nc/pb2nc.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcode/vx_pb_util/pblock.cc b/src/libcode/vx_pb_util/pblock.cc index 057720e528..f8b2f3cecc 100644 --- a/src/libcode/vx_pb_util/pblock.cc +++ b/src/libcode/vx_pb_util/pblock.cc @@ -67,11 +67,11 @@ void pblock(const char *infile, const char *outfile, Action action) { // switch(action) { - case block: + case Action::block: do_blocking(in, out, padsize); break; - case unblock: + case Action::unblock: do_unblocking(in, out, padsize); break; diff --git a/src/libcode/vx_pb_util/pblock.h b/src/libcode/vx_pb_util/pblock.h index 015daaa4c1..43a4b32fe5 100644 --- a/src/libcode/vx_pb_util/pblock.h +++ b/src/libcode/vx_pb_util/pblock.h @@ -31,7 +31,7 @@ enum class PadSize { //////////////////////////////////////////////////////////////////////// -enum Action { +enum class Action { block, unblock, diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index 85a228d41f..fc63f7952f 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -78,7 +78,7 @@ int met_main(int argc, char *argv[]) { blk_file = make_temp_file_name("/tmp/tmp_pbtime_blk", nullptr); // Block the PrepBufr file and open it for reading. - pblock(pb_file.c_str(), blk_file.c_str(), block); + pblock(pb_file.c_str(), blk_file.c_str(), Action::block); // Open the blocked temp PrepBufr file for reading openpb_(blk_file.c_str(), &file_unit); diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index b4d4456882..2561288484 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -930,7 +930,7 @@ void process_pbfile(int i_pb) { // Assume that the input PrepBufr file is unblocked. // Block the PrepBufr file and open it for reading. - pblock(file_name.c_str(), blk_file.c_str(), block); + pblock(file_name.c_str(), blk_file.c_str(), Action::block); // Dump the contents of the PrepBufr file to ASCII files if(dump_flag) { @@ -2140,7 +2140,7 @@ void process_pbfile_metadata(int i_pb) { // Assume that the input PrepBufr file is unblocked. // Block the PrepBufr file and open it for reading. - pblock(file_name.c_str(), blk_file.c_str(), block); + pblock(file_name.c_str(), blk_file.c_str(), Action::block); unit = dump_unit + i_pb + file_unit; if (unit > MAX_FORTRAN_FILE_ID || unit < MIN_FORTRAN_FILE_ID) { From 6d8a3c7053f28a17177fa1701ce0d5165a7e42f9 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 05:24:37 +0000 Subject: [PATCH 51/72] #2830 Changed ModeDataType to enum class --- src/libcode/vx_shapedata/engine.cc | 14 ++-- src/libcode/vx_shapedata/mode_conf_info.cc | 74 +++++++++++----------- src/libcode/vx_shapedata/mode_conf_info.h | 4 +- src/libcode/vx_shapedata/mode_data_type.h | 16 ++--- src/tools/core/mode/mode_exec.cc | 14 ++-- src/tools/core/mode/multivar_data.cc | 2 +- src/tools/core/mode/multivar_frontend.cc | 12 ++-- 7 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index 0bafe99679..dcc5840a47 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -192,7 +192,7 @@ void ModeFuzzyEngine::init_from_scratch() { clear_features(); - data_type = ModeDataType_Traditional; + data_type = ModeDataType::Traditional; return; } @@ -249,9 +249,9 @@ void ModeFuzzyEngine::clear_colors() { void ModeFuzzyEngine::set(const ShapeData &fcst_wd, const ShapeData &obs_wd) { - if (data_type == ModeDataType_MvMode_Fcst) { + if (data_type == ModeDataType::MvMode_Fcst) { set_fcst(fcst_wd); - } else if (data_type == ModeDataType_MvMode_Obs) { + } else if (data_type == ModeDataType::MvMode_Obs) { set_obs(obs_wd); } else { ConcatString path; @@ -280,9 +280,9 @@ void ModeFuzzyEngine::set(const ShapeData &fcst_wd, const ShapeData &obs_wd) void ModeFuzzyEngine::set_no_conv(const ShapeData &fcst_wd, const ShapeData &obs_wd) { - if (data_type == ModeDataType_MvMode_Fcst) { + if (data_type == ModeDataType::MvMode_Fcst) { set_fcst_no_conv(fcst_wd); - } else if (data_type == ModeDataType_MvMode_Obs) { + } else if (data_type == ModeDataType::MvMode_Obs) { set_obs_no_conv ( obs_wd); } else { ConcatString path; @@ -311,9 +311,9 @@ void ModeFuzzyEngine::set_only_split(const ShapeData &fcst_wd, const ShapeData & { - if (data_type == ModeDataType_MvMode_Fcst) { + if (data_type == ModeDataType::MvMode_Fcst) { set_fcst_only_split (fcst_wd); - } else if (data_type == ModeDataType_MvMode_Obs) { + } else if (data_type == ModeDataType::MvMode_Obs) { set_obs_only_split ( obs_wd); } else { ConcatString path; diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index a46d678289..642db14034 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -267,7 +267,7 @@ void ModeConfInfo::clear() Obs = 0; // so traditional mode will have the right value - data_type = ModeDataType_Traditional; + data_type = ModeDataType::Traditional; N_fields_f = 0; N_fields_o = 0; @@ -301,7 +301,7 @@ void ModeConfInfo::read_config(const char * default_file_name, const char * user void ModeConfInfo::process_config_traditional(GrdFileType ftype, GrdFileType otype) { process_config_except_fields(); - process_config_field (ftype, otype, ModeDataType_Traditional, 0); + process_config_field (ftype, otype, ModeDataType::Traditional, 0); } //////////////////////////////////////////////////////////////////////// @@ -513,11 +513,11 @@ void ModeConfInfo::process_config_field(GrdFileType ftype, GrdFileType otype, { set_data_type(dt); - if (data_type == ModeDataType_MvMode_Fcst) { + if (data_type == ModeDataType::MvMode_Fcst) { process_config_fcst(ftype, field_index); - } else if (data_type == ModeDataType_MvMode_Obs) { + } else if (data_type == ModeDataType::MvMode_Obs) { process_config_obs(otype, field_index); @@ -580,7 +580,7 @@ void ModeConfInfo::process_config_both(GrdFileType ftype, GrdFileType otype, evaluate_fcst_settings(field_index); evaluate_obs_settings(field_index); - if (data_type == ModeDataType_Traditional) { + if (data_type == ModeDataType::Traditional) { if ( fcst_array[field_index].conv_radius_array.n_elements() != obs_array[field_index].conv_radius_array.n_elements() ) { @@ -702,7 +702,7 @@ void ModeConfInfo::config_set_all_percentile_thresholds(const std::vectoris_array() ) { const DictionaryEntry * e = 0; const Dictionary & D = *field; - if (data_type == ModeDataType_Traditional) { + if (data_type == ModeDataType::Traditional) { // traditional mode, extra test if ( (N_fields_f > 0) && (N != N_fields_f) ) { mlog << Error @@ -1098,7 +1098,7 @@ return pwl_if; void ModeConfInfo::set_field_index(int k) { - if (data_type == ModeDataType_MvMode_Obs) { + if (data_type == ModeDataType::MvMode_Obs) { if ( (k < 0) || (k >= N_fields_o) ) { mlog << Error << "\nModeConfInfo::set_field_index(int) -> range check error\n\n"; @@ -1108,7 +1108,7 @@ void ModeConfInfo::set_field_index(int k) Field_Index_f = -1; Obs = obs_array + k; } - else if (data_type == ModeDataType_MvMode_Fcst) { + else if (data_type == ModeDataType::MvMode_Fcst) { if ( (k < 0) || (k >= N_fields_f) ) { mlog << Error << "\nModeConfInfo::set_field_index(int) -> range check error\n\n"; @@ -1144,10 +1144,10 @@ if ( (f_index < 0) || (f_index >= N_fields_f) || (o_index < 0) || Field_Index_f = f_index; Field_Index_o = o_index; -if (data_type != ModeDataType_MvMode_Fcst) { +if (data_type != ModeDataType::MvMode_Fcst) { Obs = obs_array + o_index; } -if (data_type != ModeDataType_MvMode_Obs) { +if (data_type != ModeDataType::MvMode_Obs) { Fcst = fcst_array + f_index; } return; @@ -1220,9 +1220,9 @@ void ModeConfInfo::set_perc_thresh(const DataPlane &dp) // Mode_Field_Info *F; - if (data_type == ModeDataType_MvMode_Obs) { + if (data_type == ModeDataType::MvMode_Obs) { F = Obs; - } else if (data_type == ModeDataType_MvMode_Fcst) { + } else if (data_type == ModeDataType::MvMode_Fcst) { F = Fcst; } else { mlog << Warning @@ -1337,7 +1337,7 @@ return; void ModeConfInfo::set_conv_radius_by_index(int k) { - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { if ( (k < 0) || (k >= Fcst->conv_radius_array.n_elements()) ) { mlog << Error << "\nModeConfInfo::set_conv_radius_by_index(int) -> " @@ -1346,7 +1346,7 @@ void ModeConfInfo::set_conv_radius_by_index(int k) } Fcst->conv_radius = Fcst->conv_radius_array[k]; } - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { if ( (k < 0) || (k >= Obs->conv_radius_array.n_elements()) ) { mlog << Error @@ -1365,10 +1365,10 @@ void ModeConfInfo::set_conv_radius_by_index(int k) void ModeConfInfo::set_conv_thresh(SingleThresh s) { - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { Fcst->conv_thresh = s; } - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { Obs->conv_thresh = s; } } @@ -1377,10 +1377,10 @@ void ModeConfInfo::set_conv_thresh(SingleThresh s) void ModeConfInfo::set_conv_radius(int r) { - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { Fcst->conv_radius = r; } - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { Obs->conv_radius = r; } } @@ -1390,7 +1390,7 @@ void ModeConfInfo::set_conv_radius(int r) void ModeConfInfo::set_conv_thresh_by_index(int k) { - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { if ( (k < 0) || (k >= Obs->conv_thresh_array.n_elements()) ) { mlog << Error << "\nModeConfInfo::set_conv_thresh_by_index(int) -> " @@ -1399,7 +1399,7 @@ void ModeConfInfo::set_conv_thresh_by_index(int k) } Obs->conv_thresh = Obs->conv_thresh_array[k]; } - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { if ( (k < 0) || (k >= Fcst->conv_thresh_array.n_elements()) ) { mlog << Error @@ -1417,10 +1417,10 @@ void ModeConfInfo::set_conv_thresh_by_index(int k) void ModeConfInfo::set_merge_thresh_by_index(int k) { - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { if ( Obs->need_merge_thresh () ) set_obs_merge_thresh_by_index (k); } - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { if ( Fcst->need_merge_thresh () ) set_fcst_merge_thresh_by_index (k); } } @@ -1431,7 +1431,7 @@ void ModeConfInfo::set_merge_thresh_by_index(int k) void ModeConfInfo::set_fcst_merge_thresh_by_index(int k) { - if (data_type == ModeDataType_MvMode_Obs) + if (data_type == ModeDataType::MvMode_Obs) { mlog << Error << "\nModeConfInfo::set_fcst_merge_thresh_by_index(int) -> " @@ -1451,10 +1451,10 @@ void ModeConfInfo::set_fcst_merge_thresh_by_index(int k) void ModeConfInfo::set_conv_thresh_by_merge_index(int k) { - if (data_type != ModeDataType_MvMode_Fcst) { + if (data_type != ModeDataType::MvMode_Fcst) { if (Obs->need_merge_thresh()) set_obs_conv_thresh_by_merge_index (k); } - if (data_type != ModeDataType_MvMode_Obs) { + if (data_type != ModeDataType::MvMode_Obs) { if (Fcst->need_merge_thresh()) set_fcst_conv_thresh_by_merge_index (k); } } @@ -1465,7 +1465,7 @@ void ModeConfInfo::set_conv_thresh_by_merge_index(int k) void ModeConfInfo::set_fcst_conv_thresh_by_merge_index(int k) { - if (data_type == ModeDataType_MvMode_Obs) + if (data_type == ModeDataType::MvMode_Obs) { mlog << Error << "\nModeConfInfo::set_fcst_conv_thresh_by_merge_index(int) -> " @@ -1485,7 +1485,7 @@ void ModeConfInfo::set_fcst_conv_thresh_by_merge_index(int k) void ModeConfInfo::set_obs_conv_thresh_by_merge_index(int k) { - if (data_type == ModeDataType_MvMode_Fcst) + if (data_type == ModeDataType::MvMode_Fcst) { mlog << Error << "\nModeConfInfo::set_obs_conv_thresh_by_merge_index(int) -> " @@ -1502,7 +1502,7 @@ void ModeConfInfo::set_obs_conv_thresh_by_merge_index(int k) void ModeConfInfo::set_fcst_merge_flag(MergeType t) { - if (data_type == ModeDataType_MvMode_Obs) + if (data_type == ModeDataType::MvMode_Obs) { mlog << Error << "\nModeConfInfo::set_fcst_merge_flag(int) -> " @@ -1516,7 +1516,7 @@ void ModeConfInfo::set_fcst_merge_flag(MergeType t) void ModeConfInfo::set_obs_merge_flag(MergeType t) { - if (data_type == ModeDataType_MvMode_Fcst) + if (data_type == ModeDataType::MvMode_Fcst) { mlog << Error << "\nModeConfInfo::set_obs_merge_flag(int) -> " @@ -1530,7 +1530,7 @@ void ModeConfInfo::set_obs_merge_flag(MergeType t) void ModeConfInfo::set_fcst_merge_thresh(SingleThresh s) { - if (data_type == ModeDataType_MvMode_Obs) + if (data_type == ModeDataType::MvMode_Obs) { mlog << Error << "\nModeConfInfo::set_fcst_merge_thresh(int) -> " @@ -1544,7 +1544,7 @@ void ModeConfInfo::set_fcst_merge_thresh(SingleThresh s) void ModeConfInfo::set_obs_merge_thresh(SingleThresh s) { - if (data_type == ModeDataType_MvMode_Fcst) + if (data_type == ModeDataType::MvMode_Fcst) { mlog << Error << "\nModeConfInfo::set_obs_merge_thresh(int) -> " @@ -1560,7 +1560,7 @@ void ModeConfInfo::set_obs_merge_thresh(SingleThresh s) void ModeConfInfo::set_obs_merge_thresh_by_index(int k) { - if (data_type == ModeDataType_MvMode_Fcst) + if (data_type == ModeDataType::MvMode_Fcst) { mlog << Error << "\nModeConfInfo::set_obs_merge_thresh_by_index(int) -> " @@ -1734,7 +1734,7 @@ void ModeConfInfo::check_multivar_not_implemented() } for (int i=0; iconv_radius_array.n_elements() ); } else { @@ -328,7 +328,7 @@ inline int ModeConfInfo::n_conv_threshs() const { // this could break down if multivar mode relaxes // its limitations on number of thresh (obs and fcst could be different) - if (data_type == ModeDataType_MvMode_Obs) + if (data_type == ModeDataType::MvMode_Obs) { return ( Obs->conv_thresh_array.n_elements() ); } else { diff --git a/src/libcode/vx_shapedata/mode_data_type.h b/src/libcode/vx_shapedata/mode_data_type.h index 59f4aea3d2..18696d5fe2 100644 --- a/src/libcode/vx_shapedata/mode_data_type.h +++ b/src/libcode/vx_shapedata/mode_data_type.h @@ -20,10 +20,10 @@ using std::string; enum ModeDataType { - ModeDataType_Traditional, // default - ModeDataType_MvMode_Obs, // mvmode, obs data only - ModeDataType_MvMode_Fcst, // mvmode, fcst data only - ModeDataType_MvMode_Both // mvmode, fcst and obs + Traditional, // default + MvMode_Obs, // mvmode, obs data only + MvMode_Fcst, // mvmode, fcst data only + MvMode_Both // mvmode, fcst and obs }; @@ -33,13 +33,13 @@ inline string sprintModeDataType(ModeDataType type) { switch (type) { - case ModeDataType_MvMode_Obs: + case ModeDataType::MvMode_Obs: return "MvMode_Obs"; - case ModeDataType_MvMode_Fcst: + case ModeDataType::MvMode_Fcst: return "MvMode_Fcst"; - case ModeDataType_MvMode_Both: + case ModeDataType::MvMode_Both: return "MvMode_Both"; - case ModeDataType_Traditional: + case ModeDataType::Traditional: default: return "TraditionalMode"; } diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index fb783ead42..578c92acb7 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -231,7 +231,7 @@ void ModeExecutive::init_multivar_intensities(const ModeConfInfo &conf) engine.conf_info = conf; // tell the engine which type of data it is - engine.set_data_type(ModeDataType_MvMode_Both); + engine.set_data_type(ModeDataType::MvMode_Both); // check one again for multivar problems engine.conf_info.check_multivar_not_implemented(); @@ -426,7 +426,7 @@ void ModeExecutive::setup_verification_grid(const ModeInputData &fcst, // set this local conf to point to forecast 0, so that that regrid info // can be accessed and it can be decided if we are to use fcst or obs // input - engine.conf_info.set_data_type(ModeDataType_MvMode_Fcst); + engine.conf_info.set_data_type(ModeDataType::MvMode_Fcst); engine.conf_info.set_field_index(0); grid = parse_vx_grid(engine.conf_info.Fcst->var_info->regrid(), &fcst._grid, &obs._grid); @@ -915,7 +915,7 @@ void ModeExecutive::do_conv_thresh_multivar_simple(Processing_t p) // string what; - if (conf.data_type == ModeDataType_MvMode_Obs) { + if (conf.data_type == ModeDataType::MvMode_Obs) { what = "observation field"; } else { what = "forecast field"; @@ -1624,7 +1624,7 @@ MultiVarData *ModeExecutive::get_multivar_data(ModeDataType dtype) switch (dtype) { - case ModeDataType_MvMode_Obs: + case ModeDataType::MvMode_Obs: obs_magic_string = engine.conf_info.Obs->var_info->magic_str().c_str(); // replace forward slashes with underscores to prevent new directories replace(obs_magic_string.begin(), obs_magic_string.end(), '/', '_'); @@ -1636,7 +1636,7 @@ MultiVarData *ModeExecutive::get_multivar_data(ModeDataType dtype) mvd->set_conv_thresh_array(engine.conf_info.Obs->conv_thresh_array, simple); mvd->set_merge_thresh_array(engine.conf_info.Obs->merge_thresh_array, simple); break; - case ModeDataType_MvMode_Fcst: + case ModeDataType::MvMode_Fcst: fcst_magic_string = engine.conf_info.Fcst->var_info->magic_str().c_str(); // replace forward slashes with underscores to prevent new directories replace(fcst_magic_string.begin(), fcst_magic_string.end(), '/', '_'); @@ -1664,14 +1664,14 @@ void ModeExecutive::add_multivar_merge_data(MultiVarData *mvd, ModeDataType dtyp bool simple = false; switch (dtype) { - case ModeDataType_MvMode_Obs: + case ModeDataType::MvMode_Obs: mvd->set_obj(engine.obs_split, simple); mvd->set_raw(engine.obs_raw, simple); mvd->set_shapedata(Obs_sd, simple); mvd->set_conv_thresh_array(engine.conf_info.Obs->conv_thresh_array, simple); mvd->set_merge_thresh_array(engine.conf_info.Obs->merge_thresh_array, simple); break; - case ModeDataType_MvMode_Fcst: + case ModeDataType::MvMode_Fcst: mvd->set_obj(engine.fcst_split, simple); mvd->set_raw(engine.fcst_raw, simple); mvd->set_shapedata(Fcst_sd, simple); diff --git a/src/tools/core/mode/multivar_data.cc b/src/tools/core/mode/multivar_data.cc index 3bcfa136f7..b0979e3b45 100644 --- a/src/tools/core/mode/multivar_data.cc +++ b/src/tools/core/mode/multivar_data.cc @@ -138,7 +138,7 @@ void MultiVarData1::_print_summary(const string &name, int *data, const ShapeDat } MultiVarData::MultiVarData() : - _dataType(ModeDataType_MvMode_Both), + _dataType(ModeDataType::MvMode_Both), _simple(0), _merge(0), _name("notset"), diff --git a/src/tools/core/mode/multivar_frontend.cc b/src/tools/core/mode/multivar_frontend.cc index 8941780df3..baa0537791 100644 --- a/src/tools/core/mode/multivar_frontend.cc +++ b/src/tools/core/mode/multivar_frontend.cc @@ -70,14 +70,14 @@ int MultivarFrontEnd::run(const StringArray & Argv) GrdFileType ft, ot; ft = config.file_type_for_field(true, i); ot = parse_conf_file_type(config.conf.lookup_dictionary(conf_key_obs)); - read_input(fcst_filenames[i], i, ModeDataType_MvMode_Fcst, ft, ot, shift); + read_input(fcst_filenames[i], i, ModeDataType::MvMode_Fcst, ft, ot, shift); } for (int i=0; idata_plane(*(config.Fcst->var_info), dp); fcstInput.push_back(ModeInputData(name, dp, g)); @@ -637,7 +637,7 @@ void MultivarFrontEnd::_simple_objects(ModeExecutive::Processing_t p, int j, int n_files, const string &filename, const ModeInputData &input) { - if (dtype == ModeDataType_MvMode_Fcst) { + if (dtype == ModeDataType::MvMode_Fcst) { _init_exec(p, filename, "None"); mode_exec->init_multivar_simple(j, n_files, dtype, config); mode_exec->setup_multivar_fcst_data(verification_grid, input); From df25b8640d173fd833ea4c9984854639d5658ebe Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 06:18:56 +0000 Subject: [PATCH 52/72] #2830 Changed StepCase to enum class --- src/libcode/vx_shapedata/shapedata.cc | 47 ++++++++++++++------------- src/libcode/vx_shapedata/shapedata.h | 2 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/libcode/vx_shapedata/shapedata.cc b/src/libcode/vx_shapedata/shapedata.cc index 94fed61cba..3e4491e380 100644 --- a/src/libcode/vx_shapedata/shapedata.cc +++ b/src/libcode/vx_shapedata/shapedata.cc @@ -35,6 +35,7 @@ #include "shapedata.h" #include "mode_columns.h" +#include "enum_as_int.hpp" #include "vx_log.h" #include "vx_util.h" #include "vx_math.h" @@ -64,7 +65,7 @@ static const bool do_split_fatten = true; static double dot(double, double, double, double); static void boundary_step(const ShapeData &, int &, int &, int &); -static int get_step_case(bool, bool, bool, bool); +static StepCase get_step_case(bool, bool, bool, bool); /////////////////////////////////////////////////////////////////////////////// // @@ -1698,7 +1699,7 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { // switch(direction) { - case(plus_x): + case plus_x: if(sd.s_is_on(xn, yn-1, false)) lr = true; if(sd.s_is_on(xn+1, yn-1, false)) ur = true; if(sd.s_is_on(xn+1, yn , false)) ul = true; @@ -1707,7 +1708,7 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { xn += 1; break; - case(plus_y): + case plus_y: if(sd.s_is_on(xn, yn , false)) lr = true; if(sd.s_is_on(xn, yn+1, false)) ur = true; if(sd.s_is_on(xn-1, yn+1, false)) ul = true; @@ -1716,7 +1717,7 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { yn += 1; break; - case(minus_x): + case minus_x: if(sd.s_is_on(xn-1, yn , false)) lr = true; if(sd.s_is_on(xn-2, yn , false)) ur = true; if(sd.s_is_on(xn-2, yn-1, false)) ul = true; @@ -1725,7 +1726,7 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { xn -= 1; break; - case(minus_y): + case minus_y: if(sd.s_is_on(xn-1, yn-1, false)) lr = true; if(sd.s_is_on(xn-1, yn-2, false)) ur = true; if(sd.s_is_on(xn, yn-2, false)) ul = true; @@ -1745,24 +1746,24 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { // switch(get_step_case(lr, ur, ul, ll)) { - case ll_case: - case lr_ul_case: - case lr_ur_ul_case: + case StepCase::ll_case: + case StepCase::lr_ul_case: + case StepCase::lr_ur_ul_case: // Turn left direction = (direction + 1)%4; if(direction < 0) direction += 4; break; - case lr_case: - case ur_ll_case: - case ur_ul_ll_case: + case StepCase::lr_case: + case StepCase::ur_ll_case: + case StepCase::ur_ul_ll_case: // Turn right direction = (direction - 1)%4; if(direction < 0) direction += 4; break; - case ul_ll_case: - case lr_ur_case: + case StepCase::ul_ll_case: + case StepCase::lr_ur_case: // Continue straight: direction remains unchanged break; @@ -1770,7 +1771,7 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { mlog << Error << "\nboundary_step() -> " << "bad step case: " - << get_step_case(lr, ur, ul, ll) << "\n\n"; + << enum_class_as_int(get_step_case(lr, ur, ul, ll)) << "\n\n"; exit(1); } @@ -1779,38 +1780,38 @@ void boundary_step(const ShapeData &sd, int &xn, int &yn, int &direction) { //////////////////////////////////////////////////////////////////////// -int get_step_case(bool lr, bool ur, bool ul, bool ll) { +StepCase get_step_case(bool lr, bool ur, bool ul, bool ll) { // // Valid cases with exactly one cell on // // Lower Left - if(!lr && !ur && !ul && ll) return ll_case; + if(!lr && !ur && !ul && ll) return StepCase::ll_case; // Lower Right - else if(lr && !ur && !ul && !ll) return lr_case; + else if(lr && !ur && !ul && !ll) return StepCase::lr_case; // // Valid cases with exactly two cells on // // Upper Left, Lower Left - else if(!lr && !ur && ul && ll) return ul_ll_case; + else if(!lr && !ur && ul && ll) return StepCase::ul_ll_case; // Lower Right, Upper Right - else if(lr && ur && !ul && !ll) return lr_ur_case; + else if(lr && ur && !ul && !ll) return StepCase::lr_ur_case; // Lower Right, Upper Left - else if(lr && !ur && ul && !ll) return lr_ul_case; + else if(lr && !ur && ul && !ll) return StepCase::lr_ul_case; // Upper Right, Lower Left - else if(!lr && ur && !ul && ll) return ur_ll_case; + else if(!lr && ur && !ul && ll) return StepCase::ur_ll_case; // // Valid cases with exactly three cells on // // Upper Right, Upper Left, Lower Left - else if(!lr && ur && ul && ll) return ur_ul_ll_case; + else if(!lr && ur && ul && ll) return StepCase::ur_ul_ll_case; // Lower Right, Upper Right, Upper Left - else if(lr && ur && ul && !ll) return lr_ur_ul_case; + else if(lr && ur && ul && !ll) return StepCase::lr_ur_ul_case; // // Otherwise, combination is invalid diff --git a/src/libcode/vx_shapedata/shapedata.h b/src/libcode/vx_shapedata/shapedata.h index e1acfb55fd..9654844047 100644 --- a/src/libcode/vx_shapedata/shapedata.h +++ b/src/libcode/vx_shapedata/shapedata.h @@ -39,7 +39,7 @@ // // Enumerations used in computing the boundary of a ShapeData object // -enum StepCase { +enum class StepCase { ll_case = 0, lr_case = 1, ul_ll_case = 2, From 1f1d52534f6d9fe74c8870827482400567b7f8a6 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 06:19:38 +0000 Subject: [PATCH 53/72] #2830 Changed enum to enum class --- src/libcode/vx_tc_util/atcf_track_line.cc | 254 +++++++++--------- src/libcode/vx_tc_util/atcf_track_line.h | 42 +-- src/libcode/vx_tc_util/prob_rirw_pair_info.cc | 7 +- src/libcode/vx_tc_util/track_pair_info.cc | 2 +- src/libcode/vx_tc_util/track_point.cc | 18 +- src/tools/tc_utils/tc_pairs/tc_pairs.cc | 2 +- src/tools/tc_utils/tc_stat/tc_stat_job.cc | 8 +- 7 files changed, 167 insertions(+), 166 deletions(-) diff --git a/src/libcode/vx_tc_util/atcf_track_line.cc b/src/libcode/vx_tc_util/atcf_track_line.cc index ae9806b64b..8dc42d3f42 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.cc +++ b/src/libcode/vx_tc_util/atcf_track_line.cc @@ -189,7 +189,7 @@ int ATCFTrackLine::mslp() const { CycloneLevel ATCFTrackLine::level() const { return(LevelOffset < N_items ? string_to_cyclonelevel(get_item(LevelOffset).c_str()) : - NoCycloneLevel); + CycloneLevel::None); } //////////////////////////////////////////////////////////////////////// @@ -205,7 +205,7 @@ int ATCFTrackLine::wind_intensity() const { QuadrantType ATCFTrackLine::quadrant() const { return(QuadrantOffset < N_items ? string_to_quadranttype(get_item(QuadrantOffset).c_str()) : - NoQuadrantType); + QuadrantType::None); } //////////////////////////////////////////////////////////////////////// @@ -337,7 +337,7 @@ int ATCFTrackLine::eye_diameter() const { SubregionCode ATCFTrackLine::subregion() const { return(Type == ATCFLineType::Track && SubRegionOffset < N_items ? string_to_subregioncode(get_item(SubRegionOffset).c_str()) : - NoSubregionCode); + SubregionCode::None); } //////////////////////////////////////////////////////////////////////// @@ -369,7 +369,7 @@ ConcatString ATCFTrackLine::storm_name() const { SystemsDepth ATCFTrackLine::depth() const { return(Type == ATCFLineType::Track && DepthOffset < N_items ? string_to_systemsdepth(get_item(DepthOffset).c_str()) : - NoSystemsDepth); + SystemsDepth::None); } //////////////////////////////////////////////////////////////////////// @@ -385,7 +385,7 @@ int ATCFTrackLine::wave_height() const { QuadrantType ATCFTrackLine::seas_code() const { return(Type == ATCFLineType::Track && SeasCodeOffset < N_items ? string_to_quadranttype(get_item(SeasCodeOffset).c_str()) : - NoQuadrantType); + QuadrantType::None); } //////////////////////////////////////////////////////////////////////// @@ -500,19 +500,19 @@ WatchWarnType ww_max(const WatchWarnType t1, const WatchWarnType t2) { // GaleWarn, // StormWarn - if(t1 == HurricaneWarn || - t2 == HurricaneWarn ) t = HurricaneWarn; - else if(t1 == TropicalStormWarn || - t2 == TropicalStormWarn ) t = TropicalStormWarn; - else if(t1 == HurricaneWatch || - t2 == HurricaneWatch ) t = HurricaneWatch; - else if(t1 == TropicalStormWatch || - t2 == TropicalStormWatch ) t = TropicalStormWatch; - else if(t1 == GaleWarn || - t2 == GaleWarn ) t = GaleWarn; - else if(t1 == StormWarn || - t2 == StormWarn ) t = StormWarn; - else t = NoWatchWarnType; + if(t1 == WatchWarnType::HurricaneWarn || + t2 == WatchWarnType::HurricaneWarn ) t = WatchWarnType::HurricaneWarn; + else if(t1 == WatchWarnType::TropicalStormWarn || + t2 == WatchWarnType::TropicalStormWarn ) t = WatchWarnType::TropicalStormWarn; + else if(t1 == WatchWarnType::HurricaneWatch || + t2 == WatchWarnType::HurricaneWatch ) t = WatchWarnType::HurricaneWatch; + else if(t1 == WatchWarnType::TropicalStormWatch || + t2 == WatchWarnType::TropicalStormWatch ) t = WatchWarnType::TropicalStormWatch; + else if(t1 == WatchWarnType::GaleWarn || + t2 == WatchWarnType::GaleWarn ) t = WatchWarnType::GaleWarn; + else if(t1 == WatchWarnType::StormWarn || + t2 == WatchWarnType::StormWarn ) t = WatchWarnType::StormWarn; + else t = WatchWarnType::None; return t; } @@ -522,13 +522,13 @@ WatchWarnType ww_max(const WatchWarnType t1, const WatchWarnType t2) { WatchWarnType int_to_watchwarntype(int i) { WatchWarnType t; - if(i == 1) t = TropicalStormWatch; - else if(i == 2) t = TropicalStormWarn; - else if(i == 3) t = GaleWarn; - else if(i == 4) t = StormWarn; - else if(i == 5) t = HurricaneWatch; - else if(i == 6) t = HurricaneWarn; - else t = NoWatchWarnType; + if(i == 1) t = WatchWarnType::TropicalStormWatch; + else if(i == 2) t = WatchWarnType::TropicalStormWarn; + else if(i == 3) t = WatchWarnType::GaleWarn; + else if(i == 4) t = WatchWarnType::StormWarn; + else if(i == 5) t = WatchWarnType::HurricaneWatch; + else if(i == 6) t = WatchWarnType::HurricaneWarn; + else t = WatchWarnType::None; return t; } @@ -539,13 +539,13 @@ WatchWarnType int_to_watchwarntype(int i) { WatchWarnType string_to_watchwarntype(const char *s) { WatchWarnType t; - if(strcasecmp(s, "TSWATCH") == 0) t = TropicalStormWatch; - else if(strcasecmp(s, "TSWARN") == 0) t = TropicalStormWarn; - else if(strcasecmp(s, "GLWARN") == 0) t = GaleWarn; - else if(strcasecmp(s, "STWARN") == 0) t = StormWarn; - else if(strcasecmp(s, "HUWATCH") == 0) t = HurricaneWatch; - else if(strcasecmp(s, "HUWARN") == 0) t = HurricaneWarn; - else t = NoWatchWarnType; + if(strcasecmp(s, "TSWATCH") == 0) t = WatchWarnType::TropicalStormWatch; + else if(strcasecmp(s, "TSWARN") == 0) t = WatchWarnType::TropicalStormWarn; + else if(strcasecmp(s, "GLWARN") == 0) t = WatchWarnType::GaleWarn; + else if(strcasecmp(s, "STWARN") == 0) t = WatchWarnType::StormWarn; + else if(strcasecmp(s, "HUWATCH") == 0) t = WatchWarnType::HurricaneWatch; + else if(strcasecmp(s, "HUWARN") == 0) t = WatchWarnType::HurricaneWarn; + else t = WatchWarnType::None; return t; } @@ -556,14 +556,14 @@ ConcatString watchwarntype_to_string(const WatchWarnType t) { const char *s = (const char *) nullptr; switch(t) { - case TropicalStormWatch: s = "TSWATCH"; break; - case TropicalStormWarn: s = "TSWARN"; break; - case GaleWarn: s = "GLWARN"; break; - case StormWarn: s = "STWARN"; break; - case HurricaneWatch: s = "HUWATCH"; break; - case HurricaneWarn: s = "HUWARN"; break; - case NoWatchWarnType: s = na_str; break; - default: s = na_str; break; + case WatchWarnType::TropicalStormWatch: s = "TSWATCH"; break; + case WatchWarnType::TropicalStormWarn: s = "TSWARN"; break; + case WatchWarnType::GaleWarn: s = "GLWARN"; break; + case WatchWarnType::StormWarn: s = "STWARN"; break; + case WatchWarnType::HurricaneWatch: s = "HUWATCH"; break; + case WatchWarnType::HurricaneWarn: s = "HUWARN"; break; + case WatchWarnType::None: s = na_str; break; + default: s = na_str; break; } return ConcatString(s); @@ -574,22 +574,22 @@ ConcatString watchwarntype_to_string(const WatchWarnType t) { CycloneLevel string_to_cyclonelevel(const char *s) { CycloneLevel l; - if(strcmp(s, "DB") == 0) l = Disturbance; - else if(strcmp(s, "TD") == 0) l = TropicalDepression; - else if(strcmp(s, "TS") == 0) l = TropicalStorm; - else if(strcmp(s, "TY") == 0) l = Typhoon; - else if(strcmp(s, "ST") == 0) l = SuperTyphoon; - else if(strcmp(s, "TC") == 0) l = TropicalCyclone; - else if(strcmp(s, "HU") == 0) l = Hurricane; - else if(strcmp(s, "SD") == 0) l = SubtropicalDepression; - else if(strcmp(s, "SS") == 0) l = SubtropicalStorm; - else if(strcmp(s, "EX") == 0) l = ExtratropicalSystem; - else if(strcmp(s, "IN") == 0) l = Inland; - else if(strcmp(s, "DS") == 0) l = Dissipating; - else if(strcmp(s, "LO") == 0) l = Low; - else if(strcmp(s, "WV") == 0) l = TropicalWave; - else if(strcmp(s, "ET") == 0) l = Extrapolated; - else /* "XX" */ l = NoCycloneLevel; + if(strcmp(s, "DB") == 0) l = CycloneLevel::Disturbance; + else if(strcmp(s, "TD") == 0) l = CycloneLevel::TropicalDepression; + else if(strcmp(s, "TS") == 0) l = CycloneLevel::TropicalStorm; + else if(strcmp(s, "TY") == 0) l = CycloneLevel::Typhoon; + else if(strcmp(s, "ST") == 0) l = CycloneLevel::SuperTyphoon; + else if(strcmp(s, "TC") == 0) l = CycloneLevel::TropicalCyclone; + else if(strcmp(s, "HU") == 0) l = CycloneLevel::Hurricane; + else if(strcmp(s, "SD") == 0) l = CycloneLevel::SubtropicalDepression; + else if(strcmp(s, "SS") == 0) l = CycloneLevel::SubtropicalStorm; + else if(strcmp(s, "EX") == 0) l = CycloneLevel::ExtratropicalSystem; + else if(strcmp(s, "IN") == 0) l = CycloneLevel::Inland; + else if(strcmp(s, "DS") == 0) l = CycloneLevel::Dissipating; + else if(strcmp(s, "LO") == 0) l = CycloneLevel::Low; + else if(strcmp(s, "WV") == 0) l = CycloneLevel::TropicalWave; + else if(strcmp(s, "ET") == 0) l = CycloneLevel::Extrapolated; + else /* "XX" */ l = CycloneLevel::None; return l; } @@ -600,23 +600,23 @@ ConcatString cyclonelevel_to_string(const CycloneLevel t) { const char *s = (const char *) nullptr; switch(t) { - case Disturbance: s = "DB"; break; - case TropicalDepression: s = "TD"; break; - case TropicalStorm: s = "TS"; break; - case Typhoon: s = "TY"; break; - case SuperTyphoon: s = "ST"; break; - case TropicalCyclone: s = "TC"; break; - case Hurricane: s = "HU"; break; - case SubtropicalDepression: s = "SD"; break; - case SubtropicalStorm: s = "SS"; break; - case ExtratropicalSystem: s = "EX"; break; - case Inland: s = "IN"; break; - case Dissipating: s = "DS"; break; - case Low: s = "LO"; break; - case TropicalWave: s = "WV"; break; - case Extrapolated: s = "ET"; break; - case NoCycloneLevel: s = na_str; break; - default: s = na_str; break; + case CycloneLevel::Disturbance: s = "DB"; break; + case CycloneLevel::TropicalDepression: s = "TD"; break; + case CycloneLevel::TropicalStorm: s = "TS"; break; + case CycloneLevel::Typhoon: s = "TY"; break; + case CycloneLevel::SuperTyphoon: s = "ST"; break; + case CycloneLevel::TropicalCyclone: s = "TC"; break; + case CycloneLevel::Hurricane: s = "HU"; break; + case CycloneLevel::SubtropicalDepression: s = "SD"; break; + case CycloneLevel::SubtropicalStorm: s = "SS"; break; + case CycloneLevel::ExtratropicalSystem: s = "EX"; break; + case CycloneLevel::Inland: s = "IN"; break; + case CycloneLevel::Dissipating: s = "DS"; break; + case CycloneLevel::Low: s = "LO"; break; + case CycloneLevel::TropicalWave: s = "WV"; break; + case CycloneLevel::Extrapolated: s = "ET"; break; + case CycloneLevel::None: s = na_str; break; + default: s = na_str; break; } return ConcatString(s); @@ -628,9 +628,9 @@ CycloneLevel wind_speed_to_cyclonelevel(int s) { CycloneLevel l; // Apply logic to convert wind speed to CycloneLevel - if(s <= 33) l = TropicalDepression; - else if(s <= 63) l = TropicalStorm; - else l = Hurricane; + if(s <= 33) l = CycloneLevel::TropicalDepression; + else if(s <= 63) l = CycloneLevel::TropicalStorm; + else l = CycloneLevel::Hurricane; return l; } @@ -640,16 +640,16 @@ CycloneLevel wind_speed_to_cyclonelevel(int s) { QuadrantType string_to_quadranttype(const char *s) { QuadrantType t; - if(strcmp(s, "AAA") == 0) t = FullCircle; - else if(strcmp(s, "NNQ") == 0) t = N_Quadrant; - else if(strcmp(s, "EEQ") == 0) t = E_Quadrant; - else if(strcmp(s, "SSQ") == 0) t = S_Quadrant; - else if(strcmp(s, "WWQ") == 0) t = W_Quadrant; - else if(strcmp(s, "NEQ") == 0) t = NE_Quadrant; - else if(strcmp(s, "SEQ") == 0) t = SE_Quadrant; - else if(strcmp(s, "SWQ") == 0) t = SW_Quadrant; - else if(strcmp(s, "NWQ") == 0) t = NW_Quadrant; - else t = NoQuadrantType; + if(strcmp(s, "AAA") == 0) t = QuadrantType::FullCircle; + else if(strcmp(s, "NNQ") == 0) t = QuadrantType::N; + else if(strcmp(s, "EEQ") == 0) t = QuadrantType::E; + else if(strcmp(s, "SSQ") == 0) t = QuadrantType::S; + else if(strcmp(s, "WWQ") == 0) t = QuadrantType::W; + else if(strcmp(s, "NEQ") == 0) t = QuadrantType::NE; + else if(strcmp(s, "SEQ") == 0) t = QuadrantType::SE; + else if(strcmp(s, "SWQ") == 0) t = QuadrantType::SW; + else if(strcmp(s, "NWQ") == 0) t = QuadrantType::NW; + else t = QuadrantType::None; return t; } @@ -660,17 +660,17 @@ ConcatString quadranttype_to_string(const QuadrantType t) { const char *s = (const char *) nullptr; switch(t) { - case FullCircle: s = "AAA"; break; - case N_Quadrant: s = "NNQ"; break; - case E_Quadrant: s = "EEQ"; break; - case S_Quadrant: s = "SSQ"; break; - case W_Quadrant: s = "WWQ"; break; - case NE_Quadrant: s = "NEQ"; break; - case SE_Quadrant: s = "SEQ"; break; - case SW_Quadrant: s = "SWQ"; break; - case NW_Quadrant: s = "NWQ"; break; - case NoQuadrantType: s = na_str; break; - default: s = na_str; break; + case QuadrantType::FullCircle: s = "AAA"; break; + case QuadrantType::N: s = "NNQ"; break; + case QuadrantType::E: s = "EEQ"; break; + case QuadrantType::S: s = "SSQ"; break; + case QuadrantType::W: s = "WWQ"; break; + case QuadrantType::NE: s = "NEQ"; break; + case QuadrantType::SE: s = "SEQ"; break; + case QuadrantType::SW: s = "SWQ"; break; + case QuadrantType::NW: s = "NWQ"; break; + case QuadrantType::None: s = na_str; break; + default: s = na_str; break; } return ConcatString(s); @@ -681,16 +681,16 @@ ConcatString quadranttype_to_string(const QuadrantType t) { SubregionCode string_to_subregioncode(const char *s) { SubregionCode c; - if(strcmp(s, "A") == 0) c = Arabian_Sea; - else if(strcmp(s, "B") == 0) c = Bay_of_Bengal; - else if(strcmp(s, "C") == 0) c = Central_Pacific; - else if(strcmp(s, "E") == 0) c = Eastern_Pacific; - else if(strcmp(s, "L") == 0) c = Atlantic; - else if(strcmp(s, "P") == 0) c = South_Pacific; - else if(strcmp(s, "Q") == 0) c = South_Atlantic; - else if(strcmp(s, "S") == 0) c = South_IO; - else if(strcmp(s, "W") == 0) c = Western_Pacific; - else c = NoSubregionCode; + if(strcmp(s, "A") == 0) c = SubregionCode::Arabian_Sea; + else if(strcmp(s, "B") == 0) c = SubregionCode::Bay_of_Bengal; + else if(strcmp(s, "C") == 0) c = SubregionCode::Central_Pacific; + else if(strcmp(s, "E") == 0) c = SubregionCode::Eastern_Pacific; + else if(strcmp(s, "L") == 0) c = SubregionCode::Atlantic; + else if(strcmp(s, "P") == 0) c = SubregionCode::South_Pacific; + else if(strcmp(s, "Q") == 0) c = SubregionCode::South_Atlantic; + else if(strcmp(s, "S") == 0) c = SubregionCode::South_IO; + else if(strcmp(s, "W") == 0) c = SubregionCode::Western_Pacific; + else c = SubregionCode::None; return c; } @@ -701,17 +701,17 @@ ConcatString subregioncode_to_string(const SubregionCode t) { const char *s = (const char *) nullptr; switch(t) { - case Arabian_Sea: s = "A"; break; - case Bay_of_Bengal: s = "B"; break; - case Central_Pacific: s = "C"; break; - case Eastern_Pacific: s = "E"; break; - case Atlantic: s = "L"; break; - case South_Pacific: s = "P"; break; - case South_Atlantic: s = "Q"; break; - case South_IO: s = "S"; break; - case Western_Pacific: s = "W"; break; - case NoSubregionCode: s = na_str; break; - default: s = na_str; break; + case SubregionCode::Arabian_Sea: s = "A"; break; + case SubregionCode::Bay_of_Bengal: s = "B"; break; + case SubregionCode::Central_Pacific: s = "C"; break; + case SubregionCode::Eastern_Pacific: s = "E"; break; + case SubregionCode::Atlantic: s = "L"; break; + case SubregionCode::South_Pacific: s = "P"; break; + case SubregionCode::South_Atlantic: s = "Q"; break; + case SubregionCode::South_IO: s = "S"; break; + case SubregionCode::Western_Pacific: s = "W"; break; + case SubregionCode::None : s = na_str; break; + default: s = na_str; break; } return ConcatString(s); @@ -722,10 +722,10 @@ ConcatString subregioncode_to_string(const SubregionCode t) { SystemsDepth string_to_systemsdepth(const char *s) { SystemsDepth d; - if(strcmp(s, "D") == 0) d = DeepDepth; - else if(strcmp(s, "M") == 0) d = MediumDepth; - else if(strcmp(s, "S") == 0) d = ShallowDepth; - else d = NoSystemsDepth; + if(strcmp(s, "D") == 0) d = SystemsDepth::Deep; + else if(strcmp(s, "M") == 0) d = SystemsDepth::Medium; + else if(strcmp(s, "S") == 0) d = SystemsDepth::Shallow; + else d = SystemsDepth::None; return d; } @@ -736,11 +736,11 @@ ConcatString systemsdepth_to_string(const SystemsDepth t) { const char *s = (const char *) nullptr; switch(t) { - case DeepDepth: s = "D"; break; - case MediumDepth: s = "M"; break; - case ShallowDepth: s = "S"; break; - case NoSystemsDepth: s = na_str; break; - default: s = na_str; break; + case SystemsDepth::Deep: s = "D"; break; + case SystemsDepth::Medium: s = "M"; break; + case SystemsDepth::Shallow: s = "S"; break; + case SystemsDepth::None: s = na_str; break; + default: s = na_str; break; } return ConcatString(s); diff --git a/src/libcode/vx_tc_util/atcf_track_line.h b/src/libcode/vx_tc_util/atcf_track_line.h index 9fc3896071..e7c9606904 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.h +++ b/src/libcode/vx_tc_util/atcf_track_line.h @@ -26,7 +26,7 @@ //////////////////////////////////////////////////////////////////////// -enum WatchWarnType { +enum class WatchWarnType { TropicalStormWatch, // Tropical Storm Watch TropicalStormWarn, // Tropical Storm Warning @@ -36,7 +36,7 @@ enum WatchWarnType { HurricaneWatch, // Hurricane Watch HurricaneWarn, // Hurricane Warning - NoWatchWarnType + None }; extern WatchWarnType ww_max(const WatchWarnType, const WatchWarnType); @@ -46,7 +46,7 @@ extern ConcatString watchwarntype_to_string(const WatchWarnType); //////////////////////////////////////////////////////////////////////// -enum CycloneLevel { +enum class CycloneLevel { Disturbance, // DB TropicalDepression, // TD TropicalStorm, // TS @@ -67,7 +67,7 @@ enum CycloneLevel { TropicalWave, // WV Extrapolated, // ET - NoCycloneLevel // XX + None // XX }; extern CycloneLevel string_to_cyclonelevel(const char *); @@ -76,20 +76,20 @@ extern CycloneLevel wind_speed_to_cyclonelevel(int); //////////////////////////////////////////////////////////////////////// -enum QuadrantType { +enum class QuadrantType { FullCircle, // AAA - N_Quadrant, // NNQ - E_Quadrant, // EEQ - S_Quadrant, // SSQ - W_Quadrant, // WWQ + N, // NNQ + E, // EEQ + S, // SSQ + W, // WWQ - NE_Quadrant, // NEQ - SE_Quadrant, // SEQ - SW_Quadrant, // SWQ - NW_Quadrant, // NWQ + NE, // NEQ + SE, // SEQ + SW, // SWQ + NW, // NWQ - NoQuadrantType + None }; extern QuadrantType string_to_quadranttype(const char *); @@ -97,7 +97,7 @@ extern ConcatString quadranttype_to_string(const QuadrantType); //////////////////////////////////////////////////////////////////////// -enum SubregionCode { +enum class SubregionCode { Arabian_Sea, // A Bay_of_Bengal, // B Central_Pacific, // C @@ -107,7 +107,7 @@ enum SubregionCode { South_Atlantic, // Q South_IO, // S Western_Pacific, // W - NoSubregionCode + None }; extern SubregionCode string_to_subregioncode(const char *); @@ -115,11 +115,11 @@ extern ConcatString subregioncode_to_string(const SubregionCode); //////////////////////////////////////////////////////////////////////// -enum SystemsDepth { - DeepDepth, // D - MediumDepth, // M - ShallowDepth, // S - NoSystemsDepth // X +enum class SystemsDepth { + Deep, // D + Medium, // M + Shallow, // S + None // X }; extern SystemsDepth string_to_systemsdepth(const char *); diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 3bd91a89af..94aeaa01fd 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -15,6 +15,7 @@ #include #include +#include "enum_as_int.hpp" #include "prob_rirw_pair_info.h" using namespace std; @@ -80,7 +81,7 @@ void ProbRIRWPairInfo::clear() { XErr = YErr = bad_data_double; BBegV = BEndV = bad_data_double; BMinV = BMaxV = bad_data_double; - BBegLev = BEndLev = NoCycloneLevel; + BBegLev = BEndLev = CycloneLevel::None; Line.clear(); return; @@ -102,9 +103,9 @@ void ProbRIRWPairInfo::dump(ostream &out, int indent_depth) const { << prefix << "XErr = " << XErr << "\n" << prefix << "YErr = " << YErr << "\n" << prefix << "BBegV = " << BBegV << "\n" - << prefix << "BBegLev = " << BBegLev << "\n" + << prefix << "BBegLev = " << enum_class_as_int(BBegLev) << "\n" << prefix << "BEndV = " << BEndV << "\n" - << prefix << "BEndLev = " << BEndLev << "\n" + << prefix << "BEndLev = " << enum_class_as_int(BEndLev) << "\n" << prefix << "BMinV = " << BMinV << "\n" << prefix << "BMaxV = " << BMaxV << "\n" << prefix << "ProbRIRW: " << "\n"; diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index 0a807f2862..2fd84368a7 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -567,7 +567,7 @@ int TrackPairInfo::i_init() const { //////////////////////////////////////////////////////////////////////// WatchWarnType TrackPairInfo::watch_warn(int i) const { - WatchWarnType ww_type = NoWatchWarnType; + WatchWarnType ww_type = WatchWarnType::None; // Only check points common to both the ADECK and BDECK tracks if(!is_bad_data(ADeck[i].lat()) && !is_bad_data(ADeck[i].lon()) && diff --git a/src/libcode/vx_tc_util/track_point.cc b/src/libcode/vx_tc_util/track_point.cc index 09ec2d68a5..6a32d4ac9d 100644 --- a/src/libcode/vx_tc_util/track_point.cc +++ b/src/libcode/vx_tc_util/track_point.cc @@ -230,32 +230,32 @@ void QuadInfo::set_quad_vals(QuadrantType ref_quad, switch(ref_quad) { // Full circle radius is stored in the first radius - case(FullCircle): + case QuadrantType::FullCircle: ALVal = rad1; break; - case(NE_Quadrant): + case QuadrantType::NE: NEVal = rad1; SEVal = rad2; SWVal = rad3; NWVal = rad4; break; - case(SE_Quadrant): + case QuadrantType::SE: NEVal = rad4; SEVal = rad1; SWVal = rad2; NWVal = rad3; break; - case(SW_Quadrant): + case QuadrantType::SW: NEVal = rad3; SEVal = rad4; SWVal = rad1; NWVal = rad2; break; - case(NW_Quadrant): + case QuadrantType::NW: NEVal = rad2; SEVal = rad3; SWVal = rad4; @@ -263,7 +263,7 @@ void QuadInfo::set_quad_vals(QuadrantType ref_quad, break; // Nothing to do - case(NoQuadrantType): + case QuadrantType::None: break; default: @@ -441,7 +441,7 @@ void TrackPoint::clear() { Lon = bad_data_double; Vmax = bad_data_int; MSLP = bad_data_int; - Level = NoCycloneLevel; + Level = CycloneLevel::None; RadP = bad_data_double; RRP = bad_data_double; MRD = bad_data_double; @@ -449,9 +449,9 @@ void TrackPoint::clear() { Eye = bad_data_double; Direction = bad_data_double; Speed = bad_data_double; - Depth = NoSystemsDepth; + Depth = SystemsDepth::None; WarmCore = false; - WatchWarn = NoWatchWarnType; + WatchWarn = WatchWarnType::None; NumMembers = bad_data_int; TrackSpread = bad_data_double; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index dacdb25a74..1516d8745d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -2079,7 +2079,7 @@ void process_watch_warn(TrackPairInfoArray &p) { ww_sid.ws_strip(); // Determine the maximum severity watch/warning in effect - for(i=0, ww_type=NoWatchWarnType; i> dl; diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.cc b/src/tools/tc_utils/tc_stat/tc_stat_job.cc index 0c29ff4c9d..ec8172776c 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.cc @@ -551,10 +551,10 @@ bool TCStatJob::is_keeper_track(const TrackPairInfo &pair, // HUWARN, TSWARN, HUWATCH, TSWATCH if(TrackWatchWarn.has(watchwarntype_to_string(ww_type)) || (TrackWatchWarn.has("ALL") && - (ww_type == HurricaneWarn || - ww_type == TropicalStormWarn || - ww_type == HurricaneWatch || - ww_type == TropicalStormWatch))) { + (ww_type == WatchWarnType::HurricaneWarn || + ww_type == WatchWarnType::TropicalStormWarn || + ww_type == WatchWarnType::HurricaneWatch || + ww_type == WatchWarnType::TropicalStormWatch))) { keep = true; break; } From aebdd2a5f11d66fcc03251d3a416dbf8d4bc31d6 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 15:40:46 +0000 Subject: [PATCH 54/72] #2830 Changed GenesisPairCategory to enum class --- src/libcode/vx_tc_util/pair_data_genesis.cc | 14 ++++++------- src/libcode/vx_tc_util/pair_data_genesis.h | 12 +++++------ src/libcode/vx_tc_util/tc_stat_line.h | 2 +- src/tools/tc_utils/tc_gen/tc_gen.cc | 20 +++++++++---------- src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc | 16 +++++++-------- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/libcode/vx_tc_util/pair_data_genesis.cc b/src/libcode/vx_tc_util/pair_data_genesis.cc index fe03b9bf3a..6eba3517d1 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.cc +++ b/src/libcode/vx_tc_util/pair_data_genesis.cc @@ -31,11 +31,11 @@ ConcatString genesispaircategory_to_string(const GenesisPairCategory c) { const char *s = (const char *) nullptr; switch(c) { - case FYOYGenesis: s = "FYOY"; break; - case FYONGenesis: s = "FYON"; break; - case FNOYGenesis: s = "FNOY"; break; - case DiscardGenesis: s = "DISCARD"; break; - default: s = na_str; break; + case GenesisPairCategory::FYOY: s = "FYOY"; break; + case GenesisPairCategory::FYON: s = "FYON"; break; + case GenesisPairCategory::FNOY: s = "FNOY"; break; + case GenesisPairCategory::Discard: s = "DISCARD"; break; + default: s = na_str; break; } return ConcatString(s); @@ -59,8 +59,8 @@ void GenesisPairDiff::clear() { DevDist = bad_data_double; DevDSec = bad_data_int; OpsDSec = bad_data_int; - DevCategory = NoGenesisPairCategory; - OpsCategory = NoGenesisPairCategory; + DevCategory = GenesisPairCategory::None; + OpsCategory = GenesisPairCategory::None; return; } diff --git a/src/libcode/vx_tc_util/pair_data_genesis.h b/src/libcode/vx_tc_util/pair_data_genesis.h index 8b248e2084..89b0a5b2f6 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.h +++ b/src/libcode/vx_tc_util/pair_data_genesis.h @@ -28,12 +28,12 @@ // //////////////////////////////////////////////////////////////////////// -enum GenesisPairCategory { - FYOYGenesis, // Hit - FYONGenesis, // False Alarm - FNOYGenesis, // Miss - DiscardGenesis, // Discard - NoGenesisPairCategory +enum class GenesisPairCategory { + FYOY, // Hit + FYON, // False Alarm + FNOY, // Miss + Discard, // Discard + None }; extern ConcatString genesispaircategory_to_string(const GenesisPairCategory); diff --git a/src/libcode/vx_tc_util/tc_stat_line.h b/src/libcode/vx_tc_util/tc_stat_line.h index 2e75fda869..276fad1638 100644 --- a/src/libcode/vx_tc_util/tc_stat_line.h +++ b/src/libcode/vx_tc_util/tc_stat_line.h @@ -22,7 +22,7 @@ //////////////////////////////////////////////////////////////////////// // Enumerate all the possible line types -enum TCStatLineType { +enum class TCStatLineType { TCMPR, TCDIAG, diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index b2ca4dc124..04e0b0c408 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -705,8 +705,8 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt, << ") is a dev and ops FALSE ALARM.\n"; // FALSE ALARM for both methods - diff.DevCategory = FYONGenesis; - diff.OpsCategory = FYONGenesis; + diff.DevCategory = GenesisPairCategory::FYON; + diff.OpsCategory = GenesisPairCategory::FYON; } // Unmatched BEST genesis (MISS) @@ -719,8 +719,8 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt, << ") is a dev and ops MISS.\n"; // MISS for both methods - diff.DevCategory = FNOYGenesis; - diff.OpsCategory = FNOYGenesis; + diff.DevCategory = GenesisPairCategory::FNOY; + diff.OpsCategory = GenesisPairCategory::FNOY; } // Matched genesis pairs (DISCARD, HIT, or FALSE ALARM) @@ -743,8 +743,8 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt, << " genesis time.\n"; // DISCARD for both methods - diff.DevCategory = DiscardGenesis; - diff.OpsCategory = DiscardGenesis; + diff.DevCategory = GenesisPairCategory::Discard; + diff.OpsCategory = GenesisPairCategory::Discard; } // Check for a HIT else { @@ -769,14 +769,14 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt, << " is a dev method HIT " << offset_cs; // HIT for the development method - diff.DevCategory = FYOYGenesis; + diff.DevCategory = GenesisPairCategory::FYOY; } else { mlog << Debug(4) << case_cs << " is a dev method FALSE ALARM " << offset_cs; // FALSE ALARM for the development method - diff.DevCategory = FYONGenesis; + diff.DevCategory = GenesisPairCategory::FYON; } // Compute init/genesis time offset @@ -796,14 +796,14 @@ void do_genesis_ctc(const TCGenVxOpt &vx_opt, << " is an ops method HIT " << offset_cs; // HIT for the operational method - diff.OpsCategory = FYOYGenesis; + diff.OpsCategory = GenesisPairCategory::FYOY; } else { mlog << Debug(4) << case_cs << " is an ops method FALSE ALARM " << offset_cs; // FALSE ALARM for the operational method - diff.OpsCategory = FYONGenesis; + diff.OpsCategory = GenesisPairCategory::FYON; } } } diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index 274d70d73d..115dad74f6 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -1067,11 +1067,11 @@ void GenCTCInfo::inc_dev(GenesisPairCategory c, const GenesisInfo *bgi) { // Discard - if(c == DiscardGenesis) { + if(c == GenesisPairCategory::Discard) { return; } // Hits - else if(c == FYOYGenesis) { + else if(c == GenesisPairCategory::FYOY) { CTSDev.cts.inc_fy_oy(); inc_pnt(fgi->lat(), fgi->lon(), fdev_fyoy_str); BestDevHitMap[bgi] += 1; @@ -1082,12 +1082,12 @@ void GenCTCInfo::inc_dev(GenesisPairCategory c, } } // False Alarms - else if(c == FYONGenesis) { + else if(c == GenesisPairCategory::FYON) { CTSDev.cts.inc_fy_on(); inc_pnt(fgi->lat(), fgi->lon(), fdev_fyon_str); } // Misses - else if(c == FNOYGenesis) { + else if(c == GenesisPairCategory::FNOY) { CTSDev.cts.inc_fn_oy(); // Count all BEST track genesis pairs @@ -1110,11 +1110,11 @@ void GenCTCInfo::inc_ops(GenesisPairCategory c, const GenesisInfo *bgi) { // Discard - if(c == DiscardGenesis) { + if(c == GenesisPairCategory::Discard) { return; } // Hits - else if(c == FYOYGenesis) { + else if(c == GenesisPairCategory::FYOY) { CTSOps.cts.inc_fy_oy(); inc_pnt(fgi->lat(), fgi->lon(), fops_fyoy_str); BestOpsHitMap[bgi] += 1; @@ -1125,12 +1125,12 @@ void GenCTCInfo::inc_ops(GenesisPairCategory c, } } // False Alarms - else if(c == FYONGenesis) { + else if(c == GenesisPairCategory::FYON) { CTSOps.cts.inc_fy_on(); inc_pnt(fgi->lat(), fgi->lon(), fops_fyon_str); } // Misses - else if(c == FNOYGenesis) { + else if(c == GenesisPairCategory::FNOY) { CTSOps.cts.inc_fn_oy(); // Count all BEST track genesis pairs From 00380dc5845eaea0a5c68fdecdd546f72d778cae Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 17:21:20 +0000 Subject: [PATCH 55/72] #2830 Removed rediundabt parenrthese --- src/basic/vx_util/interp_util.cc | 76 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc index aeb08d31ae..b5cb88c412 100644 --- a/src/basic/vx_util/interp_util.cc +++ b/src/basic/vx_util/interp_util.cc @@ -960,61 +960,61 @@ double compute_sfc_interp(const DataPlane &dp, // Compute the interpolated value for the fields above and below switch(mthd) { - case(InterpMthd::Min): // Minimum + case InterpMthd::Min: // Minimum v = interp_min(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd::Max): // Maximum + case InterpMthd::Max: // Maximum v = interp_max(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd::Median): // Median + case InterpMthd::Median: // Median v = interp_median(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd::UW_Mean): // Unweighted Mean + case InterpMthd::UW_Mean: // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, interp_thresh, &sfc_mask); break; - case(InterpMthd::DW_Mean): // Distance-Weighted Mean + case InterpMthd::DW_Mean: // Distance-Weighted Mean v = interp_dw_mean(dp, *gt, obs_x, obs_y, dw_mean_pow, interp_thresh, &sfc_mask); break; - case(InterpMthd::LS_Fit): // Least-squares fit + case InterpMthd::LS_Fit: // Least-squares fit v = interp_ls_fit(dp, *gt, obs_x, obs_y, interp_thresh, &sfc_mask); break; - case(InterpMthd::Bilin): // Bilinear interpolation + case InterpMthd::Bilin: // Bilinear interpolation v = interp_bilin(dp, wrap_lon, obs_x, obs_y, &sfc_mask); break; - case(InterpMthd::Nearest): // Nearest Neighbor + case InterpMthd::Nearest: // Nearest Neighbor v = interp_xy(dp, wrap_lon, x, y, &sfc_mask); break; - case(InterpMthd::Best): // Best Match + case InterpMthd::Best: // Best Match v = interp_best(dp, *gt, x, y, obs_v, interp_thresh, &sfc_mask); break; - case(InterpMthd::Upper_Left): // Upper Left corner of the grid box + case InterpMthd::Upper_Left: // Upper Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y), &sfc_mask); break; - case(InterpMthd::Upper_Right): // Upper Right corner of the grid box + case InterpMthd::Upper_Right: // Upper Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y), &sfc_mask); break; - case(InterpMthd::Lower_Right): // Lower Right corner of the grid box + case InterpMthd::Lower_Right: // Lower Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y), &sfc_mask); break; - case(InterpMthd::Lower_Left): // Lower Left corner of the grid box + case InterpMthd::Lower_Left: // Lower Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y), &sfc_mask); break; - case(InterpMthd::Geog_Match): // Geography Match for surface point verification + case InterpMthd::Geog_Match: // Geography Match for surface point verification v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v, &sfc_mask); break; @@ -1129,66 +1129,66 @@ double compute_horz_interp(const DataPlane &dp, // Compute the interpolated value for the fields above and below switch(mthd) { - case(InterpMthd::Min): // Minimum + case InterpMthd::Min: // Minimum v = interp_min(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd::Max): // Maximum + case InterpMthd::Max: // Maximum v = interp_max(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd::Median): // Median + case InterpMthd::Median: // Median v = interp_median(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd::UW_Mean): // Unweighted Mean + case InterpMthd::UW_Mean: // Unweighted Mean v = interp_uw_mean(dp, *gt, x, y, interp_thresh); break; - case(InterpMthd::DW_Mean): // Distance-Weighted Mean + case InterpMthd::DW_Mean: // Distance-Weighted Mean v = interp_dw_mean(dp, *gt, obs_x, obs_y, dw_mean_pow, interp_thresh); break; - case(InterpMthd::LS_Fit): // Least-squares fit + case InterpMthd::LS_Fit: // Least-squares fit v = interp_ls_fit(dp, *gt, obs_x, obs_y, interp_thresh); break; - case(InterpMthd::Nbrhd): // Neighborhood fractional coverage + case InterpMthd::Nbrhd: // Neighborhood fractional coverage v = interp_nbrhd(dp, *gt, x, y, interp_thresh, cat_thresh, cmn, csd); break; - case(InterpMthd::Bilin): // Bilinear interpolation + case InterpMthd::Bilin: // Bilinear interpolation v = interp_bilin(dp, wrap_lon, obs_x, obs_y); break; - case(InterpMthd::Nearest): // Nearest Neighbor + case InterpMthd::Nearest: // Nearest Neighbor v = interp_xy(dp, wrap_lon, x, y); break; - case(InterpMthd::Best): // Best Match + case InterpMthd::Best: // Best Match v = interp_best(dp, *gt, x, y, obs_v, interp_thresh); break; - case(InterpMthd::Upper_Left): // Upper Left corner of the grid box + case InterpMthd::Upper_Left: // Upper Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y)); break; - case(InterpMthd::Upper_Right): // Upper Right corner of the grid box + case InterpMthd::Upper_Right: // Upper Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y)); break; - case(InterpMthd::Lower_Right): // Lower Right corner of the grid box + case InterpMthd::Lower_Right: // Lower Right corner of the grid box v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y)); break; - case(InterpMthd::Lower_Left): // Lower Left corner of the grid box + case InterpMthd::Lower_Left: // Lower Left corner of the grid box v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y)); break; - case(InterpMthd::Geog_Match): // Geography Match for surface point verification + case InterpMthd::Geog_Match: // Geography Match for surface point verification v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v); break; @@ -1310,33 +1310,33 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2, // Compute interpolation weights switch(mthd) { - case(InterpMthd::Min): // Minimum - case(InterpMthd::Max): // Maximum + case InterpMthd::Min: // Minimum + case InterpMthd::Max: // Maximum w1 = w2 = bad_data_double; break; - case(InterpMthd::UW_Mean): // Unweighted Mean + case InterpMthd::UW_Mean: // Unweighted Mean w1 = w2 = 0.5; break; - case(InterpMthd::DW_Mean): // Distance-Weighted Mean + case InterpMthd::DW_Mean: // Distance-Weighted Mean w1 = (double) (dp2.valid() - to_ut) / (dp2.valid() - dp1.valid()); w2 = (double) (to_ut - dp1.valid()) / (dp2.valid() - dp1.valid()); break; - case(InterpMthd::Nearest): // Nearest Neighbor + case InterpMthd::Nearest: // Nearest Neighbor use_min = ((to_ut - dp1.valid()) <= (dp2.valid() - to_ut)); w1 = (use_min ? 1.0 : 0.0); w2 = (use_min ? 0.0 : 1.0); break; - case(InterpMthd::AW_Mean): // Area-Weighted Mean - case(InterpMthd::Median): // Median - case(InterpMthd::LS_Fit): // Least-squares fit - case(InterpMthd::Bilin): // Bilinear interpolation + case InterpMthd::AW_Mean: // Area-Weighted Mean + case InterpMthd::Median: // Median + case InterpMthd::LS_Fit: // Least-squares fit + case InterpMthd::Bilin: // Bilinear interpolation default: mlog << Error << "\nvalid_time_interp() -> " << "unsupported interpolation method encountered: " From 42c453ea246f2033db912b59bb5e5a6fd883b2bd Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 17:22:12 +0000 Subject: [PATCH 56/72] #2830 Reduced same if checking --- src/libcode/vx_analysis_util/stat_job.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index df2335067a..616c24e62b 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -2799,8 +2799,8 @@ ConcatString STATAnalysisJob::get_jobstring() const { } } - // Jobs which use out_eclv_points if(line_type.n() > 0) { + // Jobs which use out_eclv_points if(string_to_statlinetype(line_type[0].c_str()) == STATLineType::mpr && out_line_type.has(stat_eclv_str)) { @@ -2809,10 +2809,8 @@ ConcatString STATAnalysisJob::get_jobstring() const { js << "-out_eclv_points " << out_eclv_points[i] << " "; } } - } - // Jobs which perform bootstrapping - if(line_type.n() > 0) { + // Jobs which perform bootstrapping type = string_to_statlinetype(line_type[0].c_str()); if(type == STATLineType::mpr && (out_line_type.has(stat_cts_str) || From 2bd5dcf2f61adcae3acc01efa7bf854162e26889 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 17:23:51 +0000 Subject: [PATCH 57/72] #2830 Cleanup --- src/libcode/vx_analysis_util/stat_job.h | 2 +- src/libcode/vx_plot_util/vx_plot_util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 0916056e19..208c6d4894 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -70,7 +70,7 @@ enum class STATJobType { containing the aggregated counts/scores. */ aggr_stat = 3, /* Aggregate the input counts/scores and - // generate the requested output line type. */ + generate the requested output line type. */ go_index = 4, /* Compute the GO Index. */ diff --git a/src/libcode/vx_plot_util/vx_plot_util.h b/src/libcode/vx_plot_util/vx_plot_util.h index f6aee66625..4d8aedfe7d 100644 --- a/src/libcode/vx_plot_util/vx_plot_util.h +++ b/src/libcode/vx_plot_util/vx_plot_util.h @@ -37,7 +37,7 @@ //////////////////////////////////////////////////////////////////////////////// -//enum Projection {satellite, lambert, mercator} Projection; +/* enum Projection {satellite, lambert, mercator} Projection; */ //////////////////////////////////////////////////////////////////////////////// From 1f32746d54716acf5a48c8f7b9373def1d896182 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 17:24:22 +0000 Subject: [PATCH 58/72] #2830 USe empty() instead of lebgth checking --- src/tools/other/gen_vx_mask/gen_vx_mask.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 621a48ec92..e4c14b557b 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -334,7 +334,7 @@ void process_mask_file(DataPlane &dp) { // For solar masking, parse the valid time from gridded data if(is_solar_masktype(mask_type) && solar_ut == (unixtime) 0) { - if(mask_field_str.length() == 0) { + if(mask_field_str.empty()) { mlog << Error << "\nprocess_mask_file() -> " << "use \"-mask_field\" to specify the data whose valid " << "time should be used for \"solar_alt\" and " @@ -349,7 +349,7 @@ void process_mask_file(DataPlane &dp) { } // Check that mask_field has been set for data masking - if(mask_type == MaskType::Data && mask_field_str.length() == 0) { + if(mask_type == MaskType::Data && mask_field_str.empty()) { mlog << Error << "\nprocess_mask_file() -> " << "use \"-mask_field\" to specify the field for " << "\"data\" masking.\n\n"; From 08117402350d4c78b891c78b558a212065b22e88 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 5 Apr 2024 20:00:04 +0000 Subject: [PATCH 59/72] #2830 Adjusted indentations --- src/libcode/vx_analysis_util/stat_job.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 616c24e62b..573c0f43d6 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -1706,7 +1706,7 @@ int STATAnalysisJob::set_job_type(const char *c) { job_type = string_to_statjobtype(c); if(job_type == STATJobType::None) return 1; - else return 0; + else return 0; } //////////////////////////////////////////////////////////////////////// @@ -2726,7 +2726,7 @@ ConcatString STATAnalysisJob::get_jobstring() const { } // Jobs which use out_alpha - if(job_type == STATJobType::summary || + if(job_type == STATJobType::summary || out_line_type.has(stat_cts_str) || out_line_type.has(stat_mcts_str) || out_line_type.has(stat_cnt_str) || From e71debf96065a7e43e7e861258fab473f34ac382 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 8 Apr 2024 09:37:29 -0600 Subject: [PATCH 60/72] Feature #2379 develop sonarqube updates (#2850) * Per #2379, move rgb2ctable.py into the python utility scripts directory for better organization and to enable convenient SonarQube scanning. * Per #2379, remove point.py from the vx_python3_utils directory which cleary was inadvertenlty added during development 4 years ago. As far as I can tell it isn't being called by any other code and doesn't belong in the repository. Note that scripts/python/met/point.py has the same name but is entirely different. * Per #2379, update the GHA SonarQube scan to do a single one with Python and C++ combined. The nightly build script is still doing 2 separate scans for now. If this all works well, they could also be combined into a single one. * Per #2379, eliminate MET_CONFIG_OPTIONS from the SonarQube workflow since it doesn't need to be and probably shouldn't be configurable. * Per #2379, trying to copy report-task.txt out of the image * Per #2379, update build_met_sonarqube.sh to check the scan return status * Per #2379, fix bash assignment syntax * Per #2379, remove unused SCRIPT_DIR envvar * Per #2379, switch to a single SonarQube scan for MET's nightly build as well --- .github/jobs/build_sonarqube_image.sh | 5 +- .github/workflows/sonarqube.yml | 18 +----- internal/scripts/docker/Dockerfile.sonarqube | 1 - .../scripts/docker/build_met_sonarqube.sh | 62 +++++++------------ .../sonarqube/python.sonar-project.properties | 17 ----- internal/scripts/sonarqube/run_sonarqube.sh | 44 +++++-------- .../sonarqube/sonar-project.properties | 16 +++-- .../python/utility}/rgb2ctable.py | 0 src/libcode/vx_python3_utils/point.py | 39 ------------ 9 files changed, 49 insertions(+), 153 deletions(-) delete mode 100644 internal/scripts/sonarqube/python.sonar-project.properties rename {data/colortables/NCL_colortables => scripts/python/utility}/rgb2ctable.py (100%) delete mode 100644 src/libcode/vx_python3_utils/point.py diff --git a/.github/jobs/build_sonarqube_image.sh b/.github/jobs/build_sonarqube_image.sh index 9cdeea3395..55d558624b 100755 --- a/.github/jobs/build_sonarqube_image.sh +++ b/.github/jobs/build_sonarqube_image.sh @@ -28,7 +28,6 @@ time_command docker build -t ${DOCKERHUB_TAG} \ --build-arg MET_BASE_REPO \ --build-arg MET_BASE_TAG \ --build-arg SOURCE_BRANCH \ - --build-arg MET_CONFIG_OPTS \ --build-arg SONAR_SCANNER_VERSION \ --build-arg SONAR_HOST_URL \ --build-arg SONAR_TOKEN \ @@ -41,6 +40,6 @@ fi # Copy the .scannerwork directory from the image id=$(docker create ${DOCKERHUB_TAG}) -time_command docker cp $id:/met/.scannerwork /tmp/met_scannerwork +time_command mkdir -p /tmp/scannerwork +time_command docker cp $id:/met/.scannerwork/report-task.txt /tmp/scannerwork/report-task.txt docker rm -v $id - diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 36c2ccc02d..6a6627fb69 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -64,26 +64,15 @@ jobs: MET_BASE_TAG: v3.2 SOURCE_BRANCH: ${{ steps.get_branch_name.outputs.branch_name }} WD_REFERENCE_BRANCH: ${{ github.event.inputs.reference_branch }} - MET_CONFIG_OPTS: '--enable-all' SONAR_SCANNER_VERSION: 5.0.1.3006 SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: SonarQube Python Quality Gate check - id: sonarqube-python-quality-gate-check + - name: SonarQube Quality Gate check + id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master with: - scanMetadataReportFile: /tmp/met_scannerwork/python-report-task.txt - timeout-minutes: 5 - env: - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: SonarQube CXX Quality Gate check - id: sonarqube-cxx-quality-gate-check - uses: sonarsource/sonarqube-quality-gate-action@master - with: - scanMetadataReportFile: /tmp/met_scannerwork/cxx-report-task.txt + scanMetadataReportFile: /tmp/scannerwork/report-task.txt timeout-minutes: 5 env: SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} @@ -100,4 +89,3 @@ jobs: name: logs_sonarqube path: ${{ runner.workspace }}/logs if-no-files-found: ignore - diff --git a/internal/scripts/docker/Dockerfile.sonarqube b/internal/scripts/docker/Dockerfile.sonarqube index 156fa14bf7..75dc3c952c 100644 --- a/internal/scripts/docker/Dockerfile.sonarqube +++ b/internal/scripts/docker/Dockerfile.sonarqube @@ -92,4 +92,3 @@ RUN if [ ! -e "${MET_REPO_DIR}/configure.ac" ]; then \ RUN cd ${MET_REPO_DIR} \ && internal/scripts/docker/build_met_sonarqube.sh - diff --git a/internal/scripts/docker/build_met_sonarqube.sh b/internal/scripts/docker/build_met_sonarqube.sh index f726d8b3b9..45e1d10fc5 100755 --- a/internal/scripts/docker/build_met_sonarqube.sh +++ b/internal/scripts/docker/build_met_sonarqube.sh @@ -5,7 +5,7 @@ # # This build_met_sonarqube.sh script must be run from the top-level # directory of the MET repository to be analyzed. It runs SonarQube to -# scan both the Python and C/C++ MET source code. +# scan the MET source code. # # Usage: internal/scripts/docker/build_met_sonarqube.sh # @@ -48,12 +48,6 @@ if [ -z ${SONAR_REFERENCE_BRANCH+x} ]; then exit 1 fi -# Check whether MET_CONFIG_OPTS is defined -if [ -z ${MET_CONFIG_OPTS+x} ]; then - MET_CONFIG_OPTS='--enable-all' - echo "Setting MET_CONFIG_OPTS=${MET_CONFIG_OPTS} to scan all available options." -fi - # Locate the wrapper WRAPPER_NAME=build-wrapper-linux-x86-64 SONAR_WRAPPER=$(which $WRAPPER_NAME 2> /dev/null) @@ -81,52 +75,33 @@ if [ -z ${SONARQUBE_OUT_DIR} ]; then export SONARQUBE_OUT_DIR=bw-outputs fi +# Define the version string +SONAR_PROJECT_VERSION=$(cat docs/version | cut -d'=' -f2 | tr -d '" ') + # Store the full path to the scripts directory SONAR_PROPERTIES_DIR=internal/scripts/sonarqube SONAR_PROPERTIES=sonar-project.properties -# Copy sonar-project.properties for Python code +# Configure the sonar-project.properties [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES -sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ +sed -e "s|SONAR_PROJECT_KEY|MET-GHA|" \ + -e "s|SONAR_PROJECT_NAME|MET GHA|" \ + -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ - -e "s|SONAR_PROJECT_KEY|MET-GHA-Python|" \ - -e "s|SONAR_PROJECT_NAME|MET GHA Python|" \ + -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \ - -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ - $SONAR_PROPERTIES_DIR/python.sonar-project.properties > $SONAR_PROPERTIES + $SONAR_PROPERTIES_DIR/$SONAR_PROPERTIES > $SONAR_PROPERTIES # The source and reference branches must differ to define new code if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES fi - -# Run SonarQube scan for Python code -time_command $SONAR_SCANNER - -# Copy the Python scan report-task.txt file -mkdir -p /met/.scannerwork -cp .scannerwork/report-task.txt /met/.scannerwork/python-report-task.txt - -# Copy sonar-project.properties for C/C++ code -[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES -sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ - -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ - -e "s|SONAR_PROJECT_KEY|MET-GHA-CXX|" \ - -e "s|SONAR_PROJECT_NAME|MET GHA CXX|" \ - -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \ - -e "s|SONAR_REFERENCE_BRANCH|$SONAR_REFERENCE_BRANCH|" \ - $SONAR_PROPERTIES_DIR/sonar-project.properties > $SONAR_PROPERTIES -# The source and reference branches must differ to define new code -if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then - echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES -fi - -# Run the configure script +# Run the MET configure script time_command ./configure \ BUFRLIB_NAME=${BUFRLIB_NAME} \ GRIB2CLIB_NAME=${GRIB2CLIB_NAME} \ - ${MET_CONFIG_OPTS} \ + --enable-all \ CPPFLAGS="-I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/cairo" \ LIBS="-ltirpc" @@ -136,11 +111,18 @@ time_command make clean # Run SonarQube make time_command $SONAR_WRAPPER --out-dir $SONARQUBE_OUT_DIR make -# Run SonarQube scan for C/C++ code +# Run SonarQube scan time_command $SONAR_SCANNER +status=$? + +# Check return status +if [[ $status -ne 0 ]]; then + echo "ERROR: ${0} -> the SonarQube scan returned with non-zero status (${status})!" + exit ${status} +fi -# Copy the C/C++ scan report-task.txt file +# Copy the scan report-task.txt file mkdir -p /met/.scannerwork -cp .scannerwork/report-task.txt /met/.scannerwork/cxx-report-task.txt +cp .scannerwork/report-task.txt /met/.scannerwork/report-task.txt [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES diff --git a/internal/scripts/sonarqube/python.sonar-project.properties b/internal/scripts/sonarqube/python.sonar-project.properties deleted file mode 100644 index 71b6b36b71..0000000000 --- a/internal/scripts/sonarqube/python.sonar-project.properties +++ /dev/null @@ -1,17 +0,0 @@ -sonar.projectKey=SONAR_PROJECT_KEY -sonar.projectName=SONAR_PROJECT_NAME -sonar.projectVersion=1.0 - -sonar.sources=scripts/python,data/wrappers -sonar.python.version=3.6.3 - -# The build-wrapper output dir - -# Encoding of the source files -sonar.sourceEncoding=UTF-8 - -#----- Default SonarQube server -sonar.host.url=SONAR_HOST_URL - -sonar.token=SONAR_TOKEN -sonar.branch.name=SONAR_BRANCH_NAME diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh index 917158b461..1a57b0b726 100755 --- a/internal/scripts/sonarqube/run_sonarqube.sh +++ b/internal/scripts/sonarqube/run_sonarqube.sh @@ -24,10 +24,10 @@ GIT_REPO="https://github.com/dtcenter/${GIT_REPO_NAME}" function usage { - echo - echo "USAGE: $(basename $0) name" - echo " where \"name\" specifies a branch, tag, or hash." - echo + echo + echo "USAGE: $(basename $0) name" + echo " where \"name\" specifies a branch, tag, or hash." + echo } # Check for arguments @@ -90,7 +90,6 @@ function run_command() { return ${STATUS} } - # Store the full path to the scripts directory SCRIPT_DIR=`dirname $0` if [[ ${0:0:1} != "/" ]]; then SCRIPT_DIR=$(pwd)/${SCRIPT_DIR}; fi @@ -113,48 +112,35 @@ export MET_DEVELOPMENT=true # Run the configure script run_command "./configure --prefix=`pwd` --enable-all" -# Set the build id -#BUILD_ID="MET-${1}" +# Define the version string +SONAR_PROJECT_VERSION=$(grep "^version" docs/conf.py | cut -d'=' -f2 | tr -d "\'\" ") SONAR_PROPERTIES=sonar-project.properties -# Copy sonar-project.properties for Python code +# Configure sonar-project.properties [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES [ -z "$SONAR_HOST_URL" ] && SONAR_HOST_URL="http://localhost:9000" if [ -z "$SONAR_TOKEN" ]; then echo " == ERROR == SONAR_TOKEN is not defined" exit 1 else - sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ - -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ - -e "s|SONAR_PROJECT_KEY|MET_python_NB|" \ - -e "s|SONAR_PROJECT_NAME|MET python Nightly Build|" \ - -e "s|SONAR_BRANCH_NAME|develop|" \ - $SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES - - # Run SonarQube scan for Python code - run_command "$SONAR_SCANNER" - - # Copy sonar-project.properties for C/C++ code [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES - sed -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ - -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ - -e "s|SONAR_PROJECT_KEY|MET_develop_NB|" \ + sed -e "s|SONAR_PROJECT_KEY|MET_NB|" \ -e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \ - -e "s|SONAR_BRANCH_NAME|develop|" \ - $SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES + -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ + -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ + -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ + -e "s|SONAR_BRANCH_NAME|${1}|" \ + $SCRIPT_DIR/$SONAR_PROPERTIES > $SONAR_PROPERTIES # Run SonarQube clean run_command "make clean" - # Run SonarQube make + # Run SonarQube build wrapper run_command "$SONAR_WRAPPER --out-dir $SONARQUBE_OUT_DIR make" - # Run SonarQube scan for C/C++ code + # Run SonarQube scan run_command "$SONAR_SCANNER" [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES fi - -# Run SonarQube report generator to make a PDF file -#TODAY=`date +%Y%m%d` diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index c09f1d31b1..215749e75b 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -1,17 +1,15 @@ +# Project and source code settings sonar.projectKey=SONAR_PROJECT_KEY sonar.projectName=SONAR_PROJECT_NAME -sonar.projectVersion=1.0 - -sonar.sources=src +sonar.projectVersion=SONAR_PROJECT_VERSION +sonar.branch.name=SONAR_BRANCH_NAME +sonar.sources=src,scripts/python,data/wrappers +sonar.python.version=3.6.3 +sonar.sourceEncoding=UTF-8 # The build-wrapper output dir sonar.cfamily.build-wrapper-output=bw-outputs -# Encoding of the source files -sonar.sourceEncoding=UTF-8 - -#----- Default SonarQube server +# SonarQube server sonar.host.url=SONAR_HOST_URL - sonar.token=SONAR_TOKEN -sonar.branch.name=SONAR_BRANCH_NAME diff --git a/data/colortables/NCL_colortables/rgb2ctable.py b/scripts/python/utility/rgb2ctable.py similarity index 100% rename from data/colortables/NCL_colortables/rgb2ctable.py rename to scripts/python/utility/rgb2ctable.py diff --git a/src/libcode/vx_python3_utils/point.py b/src/libcode/vx_python3_utils/point.py deleted file mode 100644 index 699aa46e51..0000000000 --- a/src/libcode/vx_python3_utils/point.py +++ /dev/null @@ -1,39 +0,0 @@ - - -############################################################### - - -import sys - - -############################################################### - -print ('============= start point.py ===========') - -print (sys.argv) - - -############################################################### - - -point_data = [[ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 7, 837.0, 1618, 'NA', 1618 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 11, 837.0, 1618, 'NA', 273.05 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 17, 837.0, 1618, 'NA', 271.85 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 52, 837.0, 1618, 'NA', 92 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 53, 837.0, 1618, 'NA', 0.00417 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 7, 826.0, 1724, 'NA', 1724 ], - [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 11, 826.0, 1724, 'NA', 274.55 ]] - - -############################################################### - - -print (point_data) - - -print ('============= end point.py ===========') - - -############################################################### - - From 2a26d5927204c3521bf53094d3efdfb4e6d6aef3 Mon Sep 17 00:00:00 2001 From: davidalbo Date: Wed, 10 Apr 2024 09:09:42 -0600 Subject: [PATCH 61/72] Feature 2654 ascii2nc polar buoy support (#2846) * Added iabp data type, and modified file_handler to filter based on time range, which was added as a command line option * handle time using input year, hour, min, and doy * cleanup and switch to position day of year for time computations * Added an ascii2nc unit test for iabp data * Added utility scripts to pull iabp data from the web and find files in a time range * Modified iabp_handler to always output a placeholder 'location' observation with value 1 * added description of IABP data python utility scripts * Fixed syntax error * Fixed Another syntax error. * Slight reformat of documentation * Per #2654, update the Makefiles in scripts/python/utility to include all the python scripts that should be installed. * Per #2654, remove unused code from get_iabp_from_web.py that is getting flagged as a bug by SonarQube. * Per #2654, fix typo in docs --------- Co-authored-by: John Halley Gotway Co-authored-by: MET Tools Test Account --- docs/Users_Guide/reformat_point.rst | 53 +++- internal/test_unit/xml/unit_ascii2nc.xml | 15 + scripts/python/utility/Makefile.am | 5 +- scripts/python/utility/Makefile.in | 5 +- .../python/utility/find_iabp_in_timerange.py | 241 ++++++++++++++++ scripts/python/utility/get_iabp_from_web.py | 235 +++++++++++++++ scripts/python/utility/rgb2ctable.py | 0 src/tools/other/ascii2nc/Makefile.am | 1 + src/tools/other/ascii2nc/Makefile.in | 26 +- src/tools/other/ascii2nc/ascii2nc.cc | 73 ++++- src/tools/other/ascii2nc/file_handler.cc | 51 +++- src/tools/other/ascii2nc/file_handler.h | 9 +- src/tools/other/ascii2nc/iabp_handler.cc | 273 ++++++++++++++++++ src/tools/other/ascii2nc/iabp_handler.h | 133 +++++++++ 14 files changed, 1105 insertions(+), 15 deletions(-) create mode 100755 scripts/python/utility/find_iabp_in_timerange.py create mode 100755 scripts/python/utility/get_iabp_from_web.py mode change 100644 => 100755 scripts/python/utility/rgb2ctable.py create mode 100644 src/tools/other/ascii2nc/iabp_handler.cc create mode 100644 src/tools/other/ascii2nc/iabp_handler.h diff --git a/docs/Users_Guide/reformat_point.rst b/docs/Users_Guide/reformat_point.rst index 32695f36b0..ec09fa3f83 100644 --- a/docs/Users_Guide/reformat_point.rst +++ b/docs/Users_Guide/reformat_point.rst @@ -458,6 +458,8 @@ While initial versions of the ASCII2NC tool only supported a simple 11 column AS • `International Soil Moisture Network (ISMN) Data format `_. +• `International Arctic Buoy Programme (IABP) Data format `_. + • `AErosol RObotic NEtwork (AERONET) versions 2 and 3 format `_ • Python embedding of point observations, as described in :numref:`pyembed-point-obs-data`. See example below in :numref:`ascii2nc-pyembed`. @@ -522,6 +524,8 @@ Once the ASCII point observations have been formatted as expected, the ASCII fil netcdf_file [-format ASCII_format] [-config file] + [-valid_beg time] + [-valid_end time] [-mask_grid string] [-mask_poly file] [-mask_sid file|list] @@ -541,21 +545,25 @@ Required Arguments for ascii2nc Optional Arguments for ascii2nc ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3. The **-format ASCII_format** option may be set to "met_point", "little_r", "surfrad", "wwsis", "airnowhourlyaqobs", "airnowhourly", "airnowdaily_v2", "ndbc_standard", "ismn", "aeronet", "aeronetv2", "aeronetv3", or "python". If passing in ISIS data, use the "surfrad" format flag. +3. The **-format ASCII_format** option may be set to "met_point", "little_r", "surfrad", "wwsis", "airnowhourlyaqobs", "airnowhourly", "airnowdaily_v2", "ndbc_standard", "ismn", "iabp", "aeronet", "aeronetv2", "aeronetv3", or "python". If passing in ISIS data, use the "surfrad" format flag. 4. The **-config file** option is the configuration file for generating time summaries. -5. The **-mask_grid** string option is a named grid or a gridded data file to filter the point observations spatially. +5. The **-valid_beg** time option in YYYYMMDD[_HH[MMSS]] format sets the beginning of the retention time window. -6. The **-mask_poly** file option is a polyline masking file to filter the point observations spatially. +6. The **-valid_end** time option in YYYYMMDD[_HH[MMSS]] format sets the end of the retention time window. -7. The **-mask_sid** file|list option is a station ID masking file or a comma-separated list of station ID's to filter the point observations spatially. See the description of the "sid" entry in :numref:`config_options`. +7. The **-mask_grid** string option is a named grid or a gridded data file to filter the point observations spatially. -8. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. +8. The **-mask_poly** file option is a polyline masking file to filter the point observations spatially. -9. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging. +9. The **-mask_sid** file|list option is a station ID masking file or a comma-separated list of station ID's to filter the point observations spatially. See the description of the "sid" entry in :numref:`config_options`. -10. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression. +10. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. + +11. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging. + +12. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression. An example of the ascii2nc calling sequence is shown below: @@ -1203,3 +1211,34 @@ For how to use the script, issue the command: .. code-block:: none python3 MET_BASE/python/utility/print_pointnc2ascii.py -h + +IABP retrieval Python Utilities +==================================== + +`International Arctic Buoy Programme (IABP) Data `_ is one of the data types supported by ascii2nc. A utility script that pulls all this data from the web and stores it locally, called get_iabp_from_web.py is included. This script accesses the appropriate webpage and downloads the ascii files for all buoys. It is straightforward, but can be time intensive as the archive of this data is extensive and files are downloaded one at a time. + +The script can be found at: + +.. code-block:: none + + MET_BASE/python/utility/get_iabp_from_web.py + +For how to use the script, issue the command: + +.. code-block:: none + + python3 MET_BASE/python/utility/get_iabp_from_web.py -h + +Another IABP utility script is included for users, to be run after all files have been downloaded using get_iabp_from_web.py. This script examines all the files and lists those files that contain entries that fall within a user specified range of days. It is called find_iabp_in_timerange.py. + +The script can be found at: + +.. code-block:: none + + MET_BASE/python/utility/find_iabp_in_timerange.py + +For how to use the script, issue the command: + +.. code-block:: none + + python3 MET_BASE/python/utility/find_iabp_in_timerange.py -h diff --git a/internal/test_unit/xml/unit_ascii2nc.xml b/internal/test_unit/xml/unit_ascii2nc.xml index 2dd9df07e7..4424fd0e33 100644 --- a/internal/test_unit/xml/unit_ascii2nc.xml +++ b/internal/test_unit/xml/unit_ascii2nc.xml @@ -211,4 +211,19 @@ + + &MET_BIN;/ascii2nc + \ + -format iabp \ + -valid_beg 20140101 -valid_end 20140201 \ + &DATA_DIR_OBS;/iabp/090629.dat \ + &DATA_DIR_OBS;/iabp/109320.dat \ + &DATA_DIR_OBS;/iabp/109499.dat \ + &OUTPUT_DIR;/ascii2nc/iabp_20140101_20140201.nc + + + &OUTPUT_DIR;/ascii2nc/iabp_20140101_20140201.nc + + + diff --git a/scripts/python/utility/Makefile.am b/scripts/python/utility/Makefile.am index 5efd02b01e..2509cff62b 100644 --- a/scripts/python/utility/Makefile.am +++ b/scripts/python/utility/Makefile.am @@ -26,8 +26,11 @@ pythonutilitydir = $(pkgdatadir)/python/utility pythonutility_DATA = \ + build_ndbc_stations_from_web.py \ + find_iabp_in_timerange.py \ + get_iabp_from_web.py \ print_pointnc2ascii.py \ - build_ndbc_stations_from_web.py + rgb2ctable.py EXTRA_DIST = ${pythonutility_DATA} diff --git a/scripts/python/utility/Makefile.in b/scripts/python/utility/Makefile.in index 4c379b52a6..0b977854db 100644 --- a/scripts/python/utility/Makefile.in +++ b/scripts/python/utility/Makefile.in @@ -311,8 +311,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pythonutilitydir = $(pkgdatadir)/python/utility pythonutility_DATA = \ + build_ndbc_stations_from_web.py \ + find_iabp_in_timerange.py \ + get_iabp_from_web.py \ print_pointnc2ascii.py \ - build_ndbc_stations_from_web.py + rgb2ctable.py EXTRA_DIST = ${pythonutility_DATA} MAINTAINERCLEANFILES = Makefile.in diff --git a/scripts/python/utility/find_iabp_in_timerange.py b/scripts/python/utility/find_iabp_in_timerange.py new file mode 100755 index 0000000000..3aa76d1eff --- /dev/null +++ b/scripts/python/utility/find_iabp_in_timerange.py @@ -0,0 +1,241 @@ + #!/usr/bin/env python3 + +from optparse import OptionParser +import urllib.request +import datetime +from datetime import date +import os +import shutil +import shlex +import errno +from subprocess import Popen, PIPE + + + +#---------------------------------------------- +def usage(): + print("Usage: find_iabp_in_timerange.py -s yyyymmdd -e yyyymmdd [-d PATH]") + +#---------------------------------------------- +def is_date_in_range(input_date, start_date, end_date): + return start_date <= input_date <= end_date + +#---------------------------------------------- +def lookFor(name, inlist, filename, printWarning=False): + rval = -1 + try: + rval = inlist.index(name) + except: + if printWarning: + print(name, " not in header line, file=", filename) + + return rval + +#---------------------------------------------- +def pointToInt(index, tokens, filename): + if index < 0 or index >= len(tokens): + print("ERROR index out of range ", index) + return -1 + return int(tokens[index]) + +#---------------------------------------------- +def pointToFloat(index, tokens, filename): + if index < 0 or index >= len(tokens): + print("ERROR index out of range ", index) + return -99.99 + return float(tokens[index]) + +#---------------------------------------------- +class StationHeader: + def __init__(self, headerLine, filename): + tokens = headerLine.split() + self._ok = True + self._idIndex = lookFor('BuoyID', tokens, filename, True) + self._yearIndex = lookFor('Year', tokens, filename, True) + self._hourIndex = lookFor('Hour', tokens, filename, True) + self._minuteIndex = lookFor('Min', tokens, filename, True) + self._doyIndex = lookFor('DOY', tokens, filename, True) + self._posdoyIndex = lookFor('POS_DOY', tokens, filename, True) + self._latIndex = lookFor('Lat', tokens, filename, True) + self._lonIndex = lookFor('Lon', tokens, filename, True) + self._bpIndex = lookFor('BP', tokens, filename, False) + self._tsIndex = lookFor('Ts', tokens, filename, False) + self._taIndex = lookFor('Ta', tokens, filename, False) + self._ok = self._idIndex != -1 and self._yearIndex != -1 and self._hourIndex != -1 \ + and self._minuteIndex != -1 and self._doyIndex != -1 and self._posdoyIndex != -1 \ + and self._latIndex != -1 and self._lonIndex != -1 + if not self._ok: + print("ERROR badly formed header line") + +#---------------------------------------------- +class Station: + def __init__(self, line, filename, stationHeader): + self._ok = True + tokens = line.split() + self._id = pointToInt(stationHeader._idIndex, tokens, filename) + if self._id < 0: + self._ok = False + self._year = pointToInt(stationHeader._yearIndex, tokens, filename) + if self._year < 0: + self._ok = False + self._hour = pointToInt(stationHeader._hourIndex, tokens, filename) + if self._hour < 0: + self._ok = False + self._minute = pointToInt(stationHeader._minuteIndex, tokens, filename) + if self._minute < 0: + self._ok = False + self._doy = pointToFloat(stationHeader._doyIndex, tokens, filename) + if self._doy < 0: + self._ok = False + if self._doy > 365: + self._ok = False + self._posdoy = pointToFloat(stationHeader._posdoyIndex, tokens, filename) + if self._posdoy < 0: + self._ok = False + if self._posdoy > 365: + self._ok = False + self._lat = pointToFloat(stationHeader._latIndex, tokens, filename) + if self._lat == -99.99: + self._ok = False + self._lon = pointToFloat(stationHeader._lonIndex, tokens, filename) + if self._lon == -99.99: + self._ok = False + if stationHeader._bpIndex >= 0: + self._pressure = pointToFloat(stationHeader._bpIndex, tokens, filename) + else: + self._pressure = -99.99 + if stationHeader._tsIndex >= 0: + self._tempsurface = pointToFloat(stationHeader._tsIndex, tokens, filename) + else: + self._tempsurface = -99.99 + if stationHeader._taIndex >= 0: + self._tempair = pointToFloat(stationHeader._taIndex, tokens, filename) + else: + self._tempair = -99.99 + + if self._ok: + d = datetime.datetime(self._year, 1, 1) + datetime.timedelta(self._doy - 1) + self._month = d.month + self._day = d.day + else: + self._month = -1 + self._day = -1 + def timeInRange(self, start_date, end_date): + if self._ok: + input_date = date(self._year, self._month, self._day) + return is_date_in_range(input_date, start_date, end_date) + else: + return False + +#---------------------------------------------- +class StationTimeSeries: + def __init__(self, stationHeader): + self._stationHeader = stationHeader + self._data = [] + def add(self, line, filename): + s = Station(line, filename, self._stationHeader) + if s._ok: + self._data.append(s) + def print(self): + print("Nothing") + def hasTimesInRange(self, start_date, end_date): + for s in self._data: + if (s.timeInRange(start_date, end_date)): + return True + return False + +#---------------------------------------------- +def doCmd(cmd, debug=False): + #print(cmd) + my_env = os.environ.copy() + args = shlex.split(cmd) + proc = Popen(args, stdout=PIPE, stderr=PIPE, env=my_env) + out, err = proc.communicate() + exitcode = proc.returncode + if exitcode == 0: + return str(out) + else: + if debug: + print("Command failed ", cmd) + return "" + +#---------------------------------------------- +def getdatafilenames(aDir): + if (os.path.exists(aDir)): + allFiles = [name for name in os.listdir(aDir) \ + if not os.path.isdir(os.path.join(aDir, name))] + return [s for s in allFiles if '.dat' in s] + else: + return [] + +#---------------------------------------------- +def run2(data_path, start, end): + + if (data_path[0:2] != "./" and data_path[0] != '/'): + inpath = "./" + data_path + else: + inpath = data_path + + print("data_path = ", inpath) + + # could put testing here to make sure strings will convert + print("start = ", start) + print("end = ", end) + + y0 = int(start[0:4]) + m0 = int(start[4:6]) + d0 = int(start[6:8]) + + y1 = int(end[0:4]) + m1 = int(end[4:6]) + d1 = int(end[6:8]) + + print("Looking for file with data in range ", y0, m0, d0, " to ", y1, m1, d1) + + # read each file that ends in .dat + stationfiles = getdatafilenames(inpath) + stationfiles.sort() + + print("We have ", len(stationfiles), " data files to look at") + start_date = date(y0, m0, d0) + end_date = date(y1, m1, d1) + + for i in range(len(stationfiles)): + + #print("Looking at ", stationfiles[i]) + with open(inpath + "/" + stationfiles[i], 'r') as file: + data_all = file.read() + file.close() + lines = data_all.splitlines() + + # first line is a header, remaining lines are a time series + sh = StationHeader(lines[0], stationfiles[i]) + if sh._ok: + lines = lines[1:] + st = StationTimeSeries(sh) + for l in lines: + st.add(l, stationfiles[i]) + + if (st.hasTimesInRange(start_date, end_date)): + print(stationfiles[i]) + +#---------------------------------------------- +def create_parser_options(parser): + parser.add_option("-d", "--data_path", dest="data_path", + default="./iabp_files", help=" path to the station files (.dat) (default: ./iabp_files)") + parser.add_option("-s", "--start", dest="start", + default="notset", help=" starting yyyymmdd. Must be set") + parser.add_option("-e", "--end", dest="end", + default="notset", help=" ending yyyymmdd. Must be set") + return parser.parse_args() + +#---------------------------------------------- +if __name__ == "__main__": + usage_str = "%prog [options]" + parser = OptionParser(usage = usage_str) + options, args = create_parser_options(parser) + if (options.start == "notset" or options.end == "notset"): + usage() + exit(0) + run2(options.data_path, options.start, options.end) + exit(0) diff --git a/scripts/python/utility/get_iabp_from_web.py b/scripts/python/utility/get_iabp_from_web.py new file mode 100755 index 0000000000..b2a931c8fe --- /dev/null +++ b/scripts/python/utility/get_iabp_from_web.py @@ -0,0 +1,235 @@ + #!/usr/bin/env python3 + +from optparse import OptionParser +import urllib.request +import os +import shutil +import shlex +import errno +from subprocess import Popen, PIPE + +#---------------------------------------------------------------------------- +def makeOrScrub(path, debug=False): + if (debug): + print("Recreating path " + path) + if (os.path.exists(path)): + try: + shutil.rmtree(path) + os.makedirs(path) + except: + print('WARNING: ' + path + ' not completely cleaned out.') + else: + os.makedirs(path) + + +#---------------------------------------------- +def lookFor(name, inlist, filename, printWarning=False): + rval = -1 + try: + rval = inlist.index(name) + except: + if printWarning: + print(name, " not in header line, file=", filename) + + return rval + +#---------------------------------------------- +def pointToInt(index, tokens, filename): + if index < 0 or index >= len(tokens): + print("ERROR index out of range ", index) + return -1 + return int(tokens[index]) + +#---------------------------------------------- +def pointToFloat(index, tokens, filename): + if index < 0 or index >= len(tokens): + print("ERROR index out of range ", index) + return -99.99 + return float(tokens[index]) + +#---------------------------------------------- +class StationHeader: + def __init__(self, headerLine, filename): + tokens = headerLine.split() + self._ok = True + self._idIndex = lookFor('BuoyID', tokens, filename, True) + self._yearIndex = lookFor('Year', tokens, filename, True) + self._hourIndex = lookFor('Hour', tokens, filename, True) + self._minuteIndex = lookFor('Min', tokens, filename, True) + self._doyIndex = lookFor('DOY', tokens, filename, True) + self._posdoyIndex = lookFor('POS_DOY', tokens, filename, True) + self._latIndex = lookFor('Lat', tokens, filename, True) + self._lonIndex = lookFor('Lon', tokens, filename, True) + self._bpIndex = lookFor('Lon', tokens, filename, False) + self._tsIndex = lookFor('Lon', tokens, filename, False) + self._taIndex = lookFor('Lon', tokens, filename, False) + self._ok = self._idIndex != -1 and self._yearIndex != -1 and self._hourIndex != -1 \ + and self._minuteIndex != -1 and self._doyIndex != -1 and self._posdoyIndex != -1 \ + and self._latIndex != -1 and self._lonIndex != -1 + if not self._ok: + print("ERROR badly formed header line") + +#---------------------------------------------- +class Station: + def __init__(self, line, filename, stationHeader): + self._ok = True + tokens = line.split() + self._id = pointToInt(stationHeader._idIndex, tokens, filename) + if self._id < 0: + self._ok = False + self._hour = pointToInt(stationHeader._hourIndex, tokens, filename) + if self._hour < 0: + self._ok = False + self._minute = pointToInt(stationHeader._minuteIndex, tokens, filename) + if self._minute < 0: + self._ok = False + self._doy = pointToFloat(stationHeader._doyIndex, tokens, filename) + if self._doy < 0: + self._ok = False + self._posdoy = pointToFloat(stationHeader._posdoyIndex, tokens, filename) + if self._posdoy < 0: + self._ok = False + self._lat = pointToFloat(stationHeader._latIndex, tokens, filename) + if self._lat == -99.99: + self._ok = False + self._lon = pointToFloat(stationHeader._lonIndex, tokens, filename) + if self._lon == -99.99: + self._ok = False + if stationHeader._bpIndex >= 0: + self._pressure = pointToFloat(stationHeader._bpIndex, tokens, filename) + else: + self._pressure = -99.99 + if stationHeader._tsIndex >= 0: + self._tempsurface = pointToFloat(stationHeader._tsIndex, tokens, filename) + else: + self._tempsurface = -99.99 + if stationHeader._taIndex >= 0: + self._tempair = pointToFloat(stationHeader._taIndex, tokens, filename) + else: + self._tempair = -99.99 + +#---------------------------------------------- +class StationTimeSeries: + def __init__(self, stationHeader): + self._stationHeader = stationHeader + self._data = [] + def add(self, line, filename): + s = Station(line, filename, self._stationHeader) + if s._ok: + self._data.append(s) + def print(self): + print("Nothing") + +#---------------------------------------------- +def doCmd(cmd, debug=False): + #print(cmd) + my_env = os.environ.copy() + args = shlex.split(cmd) + proc = Popen(args, stdout=PIPE, stderr=PIPE, env=my_env) + out, err = proc.communicate() + exitcode = proc.returncode + if exitcode == 0: + return str(out) + else: + if debug: + print("Command failed ", cmd) + return "" + +#---------------------------------------------- +def nextStation(data_all, index_all): + + index_all = data_all.find('.dat', index_all) + data = "" + if index_all == -1: + return -1, data + + #is this the weird (bad) .dat.dat situtation? + teststr = data_all[index_all:index_all+8] + if teststr == ".dat.dat": + indexend = data_all.find('.dat.dat<', index_all+1) + if indexend == -1: + print("Unexpected lack of .dat.dat<") + return -1, data + data = data_all[index_all+10:indexend+8] + else: + indexend = data_all.find('.dat<', index_all+1) + if indexend == -1: + print("UNexpected lack of .dat<") + return -1, data + data = data_all[index_all+6:indexend+4] + return indexend+10, data + +#---------------------------------------------- +def getStation(sfile): + cmd = "wget https://iabp.apl.uw.edu/WebData/" + sfile + print(cmd) + doCmd(cmd, True) + + # parse contents (not used for anything just yet) + with open(sfile, 'r') as file: + data_all = file.read() + file.close() + lines = data_all.splitlines() + + # first line is a header, remaining lines are a time series + sh = StationHeader(lines[0], sfile) + if sh._ok: + lines = lines[1:] + st = StationTimeSeries(sh) + for l in lines: + st.add(l, sfile) + + +#---------------------------------------------- +def run(output_path): + + cwd = os.getcwd() + + if (output_path[0:2] != "./" and output_path[0] != '/'): + outpath = "./" + output_path + else: + outpath = output_path + makeOrScrub(outpath, True) + os.chdir(outpath) + + cmd = "wget https://iabp.apl.uw.edu/WebData" + print(cmd) + s = doCmd(cmd, True) + if not s: + status = False + + stationfiles = [] + with open("WebData", 'r') as file: + data_all = file.read().replace('\n', '') + file.close() + index_all = 0 + while index_all < len(data_all): + index_all, data = nextStation(data_all, index_all) + if (index_all == -1): + break; + stationfiles.append(data) + + print("Parsed out ", len(stationfiles), " individual station files") + + # pull down all the station files + for i in range(len(stationfiles)): + getStation(stationfiles[i]) + + print("created ", len(stationfiles), " station files in ", outpath) + os.chdir(cwd) + +#---------------------------------------------- +def create_parser_options(parser): + parser.add_option("-o", "--output_path", dest="output_path", + default="./iabp_files", help=" create an output path or clear out what is there and put output files to that path (default: ./iabp_files)") + #parser.add_option("-H", "--Help", dest="options", action="store_true", default=False, help = " show usage information (optional, default = False)") + return parser.parse_args() + +#---------------------------------------------- +if __name__ == "__main__": + + usage_str = "%prog [options]" + parser = OptionParser(usage = usage_str) + options, args = create_parser_options(parser) + run(options.output_path) + exit(0) diff --git a/scripts/python/utility/rgb2ctable.py b/scripts/python/utility/rgb2ctable.py old mode 100644 new mode 100755 diff --git a/src/tools/other/ascii2nc/Makefile.am b/src/tools/other/ascii2nc/Makefile.am index 0647687561..ab69ead9f1 100644 --- a/src/tools/other/ascii2nc/Makefile.am +++ b/src/tools/other/ascii2nc/Makefile.am @@ -30,6 +30,7 @@ ascii2nc_SOURCES = ascii2nc.cc \ airnow_locations.cc airnow_locations.h \ aeronet_handler.cc aeronet_handler.h \ ismn_handler.cc ismn_handler.h \ + iabp_handler.cc iabp_handler.h \ $(OPT_PYTHON_SOURCES) ascii2nc_CPPFLAGS = ${MET_CPPFLAGS} -I../../../basic/vx_log diff --git a/src/tools/other/ascii2nc/Makefile.in b/src/tools/other/ascii2nc/Makefile.in index 4c364feb94..ccc217163a 100644 --- a/src/tools/other/ascii2nc/Makefile.in +++ b/src/tools/other/ascii2nc/Makefile.in @@ -110,8 +110,8 @@ am__ascii2nc_SOURCES_DIST = ascii2nc.cc ascii2nc_conf_info.cc \ airnow_handler.h ndbc_handler.cc ndbc_handler.h \ ndbc_locations.cc ndbc_locations.h airnow_locations.cc \ airnow_locations.h aeronet_handler.cc aeronet_handler.h \ - ismn_handler.cc ismn_handler.h python_handler.h \ - python_handler.cc + ismn_handler.cc ismn_handler.h iabp_handler.cc iabp_handler.h \ + python_handler.h python_handler.cc @ENABLE_PYTHON_TRUE@am__objects_1 = ascii2nc-python_handler.$(OBJEXT) am__objects_2 = $(am__objects_1) am_ascii2nc_OBJECTS = ascii2nc-ascii2nc.$(OBJEXT) \ @@ -126,7 +126,8 @@ am_ascii2nc_OBJECTS = ascii2nc-ascii2nc.$(OBJEXT) \ ascii2nc-ndbc_locations.$(OBJEXT) \ ascii2nc-airnow_locations.$(OBJEXT) \ ascii2nc-aeronet_handler.$(OBJEXT) \ - ascii2nc-ismn_handler.$(OBJEXT) $(am__objects_2) + ascii2nc-ismn_handler.$(OBJEXT) \ + ascii2nc-iabp_handler.$(OBJEXT) $(am__objects_2) ascii2nc_OBJECTS = $(am_ascii2nc_OBJECTS) am__DEPENDENCIES_1 = ascii2nc_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @@ -155,6 +156,7 @@ am__depfiles_remade = ./$(DEPDIR)/ascii2nc-aeronet_handler.Po \ ./$(DEPDIR)/ascii2nc-ascii2nc.Po \ ./$(DEPDIR)/ascii2nc-ascii2nc_conf_info.Po \ ./$(DEPDIR)/ascii2nc-file_handler.Po \ + ./$(DEPDIR)/ascii2nc-iabp_handler.Po \ ./$(DEPDIR)/ascii2nc-ismn_handler.Po \ ./$(DEPDIR)/ascii2nc-little_r_handler.Po \ ./$(DEPDIR)/ascii2nc-met_handler.Po \ @@ -392,6 +394,7 @@ ascii2nc_SOURCES = ascii2nc.cc \ airnow_locations.cc airnow_locations.h \ aeronet_handler.cc aeronet_handler.h \ ismn_handler.cc ismn_handler.h \ + iabp_handler.cc iabp_handler.h \ $(OPT_PYTHON_SOURCES) ascii2nc_CPPFLAGS = ${MET_CPPFLAGS} -I../../../basic/vx_log @@ -519,6 +522,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-ascii2nc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-ascii2nc_conf_info.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-file_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-iabp_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-ismn_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-little_r_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-met_handler.Po@am__quote@ # am--include-marker @@ -730,6 +734,20 @@ ascii2nc-ismn_handler.obj: ismn_handler.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-ismn_handler.obj `if test -f 'ismn_handler.cc'; then $(CYGPATH_W) 'ismn_handler.cc'; else $(CYGPATH_W) '$(srcdir)/ismn_handler.cc'; fi` +ascii2nc-iabp_handler.o: iabp_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-iabp_handler.o -MD -MP -MF $(DEPDIR)/ascii2nc-iabp_handler.Tpo -c -o ascii2nc-iabp_handler.o `test -f 'iabp_handler.cc' || echo '$(srcdir)/'`iabp_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-iabp_handler.Tpo $(DEPDIR)/ascii2nc-iabp_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='iabp_handler.cc' object='ascii2nc-iabp_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-iabp_handler.o `test -f 'iabp_handler.cc' || echo '$(srcdir)/'`iabp_handler.cc + +ascii2nc-iabp_handler.obj: iabp_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-iabp_handler.obj -MD -MP -MF $(DEPDIR)/ascii2nc-iabp_handler.Tpo -c -o ascii2nc-iabp_handler.obj `if test -f 'iabp_handler.cc'; then $(CYGPATH_W) 'iabp_handler.cc'; else $(CYGPATH_W) '$(srcdir)/iabp_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-iabp_handler.Tpo $(DEPDIR)/ascii2nc-iabp_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='iabp_handler.cc' object='ascii2nc-iabp_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-iabp_handler.obj `if test -f 'iabp_handler.cc'; then $(CYGPATH_W) 'iabp_handler.cc'; else $(CYGPATH_W) '$(srcdir)/iabp_handler.cc'; fi` + ascii2nc-python_handler.o: python_handler.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-python_handler.o -MD -MP -MF $(DEPDIR)/ascii2nc-python_handler.Tpo -c -o ascii2nc-python_handler.o `test -f 'python_handler.cc' || echo '$(srcdir)/'`python_handler.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-python_handler.Tpo $(DEPDIR)/ascii2nc-python_handler.Po @@ -877,6 +895,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/ascii2nc-ascii2nc.Po -rm -f ./$(DEPDIR)/ascii2nc-ascii2nc_conf_info.Po -rm -f ./$(DEPDIR)/ascii2nc-file_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-iabp_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-ismn_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-little_r_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-met_handler.Po @@ -936,6 +955,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/ascii2nc-ascii2nc.Po -rm -f ./$(DEPDIR)/ascii2nc-ascii2nc_conf_info.Po -rm -f ./$(DEPDIR)/ascii2nc-file_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-iabp_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-ismn_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-little_r_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-met_handler.Po diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index a0c76e0082..940e12cedf 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -86,6 +86,7 @@ #include "airnow_handler.h" #include "ndbc_handler.h" #include "ismn_handler.h" +#include "iabp_handler.h" #ifdef ENABLE_PYTHON #include "global_python.h" @@ -117,6 +118,7 @@ enum class ASCIIFormat { Airnow_hourly, NDBC_standard, ISMN, + IABP, Aeronet_v2, Aeronet_v3, Python, @@ -137,6 +139,10 @@ static MaskPlane mask_area; static MaskPoly mask_poly; static StringArray mask_sid; +// Beginning and ending times +static unixtime valid_beg_ut; +static unixtime valid_end_ut; + static int compress_level = -1; //////////////////////////////////////////////////////////////////////// @@ -152,6 +158,8 @@ static void set_mask_grid(const StringArray &); static void set_mask_poly(const StringArray &); static void set_mask_sid(const StringArray &); static void set_compress(const StringArray &); +static void set_valid_beg_time(const StringArray &); +static void set_valid_end_time(const StringArray &); static void setup_wrapper_path(); @@ -166,6 +174,9 @@ int met_main(int argc, char *argv[]) { // if(argc == 1) { usage(); return 0; } + // Initialize time range + valid_beg_ut = valid_end_ut = (unixtime) 0; + // // Parse the command line into tokens // @@ -184,6 +195,8 @@ int met_main(int argc, char *argv[]) { cline.add(set_mask_grid, "-mask_grid", 1); cline.add(set_mask_poly, "-mask_poly", 1); cline.add(set_mask_sid, "-mask_sid", 1); + cline.add(set_valid_beg_time, "-valid_beg", 1); + cline.add(set_valid_end_time, "-valid_end", 1); cline.add(set_compress, "-compress", 1); // @@ -211,6 +224,17 @@ int met_main(int argc, char *argv[]) { << "Config File: " << config_filename << "\n"; config_info.read_config(DEFAULT_CONFIG_FILENAME, config_filename.text()); + // Check that valid_end_ut >= valid_beg_ut + if(valid_beg_ut != (unixtime) 0 && + valid_end_ut != (unixtime) 0 && + valid_beg_ut > valid_end_ut) { + mlog << Error << "\nmet_main() -> " + << "the ending time (" << unix_to_yyyymmdd_hhmmss(valid_end_ut) + << ") must be greater than the beginning time (" + << unix_to_yyyymmdd_hhmmss(valid_beg_ut) << ").\n\n"; + exit(1); + } + // // Create the file handler based on the ascii format specified on // the command line. If one wasn't specified, we'll look in the @@ -225,7 +249,8 @@ int met_main(int argc, char *argv[]) { if(deflate_level > 9) deflate_level = config_info.get_compression_level(); file_handler->setCompressionLevel(deflate_level); file_handler->setSummaryInfo(config_info.getSummaryInfo()); - + file_handler->setValidTimeRange(valid_beg_ut, valid_end_ut); + // // Set the masking grid and polyline, if specified. // @@ -330,6 +355,10 @@ FileHandler *create_file_handler(const ASCIIFormat format, const ConcatString &a return (FileHandler *) new IsmnHandler(program_name); } + case ASCIIFormat::IABP: { + return((FileHandler *) new IabpHandler(program_name)); + } + case ASCIIFormat::Aeronet_v2: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(2); @@ -375,6 +404,22 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { exit(1); } + // + // See if this is an IABP file. + // put this first as it can have the same number of columns as some + // other ones, which look only at the number of columns + // + f_in.rewind(); + IabpHandler *iabp_file = new IabpHandler(program_name); + + if(iabp_file->isFileType(f_in)) { + f_in.close(); + return((FileHandler *) iabp_file); + } + + delete iabp_file; + + // // See if this is a MET file. // @@ -505,6 +550,8 @@ void usage() { << "\t[-mask_sid file|list]\n" << "\t[-log file]\n" << "\t[-v level]\n" + << "\t[-valid_beg time]\n" + << "\t[-valid_end time]\n" << "\t[-compress level]\n\n" << "\twhere\t\"ascii_file\" is the formatted ASCII " @@ -524,6 +571,7 @@ void usage() { << AirnowHandler::getFormatStringHourly() << "\", \"" << NdbcHandler::getFormatStringStandard() << "\", \"" << IsmnHandler::getFormatString() << "\", \"" + << IabpHandler::getFormatString() << "\", \"" << AeronetHandler::getFormatString() << "\", \"" << AeronetHandler::getFormatString_v2() << "\", \"" << AeronetHandler::getFormatString_v3() << "\""; @@ -556,6 +604,12 @@ void usage() { << "\t\t\"-v level\" overrides the default level of logging (" << mlog.verbosity_level() << ") (optional).\n" + << "\t\t\"-valid_beg time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "beginning of the processed data time window (optional).\n" + + << "\t\t\"-valid_end time\" in YYYYMMDD[_HH[MMSS]] sets the " + << "end of the processed data time window (optional).\n" + << "\t\t\"-compress level\" overrides the compression level of NetCDF variable (" << config_info.get_compression_level() << ") (optional).\n\n" @@ -609,6 +663,9 @@ void set_format(const StringArray & a) { else if(IsmnHandler::getFormatString() == a[0]) { ascii_format = ASCIIFormat::ISMN; } + else if(IabpHandler::getFormatString() == a[0]) { + ascii_format = ASCIIFormat::IABP; + } else if(AeronetHandler::getFormatString() == a[0] || AeronetHandler::getFormatString_v2() == a[0]) { ascii_format = ASCIIFormat::Aeronet_v2; @@ -702,6 +759,20 @@ void set_mask_sid(const StringArray & a) { //////////////////////////////////////////////////////////////////////// +void set_valid_beg_time(const StringArray & a) +{ + valid_beg_ut = timestring_to_unix(a[0].c_str()); +} + +//////////////////////////////////////////////////////////////////////// + +void set_valid_end_time(const StringArray & a) +{ + valid_end_ut = timestring_to_unix(a[0].c_str()); +} + +//////////////////////////////////////////////////////////////////////// + void set_compress(const StringArray & a) { compress_level = atoi(a[0].c_str()); } diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 6e2521f0c8..5495c8b6dc 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -57,7 +57,9 @@ FileHandler::FileHandler(const string &program_name) : use_var_id(false), do_monitor(false), deflate_level(DEF_DEFLATE_LEVEL), - _dataSummarized(false) + _dataSummarized(false), + valid_beg_ut((time_t)0), + valid_end_ut((time_t)0) { } @@ -77,6 +79,12 @@ bool FileHandler::readAsciiFiles(const vector< ConcatString > &ascii_filename_li // Loop through the ASCII files, reading in the observations. At the end of // this loop, all of the observations will be in the _observations vector. + // + // debug counts + // + num_observations_in_range = 0; + num_observations_out_of_range = 0; + for (vector< ConcatString >::const_iterator ascii_filename = ascii_filename_list.begin(); ascii_filename != ascii_filename_list.end(); ++ascii_filename) { @@ -103,6 +111,9 @@ bool FileHandler::readAsciiFiles(const vector< ConcatString > &ascii_filename_li ascii_file.close(); } + mlog << Debug(2) << " Kept " << num_observations_in_range + << " observations, rejected (out of range) " << num_observations_out_of_range + << " observations\n"; return true; } @@ -172,6 +183,14 @@ void FileHandler::setSummaryInfo(const TimeSummaryInfo &summary_info) { //////////////////////////////////////////////////////////////////////// +void FileHandler::setValidTimeRange(const time_t &valid_beg, const time_t valid_end) +{ + valid_beg_ut = valid_beg; + valid_end_ut = valid_end; +} + +//////////////////////////////////////////////////////////////////////// + bool FileHandler::summarizeObs(const TimeSummaryInfo &summary_info) { bool result = summary_obs.summarizeObs(summary_info); @@ -275,6 +294,16 @@ bool FileHandler::_addObservations(const Observation &obs) // if(filters.is_filtered_sid(obs.getStationId().c_str())) return false; + // + // Check if valid time is in range + // + if (_keep_valid_time(obs.getValidTime())) { + num_observations_in_range++; + } else { + num_observations_out_of_range++; + return false; + } + // Save obs because the obs vector is sorted after time summary _observations.push_back(obs); if (do_summary) summary_obs.addObservationObj(obs); @@ -334,3 +363,23 @@ void FileHandler::debug_print_observations(vector< Observation > my_observation, } //////////////////////////////////////////////////////////////////////// + +bool FileHandler::_keep_valid_time(const time_t &valid_time) const +{ + bool keep = true; + + // If valid times are both set, check the range + if (valid_beg_ut != (time_t) 0 && valid_end_ut != (time_t) 0) { + if (valid_time < valid_beg_ut || valid_time > valid_end_ut) keep = false; + } + // If only beg set, check the lower bound + else if (valid_beg_ut != (time_t) 0 && valid_end_ut == (time_t) 0) { + if (valid_time < valid_beg_ut) keep = false; + } + // If only end set, check the upper bound + else if (valid_beg_ut == (time_t) 0 && valid_end_ut != (time_t) 0) { + if (valid_time > valid_end_ut) keep = false; + } + return(keep); +} + diff --git a/src/tools/other/ascii2nc/file_handler.h b/src/tools/other/ascii2nc/file_handler.h index af721c008c..07d77e54f3 100644 --- a/src/tools/other/ascii2nc/file_handler.h +++ b/src/tools/other/ascii2nc/file_handler.h @@ -66,7 +66,7 @@ class FileHandler void setCompressionLevel(int compressoion_level); void setSummaryInfo(bool new_do_summary); void setSummaryInfo(const TimeSummaryInfo &summary_info); - + void setValidTimeRange(const time_t &valid_beg, const time_t valid_end); protected: @@ -114,6 +114,10 @@ class FileHandler TimeSummaryInfo _summaryInfo; SummaryObs summary_obs; + time_t valid_beg_ut, valid_end_ut; + int num_observations_in_range; + int num_observations_out_of_range; + /////////////////////// // Protected methods // /////////////////////// @@ -143,6 +147,9 @@ class FileHandler void _closeNetcdf(); bool _openNetcdf(const std::string &nc_filename); void debug_print_observations(std::vector< Observation >, std::string); + + bool _keep_valid_time(const time_t &valid_time) const; + }; inline void FileHandler::setCompressionLevel(int compressoion_level) { deflate_level = compressoion_level; } diff --git a/src/tools/other/ascii2nc/iabp_handler.cc b/src/tools/other/ascii2nc/iabp_handler.cc new file mode 100644 index 0000000000..71ce27f10c --- /dev/null +++ b/src/tools/other/ascii2nc/iabp_handler.cc @@ -0,0 +1,273 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2024 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +//////////////////////////////////////////////////////////////////////// + +using namespace std; + +#include + +#include "vx_log.h" +#include "vx_math.h" +#include "vx_util.h" + +#include "iabp_handler.h" + +const double IabpHandler::IABP_MISSING_VALUE = -999.0; + + +const int IabpHandler::MIN_NUM_HDR_COLS = 8; + +// days in the month +static int daysOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +static int _lookfor(const DataLine &dl, const string &name); +static int _lookfor(const DataLine &dl, const string &name, const string &ascii_file, bool &ok); +static time_t _time(const string &syear, const string &shour, const string &smin, const string &sdoy); + + +//////////////////////////////////////////////////////////////////////// +// +// Code for class IabpHandler +// +//////////////////////////////////////////////////////////////////////// + +IabpHandler::IabpHandler(const string &program_name) : + FileHandler(program_name) { + use_var_id = true; +} + +//////////////////////////////////////////////////////////////////////// + +IabpHandler::~IabpHandler() { +} + +//////////////////////////////////////////////////////////////////////// + +bool IabpHandler::isFileType(LineDataFile &ascii_file) const { + + // IABP files are identified by having a .dat suffix and + // checking the always present data columns. + // The header look like this: + // BuoyID Year Hour Min DOY POS_DOY Lat Lon [ BP Ts Ta] + + // Initialize using the filename suffix + bool is_file_type = check_prefix_suffix(ascii_file.short_filename(), + nullptr, ".dat"); + + // Read the header line + DataLine dl; + while(dl.n_items() == 0) ascii_file >> dl; + + // Check the minimum number of header columns + if(dl.n_items() < MIN_NUM_HDR_COLS) { + return false; + } + + string line = dl.get_line(); + ConcatString cstring(line); + + StringArray tokens = cstring.split(" "); + if (tokens[0] != "BuoyID") is_file_type = false; + if (tokens[1] != "Year") is_file_type = false; + if (tokens[2] != "Hour") is_file_type = false; + if (tokens[3] != "Min") is_file_type = false; + if (tokens[4] != "DOY") is_file_type = false; + if (tokens[5] != "POS_DOY") is_file_type = false; + if (tokens[6] != "Lat") is_file_type = false; + if (tokens[7] != "Lon") is_file_type = false; + + return(is_file_type); +} + +//////////////////////////////////////////////////////////////////////// +// Private/Protected methods +//////////////////////////////////////////////////////////////////////// + +bool IabpHandler::_readObservations(LineDataFile &ascii_file) +{ + // Read and save the header information + if(!_readHeaderInfo(ascii_file)) return(false); + + string header_type = "IABP_STANDARD"; + + // Process the observation lines + DataLine dl; + while(ascii_file >> dl) { + + // Make sure that the line contains the correct number of tokens + if(dl.n_items() != _numColumns) { + mlog << Error << "\nIabpHandler::_readObervations() -> " + << "unexpected number of columns (" << dl.n_items() + << " != " << _numColumns << ") on line number " + << dl.line_number() << " of IABP file \"" + << ascii_file.filename() << "\"!\n\n"; + return(false); + } + + // Extract the valid time from the data line, using POS_DOY (scientist is most + // interested in location) Use POS_DOY to compute the month and day based on year + // (to handle leap year) + time_t valid_time = _time(dl[_yearPtr], dl[_hourPtr], dl[_minutePtr], dl[_posdoyPtr]); + if(valid_time == 0) { + mlog << Warning << "\nIabpHandler::_readObservations() -> " + << "No valid time computed in file, line number " + << dl.line_number() << " of IABP file \"" + << ascii_file.filename() << "\". Ignore this line\n\n"; + return(false); + } + + double lat = stod(dl[_latPtr]); + double lon = stod(dl[_lonPtr]); + string stationId = dl[_idPtr]; + string quality_flag = na_str; + int grib_code = 0; + double height_m = bad_data_double; + double pres = bad_data_double; + double elev = bad_data_double; + double ts = bad_data_double; + double ta = bad_data_double; + + if (lat == IABP_MISSING_VALUE || lon == IABP_MISSING_VALUE) { + // This is either a rare event or never happens + mlog << Warning << "\nIabpHandler::_readObservations() -> " + << "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); + } + + if (_bpPtr >= 0) { + // is this the right placeholder for this? To always put it in to the + // fixed slot of an observation? + pres = stod(dl[_bpPtr]); + if (pres == IABP_MISSING_VALUE) { + pres = bad_data_double; + } + } + + // Add a location placeholder observation in case neither of the temps are available + // Otherwise there would be no observations for this entry, and we want to have + // valid entries for every time/lat/lon. + _addObservations(Observation( + header_type, stationId, valid_time, + lat, lon, elev, quality_flag, grib_code, + pres, height_m, 1.0, "Location")); + grib_code++; + + if (_tsPtr >= 0) { + ts = stod(dl[_tsPtr]); + if (ts != IABP_MISSING_VALUE) { + _addObservations(Observation( + header_type, stationId, valid_time, + lat, lon, elev, quality_flag, grib_code, + pres, height_m, ts, "Temp_surface")); + grib_code++; + } + } + if (_taPtr >= 0) { + ta = stod(dl[_taPtr]); + if (ta != IABP_MISSING_VALUE) { + _addObservations(Observation( + header_type, stationId, valid_time, + lat, lon, elev, quality_flag, grib_code, + pres, height_m, ta, "Temp_air")); + } + } + + + + } // end while + + return(true); +} + +// //////////////////////////////////////////////////////////////////////// + +bool IabpHandler::_readHeaderInfo(LineDataFile &ascii_file) { + + DataLine dl; + if (!(ascii_file >> dl)) + { + mlog << Error << "\nIabpHandler::_readHeaderInfo() -> " + << "error reading header line from input ASCII file \"" + << ascii_file.filename() << "\"\n\n"; + return false; + } + + // Check the minimum number of header columns + if(dl.n_items() < MIN_NUM_HDR_COLS) { + mlog << Error << "\nIabpHandler::_readHeaderInfo() -> " + << "unexpected number of header columns (" + << dl.n_items() << " < " << MIN_NUM_HDR_COLS + << ") in IABP file \"" << ascii_file.filename() + << "\"!\n\n"; + return(false); + } + + // Map the header information to column numbers + bool ok = true; + string filename = ascii_file.filename(); + _idPtr = _lookfor(dl, "BuoyID", filename, ok); + _yearPtr = _lookfor(dl, "Year", filename, ok); + _hourPtr = _lookfor(dl, "Hour", filename, ok); + _minutePtr = _lookfor(dl, "Min", filename, ok); + _doyPtr = _lookfor(dl, "DOY", filename, ok); + _posdoyPtr = _lookfor(dl, "POS_DOY", filename, ok); + _latPtr = _lookfor(dl, "Lat", filename, ok); + _lonPtr = _lookfor(dl, "Lon", filename, ok); + _numColumns = MIN_NUM_HDR_COLS; + _bpPtr = _lookfor(dl, "BP"); + if (_bpPtr >= 0) ++_numColumns; + _tsPtr = _lookfor(dl, "Ts"); + if (_tsPtr >= 0) ++_numColumns; + _taPtr = _lookfor(dl, "Ta"); + if (_taPtr >= 0) ++_numColumns; + return ok; +} + +//////////////////////////////////////////////////////////////////////// + +static int _lookfor(const DataLine &dl, const string &name, const string &ascii_file, bool &ok) +{ + for (int i=0; i " + << "reading ASCII file \"" + << ascii_file << "\" did not find expected header item:\"" << name << "\" ignore file\n\n"; + ok = false; + return -1; +} + +//////////////////////////////////////////////////////////////////////// + +static int _lookfor(const DataLine &dl, const string &name) +{ + for (int i=0; i +#include + +#include "file_handler.h" + +//////////////////////////////////////////////////////////////////////// +// +// International Arctic Buoy Programme +// https://iabp.apl.uw.edu/data.html +// Files pulled from: +// https://iabp.apl.uw.edu/WebData/ +// +// +// Dataset file names: +// .dat where is an integer. +// +// Dataset Conents: +// +// Buoy data files are updated daily and made available individually at the WebData URL above. +// Values provided are confined to surface temperature,atmospheric temperature, and barometric pressure when these values are available. +// All buoy files contain at least dates and positions. +// Each file has a header line and one or more data lines. +// +// Header Line example (BP Ts and Ta are not always present, any subset could be there or not): +// +// BuoyID Year Hour Min DOY POS_DOY Lat Lon BP Ts Ta +// +// Record Lines (many per file, typically): +// Each file contains data from all buoys on a given date. +// Data includes: BuoyID, year, hour, minute, Day of Year, Position Day of year, +// latitude, longitude, [Barometric Pressure], [Surface Temp], and [Atmospheric Temp]. +// The last 3 values are optional and depend on the header line. +// +// Record line Example +// +// 5318 2014 02 20 28.0970 28.0930 72.75970 -165.25190 1016.62 -999.00 -13.92 +// +// It looks like the missing data value is -999.0, but this might not always be the case, it seems to not be documented. +// + +//////////////////////////////////////////////////////////////////////// + +class IabpHandler : public FileHandler { + + public: + + IabpHandler(const string &program_name); + virtual ~IabpHandler(); + + virtual bool isFileType(LineDataFile &ascii_file) const; + + static string getFormatString() { return "iabp"; } + + protected: + + ///////////////////////// + // Protected constants + ///////////////////////// + + // The minimum number of columns in the header line in the file. + static const int MIN_NUM_HDR_COLS; + + // a missing data value found in some iabp files + static const double IABP_MISSING_VALUE; + + /////////////////////// + // Protected members + /////////////////////// + + // Store list of unqiue output variable names + StringArray _varNames; + + // pointers based on header content + int _idPtr; + int _yearPtr; + int _hourPtr; + int _minutePtr; + int _doyPtr; + int _posdoyPtr; + int _latPtr; + int _lonPtr; + int _bpPtr; + int _tsPtr; + int _taPtr; + + // depends on which of the optional data types are present in a file + int _numColumns; + + string _buoyId; + time_t _validTime; + double _stationLat; + double _stationLon; + double _stationElv; + double _bp; + double _ts; + double _ta; + + /////////////////////// + // Protected methods + /////////////////////// + + // Read and save the header information from the given file + bool _readHeaderInfo(LineDataFile &ascii_file); + + // Get the valid time from the observation line + // Read the observations and add them to the + // _observations vector + virtual bool _readObservations(LineDataFile &ascii_file); + + // compute the time value from inputs + time_t _time2(const string &syear, const string &shour, const string &smin, const string &sdoy); +}; + +//////////////////////////////////////////////////////////////////////// + +#endif /* __IABP_HANDLER_H__ */ + +//////////////////////////////////////////////////////////////////////// From f78720b861fe6a7f8e1a22fd77ff4fdcf5e168c6 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 17 Apr 2024 14:57:13 -0600 Subject: [PATCH 62/72] Feature #2786 rpss_from_prob (#2861) * Per #2786, small change to a an error message unrelated to this development. * Per #2786, add RPSInfo::set_climo_prob() function to derive the RPS line type from climatology probability bins. And update Ensemble-Stat to call it. * Per #2786, minor change to clarify error log message. * Per #2786, for is_prob = TRUE input, the RPS line type is the only output option. Still need to update docs! * Per #2786, add new call to Ensemble-Stat to test computing RPS from climo probabilities * Per #2786, use name rps_climo_bin_prob to be very explicit. * Per #2786, redefine logic of RPSInfo::set_climo_bin_prob() to match the CPC definition. Note that reliability, resolution, uncertainty, and RPSS based on the sample climatology are all set to bad data. Need to investigate whether they can be computed using these inputs. * Per #2786, remove the requirement that any fcst.prob_cat_thresh thresholds must be defined. If they are defined, pass them through to the FCST_THRESH output column. If not, write NA. Add check to make sure the event occurs in exactly 1 category. * Per #2786, don't enforce fcst.prob_cat_thresh == obs.prob_cat_thresh for probabilistic inputs. And add more is_prob checks so that only the RPS line type can be written when given probabilistic inputs. * updated documentation * Per #2786, call rescale_probability() function to convert from 0-100 probs to 0-1 probs. --------- Co-authored-by: j-opatz --- docs/Users_Guide/ensemble-stat.rst | 34 ++- .../EnsembleStatConfig_rps_climo_bin_prob | 223 ++++++++++++++++++ internal/test_unit/xml/unit_ensemble_stat.xml | 20 ++ src/basic/vx_util/thresh_array.cc | 4 +- src/libcode/vx_statistics/ens_stats.cc | 103 ++++++++ src/libcode/vx_statistics/ens_stats.h | 2 + src/tools/core/ensemble_stat/ensemble_stat.cc | 57 +++-- .../ensemble_stat/ensemble_stat_conf_info.cc | 11 +- 8 files changed, 429 insertions(+), 25 deletions(-) create mode 100644 internal/test_unit/config/EnsembleStatConfig_rps_climo_bin_prob diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 9a5574a658..dd221dd1d2 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -63,6 +63,8 @@ When computing the CRPS skill score for (:ref:`Gneiting et al., 2004 + + + + &MET_BIN;/ensemble_stat + + DESC RPS_CLIMO_BIN_PROB + OUTPUT_PREFIX RPS_CLIMO_BIN_PROB + + \ + 1 \ + &DATA_DIR_MODEL;/cpc_climo_prob/gefs-00z_aer-rfcst-cal_tmean_20210101_week2_cats_33-67ptile.nc \ + &CONFIG_DIR;/EnsembleStatConfig_rps_climo_bin_prob \ + -grid_obs &DATA_DIR_MODEL;/cpc_climo_prob/tmean_07d_20210115_cats_33-67ptile.nc \ + -outdir &OUTPUT_DIR;/ensemble_stat -v 1 + + + &OUTPUT_DIR;/ensemble_stat/ensemble_stat_RPS_CLIMO_BIN_PROB_20210101_000000V.stat + + + diff --git a/src/basic/vx_util/thresh_array.cc b/src/basic/vx_util/thresh_array.cc index e315536499..4a0b421ae1 100644 --- a/src/basic/vx_util/thresh_array.cc +++ b/src/basic/vx_util/thresh_array.cc @@ -684,8 +684,8 @@ bool check_prob_thresh(const ThreshArray &ta, bool error_out) { << "select at least 3 thresholds which include the range [0, 1] " << "(current setting: " << ta.get_str() << ").\n" << "Consider using the \"==n\" shorthand notation to specify " - << "probability bins of equal width, for n < 1, or the integer " - << "number of ensemble members, for n > 1.\n\n"; + << "probability bins of equal width for n < 1, or the integer " + << "number of ensemble members for n > 1.\n\n"; exit(1); } else { diff --git a/src/libcode/vx_statistics/ens_stats.cc b/src/libcode/vx_statistics/ens_stats.cc index 782832b79f..6483e68045 100644 --- a/src/libcode/vx_statistics/ens_stats.cc +++ b/src/libcode/vx_statistics/ens_stats.cc @@ -632,6 +632,109 @@ void RPSInfo::set(const PairDataEnsemble &pd) { //////////////////////////////////////////////////////////////////////// +void RPSInfo::set_climo_bin_prob(const PairDataEnsemble &pd, + const ThreshArray &ocat_ta) { + + // Compute RPS directly from the binned probabilities rather + // than with an Nx2 probabilistic contingency table. + + // Store the dimensions + n_pair = pd.n_pair; + n_prob = pd.n_ens; + + // If no forecast thresholds are provided, store a single NA thresh + if(fthresh.n() == 0) fthresh.add(na_str); + + // Check that the number of observation category thresholds + // and bins match + if(ocat_ta.n() != pd.n_ens) { + mlog << Error << "\nRPSInfo::set_climo_bin_prob() -> " + << "the number of climatology probability bins (" + << pd.n_ens << ") must match the number of observation " + << " category thresholds (" << write_css(ocat_ta) + << ") defined by the \"" << conf_key_prob_cat_thresh + << "\" configuration file option.\n\n"; + exit(1); + } + + // Initialize RPS + rps = rpscl = 0.0; + + // Loop over the observations + for(int i_obs=0; i_obs " + << "unexpected sum of binned probabilities (" + << pfcst_sum << " != 1).\n\n"; + } + + // Increment sums for the event + if(ocat_ta[i_bin].check(pd.o_na[i_obs])) { + n_event++; + rps_obs += (1.0 - pfcst_sum)*(1.0 - pfcst_sum); + rpscl_obs += (1.0 - pclim_sum)*(1.0 - pclim_sum); + } + // Increment sums for the non-event + else { + rps_obs += (0.0 - pfcst_sum)*(0.0 - pfcst_sum); + rpscl_obs += (0.0 - pclim_sum)*(0.0 - pclim_sum); + } + + } // end for i_bin + + // Make sure the event occurs in exactly 1 bin + if(n_event != 1) { + mlog << Warning << "\nRPSInfo::set_climo_bin_prob() -> " + << "the observation value (" << pd.o_na[i_obs] + << ") met " << n_event << " of the observation " + << " category thresholds (" << write_css(ocat_ta) + << ") instead of exactly 1!\n\n"; + } + + // Divide by number of bins minus 1 + rps_obs /= (pd.n_ens - 1); + rpscl_obs /= (pd.n_ens - 1); + + // Increment running sums + rps += rps_obs / pd.n_obs ; + rpscl += rpscl_obs / pd.n_obs; + + } // end for i_obs + + // Compute RPSS relative to climatology + rpss = (!is_eq(rpscl, 0.0) ? + 1.0 - (rps / rpscl) : + bad_data_double); + + // Store other RPS statistics as bad data + rpss_smpl = bad_data_double; + rps_rel = bad_data_double; + rps_res = bad_data_double; + rps_unc = bad_data_double; + + return; +} + +//////////////////////////////////////////////////////////////////////// + double RPSInfo::rps_comp() const { return(is_bad_data(rps) ? bad_data_double : 1.0 - rps); } diff --git a/src/libcode/vx_statistics/ens_stats.h b/src/libcode/vx_statistics/ens_stats.h index 69eca9f4e1..1f5adb51b8 100644 --- a/src/libcode/vx_statistics/ens_stats.h +++ b/src/libcode/vx_statistics/ens_stats.h @@ -140,6 +140,8 @@ class RPSInfo { // Compute statistics void set(const PairDataEnsemble &); + void set_climo_bin_prob(const PairDataEnsemble &, + const ThreshArray &); // Compute the complement of the RPS double rps_comp() const; diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index f00ca74bfd..0ed6b71597 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -69,7 +69,9 @@ // 037 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main. // 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic. // 039 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. -// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files +// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from +// header files +// 041 04/16/24 Halley Gotway MET #2786 Compute RPS from climo bin probs. // //////////////////////////////////////////////////////////////////////// @@ -663,6 +665,9 @@ bool get_data_plane(const char *infile, GrdFileType ftype, dp = met_regrid(dp, mtddf->grid(), grid, info->regrid()); } + // Rescale probabilities from [0, 100] to [0, 1] + if(info->is_prob()) rescale_probability(dp); + // Store the valid time, if not already set if(ens_valid_ut == (unixtime) 0) { ens_valid_ut = dp.valid(); @@ -723,6 +728,13 @@ bool get_data_plane_array(const char *infile, GrdFileType ftype, } } + // Rescale probabilities from [0, 100] to [0, 1] + if(info->is_prob()) { + for(i=0; iget_var_info()->is_prob()) { + rps_info.set_climo_bin_prob(*pd_ptr, vx_opt.ocat_ta); + } + // Compute ensemble RPS statistics from ensemble member values + else { + rps_info.set(*pd_ptr); + } // Write out RPS if(vx_opt.output_flag[i_rps] != STATOutputType::None && @@ -2053,6 +2071,9 @@ void write_txt_files(const EnsembleStatVxOpt &vx_opt, int i, j; PairDataEnsemble pd; + // Check for probabilistic input + bool is_prob = vx_opt.vx_pd.fcst_info->get_var_info()->is_prob(); + // Process each observation filtering threshold for(i=0; iget_var_info()->is_prob() && + fcat_ta.n() != ocat_ta.n()) { mlog << Error << "\nEnsembleStatVxOpt::process_config() -> " - << "The number of forecast (" << fcat_ta.n() - << ") and observation (" << ocat_ta.n() + << "The number of forecast (" << write_css(fcat_ta) + << ") and observation (" << write_css(ocat_ta) << ") probability category thresholds in \"" - << conf_key_prob_cat_thresh << "\" must match.\n\n"; + << conf_key_prob_cat_thresh << "\" must match!\n\n"; exit(1); } From 947b061dc6fbaf1fb3b3572952e41eaf6e86cee7 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 17 Apr 2024 16:52:16 -0600 Subject: [PATCH 63/72] Feature #2862 v12.0.0-beta4 (#2864) --- docs/Users_Guide/release-notes.rst | 28 ++++++++++++++++++++++++++++ docs/conf.py | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/Users_Guide/release-notes.rst b/docs/Users_Guide/release-notes.rst index c762149df0..3dce6cb0e3 100644 --- a/docs/Users_Guide/release-notes.rst +++ b/docs/Users_Guide/release-notes.rst @@ -9,6 +9,32 @@ When applicable, release notes are followed by the GitHub issue number which des enhancement, or new feature (`MET GitHub issues `_). Important issues are listed **in bold** for emphasis. +MET Version 12.0.0-beta4 Release Notes (20240417) +------------------------------------------------- + + .. dropdown:: Repository, build, and test + + * Add GitHub action to run SonarQube for MET pull requests and feature branches (`#2379 `_). + * Move namespace specifications below include directives (`#2696 `_). + * Enhance GitHub action compilation options and testing workflows (`#2815 `_). + * Fix the SonarQube findings for MET version 12.0.0 (`#2673 `_). + * SonarQube: Replace "enum" to "enum class" (`#2830 `_). + + .. dropdown:: Bugfixes + + * **Bugfix: Fix the TC-Diag and TC-RMW tools to correctly handle the range and azimuth settings in range/azimuth grids** (`#2833 `_). + + .. dropdown:: Enhancements + + * **Refine configuration options for defining bins in the verification of probabilistic forecasts** (`#2280 `_). + * **Add new wind direction verification statistics for RMSE, Bias, and MAE** (`#2395 `_). + * Add new ECNT statistics that incorporate observational uncertainty as advised in Ferro (2017) (`#2583 `_). + * Enhance ASCII2NC to support IABP/IPAB Arctic and Antarctic drifting buoy observations (`#2654 `_). + * Enhance Multivariate MODE to read input data only once rather than multiple times (`#2707 `_). + * Enhance the calculation of RPSS to support starting from probabilistic data (`#2786 `_). + * Add convex hull to MODE output (`#2819 `_). + * Enhance Point2Grid to check "coordinates" variable attribute for ingesting non-traditional grids (`#2858 `_). + MET Version 12.0.0-beta3 Release Notes (20240207) ------------------------------------------------- @@ -108,3 +134,5 @@ MET Version 12.0.0 Upgrade Instructions * The required `Proj `_ library dependency was added in the 12.0.0-beta1 development cycle (`#2669 `_). * The optional `Atlas `_ library dependency was added in the 12.0.0-beta2 development cycle (`#2574 `_). * The optional `ecKit `_ library dependency was added in the 12.0.0-beta2 development cycle (`#2574 `_). + +* Note that the `#2833 `_ bugfix affects all previously generated output from the TC-Diag and TC-RMW tools. diff --git a/docs/conf.py b/docs/conf.py index ad28a7dd63..3a135308ab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,11 +20,11 @@ project = 'MET' author = 'UCAR/NCAR, NOAA, CSU/CIRA, and CU/CIRES' author_list = 'Prestopnik, J., H. Soh, L. Goodrich, B. Brown, R. Bullock, J. Halley Gotway, K. Newman, J. Opatz, T. Jensen' -version = '12.0.0-beta3' +version = '12.0.0-beta4' verinfo = version release = f'{version}' release_year = '2024' -release_date = f'{release_year}-02-07' +release_date = f'{release_year}-04-17' copyright = f'{release_year}, {author}' # -- General configuration --------------------------------------------------- From 406d99137c5212489b53d08fbd316dea0dba1275 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 18 Apr 2024 09:55:23 -0600 Subject: [PATCH 64/72] Feature #2379 develop single_sq_project (#2865) --- internal/scripts/docker/build_met_sonarqube.sh | 4 +--- internal/scripts/sonarqube/run_sonarqube.sh | 4 +--- internal/scripts/sonarqube/sonar-project.properties | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/scripts/docker/build_met_sonarqube.sh b/internal/scripts/docker/build_met_sonarqube.sh index 45e1d10fc5..2eea05654e 100755 --- a/internal/scripts/docker/build_met_sonarqube.sh +++ b/internal/scripts/docker/build_met_sonarqube.sh @@ -84,9 +84,7 @@ SONAR_PROPERTIES=sonar-project.properties # Configure the sonar-project.properties [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES -sed -e "s|SONAR_PROJECT_KEY|MET-GHA|" \ - -e "s|SONAR_PROJECT_NAME|MET GHA|" \ - -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ +sed -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \ diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh index 1a57b0b726..ac439b8a11 100755 --- a/internal/scripts/sonarqube/run_sonarqube.sh +++ b/internal/scripts/sonarqube/run_sonarqube.sh @@ -125,9 +125,7 @@ if [ -z "$SONAR_TOKEN" ]; then exit 1 else [ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES - sed -e "s|SONAR_PROJECT_KEY|MET_NB|" \ - -e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \ - -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ + sed -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \ -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \ -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \ -e "s|SONAR_BRANCH_NAME|${1}|" \ diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index 215749e75b..30ee495c7b 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -1,6 +1,6 @@ # Project and source code settings -sonar.projectKey=SONAR_PROJECT_KEY -sonar.projectName=SONAR_PROJECT_NAME +sonar.projectKey=MET +sonar.projectName=MET sonar.projectVersion=SONAR_PROJECT_VERSION sonar.branch.name=SONAR_BRANCH_NAME sonar.sources=src,scripts/python,data/wrappers From 0a219b50ffe217b5efb347c6eea2ab27c82e0c4d Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 18 Apr 2024 15:05:44 -0600 Subject: [PATCH 65/72] Hotfix to the documentation in the develop branch. Issue #2858 was closed as a duplicate of #2857. I had included it in the MET-12.0.0-beta4 release notes, but the work is not yet actually complete. --- docs/Users_Guide/release-notes.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/Users_Guide/release-notes.rst b/docs/Users_Guide/release-notes.rst index 3dce6cb0e3..c8f2fb0f2c 100644 --- a/docs/Users_Guide/release-notes.rst +++ b/docs/Users_Guide/release-notes.rst @@ -33,7 +33,6 @@ MET Version 12.0.0-beta4 Release Notes (20240417) * Enhance Multivariate MODE to read input data only once rather than multiple times (`#2707 `_). * Enhance the calculation of RPSS to support starting from probabilistic data (`#2786 `_). * Add convex hull to MODE output (`#2819 `_). - * Enhance Point2Grid to check "coordinates" variable attribute for ingesting non-traditional grids (`#2858 `_). MET Version 12.0.0-beta3 Release Notes (20240207) ------------------------------------------------- From d4c4ebac30c00a90cdc954d930f6c433ee38ccf3 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 25 Apr 2024 15:01:21 -0600 Subject: [PATCH 66/72] Feature 2842 ugrid config (#2852) * #2842 Removed UGrid related setting * #2842 Corrected vertical level for data_plane_array * #2842 Do not allow the time range * #2842 The UGridConfig file can be passed as ugrid_dataset * #2842 Changed -config option to -ugrid_config * #2842 Deleted UGrid configurations * 2842 Fix a compile error when UGrid is disabled * #2842 Cleanup * #2842 Added an unittest point_stat_ugrid_mpas_config * #2842 Added a PointStatConfig without UGrid dataset. * #2842 Corrected ty[po at the variable name * Switched from time_centered to time_instant. I think time_centered is the center of the forecast lead window and time_instant is the time the forecast is valid (end of forecast window). * #2842 Removed ugrid_max_distance_km and unused metadata names * #2842 Restored time variable time_instant for LFric * #2842 Adjust lon between -180 and 180 * #2842 Adjust lon between -180 and 180 * #2842 Adjust lon between -180 and 180 * #2842 Adjusted lon to between -180 to 180 * #2842 Changed variable names * Per #2842, switch from degrees east to west right when the longitudes are read. * #2842, switch from degrees east to west right when the longitudes are read * #2842 Cleanup debug messages --------- Co-authored-by: Howard Soh Co-authored-by: Daniel Adriaansen Co-authored-by: John Halley Gotway --- data/config/GridStatConfig_default | 6 - data/config/PointStatConfig_default | 6 - data/config/UGridConfig_lfric | 17 +- data/config/UGridConfig_mpas | 15 +- .../config/PointStatConfig_ugrid_no_dataset | 167 ++++++++++++++++++ internal/test_unit/xml/unit_ugrid.xml | 26 +++ src/libcode/vx_data2d_ugrid/data2d_ugrid.cc | 23 +-- src/libcode/vx_data2d_ugrid/ugrid_file.cc | 37 ++-- src/libcode/vx_data2d_ugrid/var_info_ugrid.cc | 55 ------ src/libcode/vx_grid/grid_base.cc | 22 +-- src/libcode/vx_grid/unstructured_grid.cc | 74 ++++---- src/libcode/vx_grid/unstructured_grid_defs.h | 8 +- src/libcode/vx_regrid/vx_regrid.cc | 1 - src/tools/core/grid_stat/grid_stat.cc | 26 ++- src/tools/core/grid_stat/grid_stat.h | 2 +- .../core/grid_stat/grid_stat_conf_info.cc | 30 ++-- .../core/grid_stat/grid_stat_conf_info.h | 5 +- src/tools/core/point_stat/point_stat.cc | 28 ++- src/tools/core/point_stat/point_stat.h | 2 +- .../core/point_stat/point_stat_conf_info.cc | 30 ++-- .../core/point_stat/point_stat_conf_info.h | 5 +- 21 files changed, 364 insertions(+), 221 deletions(-) create mode 100644 internal/test_unit/config/PointStatConfig_ugrid_no_dataset diff --git a/data/config/GridStatConfig_default b/data/config/GridStatConfig_default index adbb9a214b..4bec5ecf4b 100644 --- a/data/config/GridStatConfig_default +++ b/data/config/GridStatConfig_default @@ -264,12 +264,6 @@ nc_pairs_flag = { //////////////////////////////////////////////////////////////////////////////// -ugrid_dataset = ""; -ugrid_max_distance_km = 30; -ugrid_coordinates_file = ""; - -//////////////////////////////////////////////////////////////////////////////// - grid_weight_flag = NONE; tmp_dir = "/tmp"; output_prefix = ""; diff --git a/data/config/PointStatConfig_default b/data/config/PointStatConfig_default index 9a8132dccc..d4b277c6a3 100644 --- a/data/config/PointStatConfig_default +++ b/data/config/PointStatConfig_default @@ -299,12 +299,6 @@ output_flag = { //////////////////////////////////////////////////////////////////////////////// -ugrid_dataset = ""; -ugrid_max_distance_km = 30; -ugrid_coordinates_file = ""; - -//////////////////////////////////////////////////////////////////////////////// - tmp_dir = "/tmp"; output_prefix = ""; version = "V12.0.0"; diff --git a/data/config/UGridConfig_lfric b/data/config/UGridConfig_lfric index 7c5e164643..8b12f429f5 100644 --- a/data/config/UGridConfig_lfric +++ b/data/config/UGridConfig_lfric @@ -2,7 +2,7 @@ // // Unstructured grid configuration file. // -// UGridConfig_lfric at the current working directory overrides the settings here. +// UGridConfig_lfric at the current working directory replaces the settings here. // For additional or updated information, please see the MET User's Guide. // //////////////////////////////////////////////////////////////////////////////// @@ -12,23 +12,14 @@ // ugrid_metadata_map = [ { key = "dim_face"; val = "nMesh2d_face"; }, - { key = "dim_node"; val = "nMesh2d_node"; }, - { key = "dim_edge"; val = "nMesh2d_edge"; }, { key = "dim_time"; val = "time_counter"; }, - { key = "dim_vert"; val = "nVertLevels"; }, - { key = "cell_id"; val = "indexToCellID"; }, + { key = "dim_vert"; val = ""; }, // optional { key = "lat_face"; val = "Mesh2d_face_y"; }, { key = "lon_face"; val = "Mesh2d_face_x"; }, - { key = "vert_face"; val = "zCell"; }, - { key = "lat_edge"; val = "Mesh2d_edge_y"; }, - { key = "lon_edge"; val = "Mesh2d_edge_x"; }, - { key = "lat_node"; val = "Mesh2d_node_y"; }, - { key = "lon_node"; val = "Mesh2d_node_x"; }, - { key = "time"; val = "time_centered"; } + { key = "vert_face"; val = ""; }, // optional + { key = "time"; val = "time_instant"; } ]; -ugrid_max_distance_km = 30; - //////////////////////////////////////////////////////////////////////////////// version = "V12.0.0"; diff --git a/data/config/UGridConfig_mpas b/data/config/UGridConfig_mpas index 803daf6767..70fca86f98 100644 --- a/data/config/UGridConfig_mpas +++ b/data/config/UGridConfig_mpas @@ -2,7 +2,7 @@ // // Unstructured grid configuration file. // -// UGridConfig_mpas at the current working directory overrides the settings here. +// UGridConfig_mpas at the current working directory replaces the settings here. // For additional or updated information, please see the MET User's Guide. // //////////////////////////////////////////////////////////////////////////////// @@ -12,23 +12,14 @@ // ugrid_metadata_map = [ { key = "dim_face"; val = "nCells"; }, - { key = "dim_node"; val = "nVertices"; }, - { key = "dim_edge"; val = "nEdges"; }, { key = "dim_time"; val = "Time"; }, - { key = "dim_vert"; val = "nVertLevels"; }, - { key = "cell_id"; val = "indexToCellID"; }, + { key = "dim_vert"; val = "nVertLevels"; }, // optional { key = "lat_face"; val = "latCell"; }, { key = "lon_face"; val = "lonCell"; }, - { key = "vert_face"; val = "zCell"; }, - { key = "lat_edge"; val = "latEdge"; }, - { key = "lon_edge"; val = "lonEdge"; }, - { key = "lat_node"; val = "latVertex"; }, - { key = "lon_node"; val = "lonVertex"; }, + { key = "vert_face"; val = "zCell"; }, // optional { key = "time"; val = "xtime"; } ]; -ugrid_max_distance_km = 30; - //////////////////////////////////////////////////////////////////////////////// version = "V12.0.0"; diff --git a/internal/test_unit/config/PointStatConfig_ugrid_no_dataset b/internal/test_unit/config/PointStatConfig_ugrid_no_dataset new file mode 100644 index 0000000000..e70a3af9ee --- /dev/null +++ b/internal/test_unit/config/PointStatConfig_ugrid_no_dataset @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Point-Stat configuration file. +// +// For additional information, please see the MET User's Guide. +// +//////////////////////////////////////////////////////////////////////////////// + +model = "WRF"; + +// +// 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; + + +fcst = { + sid_inc = []; + sid_exc = []; + obs_quality_inc = []; + obs_quality_exc = []; + + field = [ + { name = "theta"; level = "L2"; message_type = "ADPSFC"; } + ]; + +} + +obs = { + sid_inc = []; + sid_exc = []; + obs_quality_inc = []; + obs_quality_exc = []; + + field = [ + { name = "TMP"; level = "P1000-500"; message_type = "ADPSFC"; } + ]; + +} + +//////////////////////////////////////////////////////////////////////////////// + +climo_mean = obs; +climo_mean = { + file_name = []; +} + +//////////////////////////////////////////////////////////////////////////////// + +mask = { + grid = []; + poly = []; + sid = []; + llpnt = [{ name = "ALLLATLON"; lat_thresh = NA; lon_thresh = NA; }]; +} + +//////////////////////////////////////////////////////////////////////////////// + +ci_alpha = [ 0.05 ]; + +boot = { + interval = PCTILE; + rep_prop = 1.0; + n_rep = 200; + rng = "mt19937"; + seed = "1"; +} + +//////////////////////////////////////////////////////////////////////////////// + +interp = { + vld_thresh = 1.0; + + type = [ + { + method = NEAREST; + width = 1; + } + ]; +} + +//////////////////////////////////////////////////////////////////////////////// + +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 = NONE; + sal1l2 = NONE; + vl1l2 = NONE; + val1l2 = NONE; + vcnt = BOTH; + pct = NONE; + pstd = NONE; + pjc = NONE; + prc = NONE; + ecnt = NONE; + orank = NONE; + rps = NONE; + eclv = BOTH; + mpr = BOTH; + seeps = NONE; + seeps_mpr = NONE; +} + +//////////////////////////////////////////////////////////////////////////////// +// Threshold for SEEPS p1 (Probability of being dry) + +seeps_p1_thresh = NA; + +//////////////////////////////////////////////////////////////////////////////// +// Unstructured Grid (optional ecept ugrid_dataset) + +//ugrid_dataset = "mpas"; +ugrid_max_distance_km = 35; +//ugrid_map_config = ""; +ugrid_coordinates_file = "${MET_TEST_INPUT}/ugrid_data/mpas/static.40962_reduced.nc"; + +//////////////////////////////////////////////////////////////////////////////// + +duplicate_flag = NONE; +rank_corr_flag = TRUE; +tmp_dir = "/tmp"; +output_prefix = "${OUTPUT_PREFIX}"; +version = "V12.0.0"; + +//////////////////////////////////////////////////////////////////////////////// diff --git a/internal/test_unit/xml/unit_ugrid.xml b/internal/test_unit/xml/unit_ugrid.xml index a77d95d886..80211fdc2f 100644 --- a/internal/test_unit/xml/unit_ugrid.xml +++ b/internal/test_unit/xml/unit_ugrid.xml @@ -111,4 +111,30 @@ + + &MET_BIN;/point_stat + + BEG_DS -1800 + END_DS 1800 + OUTPUT_PREFIX UGRID_MPAS_CFG_OUT_TEMP + CONFIG_DIR &CONFIG_DIR; + + \ + &DATA_DIR_UGRID;/mpas/mpasout.2012-04-09_12.00.00_reduced.nc \ + &OUTPUT_DIR;/pb2nc/gdas1.20120409.t12z.prepbufr.nc \ + &CONFIG_DIR;/PointStatConfig_ugrid_no_dataset \ + -ugrid_config ${MET_BASE}/config/UGridConfig_mpas \ + -outdir &OUTPUT_DIR;/point_stat_ugrid -v 1 + + + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V.stat + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_fho.txt + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_ctc.txt + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_cts.txt + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_cnt.txt + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_eclv.txt + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_mpr.txt + + + diff --git a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc index 25e5f3ef6f..7b9ea3b25f 100644 --- a/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc +++ b/src/libcode/vx_data2d_ugrid/data2d_ugrid.cc @@ -322,27 +322,6 @@ int MetUGridDataFile::data_plane_array(VarInfo &vinfo, mlog << Error << "\n" << method_name << "LevelType_Time for unstructured grid is not enabled\n\n"; exit(1); - /* Not enabled - const int debug_level = 7; - LongArray time_offsets = collect_time_offsets(vinfo); - if (0 < time_offsets.n_elements()) { - for (int idx=0; idx= debug_level) { - for (int idx=0; idx< time_offsets.n_elements(); idx++ ) { - mlog << Debug(debug_level) << method_name << "time: " - << unix_to_yyyymmdd_hhmmss(_file->ValidTime[time_offsets[idx]]) - << " from index " << time_offsets[idx] << "\n"; - } - } - } - */ } else if (level.type() == LevelType_Pres) { if (nullptr == data_vinfo) { @@ -353,7 +332,7 @@ int MetUGridDataFile::data_plane_array(VarInfo &vinfo, if (vlevel >= lvl_lower && vlevel <= lvl_upper) { vinfo.set_req_name(vinfo_list[idx]->name.c_str()); if (data_plane(vinfo, plane, vinfo_list[idx])) { - plane_array.add(plane, lvl_lower, lvl_upper); + plane_array.add(plane, vlevel, vlevel); n_rec++; } mlog << Debug(5) << method_name diff --git a/src/libcode/vx_data2d_ugrid/ugrid_file.cc b/src/libcode/vx_data2d_ugrid/ugrid_file.cc index f85a6ea0ea..d157f75f0c 100644 --- a/src/libcode/vx_data2d_ugrid/ugrid_file.cc +++ b/src/libcode/vx_data2d_ugrid/ugrid_file.cc @@ -940,6 +940,9 @@ void UGridFile::read_netcdf_grid() } } + // Convert longitude from degrees east to west + for (int idx=0; idxNedge = data.Nedge; -D->Nnode = data.Nnode; +D->n_edge = data.n_edge; +D->n_node = data.n_node; D->max_distance_km = data.max_distance_km; -D->set_points(data.Nface, data.pointLonLat); +D->set_points(data.n_face, data.point_lonlat); us = D; D = (UnstructuredData *)nullptr; @@ -1690,11 +1690,11 @@ bool is_eq(const UnstructuredData * us1, const UnstructuredData * us2) bool status = false; if (us1 && us2) { if (us1 == us2) status = true; - else status = us1->Nface == us2->Nface - && us1->Nnode == us2->Nnode - && us1->Nedge == us2->Nedge - && us1->pointLonLat[0] == us2->pointLonLat[0] - && (us1->Nface > 0 && us1->pointLonLat[us1->Nface-1] == us2->pointLonLat[us2->Nface-1]) + else status = us1->n_face == us2->n_face + && us1->n_node == us2->n_node + && us1->n_edge == us2->n_edge + && us1->point_lonlat[0] == us2->point_lonlat[0] + && (us1->n_face > 0 && us1->point_lonlat[us1->n_face-1] == us2->point_lonlat[us2->n_face-1]) && is_eq(us1->lat_checksum, us2->lat_checksum) && is_eq(us1->lon_checksum, us2->lon_checksum); } diff --git a/src/libcode/vx_grid/unstructured_grid.cc b/src/libcode/vx_grid/unstructured_grid.cc index 9af740a233..d1a56ff9f0 100644 --- a/src/libcode/vx_grid/unstructured_grid.cc +++ b/src/libcode/vx_grid/unstructured_grid.cc @@ -96,14 +96,14 @@ void UnstructuredGrid::set_from_data(const UnstructuredData &data) { clear(); if (data.name) Name = data.name; - Nx = data.Nface; + Nx = data.n_face; - Data.Nface = Nx; - Data.Nedge = data.Nedge; - Data.Nnode = data.Nnode; + Data.n_face = Nx; + Data.n_edge = data.n_edge; + Data.n_node = data.n_node; Data.max_distance_km = data.max_distance_km; - Data.set_points(Nx, data.pointLonLat); + Data.set_points(Nx, data.point_lonlat); } @@ -120,9 +120,9 @@ void UnstructuredGrid::set_max_distance_km(double max_distance) { void UnstructuredGrid::latlon_to_xy(double lat, double lon, double &x, double &y) const { - PointLonLat _pointLonLat(lon, lat); + PointLonLat _point_lonlat(lon, lat); - IndexKDTree::ValueList neighbor = Data.kdtree->closestPoints(_pointLonLat, 1); + IndexKDTree::ValueList neighbor = Data.kdtree->closestPoints(_point_lonlat, 1); size_t index(neighbor[0].payload()); double distance_km(neighbor[0].distance()/1000.); bool in_distance = Data.is_in_distance(distance_km); @@ -130,16 +130,12 @@ void UnstructuredGrid::latlon_to_xy(double lat, double lon, double &x, double &y x = in_distance ? index : -1.0; y = 0; - //PointLonLat r_lonlat; - //if(_distance > 180.0) atlas_geometry.xyz2lonlat(neighbor[0].point(), r_lonlat); - //else r_lonlat.assign(neighbor[0].point()[0], neighbor[0].point()[1]); - if(mlog.verbosity_level() >= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredGrid::latlon_to_xy() " << "input=(" << lon << ", " << lat << ") ==> (" << x << ", " << y << ") == (" - << Data.pointLonLat[index].x() << ", " << Data.pointLonLat[index].y() + << Data.point_lonlat[index].x() << ", " << Data.point_lonlat[index].y() << ") distance= " << distance_km << "km, " - << _pointLonLat.distance(Data.pointLonLat[index]) + << _point_lonlat.distance(Data.point_lonlat[index]) << " degree" << (in_distance ? " " : ", rejected") << "\n"; } @@ -149,8 +145,8 @@ void UnstructuredGrid::latlon_to_xy(double lat, double lon, double &x, double &y void UnstructuredGrid::xy_to_latlon(double x, double y, double &lat, double &lon) const { - lat = Data.pointLonLat[x].y(); - lon = Data.pointLonLat[x].x(); + lat = Data.point_lonlat[x].y(); + lon = Data.point_lonlat[x].x(); if(mlog.verbosity_level() >= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredGrid::xy_to_latlon() " @@ -213,7 +209,7 @@ else out << "(nul)\n"; out << '\n'; -out << prefix << "Nface = " << Nx << "\n"; +out << prefix << "n_face = " << Nx << "\n"; // // done @@ -234,7 +230,7 @@ ConcatString a; a << "Projection: UnstructuredGrid" << sep; -a << "Nface: " << Nx << sep; +a << "n_face: " << Nx << sep; // // done // @@ -352,13 +348,13 @@ void UnstructuredData::build_tree() { atlas::idx_t n = 0; kdtree = new IndexKDTree(atlas_geometry); - kdtree->reserve(Nface); - for (int i=0; ireserve(n_face); + for (int i=0; iinsert(pointLL, n++); - lat_checksum += (i+1) * pointLonLat[i].y(); - lon_checksum += (i+1) * pointLonLat[i].x(); + lat_checksum += (i+1) * point_lonlat[i].y(); + lon_checksum += (i+1) * point_lonlat[i].x(); } kdtree->build(); @@ -368,18 +364,18 @@ void UnstructuredData::build_tree() { //////////////////////////////////////////////////////////////////////// void UnstructuredData::copy_from(const UnstructuredData &us_data) { - set_points(us_data.Nface, us_data.pointLonLat); - Nedge = us_data.Nedge; - Nnode = us_data.Nnode; + set_points(us_data.n_face, us_data.point_lonlat); + n_edge = us_data.n_edge; + n_node = us_data.n_node; max_distance_km = us_data.max_distance_km; } //////////////////////////////////////////////////////////////////////// void UnstructuredData::copy_from(const UnstructuredData *us_data) { - set_points(us_data->Nface, us_data->pointLonLat); - Nedge = us_data->Nedge; - Nnode = us_data->Nnode; + set_points(us_data->n_face, us_data->point_lonlat); + n_edge = us_data->n_edge; + n_node = us_data->n_node; max_distance_km = us_data->max_distance_km; } @@ -400,15 +396,15 @@ void UnstructuredData::set_points(int count, double *_lon, double *_lat) { clear_data(); - Nface = count; - pointLonLat.reserve(count); + n_face = count; + point_lonlat.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(int, double *, double *) first (" - << pointLonLat[0].x() << ", " << pointLonLat[0].y() << ") and last (" - << pointLonLat[count-1].x() << ", " << pointLonLat[count-1].y() << ") from (" + << point_lonlat[0].x() << ", " << point_lonlat[0].y() << ") and last (" + << point_lonlat[count-1].x() << ", " << point_lonlat[count-1].y() << ") from (" << _lon[0] << ", " << _lat[0] << ") and (" << _lon[count-1] << ", " << _lat[count-1] << ")\n"; @@ -422,15 +418,15 @@ void UnstructuredData::set_points(int count, const std::vector &ptL clear_data(); - Nface = count; - pointLonLat.reserve(count); + n_face = count; + point_lonlat.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog - << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(std::vector &) first: (" - << pointLonLat[0].x() << ", " << pointLonLat[0].y() << ") and last (" - << pointLonLat[count-1].x() << ", " << pointLonLat[count-1].y() << ") from (" + << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(int, std::vector &) first: (" + << point_lonlat[0].x() << ", " << point_lonlat[0].y() << ") and last (" + << point_lonlat[count-1].x() << ", " << point_lonlat[count-1].y() << ") from (" << ptLonLat[0].x() << ", " << ptLonLat[0].y() << ") and (" << ptLonLat[count-1].x() << ", " << ptLonLat[count-1].y() << ")\n"; diff --git a/src/libcode/vx_grid/unstructured_grid_defs.h b/src/libcode/vx_grid/unstructured_grid_defs.h index a363bbab6d..68456d0d35 100644 --- a/src/libcode/vx_grid/unstructured_grid_defs.h +++ b/src/libcode/vx_grid/unstructured_grid_defs.h @@ -36,14 +36,14 @@ struct UnstructuredData { const char * name; // not allocated - int Nface; - int Nedge; - int Nnode; + int n_face; + int n_edge; + int n_node; double max_distance_km; // This should be set after calling set_points() double lat_checksum; double lon_checksum; - std::vector pointLonLat; + std::vector point_lonlat; atlas::util::IndexKDTree *kdtree; UnstructuredData(); diff --git a/src/libcode/vx_regrid/vx_regrid.cc b/src/libcode/vx_regrid/vx_regrid.cc index 7abfee78b4..5fcc970601 100644 --- a/src/libcode/vx_regrid/vx_regrid.cc +++ b/src/libcode/vx_regrid/vx_regrid.cc @@ -133,7 +133,6 @@ to_data.set_accum (from_data.accum()); // // copy data // - for (xt=0; xt<(to_grid.nx()); ++xt) { for (yt=0; yt<(to_grid.ny()); ++yt) { diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index 89ac9c8385..6d8e13864d 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -192,11 +192,13 @@ static void finish_txt_files(); static void clean_up(); static void usage(); -static void set_config(const StringArray &); static void set_outdir(const StringArray &); static void set_compress(const StringArray &); static bool read_data_plane(VarInfo* info, DataPlane& dp, Met2dDataFile* mtddf, const ConcatString &filename); +#ifdef WITH_UGRID +static void set_ugrid_config(const StringArray &); +#endif //////////////////////////////////////////////////////////////////////// @@ -248,6 +250,9 @@ void process_command_line(int argc, char **argv) { // Add the options function calls cline.add(set_outdir, "-outdir", 1); cline.add(set_compress, "-compress", 1); +#ifdef WITH_UGRID + cline.add(set_ugrid_config, "-ugrid_config", 1); +#endif // Parse the command line cline.parse(); @@ -271,7 +276,9 @@ void process_command_line(int argc, char **argv) { // Read the config files conf_info.read_config(default_config_file.c_str(), config_file.c_str()); - conf_info.read_configs(config_files); +#ifdef WITH_UGRID + conf_info.read_ugrid_configs(ugrid_config_files, config_file.c_str()); +#endif // Get the forecast and observation file types from config, if present ftype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_fcst)); @@ -3094,6 +3101,9 @@ void usage() { << "\tfcst_file\n" << "\tobs_file\n" << "\tconfig_file\n" +#ifdef WITH_UGRID + << "\t[-ugrid_config config_file]\n" +#endif << "\t[-outdir path]\n" << "\t[-log file]\n" << "\t[-v level]\n" @@ -3108,8 +3118,10 @@ void usage() { << "\t\t\"config_file\" is a GridStatConfig file containing " << "the desired configuration settings (required).\n" - << "\t\t\"-config config_file\" specifies additional PointStatConfig file containing " - << "the configuration settings for unstructured grid (optional).\n" +#ifdef WITH_UGRID + << "\t\t\"-ugrid_config ugrid_config_file\" is a UGridConfig file containing " + << "the desired configuration settings for unstructured grid (required only for UGrid)\n" +#endif << "\t\t\"-outdir path\" overrides the default output directory " << "(" << out_dir << ") (optional).\n" @@ -3128,10 +3140,12 @@ void usage() { //////////////////////////////////////////////////////////////////////// -void set_config(const StringArray & a) +#ifdef WITH_UGRID +void set_ugrid_config(const StringArray & a) { - config_files.add(a[0]); + ugrid_config_files.add(a[0]); } +#endif //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index b5db513b57..ccd85c82ac 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -113,7 +113,7 @@ static ConcatString obs_file; // Input Config file static ConcatString config_file; -static StringArray config_files; +static StringArray ugrid_config_files; static GridStatConfInfo conf_info; // Optional arguments 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 d277783684..db34b15925 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.cc +++ b/src/tools/core/grid_stat/grid_stat_conf_info.cc @@ -49,6 +49,9 @@ void GridStatConfInfo::init_from_scratch() { // Initialize pointers vx_opt = (GridStatVxOpt *) nullptr; +#ifdef WITH_UGRID + ignore_ugrid_dataset = false; +#endif clear(); return; @@ -69,7 +72,7 @@ void GridStatConfInfo::clear() { version.clear(); #ifdef WITH_UGRID ugrid_nc.clear(); - ugrid_dataset.clear(); + if (!ignore_ugrid_dataset) ugrid_dataset.clear(); ugrid_map_config.clear(); ugrid_max_distance_km = bad_data_double; #endif @@ -109,18 +112,25 @@ void GridStatConfInfo::read_config(const char *default_file_name, //////////////////////////////////////////////////////////////////////// -void GridStatConfInfo::read_configs(StringArray user_file_names) { - - const char *file_name; - for (int i=0; i " - << "The configuration file \"" << user_file_names[i]<< "\" does not exist.\n\n"; +#ifdef WITH_UGRID +void GridStatConfInfo::read_ugrid_configs(StringArray ugrid_config_names, const char * user_config) { + + ConcatString file_name; + for (int i=0; i " + << "The configuration file \"" << ugrid_config_names[i]<< "\" does not exist.\n\n"; } + if (file_exists(user_config)) conf.read(user_config); /* to avoid overriding by ugrid_config_names */ return; } +#endif //////////////////////////////////////////////////////////////////////// @@ -154,7 +164,7 @@ void GridStatConfInfo::process_config(GrdFileType ftype, #ifdef WITH_UGRID // Conf: ugrid_dataset - ugrid_dataset = parse_conf_ugrid_dataset(&conf); + if (!ignore_ugrid_dataset) ugrid_dataset = parse_conf_ugrid_dataset(&conf); // Conf: ugrid_nc ugrid_nc = parse_conf_ugrid_coordinates_file(&conf); 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 33418fbfbb..ca529a27e1 100644 --- a/src/tools/core/grid_stat/grid_stat_conf_info.h +++ b/src/tools/core/grid_stat/grid_stat_conf_info.h @@ -284,6 +284,7 @@ class GridStatConfInfo { ConcatString output_prefix; // String to customize output file name ConcatString version; // Config file version #ifdef WITH_UGRID + bool ignore_ugrid_dataset; ConcatString ugrid_nc; // NetCDF for coordinate variables of unstructured grid ConcatString ugrid_dataset; // UGRid dataset name (mpas, lfric etc) ConcatString ugrid_map_config; // User's configuration file which contains ugrid metadata mapping @@ -299,7 +300,9 @@ class GridStatConfInfo { void clear(); void read_config (const char *, const char *); - void read_configs (StringArray user_file_names); +#ifdef WITH_UGRID + void read_ugrid_configs(StringArray ugrid_config_names, const char * user_config); +#endif void process_config(GrdFileType, GrdFileType); void process_flags (); void process_masks (const Grid &); diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 38cbc28f40..313db804b8 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -175,12 +175,14 @@ static void finish_txt_files(); static void clean_up(); static void usage(); -static void set_config(const StringArray &); static void set_point_obs(const StringArray &); static void set_ncfile(const StringArray &); static void set_obs_valid_beg_time(const StringArray &); static void set_obs_valid_end_time(const StringArray &); static void set_outdir(const StringArray &); +#ifdef WITH_UGRID +static void set_ugrid_config(const StringArray &); +#endif //////////////////////////////////////////////////////////////////////// @@ -240,7 +242,9 @@ void process_command_line(int argc, char **argv) { cline.set_usage(usage); // Add the options function calls - cline.add(set_config, "-config", 1); +#ifdef WITH_UGRID + cline.add(set_ugrid_config, "-ugrid_config", 1); +#endif cline.add(set_point_obs, "-point_obs", 1); cline.add(set_ncfile, "-ncfile", 1); cline.add(set_obs_valid_beg_time, "-obs_valid_beg", 1); @@ -283,7 +287,9 @@ void process_command_line(int argc, char **argv) { // Read the config files conf_info.read_config(default_config_file.c_str(), config_file.c_str()); - conf_info.read_configs(config_files); +#ifdef WITH_UGRID + conf_info.read_ugrid_configs(ugrid_config_files, config_file.c_str()); +#endif // Get the forecast file type from config, if present ftype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_fcst)); @@ -2203,7 +2209,9 @@ void usage() { << "\tfcst_file\n" << "\tobs_file\n" << "\tconfig_file\n" - << "\t[-config config_file]\n" +#ifdef WITH_UGRID + << "\t[-ugrid_config config_file]\n" +#endif << "\t[-point_obs file]\n" << "\t[-obs_valid_beg time]\n" << "\t[-obs_valid_end time]\n" @@ -2220,8 +2228,10 @@ void usage() { << "\t\t\"config_file\" is a PointStatConfig file containing " << "the desired configuration settings (required).\n" - << "\t\t\"-config config_file\" specifies additional PointStatConfig file containing " - << "the configuration settings for unstructured grid (optional).\n" +#ifdef WITH_UGRID + << "\t\t\"-ugrid_config ugrid_config_file\" is a UGridConfig file containing " + << "the desired configuration settings for unstructured grid (required only for UGrid)\n" +#endif << "\t\t\"-point_obs file\" specifies additional NetCDF point " << "observation files to be used (optional).\n" @@ -2246,10 +2256,12 @@ void usage() { //////////////////////////////////////////////////////////////////////// -void set_config(const StringArray & a) +#ifdef WITH_UGRID +void set_ugrid_config(const StringArray & a) { - config_files.add(a[0]); + ugrid_config_files.add(a[0]); } +#endif //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 7d69a62b62..0804650b0a 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -108,7 +108,7 @@ static StringArray obs_file; // Input Config file static ConcatString config_file; -static StringArray config_files; +static StringArray ugrid_config_files; static PointStatConfInfo conf_info; // Optional arguments 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 ce7a0035f7..e05157d5bc 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -49,6 +49,9 @@ void PointStatConfInfo::init_from_scratch() { // Initialize pointers vx_opt = (PointStatVxOpt *) nullptr; +#ifdef WITH_UGRID + ignore_ugrid_dataset = false; +#endif clear(); return; @@ -73,7 +76,7 @@ void PointStatConfInfo::clear() { version.clear(); #ifdef WITH_UGRID ugrid_nc.clear(); - ugrid_dataset.clear(); + if (!ignore_ugrid_dataset) ugrid_dataset.clear(); ugrid_map_config.clear(); ugrid_max_distance_km = bad_data_double; #endif @@ -105,18 +108,25 @@ void PointStatConfInfo::read_config(const char *default_file_name, //////////////////////////////////////////////////////////////////////// -void PointStatConfInfo::read_configs(StringArray user_file_names) { - - const char *file_name; - for (int i=0; i " - << "The configuration file \"" << user_file_names[i]<< "\" does not exist.\n\n"; +#ifdef WITH_UGRID +void PointStatConfInfo::read_ugrid_configs(StringArray ugrid_config_names, const char * user_config) { + + ConcatString file_name; + for (int i=0; i " + << "The configuration file \"" << ugrid_config_names[i]<< "\" does not exist.\n\n"; } + if (file_exists(user_config)) conf.read(user_config); /* to avoid overriding by ugrid_config_names */ return; } +#endif //////////////////////////////////////////////////////////////////////// @@ -143,7 +153,7 @@ void PointStatConfInfo::process_config(GrdFileType ftype) { #ifdef WITH_UGRID // Conf: ugrid_dataset - ugrid_dataset = parse_conf_ugrid_dataset(&conf); + if (!ignore_ugrid_dataset) ugrid_dataset = parse_conf_ugrid_dataset(&conf); // Conf: ugrid_nc ugrid_nc = parse_conf_ugrid_coordinates_file(&conf); 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 5e3db2184a..befde20349 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -247,6 +247,7 @@ class PointStatConfInfo { ConcatString output_prefix; // String to customize output file name ConcatString version; // Config file version #ifdef WITH_UGRID + bool ignore_ugrid_dataset; ConcatString ugrid_nc; // NetCDF for coordinate variables of unstructured grid ConcatString ugrid_dataset; // UGRid dataset name (mpas, lfric etc) ConcatString ugrid_map_config; // User's configuration file which contains ugrid metadata mapping @@ -261,7 +262,9 @@ class PointStatConfInfo { void clear(); void read_config(const char *, const char *); - void read_configs(StringArray user_file_names); +#ifdef WITH_UGRID + void read_ugrid_configs(StringArray ugrid_config_names, const char * user_config); +#endif void process_config(GrdFileType); void process_grib_codes(); From 3caffb4cda40a119138a089495c6a289d9c59a83 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 29 Apr 2024 09:53:38 -0600 Subject: [PATCH 67/72] Feature 2753 comp script config (#2868) * set dynamic library file extension to .dylib if running on MacOS and .so otherwise * Added disabling of jasper documentation for compiliation on Hera * Updated * remove extra export of compiler env vars * include full path to log file so it is easier to file the log file to examine when a command fails * send cmake output to a log file * remove redundant semi-colon * use full path to log file so it is easier to examine on failure * use run_cmd to catch if rm command fails * Modifications for compilation on hera, gaea, and orion * Updating * fixed variable name * clean up if/else statements * set TIFF_LIBRARY_RELEASE argument to use full path to dynamic library file to prevent failure installing proj library * set LDFLAGS so that LDFLAGS value set in the user's environment will also be used * Updated based on gaea, orion, and hera installs * Updated * change extension of dynamic library files only if architecture is arm64 because older Macs still use .so * added netcdf library to args to prevent error installing NetCDF-CXX when PROJ has been installed in the same run of the script -- PATH is set in the COMPILE_PROJ if block that causes this flag from being added automatically * clean up how rpath and -L are added to LDFLAGS so that each entry is separate -- prevents errors installing on Mac arm64 because multiple rpath values aren't read using :. Also use MET_PROJLIB * Updated * removed -ltiff from MET libs * only add path to rpath and -L arguments if they are not already included in LDFLAGS * changed from using LIB_TIFF (full path to tiff lib file) to use TIFF_LIB_DIR (dir containing tiff lib file). Added TIFF_INCLUDE_DIR to proj compilation and -DJAS_ENABLE_DOC to jasper compliation taken from @jprestop branch * update comments * ensure all MET_* and MET_*LIB variables are added to the rpath for consistency * remove unnecessary if block and only export LDFLAGS at the end of setting locally * Updated * Added section for adding /lib64 and rearranged placement of ADDTL_DIR * Commenting out the running of the Jasper lib tests * Updating and/or removing files * Updating and/or removing files * Latest udpates which include the addition of the tiff library for proj * Remove commented out line. Co-authored-by: John Halley Gotway * Make indentation consistent. Co-authored-by: John Halley Gotway * Make indentation consistent. Co-authored-by: John Halley Gotway * Make indentation consistent. Co-authored-by: John Halley Gotway * Per 2753, added -lm to configure_lib_args for NetCDF-CXX * Per #2753 updating acorn files * Per #2753, update wcoss2 files * Per #2753, updating acorn file to include MET_PYTHON_EXE * Per #2753, updated files for 12.0.0 for derecho * Per #2753, updated derecho file adding MET_PYTHON_EXE and made corrections * Updating config files * Updating orion files * Updates for gaea's files * Updating gaea modulefile * Removing modulefile for cheyenne * Added MET_PYTHON_EXE * Added MET_PYTHON_EXE to hera too * Adding file for hercules * Removing equals sign from setenv * Adding file for hercules * Updated script to add libjpeg installation for grib2c * Per #2753, Adding file for casper --------- Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com> Co-authored-by: John Halley Gotway --- .../scripts/installation/compile_MET_all.sh | 26 ++++++++- ...env.acorn_py3.10 => install_met_env.acorn} | 0 .../config/install_met_env.casper | 54 +++++++++++-------- .../config/install_met_env.derecho | 30 ++++++----- .../installation/config/install_met_env.gaea | 19 +++---- .../installation/config/install_met_env.hera | 4 +- .../config/install_met_env.hercules | 39 ++++++++++++++ .../installation/config/install_met_env.jet | 8 +-- .../installation/config/install_met_env.orion | 18 +++---- ...v.wcoss2_py3.10 => install_met_env.wcoss2} | 4 +- .../installation/modulefiles/11.1.0_cheyenne | 29 ---------- .../installation/modulefiles/12.0.0_acorn | 4 ++ .../installation/modulefiles/12.0.0_casper | 24 +++++++++ .../installation/modulefiles/12.0.0_derecho | 22 ++++++++ .../installation/modulefiles/12.0.0_gaea | 4 +- .../installation/modulefiles/12.0.0_hera | 2 + .../installation/modulefiles/12.0.0_hercules | 20 +++++++ .../installation/modulefiles/12.0.0_jet | 2 + .../installation/modulefiles/12.0.0_orion | 7 +-- 19 files changed, 222 insertions(+), 94 deletions(-) rename internal/scripts/installation/config/{install_met_env.acorn_py3.10 => install_met_env.acorn} (100%) create mode 100644 internal/scripts/installation/config/install_met_env.hercules rename internal/scripts/installation/config/{install_met_env.wcoss2_py3.10 => install_met_env.wcoss2} (98%) delete mode 100644 internal/scripts/installation/modulefiles/11.1.0_cheyenne create mode 100644 internal/scripts/installation/modulefiles/12.0.0_casper create mode 100644 internal/scripts/installation/modulefiles/12.0.0_derecho create mode 100644 internal/scripts/installation/modulefiles/12.0.0_hercules diff --git a/internal/scripts/installation/compile_MET_all.sh b/internal/scripts/installation/compile_MET_all.sh index 98d9fca899..6524aa8563 100755 --- a/internal/scripts/installation/compile_MET_all.sh +++ b/internal/scripts/installation/compile_MET_all.sh @@ -37,7 +37,7 @@ # The compile_MET_all.sh script will compile and install MET and its # external library dependencies, if needed, including: # PROJ (with dependency SQLITE >= 3.11), GSL, BUFRLIB, -# GRIB2C (with dependencies Z, PNG, JASPER), HDF5, NETCDF (C and CXX), +# GRIB2C (with dependencies Z, PNG, JASPER, JPEG), HDF5, NETCDF (C and CXX), # HDF4 (optional for MODIS-Regrid and lidar2nc), HDFEOS (optional for # MODIS-Regrid and lidar2nc), FREETYPE (optional for MODE Graphics), # and CAIRO (optional for MODE Graphics). @@ -51,7 +51,7 @@ # in the input environment configuration file (install_met_env.: # MET_GRIB2CLIB, MET_GRIB2CINC, GRIB2CLIB_NAME, MET_BUFRLIB, BUFRLIB_NAME, # MET_HDF5, MET_NETCDF, MET_PROJ, MET_GSL, LIB_JASPER, LIB_LIBPNG, LIB_Z, -# SQLITE_INCLUDE_DIR, SQLITE_LIB_DIR, TIFF_INCLUDE_DIR, TIFF_LIB_DIR. +# LIB_JPEG, SQLITE_INCLUDE_DIR, SQLITE_LIB_DIR, TIFF_INCLUDE_DIR, TIFF_LIB_DIR. # # The optional libraries ecKit and atlas offer support for unstructured # grids. The optional libraries HDF4, HDFEOS, FREETYPE, and CAIRO are @@ -176,11 +176,13 @@ if [[ -z ${MET_GRIB2CLIB} ]] && [[ -z ${MET_GRIB2C} ]]; then COMPILE_ZLIB=1 COMPILE_LIBPNG=1 COMPILE_JASPER=1 + COMPILE_JPEG=1 COMPILE_G2CLIB=1 else COMPILE_ZLIB=0 COMPILE_LIBPNG=0 COMPILE_JASPER=0 + COMPILE_JPEG=0 COMPILE_G2CLIB=0 fi @@ -269,6 +271,7 @@ if [ ! -z "${SKIP_LIBS}" ]; then COMPILE_ZLIB=0 COMPILE_LIBPNG=0 COMPILE_JASPER=0 + COMPILE_JPEG=0 COMPILE_G2CLIB=0 COMPILE_ECKIT=0 COMPILE_ATLAS=0 @@ -570,6 +573,7 @@ if [[ $COMPILE_LIBPNG -eq 1 && $HOST != ys* ]]; then run_cmd "make ${MAKE_ARGS} install > $(pwd)/libpng.make_install.log 2>&1" fi + # Compile JASPER if [ $COMPILE_JASPER -eq 1 ]; then @@ -594,6 +598,24 @@ if [ $COMPILE_JASPER -eq 1 ]; then run_cmd "make ${MAKE_ARGS} install > $(pwd)/jasper.make_install.log 2>&1" fi +# Compile JPEG +if [ $COMPILE_JPEG -eq 1 ]; then + + vrs="9e" + + echo + echo "Compiling JPEG at `date`" + mkdir -p ${LIB_DIR}/jpeg + rm -rf ${LIB_DIR}/jpeg/jpeg* + tar -xf ${TAR_DIR}/jpegsrc.v${vrs}.tar.gz -C ${LIB_DIR}/jpeg + cd ${LIB_DIR}/jpeg/jpeg-${vrs} + echo "cd `pwd`" + run_cmd "./configure --prefix=${LIB_DIR} LDFLAGS=-L${LIB_DIR}/lib CPPFLAGS=-I${LIB_DIR}/include > $(pwd)/libjpeg.configure.log 2>&1" + run_cmd "make ${MAKE_ARGS} > $(pwd)/libjpeg.make.log 2>&1" + run_cmd "make ${MAKE_ARGS} install > $(pwd)/libjpeg.make_install.log 2>&1" +fi + + # Compile G2CLIB if [ $COMPILE_G2CLIB -eq 1 ]; then diff --git a/internal/scripts/installation/config/install_met_env.acorn_py3.10 b/internal/scripts/installation/config/install_met_env.acorn similarity index 100% rename from internal/scripts/installation/config/install_met_env.acorn_py3.10 rename to internal/scripts/installation/config/install_met_env.acorn diff --git a/internal/scripts/installation/config/install_met_env.casper b/internal/scripts/installation/config/install_met_env.casper index c9e9f06a91..703be5e531 100644 --- a/internal/scripts/installation/config/install_met_env.casper +++ b/internal/scripts/installation/config/install_met_env.casper @@ -1,30 +1,40 @@ -module load ncarenv/1.3 -module load intel/2021.2 -module load netcdf/4.8.0 +module load ncarenv/23.10 +module load intel-classic/2023.2.1 +module load cmake/3.26.3 -export TEST_BASE=/glade/p/ral/jntp/MET/MET_releases/casper/11.1.0 -export COMPILER=intel_2021.2 +export TEST_BASE=/glade/work/dtcrt/METplus/casper/components/MET/installations/12.0.0 +export COMPILER=intel-classic_2023.2.1 export MET_SUBDIR=${TEST_BASE} -export MET_TARBALL=v11.1.0.tar.gz +export MET_TARBALL=v12.0.0.tar.gz export USE_MODULES=TRUE -export MET_PYTHON=/glade/p/ral/jntp/MET/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10 +export MET_PYTHON=/glade/work/dtcrt/METplus/casper/miniconda/miniconda3/envs/metplus_v5.1_py3.10 export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 export MET_PYTHON_LD=`${MET_PYTHON}/bin/python3-config --ldflags --embed` -export MET_NETCDF=/glade/u/apps/ch/opt/netcdf/4.8.0/intel/2021.2/ -export MET_HDF5=/glade/u/apps/ch/opt/netcdf/4.8.0/intel/2021.2/ +#export ADDTL_DIR=/usr/lib64 export EXTERNAL_LIBS=${TEST_BASE}/external_libs -#export MET_GSL=${EXTERNAL_LIBS} -#export MET_BUFRLIB=${EXTERNAL_LIBS} -#export BUFRLIB_NAME=-lbufr -#export MET_HDF5=${EXTERNAL_LIBS} -#export MET_GRIB2CLIB=${EXTERNAL_LIBS}/lib -#export MET_GRIB2CINC=${EXTERNAL_LIBS}/include -#export GRIB2CLIB_NAME=-lgrib2c -#export LIB_JASPER=${EXTERNAL_LIBS}/lib -#export LIB_LIBPNG=${EXTERNAL_LIBS}/lib -#export LIB_Z=${EXTERNAL_LIBS}/lib -export SET_D64BIT=FALSE +#export COMPILE_ECKIT=1 +#export COMPILE_ATLAS=1 +export MET_PROJ=${EXTERNAL_LIBS} +export MET_ECKIT=${EXTERNAL_LIBS} +export MET_ATLAS=${EXTERNAL_LIBS} +export MET_GSL=${EXTERNAL_LIBS} +export MET_BUFRLIB=${EXTERNAL_LIBS} +export BUFRLIB_NAME=-lbufr_4 +export MET_GRIB2CLIB=${EXTERNAL_LIBS}/lib64 +export MET_GRIB2CINC=${EXTERNAL_LIBS}/include +export GRIB2CLIB_NAME=-lg2c +export LIB_JASPER=${EXTERNAL_LIBS}/lib64 +export LIB_LIBPNG=${EXTERNAL_LIBS}/lib +export LIB_Z=${EXTERNAL_LIBS}/lib +export LIB_JPEG=${EXTERNAL_LIBS}/lib +export MET_NETCDF=${EXTERNAL_LIBS} +export MET_HDF5=${EXTERNAL_LIBS} +export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib +export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include +export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib +export MAKE_ARGS="-j 5" #export CFLAGS="-Wall -g" #export CXXFLAGS="-Wall -g" -export MAKE_ARGS=-j -export CXXFLAGS="-std=c++11" +#export CXXFLAGS="-std=c++11" +#export SKIP_MET=true diff --git a/internal/scripts/installation/config/install_met_env.derecho b/internal/scripts/installation/config/install_met_env.derecho index 5ad11f3eb7..eb02198760 100644 --- a/internal/scripts/installation/config/install_met_env.derecho +++ b/internal/scripts/installation/config/install_met_env.derecho @@ -1,36 +1,42 @@ -module load ncarenv/23.06 -module load intel-oneapi/2023.0.0 +module load ncarenv/23.09 +module load intel/2023.2.1 module load cmake/3.26.3 -module load hdf5/1.12.2 -module load netcdf/4.9.2 -export TEST_BASE=/glade/p/ral/jntp/MET/MET_releases/12.0.0 -export COMPILER=intel-oneapi_2023.0.0 +export CC=icx +export CXX=icpx +export FC=ifx +export F77=ifx +export F90=ifx + +export TEST_BASE=/glade/work/dtcrt/METplus/derecho/components/MET/installations/12.0.0 +export COMPILER=intel_2023.2.1 export MET_SUBDIR=${TEST_BASE} export MET_TARBALL=v12.0.0.tar.gz export USE_MODULES=TRUE -export MET_PYTHON=/glade/p/ral/jntp/MET/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10 +export MET_PYTHON=/glade/work/dtcrt/METplus/derecho/miniconda/miniconda3/envs/metplus_v5.1_py3.10 export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 export MET_PYTHON_LD=`${MET_PYTHON}/bin/python3-config --ldflags --embed` -export MET_NETCDF=/glade/u/apps/derecho/23.06/spack/opt/spack/netcdf/4.9.2/oneapi/2023.0.0/iijr -export MET_HDF5=/glade/u/apps/derecho/23.06/spack/opt/spack/hdf5/1.12.2/oneapi/2023.0.0/d6xa -export ADDTL_DIR=/usr/lib64 export EXTERNAL_LIBS=${TEST_BASE}/external_libs -#export MET_PROJ=${EXTERNAL_LIBS} -#export LIB_TIFF=${ADDTL_DIR}/libtiff.so.5 export COMPILE_ECKIT=1 export COMPILE_ATLAS=1 +#export MET_PROJ=${EXTERNAL_LIBS} #export MET_ECKIT=${EXTERNAL_LIBS} #export MET_ATLAS=${EXTERNAL_LIBS} #export MET_GSL=${EXTERNAL_LIBS} #export MET_BUFRLIB=${EXTERNAL_LIBS} #export BUFRLIB_NAME=-lbufr_4 +#export MET_NETCDF=${EXTERNAL_LIBS} +#export MET_HDF5=${EXTERNAL_LIBS} #export MET_GRIB2CLIB=${EXTERNAL_LIBS}/lib64 #export MET_GRIB2CINC=${EXTERNAL_LIBS}/include #export GRIB2CLIB_NAME=-lg2c #export LIB_JASPER=${EXTERNAL_LIBS}/lib64 #export LIB_LIBPNG=${EXTERNAL_LIBS}/lib #export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib +#export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib export MAKE_ARGS=-j #export CFLAGS="-Wall -g" #export CXXFLAGS="-Wall -g" diff --git a/internal/scripts/installation/config/install_met_env.gaea b/internal/scripts/installation/config/install_met_env.gaea index 78052504da..8a60c93f84 100644 --- a/internal/scripts/installation/config/install_met_env.gaea +++ b/internal/scripts/installation/config/install_met_env.gaea @@ -5,21 +5,18 @@ export F77=ifx export F90=ifx export CC=icx export CXX=icpx -export TEST_BASE=/usw/met/12.0.0-beta2 +export TEST_BASE=/usw/met/12.0.0 export COMPILER=intel-oneapi_2022.0.2 export MET_SUBDIR=${TEST_BASE} -export MET_TARBALL=v12.0.0-beta2.tar.gz +export MET_TARBALL=v12.0.0.tar.gz export USE_MODULES=TRUE -export MET_PYTHON=/lustre/f2/dev/esrl/Julie.Prestopnik/projects/miniconda/miniconda3/envs/metplus_v5.1_py3.10/ +export MET_PYTHON=/gpfs/f5/esrl/proj-shared/Julie.Prestopnik/projects/miniconda/miniconda3/envs/metplus_v5.1_py3.10/ export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python3.10/config-3.10-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython3.10\ -lcrypt\ -lpthread\ -ldl\ -lutil\ -lm -export ADDTL_DIR=/usr/lib64 -#export TIFF_INCLUDE_DIR=/lustre/f2/dev/esrl/Julie.Prestopnik/projects/miniconda/miniconda3/pkgs/libtiff-4.4.0-h82bc61c_5/include -#export LIB_TIFF=${ADDTL_DIR}/libtiff.so.5 -#export EXTERNAL_LIBS=/usw/met/12.0.0-beta2/external_libs +export EXTERNAL_LIBS=${TEST_BASE}/external_libs +COMPILE_ATLAS=1 +COMPILE_ECKIT=1 #export MET_PROJ=${EXTERNAL_LIBS} -#COMPILE_ATLAS=1 -#COMPILE_ECKIT=1 #export MET_ATLAS=${EXTERNAL_LIBS} #export MET_ECKIT=${EXTERNAL_LIBS} #export MET_GSL=${EXTERNAL_LIBS} @@ -33,5 +30,9 @@ export ADDTL_DIR=/usr/lib64 #export LIB_JASPER=${EXTERNAL_LIBS}/lib #export LIB_LIBPNG=${EXTERNAL_LIBS}/lib #export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib +#export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib export MAKE_ARGS="-j 5" diff --git a/internal/scripts/installation/config/install_met_env.hera b/internal/scripts/installation/config/install_met_env.hera index cddaa00f90..2b0b054190 100755 --- a/internal/scripts/installation/config/install_met_env.hera +++ b/internal/scripts/installation/config/install_met_env.hera @@ -1,6 +1,6 @@ module load gnu/9.2.0 module load intel/2022.1.2 -module load cmake/3.26.4 +module load cmake/3.28.1 export FC=ifort export F77=ifort @@ -34,6 +34,8 @@ export COMPILE_ATLAS=1 #export LIB_JASPER=${EXTERNAL_LIBS}/lib #export LIB_LIBPNG=${EXTERNAL_LIBS}/lib #export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib #export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include #export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib export MAKE_ARGS="-j 5" diff --git a/internal/scripts/installation/config/install_met_env.hercules b/internal/scripts/installation/config/install_met_env.hercules new file mode 100644 index 0000000000..dffb8fe186 --- /dev/null +++ b/internal/scripts/installation/config/install_met_env.hercules @@ -0,0 +1,39 @@ +module load intel-oneapi-compilers/2022.2.1 +module load cmake/3.26.3 + +export CC=icx +export CXX=icpx +export FC=ifx +export F77=ifx +export F90=ifx + +export TEST_BASE=/apps/contrib/MET/12.0.0-beta3 +export COMPILER=intel-oneapi-compilers_2022.2.1 +export MET_SUBDIR=${TEST_BASE}/ +export MET_TARBALL=v12.0.0-beta3.tar.gz +export USE_MODULES=TRUE +export MET_PYTHON=/work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10 +export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 +export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python3.10/config-3.10-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython3.10\ -lcrypt\ -lpthread\ -ldl\ -lutil\ -lrt\ -lm\ -lm +export EXTERNAL_LIBS=${TEST_BASE}/external_libs +COMPILE_ATLAS=1 +COMPILE_ECKIT=1 +#export MET_PROJ=${EXTERNAL_LIBS} +#export MET_ATLAS=${EXTERNAL_LIBS} +#export MET_ECKIT=${EXTERNAL_LIBS} +#export MET_GSL=${EXTERNAL_LIBS} +#export MET_BUFRLIB=${EXTERNAL_LIBS} +#export BUFRLIB_NAME=-lbufr_4 +#export MET_HDF5=${EXTERNAL_LIBS} +#export MET_NETCDF=${EXTERNAL_LIBS} +#export MET_GRIB2CLIB=${EXTERNAL_LIBS}/lib +#export MET_GRIB2CINC=${EXTERNAL_LIBS}/include +#export GRIB2CLIB_NAME=-lg2c +#export LIB_JASPER=${EXTERNAL_LIBS}/lib +#export LIB_LIBPNG=${EXTERNAL_LIBS}/lib +#export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib +#export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib +export MAKE_ARGS="-j 5" diff --git a/internal/scripts/installation/config/install_met_env.jet b/internal/scripts/installation/config/install_met_env.jet index b3be597853..15b5563ac2 100644 --- a/internal/scripts/installation/config/install_met_env.jet +++ b/internal/scripts/installation/config/install_met_env.jet @@ -1,5 +1,5 @@ module load intel/2022.1.2 -module load cmake/3.26.4 +module load cmake/3.28.1 export FC=ifort export F77=ifort @@ -14,13 +14,11 @@ export USE_MODULES=TRUE export MET_PYTHON=/mnt/lfs1/HFIP/dtc-hurr/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10 export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python3.10/config-3.10-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython3.10\ -lcrypt\ -lpthread\ -ldl\ -lutil\ -lrt\ -lm\ -lm -export ADDTL_DIR=/usr/lib64 +#export ADDTL_DIR=/usr/lib64 export EXTERNAL_LIBS=${TEST_BASE}/external_libs/ COMPILE_ATLAS=1 COMPILE_ECKIT=1 #export MET_PROJ=${EXTERNAL_LIBS} -export TIFF_INCLUDE_DIR=/usr/include -export TIFF_LIB_DIR=/usr/lib64 #export MET_ATLAS=${EXTERNAL_LIBS} #export MET_ECKIT=${EXTERNAL_LIBS} #export MET_GSL=${EXTERNAL_LIBS} @@ -34,6 +32,8 @@ export TIFF_LIB_DIR=/usr/lib64 #export LIB_JASPER=${EXTERNAL_LIBS}/lib #export LIB_LIBPNG=${EXTERNAL_LIBS}/lib #export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib #export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include #export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib export MAKE_ARGS="-j 5" diff --git a/internal/scripts/installation/config/install_met_env.orion b/internal/scripts/installation/config/install_met_env.orion index b951ee41f5..7ba320fe03 100644 --- a/internal/scripts/installation/config/install_met_env.orion +++ b/internal/scripts/installation/config/install_met_env.orion @@ -1,23 +1,19 @@ module load intel/2020.2 module load cmake/3.22.1 -export TEST_BASE=/apps/contrib/MET/12.0.0-beta2 +export TEST_BASE=/apps/contrib/MET/12.0.0 export COMPILER=intel_2020 export MET_SUBDIR=${TEST_BASE}/ -export MET_TARBALL=v12.0.0-beta2.tar.gz +export MET_TARBALL=v12.0.0.tar.gz export USE_MODULES=TRUE export MET_PYTHON=/work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10 export MET_PYTHON_CC=-I${MET_PYTHON}/include/python3.10 export MET_PYTHON_LD=-L${MET_PYTHON}/lib/python3.10/config-3.10-x86_64-linux-gnu\ -L${MET_PYTHON}/lib\ -lpython3.10\ -lcrypt\ -lpthread\ -ldl\ -lutil\ -lrt\ -lm\ -lm -export ADDTL_DIR=/usr/lib64 -#export TIFF_INCLUDE_DIR=${ADDTL_DIR} -#export LIB_TIFF=${ADDTL_DIR}/libtiff.so.5 +#export ADDTL_DIR=/usr/lib64 export EXTERNAL_LIBS=${TEST_BASE}/external_libs -#export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include -#export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib +COMPILE_ATLAS=1 +COMPILE_ECKIT=1 #export MET_PROJ=${EXTERNAL_LIBS} -#COMPILE_ATLAS=1 -#COMPILE_ECKIT=1 #export MET_ATLAS=${EXTERNAL_LIBS} #export MET_ECKIT=${EXTERNAL_LIBS} #export MET_GSL=${EXTERNAL_LIBS} @@ -31,4 +27,8 @@ export EXTERNAL_LIBS=${TEST_BASE}/external_libs #export LIB_JASPER=${EXTERNAL_LIBS}/lib #export LIB_LIBPNG=${EXTERNAL_LIBS}/lib #export LIB_Z=${EXTERNAL_LIBS}/lib +#export TIFF_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export TIFF_LIB_DIR=${EXTERNAL_LIBS}/lib +#export SQLITE_INCLUDE_DIR=${EXTERNAL_LIBS}/include +#export SQLITE_LIB_DIR=${EXTERNAL_LIBS}/lib export MAKE_ARGS="-j 5" diff --git a/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 b/internal/scripts/installation/config/install_met_env.wcoss2 similarity index 98% rename from internal/scripts/installation/config/install_met_env.wcoss2_py3.10 rename to internal/scripts/installation/config/install_met_env.wcoss2 index f2f29e57df..86b73e0064 100644 --- a/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 +++ b/internal/scripts/installation/config/install_met_env.wcoss2 @@ -21,13 +21,13 @@ export F77=ifort export F90=ifort export CC=icc export CXX=icpc -#export TEST_BASE=/apps/ops/para/libs/intel/19.1.3.304/met/12.0.0-beta1 +#export TEST_BASE=/apps/ops/para/libs/intel/19.1.3.304/met/12.0.0-beta3 export TEST_BASE=$(pwd) export LIB_DIR=${TEST_BASE}/external_libs export BIN_DIR_PATH=${TEST_BASE}/bin export COMPILER=intel_19.1.3.304 export MET_SUBDIR=${TEST_BASE} -export MET_TARBALL=v12.0.0-beta1.tar.gz +export MET_TARBALL=v12.0.0-beta3.tar.gz export USE_MODULES=TRUE export ADDTL_DIR=/apps/spack/gettext/0.21/intel/19.1.3.304/at2kdo4edvuhyzrt5g6zhwrdb7bdui4s/lib64 export PYTHON_MODULE=python_3.10.4 diff --git a/internal/scripts/installation/modulefiles/11.1.0_cheyenne b/internal/scripts/installation/modulefiles/11.1.0_cheyenne deleted file mode 100644 index 70032e4f5d..0000000000 --- a/internal/scripts/installation/modulefiles/11.1.0_cheyenne +++ /dev/null @@ -1,29 +0,0 @@ -#%Module###################################################################### -## -## Model Evaluation Tools -## -proc ModulesHelp { } { - puts stderr "Sets up the paths and environment variables to use the Model Evaluation Tools v11.1.0 - *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" -} - -# If they exist, remove ncdump and ncgen from /glade/p/ral/jntp/MET/MET_releases/11.1.0/external_libs/bin - -# The intel compiler is required to run MET -module load ncarenv/1.3 -module load intel/2021.2 -module load netcdf/4.8.0 - -set base /glade/p/ral/jntp/MET/MET_releases/11.1.0 -set ver 11.1.0 -set share $base/share/met - -prepend-path PATH $base/bin:/glade/p/ral/jntp/MET/MET_releases/11.1.0/external_libs/bin:/glade/p/ral/jntp/MET/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin - -setenv METversion V$ver - -# setenv MET_BUFRLIB /glade/p/ral/jntp/MET/MET_releases/11.1.0/external_libs/libs -# setenv MET_GRIB2C /glade/p/ral/jntp/MET/MET_releases/11.1.0/external_libs -# setenv MET_GSL /glade/p/ral/jntp/MET/MET_releases/11.1.0/external_libs - - diff --git a/internal/scripts/installation/modulefiles/12.0.0_acorn b/internal/scripts/installation/modulefiles/12.0.0_acorn index c97f4e92ed..5d7a98dcd7 100644 --- a/internal/scripts/installation/modulefiles/12.0.0_acorn +++ b/internal/scripts/installation/modulefiles/12.0.0_acorn @@ -22,6 +22,9 @@ module load libpng/1.6.37 module load gsl/2.7 module load g2c/1.6.4 module load proj/7.1.0 +module use /apps/dev/lmodules/intel/19.1.3.304/ +module load atlas/0.30.0 +module load eckit/1.20.2 set base /apps/sw_review/emc/MET/12.0.0 set ver 12.0.0 @@ -32,3 +35,4 @@ prepend-path PATH $base/bin setenv METversion V$ver setenv MET_ROOT $base +setenv MET_PYTHON_EXE /apps/dev/ve/evs/2.0/bin/python \ No newline at end of file diff --git a/internal/scripts/installation/modulefiles/12.0.0_casper b/internal/scripts/installation/modulefiles/12.0.0_casper new file mode 100644 index 0000000000..1c270efb3e --- /dev/null +++ b/internal/scripts/installation/modulefiles/12.0.0_casper @@ -0,0 +1,24 @@ +#%Module###################################################################### +## +## Model Evaluation Tools +## +proc ModulesHelp { } { + puts stderr "Sets up the paths and environment variables to use the Model Evaluation Tools v12.0.0 + *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" +} + + +# The intel compiler is required to run MET + +module load ncarenv/23.10 +module load intel-classic/2023.2.1 + +set base /glade/work/dtcrt/METplus/casper/components/MET/installations/12.0.0 +set ver 12.0.0 +set share $base/share/met + +prepend-path PATH $base/bin:/glade/work/dtcrt/METplus/casper/components/MET/installations/12.0.0/external_libs/bin:/glade/work/dtcrt/METplus/casper/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin + +setenv METversion V$ver + + diff --git a/internal/scripts/installation/modulefiles/12.0.0_derecho b/internal/scripts/installation/modulefiles/12.0.0_derecho new file mode 100644 index 0000000000..bfbe555e99 --- /dev/null +++ b/internal/scripts/installation/modulefiles/12.0.0_derecho @@ -0,0 +1,22 @@ +#%Module###################################################################### +## +## Model Evaluation Tools +## +proc ModulesHelp { } { + puts stderr "Sets up the paths and environment variables to use the Model Evaluation Tools v12.0.0 + *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" +} + +# The intel compiler is required to run MET + +module load ncarenv/23.09 +module load intel/2023.2.1 + +set base /glade/work/dtcrt/METplus/derecho/components/MET/installations/12.0.0 +set ver 12.0.0 +set share $base/share/met + +prepend-path PATH $base/bin:/glade/work/dtcrt/METplus/derecho/components/MET/installations/12.0.0/external_libs/bin:/glade/work/dtcrt/METplus/derecho/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin + +setenv METversion V$ver +setenv MET_PYTHON_EXE /glade/work/dtcrt/METplus/derecho/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin/python3 diff --git a/internal/scripts/installation/modulefiles/12.0.0_gaea b/internal/scripts/installation/modulefiles/12.0.0_gaea index 1ce4cd13c3..00b4625114 100644 --- a/internal/scripts/installation/modulefiles/12.0.0_gaea +++ b/internal/scripts/installation/modulefiles/12.0.0_gaea @@ -14,4 +14,6 @@ set ver 12.0.0 set share $base/$ver/share/met set lib_base $base/12.0.0 -prepend-path PATH $base/$ver/bin:$lib_base/external_libs/bin:/lustre/f2/dev/esrl/Julie.Prestopnik/projects/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +prepend-path PATH $base/$ver/bin:$lib_base/external_libs/bin:/gpfs/f5/esrl/proj-shared/Julie.Prestopnik/projects/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin + +setenv MET_PYTHON_EXE /gpfs/f5/esrl/proj-shared/Julie.Prestopnik/projects/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin/python \ No newline at end of file diff --git a/internal/scripts/installation/modulefiles/12.0.0_hera b/internal/scripts/installation/modulefiles/12.0.0_hera index 2548513892..a97925d7e2 100644 --- a/internal/scripts/installation/modulefiles/12.0.0_hera +++ b/internal/scripts/installation/modulefiles/12.0.0_hera @@ -19,6 +19,8 @@ setenv MET_ROOT $base/$ver prepend-path PATH $base/$ver/bin:$lib_base/external_libs/bin:/scratch1/BMC/dtc/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +setenv MET_PYTHON_EXE /scratch1/BMC/dtc/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin/python + #setenv METversion $ver #setenv MET_CONFIG $share/config #setenv MET_POLY $share/poly diff --git a/internal/scripts/installation/modulefiles/12.0.0_hercules b/internal/scripts/installation/modulefiles/12.0.0_hercules new file mode 100644 index 0000000000..deec9e17e9 --- /dev/null +++ b/internal/scripts/installation/modulefiles/12.0.0_hercules @@ -0,0 +1,20 @@ +#%Module###################################################################### +## +## Model Evaluation Tools +## +proc ModulesHelp { } { + puts stderr "Sets up the paths and environment variables to use the Model Evaluation Tools v12.0.0 + *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" +} + +prereq intel-oneapi-compilers/2022.2.1 + +set base /apps/contrib/MET +set ver 12.0.0 +set share $base/$ver/share/met +set lib_base $base/12.0.0 +setenv MET_ROOT $base/$ver/MET-12.0.0 + +prepend-path PATH $base/$ver/bin:$lib_base/external_libs/bin:/work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin + +setenv MET_PYTHON_EXE /work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin/python diff --git a/internal/scripts/installation/modulefiles/12.0.0_jet b/internal/scripts/installation/modulefiles/12.0.0_jet index 430bd27113..0ab7b873ce 100644 --- a/internal/scripts/installation/modulefiles/12.0.0_jet +++ b/internal/scripts/installation/modulefiles/12.0.0_jet @@ -15,3 +15,5 @@ set share $base/share/met setenv MET_ROOT $base/$ver/MET-12.0.0 prepend-path PATH $base/bin:$base/external_libs/bin:/mnt/lfs1/HFIP/dtc-hurr/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10 + +setenv MET_PYTHON_EXE /mnt/lfs1/HFIP/dtc-hurr/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10_intel/bin/python \ No newline at end of file diff --git a/internal/scripts/installation/modulefiles/12.0.0_orion b/internal/scripts/installation/modulefiles/12.0.0_orion index ed0dd56805..a78bfe25bb 100644 --- a/internal/scripts/installation/modulefiles/12.0.0_orion +++ b/internal/scripts/installation/modulefiles/12.0.0_orion @@ -10,10 +10,11 @@ proc ModulesHelp { } { prereq intel/2020.2 set base /apps/contrib/MET -set ver 12.0.0-beta2 +set ver 12.0.0 set share $base/$ver/share/met -set lib_base $base/12.0.0-beta2 -setenv MET_ROOT $base/$ver/MET-12.0.0-beta2 +set lib_base $base/12.0.0 +setenv MET_ROOT $base/$ver/MET-12.0.0 prepend-path PATH $base/$ver/bin:$lib_base/external_libs/bin:/work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +setenv MET_PYTHON_EXE /work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin/python From d3ecc87e759a940ac04b5f27166f3a4c2c5b9251 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 30 Apr 2024 15:17:43 -0600 Subject: [PATCH 68/72] Feature #2795 level_mismatch_warning (#2873) * Per #2795, move the warning message about level mismatch from the config validation step to when the forecast files are being processed. Only check this when the number of forecast fields is greater than 1, but no longer limit the check to pressure levels only. * Per #2795, add comments * Whitespace * Per #2795, port level mismatch fix over to Ensemble-Stat. Check it for each verification task, but only print it once for each task, rather than once for each task * ensemble member. --- src/tools/core/ensemble_stat/ensemble_stat.cc | 34 +++++++++--- .../ensemble_stat/ensemble_stat_conf_info.cc | 19 ------- src/tools/core/point_stat/point_stat.cc | 52 ++++++++++++------- .../core/point_stat/point_stat_conf_info.cc | 19 ------- 4 files changed, 59 insertions(+), 65 deletions(-) diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 0ed6b71597..e81fc80039 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -70,8 +70,9 @@ // 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic. // 039 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. // 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from -// header files +// header files. // 041 04/16/24 Halley Gotway MET #2786 Compute RPS from climo bin probs. +// 042 04/29/24 Halley Gotway MET #2795 Move level mismatch warning. // //////////////////////////////////////////////////////////////////////// @@ -839,6 +840,10 @@ void process_point_vx() { // Loop through each of the fields to be verified for(i=0; iget_var_info(); + VarInfo *obs_info = conf_info.vx_opt[i].vx_pd.obs_info; + bool print_level_mismatch_warning = true; + // Initialize emn_dpa.clear(); @@ -857,6 +862,23 @@ void process_point_vx() { continue; } + // MET #2795, for multiple individual forecast levels, print a + // warning if the observations levels are not fully covered. + if(print_level_mismatch_warning && + fcst_dpa.n_planes() > 1 && + !is_eq(fcst_info->level().lower(), fcst_info->level().upper()) && + (obs_info->level().lower() < fcst_info->level().lower() || + obs_info->level().upper() > fcst_info->level().upper())) { + mlog << Warning << "\nprocess_point_vx() -> " + << "The forecast level range (" << fcst_info->magic_str() + << ") does not fully contain the observation level range (" + << obs_info->magic_str() << "). No vertical interpolation " + << "will be performed for observations falling outside " + << "the range of forecast levels. Instead, they will be " + << "matched to the single nearest forecast level.\n\n"; + print_level_mismatch_warning = false; + } + // Store ensemble member data conf_info.vx_opt[i].vx_pd.set_fcst_dpa(fcst_dpa); @@ -875,20 +897,18 @@ void process_point_vx() { mlog << Debug(2) << "Processing ensemble mean file: " << ens_mean_file << "\n"; - VarInfo *info = conf_info.vx_opt[i].vx_pd.fcst_info->get_var_info(); - // Read the gridded data from the ensemble mean file - if(!get_data_plane_array(ens_mean_file.c_str(), info->file_type(), info, - emn_dpa, true)) { + if(!get_data_plane_array(ens_mean_file.c_str(), fcst_info->file_type(), + fcst_info, emn_dpa, true)) { mlog << Error << "\nprocess_point_vx() -> " << "trouble reading the ensemble mean field \"" - << info->magic_str() << "\" from file \"" + << fcst_info->magic_str() << "\" from file \"" << ens_mean_file << "\"\n\n"; exit(1); } // Dump out the number of levels found - mlog << Debug(2) << "For " << info->magic_str() + mlog << Debug(2) << "For " << fcst_info->magic_str() << " found " << emn_dpa.n_planes() << " forecast levels.\n"; } 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 8306e3f41e..7987c742de 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -710,25 +710,6 @@ void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict, vx_pd.obs_info->dump(cout); } - // Check the levels for the forecast and observation fields. If the - // forecast field is a range of pressure levels, check to see if the - // range of observation field pressure levels is wholly contained in the - // fcst levels. If not, print a warning message. - if(vx_pd.fcst_info->get_var_info()->level().type() == LevelType_Pres && - !is_eq(vx_pd.fcst_info->get_var_info()->level().lower(), vx_pd.fcst_info->get_var_info()->level().upper()) && - (vx_pd.obs_info->level().lower() < vx_pd.fcst_info->get_var_info()->level().lower() || - vx_pd.obs_info->level().upper() > vx_pd.fcst_info->get_var_info()->level().upper())) { - - mlog << Warning - << "\nEnsembleStatVxOpt::process_config() -> " - << "The range of requested observation pressure levels " - << "is not contained within the range of requested " - << "forecast pressure levels. No vertical interpolation " - << "will be performed for observations falling outside " - << "the range of forecast levels. Instead, they will be " - << "matched to the single nearest forecast level.\n\n"; - } - // No support for wind direction if(vx_pd.fcst_info->get_var_info()->is_wind_direction() || vx_pd.obs_info->is_wind_direction()) { diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 313db804b8..bbfb8774d5 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -102,7 +102,8 @@ // 050 02/11/22 Halley Gotway MET #2045 Fix HiRA output. // 051 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 052 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. -// 053 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files +// 053 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files. +// 054 04/29/24 Halley Gotway MET #2795 Move level mismatch warning. // //////////////////////////////////////////////////////////////////////// @@ -606,25 +607,37 @@ void process_fcst_climo_files() { // the forecast and climatological fields for verification for(int i=0; idata_plane_array( - *conf_info.vx_opt[i].vx_pd.fcst_info, fcst_dpa); - mlog << Debug(2) - << "\n" << sep_str << "\n\n" - << "Reading data for " - << conf_info.vx_opt[i].vx_pd.fcst_info->magic_str() - << ".\n"; + n_fcst = fcst_mtddf->data_plane_array(*fcst_info, fcst_dpa); + mlog << Debug(2) << "\n" << sep_str << "\n\n" + << "Reading data for " << fcst_info->magic_str() << ".\n"; // Check for zero fields if(n_fcst == 0) { mlog << Warning << "\nprocess_fcst_climo_files() -> " - << "no fields matching " - << conf_info.vx_opt[i].vx_pd.fcst_info->magic_str() - << " found in file: " - << fcst_file << "\n\n"; + << "no fields matching " << fcst_info->magic_str() + << " found in file: " << fcst_file << "\n\n"; continue; } + // MET #2795, for multiple individual forecast levels, print a + // warning if the observations levels are not fully covered. + if(n_fcst > 1 && + !is_eq(fcst_info->level().lower(), fcst_info->level().upper()) && + (obs_info->level().lower() < fcst_info->level().lower() || + obs_info->level().upper() > fcst_info->level().upper())) { + mlog << Warning << "\nprocess_fcst_climo_files() -> " + << "The forecast level range (" << fcst_info->magic_str() + << ") does not fully contain the observation level range (" + << obs_info->magic_str() << "). No vertical interpolation " + << "will be performed for observations falling outside " + << "the range of forecast levels. Instead, they will be " + << "matched to the single nearest forecast level.\n\n"; + } + // Setup the first pass through the data if(is_first_pass) setup_first_pass(fcst_dpa[0], fcst_mtddf->grid()); @@ -632,19 +645,18 @@ void process_fcst_climo_files() { if(!(fcst_mtddf->grid() == grid)) { mlog << Debug(1) << "Regridding " << fcst_dpa.n_planes() - << " forecast field(s) for " - << conf_info.vx_opt[i].vx_pd.fcst_info->magic_str() + << " forecast field(s) for " << fcst_info->magic_str() << " to the verification grid.\n"; // Loop through the forecast fields for(j=0; jgrid(), grid, - conf_info.vx_opt[i].vx_pd.fcst_info->regrid()); + fcst_info->regrid()); } } // Rescale probabilities from [0, 100] to [0, 1] - if(conf_info.vx_opt[i].vx_pd.fcst_info->p_flag()) { + if(fcst_info->p_flag()) { for(j=0; jmagic_str() - << " found " << n_fcst << " forecast levels, " + << "For " << fcst_info->magic_str() << " found " + << n_fcst << " forecast levels, " << cmn_dpa.n_planes() << " climatology mean levels, and " << csd_dpa.n_planes() << " climatology standard deviation levels.\n"; @@ -1825,8 +1837,8 @@ void do_hira_ens(int i_vx, const PairDataPoint *pd_ptr) { conf_info.vx_opt[i_vx].hira_info.width[i], grid.wrap_lon()); if (nullptr == gt) { - mlog << Warning - << "\nPdo_hira_ens() Fail to get GridTemplate for " << i << "-th width.\n\n"; + mlog << Warning << "\ndo_hira_ens() -> " + << "failed to get GridTemplate for " << i << "-th width.\n\n"; continue; } 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 e05157d5bc..1a416fbd5a 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -851,25 +851,6 @@ void PointStatVxOpt::process_config(GrdFileType ftype, vx_pd.obs_info->dump(cout); } - // Check the levels for the forecast and observation fields. If the - // forecast field is a range of pressure levels, check to see if the - // range of observation field pressure levels is wholly contained in the - // fcst levels. If not, print a warning message. - if(vx_pd.fcst_info->level().type() == LevelType_Pres && - !is_eq(vx_pd.fcst_info->level().lower(), vx_pd.fcst_info->level().upper()) && - (vx_pd.obs_info->level().lower() < vx_pd.fcst_info->level().lower() || - vx_pd.obs_info->level().upper() > vx_pd.fcst_info->level().upper())) { - - mlog << Warning - << "\nPointStatVxOpt::process_config() -> " - << "The range of requested observation pressure levels " - << "is not contained within the range of requested " - << "forecast pressure levels. No vertical interpolation " - << "will be performed for observations falling outside " - << "the range of forecast levels. Instead, they will be " - << "matched to the single nearest forecast level.\n\n"; - } - // No support for wind direction if(vx_pd.fcst_info->is_wind_direction() || vx_pd.obs_info->is_wind_direction()) { From ccd1061f90cd79cad444424b7beba968b89cb431 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 1 May 2024 10:39:15 -0600 Subject: [PATCH 69/72] Feature #2870 removing_MISSING_warning (#2872) * Per #2870, define utility functions for parsing the file type from a file list and for logging missing files, checking for the MISSING keyword. Also, update Ensemble-Stat and Gen-Ens-Prod to call these functions. * Per #2870, update the gen_ens_prod tests to demonstrate the use of the MISSING keyword for missing files. METplus uses this keyword for Ensemble-Stat and Gen-Ens-Prod. --- internal/test_unit/xml/unit_gen_ens_prod.xml | 10 +-- .../vx_data2d_factory/parse_file_list.cc | 65 ++++++++++++++++ .../vx_data2d_factory/parse_file_list.h | 7 ++ src/tools/core/ensemble_stat/ensemble_stat.cc | 76 +++++-------------- src/tools/other/gen_ens_prod/gen_ens_prod.cc | 41 +++++----- 5 files changed, 116 insertions(+), 83 deletions(-) diff --git a/internal/test_unit/xml/unit_gen_ens_prod.xml b/internal/test_unit/xml/unit_gen_ens_prod.xml index 771bf3e201..371a5c5283 100644 --- a/internal/test_unit/xml/unit_gen_ens_prod.xml +++ b/internal/test_unit/xml/unit_gen_ens_prod.xml @@ -26,7 +26,7 @@ echo "&DATA_DIR_MODEL;/grib1/arw-fer-gep1/arw-fer-gep1_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-sch-gep2/arw-sch-gep2_2012040912_F024.grib \ - &DATA_DIR_MODEL;/grib1/arw-tom-gep3/arw-tom-gep3_2012040912_F024.grib \ + MISSING \ &DATA_DIR_MODEL;/grib1/nmm-fer-gep4/nmm-fer-gep4_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-fer-gep5/arw-fer-gep5_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-sch-gep6/arw-sch-gep6_2012040912_F024.grib \ @@ -42,7 +42,7 @@ -ens &OUTPUT_DIR;/gen_ens_prod/input_file_list \ -config &CONFIG_DIR;/GenEnsProdConfig \ -out &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_NO_CTRL_20120410_120000V.nc \ - -v 2 + -v 3 &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_NO_CTRL_20120410_120000V.nc @@ -52,7 +52,7 @@ echo "&DATA_DIR_MODEL;/grib1/arw-fer-gep1/arw-fer-gep1_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-sch-gep2/arw-sch-gep2_2012040912_F024.grib \ - &DATA_DIR_MODEL;/grib1/arw-tom-gep3/arw-tom-gep3_2012040912_F024.grib \ + MISSING/&DATA_DIR_MODEL;/grib1/arw-tom-gep3/arw-tom-gep3_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/nmm-fer-gep4/nmm-fer-gep4_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-fer-gep5/arw-fer-gep5_2012040912_F024.grib \ &DATA_DIR_MODEL;/grib1/arw-sch-gep6/arw-sch-gep6_2012040912_F024.grib \ @@ -69,7 +69,7 @@ -ctrl &DATA_DIR_MODEL;/grib1/arw-tom-gep0/arw-tom-gep0_2012040912_F024.grib \ -config &CONFIG_DIR;/GenEnsProdConfig \ -out &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_WITH_CTRL_20120410_120000V.nc \ - -v 2 + -v 3 &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_WITH_CTRL_20120410_120000V.nc @@ -162,7 +162,7 @@ -ctrl &DATA_DIR_MODEL;/grib1/arw-tom-gep0/arw-tom-gep0_2012040912_F024.grib \ -config &CONFIG_DIR;/GenEnsProdConfig_normalize \ -out &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_NORMALIZE.nc \ - -v 2 + -v 3 &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_NORMALIZE.nc diff --git a/src/libcode/vx_data2d_factory/parse_file_list.cc b/src/libcode/vx_data2d_factory/parse_file_list.cc index 0363f0221f..2e2be2a632 100644 --- a/src/libcode/vx_data2d_factory/parse_file_list.cc +++ b/src/libcode/vx_data2d_factory/parse_file_list.cc @@ -37,6 +37,7 @@ using namespace std; static const char python_str [] = "python"; static const char file_list_str [] = "file_list"; +static const char missing_str [] = "MISSING"; //////////////////////////////////////////////////////////////////////// @@ -201,4 +202,68 @@ return a; } +//////////////////////////////////////////////////////////////////////// + + +GrdFileType parse_file_list_type(const StringArray& file_list) + +{ + +GrdFileType ftype = FileType_None; + +for ( int i=0; i filetype " - << grdfiletype_to_string(etype) << " from the configuration is not supported\n\n"; - exit(1); + // Get the ensemble file type from the files + if(etype == FileType_None) { + etype = parse_file_list_type(ens_file_list); } - // Read the first input ensemble file - if(!(ens_mtddf = mtddf_factory.new_met_2d_data_file(ens_file_list[0].c_str(), etype))) { + // UGrid not supported + if(etype == FileType_UGrid) { mlog << Error << "\n" << method_name - << "trouble reading ensemble file \"" - << ens_file_list[0] << "\"\n\n"; - exit(1); - } - - // Store the input ensemble file type - etype = ens_mtddf->file_type(); - if(FileType_UGrid == etype) { - mlog << Error << "\n" << program_name << " -> The filetype " - << grdfiletype_to_string(etype) << " (" << ens_file_list[0] - << ") is not supported\n\n"; - + << grdfiletype_to_string(etype) + << " ensemble files are not supported\n\n"; exit(1); } - // Observation files are required if(!grid_obs_flag && !point_obs_flag) { mlog << Error << "\n" << method_name @@ -406,28 +393,17 @@ void process_command_line(int argc, char **argv) { // Get the observation file type from config, if present otype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_obs)); - if(FileType_UGrid == otype) { - mlog << Error << "\n" << program_name << " -> filetype " - << grdfiletype_to_string(otype) << " from the configuration is not supported\n\n"; - - exit(1); - } - // Read the first gridded observation file - if(!(obs_mtddf = mtddf_factory.new_met_2d_data_file(grid_obs_file_list[0].c_str(), otype))) { - mlog << Error << "\n" << method_name - << "trouble reading gridded observation file \"" - << grid_obs_file_list[0] << "\"\n\n"; - exit(1); + // Get the observation file type from the files + if(otype == FileType_None) { + otype = parse_file_list_type(grid_obs_file_list); } - // Store the gridded observation file type - otype = obs_mtddf->file_type(); - if(FileType_UGrid == otype) { - mlog << Error << "\n" << program_name << " -> The filetype " - << grdfiletype_to_string(etype) << " (" << grid_obs_file_list[0] - << ") is not supported\n\n"; - + // UGrid not supported + if(otype == FileType_UGrid) { + mlog << Error << "\n" << method_name + << grdfiletype_to_string(otype) + << " gridded observation files are not supported\n\n"; exit(1); } } @@ -476,9 +452,7 @@ void process_command_line(int argc, char **argv) { if(!file_exists(ens_file_list[i].c_str()) && !is_python_grdfiletype(etype)) { - mlog << Warning << "\n" << method_name - << "can't open input ensemble file: " - << ens_file_list[i] << "\n\n"; + log_missing_file(method_name, "input ensemble file", ens_file_list[i]); ens_file_vld.add(0); } else { @@ -489,9 +463,7 @@ void process_command_line(int argc, char **argv) { // User-specified ensemble mean file if(ens_mean_file.nonempty()) { if(!file_exists(ens_mean_file.c_str())) { - mlog << Warning << "\n" << method_name - << "can't open input ensemble mean file: " - << ens_mean_file << "\n\n"; + log_missing_file(method_name, "input ensemble mean file", ens_mean_file); ens_mean_file = ""; } } @@ -503,10 +475,6 @@ void process_command_line(int argc, char **argv) { << "control file is not provided with -ctrl argument\n\n"; } - // Deallocate memory for data files - if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) nullptr; } - if(obs_mtddf) { delete obs_mtddf; obs_mtddf = (Met2dDataFile *) nullptr; } - return; } @@ -995,10 +963,8 @@ void process_point_obs(int i_nc) { #endif if(!nc_point_obs.open(point_obs_file_list[i_nc].c_str())) { nc_point_obs.close(); - - mlog << Warning << "\n" << method_name - << "can't open observation netCDF file: " - << point_obs_file_list[i_nc] << "\n\n"; + log_missing_file(method_name, "observation netCDF file", + point_obs_file_list[i_nc]); return; } diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index 4de6c2b2b8..46ad8b66df 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -20,10 +20,10 @@ // 003 02/17/22 Halley Gotway MET #1918 Add normalize config option. // 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main // 005 10/03/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files +// 006 04/29/24 Halley Gotway MET #2870 Ignore MISSING keyword. // //////////////////////////////////////////////////////////////////////// - #include #include #include @@ -53,7 +53,6 @@ using namespace std; using namespace netCDF; - //////////////////////////////////////////////////////////////////////// static void process_command_line(int, char **); @@ -111,19 +110,17 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// - const string get_tool_name() { return "gen_ens_prod"; } - //////////////////////////////////////////////////////////////////////// void process_command_line(int argc, char **argv) { int i; CommandLine cline; ConcatString default_config_file; - Met2dDataFile *ens_mtddf = (Met2dDataFile *) nullptr; + const char *method_name = "process_command_line() -> "; // // Check for zero arguments @@ -159,19 +156,19 @@ void process_command_line(int argc, char **argv) { // Check that the required arguments have been set n_ens_files = ens_files.n(); if(n_ens_files == 0) { - mlog << Error << "\nprocess_command_line() -> " + mlog << Error << "\n" << method_name << "the ensemble file list must be set using the " << "\"-ens\" option.\n\n"; exit(1); } if(out_file.length() == 0) { - mlog << Error << "\nprocess_command_line() -> " + mlog << Error << "\n" << method_name << "the output file must be set using the " << "\"-out\" option.\n\n"; exit(1); } if(config_file.length() == 0) { - mlog << Error << "\nprocess_command_line() -> " + mlog << Error << "\n" << method_name << "the configuration file must be set using the " << "\"-config\" option.\n\n"; exit(1); @@ -191,15 +188,18 @@ void process_command_line(int argc, char **argv) { // Get the ensemble file type from config, if present etype = parse_conf_file_type(conf_info.conf.lookup_dictionary(conf_key_ens)); - // Read the first input ensemble file - if(!(ens_mtddf = mtddf_factory.new_met_2d_data_file(ens_files[0].c_str(), etype))) { - mlog << Error << "\nprocess_command_line() -> " - << "trouble reading ensemble file \"" << ens_files[0] << "\"\n\n"; - exit(1); + // Get the ensemble file type from the files + if(etype == FileType_None) { + etype = parse_file_list_type(ens_files); } - // Store the input ensemble file type - etype = ens_mtddf->file_type(); + // UGrid not supported + if(etype == FileType_UGrid) { + mlog << Error << "\n" << method_name + << grdfiletype_to_string(etype) + << " ensemble files are not supported\n\n"; + exit(1); + } // Process the configuration conf_info.process_config(etype, &ens_files, ctrl_file.nonempty()); @@ -225,7 +225,7 @@ void process_command_line(int argc, char **argv) { // Check for control in the list of ensemble files if(ctrl_file.nonempty() && ens_files.has(ctrl_file) && n_ens_files != 1) { - mlog << Error << "\nprocess_command_line() -> " + mlog << Error << "\n" << method_name << "the ensemble control file should not appear in the list " << "of ensemble member files:\n" << ctrl_file << "\n\n"; exit(1); @@ -235,9 +235,7 @@ void process_command_line(int argc, char **argv) { for(i=0; i " - << "cannot open input ensemble file: " - << ens_files[i] << "\n\n"; + log_missing_file(method_name, "input ensemble file", ens_files[i]); ens_file_vld.add(0); } else { @@ -246,14 +244,11 @@ void process_command_line(int argc, char **argv) { } if(conf_info.control_id.nonempty() && ctrl_file.empty()) { - mlog << Warning << "\nprocess_command_line() -> " + mlog << Warning << "\n" << method_name << "control_id is set in the config file but " << "control file is not provided with -ctrl argument\n\n"; } - // Deallocate memory for data files - if(ens_mtddf) { delete ens_mtddf; ens_mtddf = (Met2dDataFile *) nullptr; } - return; } From 7f9bf9c461ea83076f8e3b502e607b39399bca54 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 1 May 2024 10:44:44 -0600 Subject: [PATCH 70/72] Feature 2842 ugrid config (#2875) * #2842 Removed UGrid related setting * #2842 Corrected vertical level for data_plane_array * #2842 Do not allow the time range * #2842 The UGridConfig file can be passed as ugrid_dataset * #2842 Changed -config option to -ugrid_config * #2842 Deleted UGrid configurations * 2842 Fix a compile error when UGrid is disabled * #2842 Cleanup * #2842 Added an unittest point_stat_ugrid_mpas_config * #2842 Added a PointStatConfig without UGrid dataset. * #2842 Corrected ty[po at the variable name * Switched from time_centered to time_instant. I think time_centered is the center of the forecast lead window and time_instant is the time the forecast is valid (end of forecast window). * #2842 Removed ugrid_max_distance_km and unused metadata names * #2842 Restored time variable time_instant for LFric * #2842 Adjust lon between -180 and 180 * #2842 Adjust lon between -180 and 180 * #2842 Adjust lon between -180 and 180 * #2842 Adjusted lon to between -180 to 180 * #2842 Changed variable names * Per #2842, switch from degrees east to west right when the longitudes are read. * #2842, switch from degrees east to west right when the longitudes are read * #2842 Cleanup debug messages * #2842 Disabled output types except STAT for sl1l2 * #2842 Disabled output types except STAT for sl1l2 and MPR * #2842 Reduced output files for UGrid --------- Co-authored-by: Howard Soh Co-authored-by: Daniel Adriaansen Co-authored-by: John Halley Gotway --- .../config/GridStatConfig_ugrid_mpas | 10 +++--- .../config/GridStatConfig_ugrid_mpas_diag | 10 +++--- .../config/PointStatConfig_ugrid_mpas_diag | 16 +++++----- .../config/PointStatConfig_ugrid_mpas_out | 16 +++++----- .../config/PointStatConfig_ugrid_no_dataset | 16 +++++----- internal/test_unit/xml/unit_ugrid.xml | 32 ++++++++++++------- 6 files changed, 54 insertions(+), 46 deletions(-) diff --git a/internal/test_unit/config/GridStatConfig_ugrid_mpas b/internal/test_unit/config/GridStatConfig_ugrid_mpas index db40bb0798..d54b25de53 100644 --- a/internal/test_unit/config/GridStatConfig_ugrid_mpas +++ b/internal/test_unit/config/GridStatConfig_ugrid_mpas @@ -203,12 +203,12 @@ output_flag = { cts = NONE; mctc = NONE; mcts = NONE; - cnt = STAT; + cnt = NONE; sl1l2 = STAT; - sal1l2 = STAT; - vl1l2 = STAT; - val1l2 = STAT; - vcnt = STAT; + sal1l2 = NONE; + vl1l2 = NONE; + val1l2 = NONE; + vcnt = NONE; pct = NONE; pstd = NONE; pjc = NONE; diff --git a/internal/test_unit/config/GridStatConfig_ugrid_mpas_diag b/internal/test_unit/config/GridStatConfig_ugrid_mpas_diag index c893957e15..9e479d0302 100644 --- a/internal/test_unit/config/GridStatConfig_ugrid_mpas_diag +++ b/internal/test_unit/config/GridStatConfig_ugrid_mpas_diag @@ -203,12 +203,12 @@ output_flag = { cts = NONE; mctc = NONE; mcts = NONE; - cnt = STAT; + cnt = NONE; sl1l2 = STAT; - sal1l2 = STAT; - vl1l2 = STAT; - val1l2 = STAT; - vcnt = STAT; + sal1l2 = NONE; + vl1l2 = NONE; + val1l2 = NONE; + vcnt = NONE; pct = NONE; pstd = NONE; pjc = NONE; diff --git a/internal/test_unit/config/PointStatConfig_ugrid_mpas_diag b/internal/test_unit/config/PointStatConfig_ugrid_mpas_diag index ca0ef81ae7..886c6bb301 100644 --- a/internal/test_unit/config/PointStatConfig_ugrid_mpas_diag +++ b/internal/test_unit/config/PointStatConfig_ugrid_mpas_diag @@ -119,17 +119,17 @@ hira = { //////////////////////////////////////////////////////////////////////////////// output_flag = { - fho = BOTH; - ctc = BOTH; - cts = BOTH; + fho = STAT; + ctc = STAT; + cts = STAT; mctc = NONE; mcts = NONE; - cnt = BOTH; - sl1l2 = NONE; + cnt = NONE; + sl1l2 = STAT; sal1l2 = NONE; vl1l2 = NONE; val1l2 = NONE; - vcnt = BOTH; + vcnt = NONE; pct = NONE; pstd = NONE; pjc = NONE; @@ -137,8 +137,8 @@ output_flag = { ecnt = NONE; orank = NONE; rps = NONE; - eclv = BOTH; - mpr = BOTH; + eclv = NONE; + mpr = STAT; seeps = NONE; seeps_mpr = NONE; } diff --git a/internal/test_unit/config/PointStatConfig_ugrid_mpas_out b/internal/test_unit/config/PointStatConfig_ugrid_mpas_out index 1e1f9e4887..c16deb0f7d 100644 --- a/internal/test_unit/config/PointStatConfig_ugrid_mpas_out +++ b/internal/test_unit/config/PointStatConfig_ugrid_mpas_out @@ -119,17 +119,17 @@ hira = { //////////////////////////////////////////////////////////////////////////////// output_flag = { - fho = BOTH; - ctc = BOTH; - cts = BOTH; + fho = STAT; + ctc = STAT; + cts = STAT; mctc = NONE; mcts = NONE; - cnt = BOTH; - sl1l2 = NONE; + cnt = NONE; + sl1l2 = STAT; sal1l2 = NONE; vl1l2 = NONE; val1l2 = NONE; - vcnt = BOTH; + vcnt = NONE; pct = NONE; pstd = NONE; pjc = NONE; @@ -137,8 +137,8 @@ output_flag = { ecnt = NONE; orank = NONE; rps = NONE; - eclv = BOTH; - mpr = BOTH; + eclv = NONE; + mpr = STAT; seeps = NONE; seeps_mpr = NONE; } diff --git a/internal/test_unit/config/PointStatConfig_ugrid_no_dataset b/internal/test_unit/config/PointStatConfig_ugrid_no_dataset index e70a3af9ee..9c7c7f5b3a 100644 --- a/internal/test_unit/config/PointStatConfig_ugrid_no_dataset +++ b/internal/test_unit/config/PointStatConfig_ugrid_no_dataset @@ -119,17 +119,17 @@ hira = { //////////////////////////////////////////////////////////////////////////////// output_flag = { - fho = BOTH; - ctc = BOTH; - cts = BOTH; + fho = NONE; + ctc = NONE; + cts = NONE; mctc = NONE; mcts = NONE; - cnt = BOTH; - sl1l2 = NONE; + cnt = NONE; + sl1l2 = STAT; sal1l2 = NONE; vl1l2 = NONE; val1l2 = NONE; - vcnt = BOTH; + vcnt = NONE; pct = NONE; pstd = NONE; pjc = NONE; @@ -137,8 +137,8 @@ output_flag = { ecnt = NONE; orank = NONE; rps = NONE; - eclv = BOTH; - mpr = BOTH; + eclv = NONE; + mpr = STAT; seeps = NONE; seeps_mpr = NONE; } diff --git a/internal/test_unit/xml/unit_ugrid.xml b/internal/test_unit/xml/unit_ugrid.xml index 80211fdc2f..1122340a72 100644 --- a/internal/test_unit/xml/unit_ugrid.xml +++ b/internal/test_unit/xml/unit_ugrid.xml @@ -77,12 +77,6 @@ &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V.stat - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_fho.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_ctc.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_cts.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_cnt.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_eclv.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_DIAG_TEMP_000000L_20120409_120000V_mpr.txt @@ -102,12 +96,26 @@ &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V.stat - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_fho.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_ctc.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_cts.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_cnt.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_eclv.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_OUT_TEMP_000000L_20120409_120000V_mpr.txt + + + + + &MET_BIN;/point_stat + + BEG_DS -1800 + END_DS 1800 + OUTPUT_PREFIX UGRID_MPAS_CFG_OUT_TEMP + CONFIG_DIR &CONFIG_DIR; + + \ + &DATA_DIR_UGRID;/mpas/mpasout.2012-04-09_12.00.00_reduced.nc \ + &OUTPUT_DIR;/pb2nc/gdas1.20120409.t12z.prepbufr.nc \ + &CONFIG_DIR;/PointStatConfig_ugrid_no_dataset \ + -ugrid_config ${MET_BASE}/config/UGridConfig_mpas \ + -outdir &OUTPUT_DIR;/point_stat_ugrid -v 1 + + + &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V.stat From 566d4fb31e3000e94814ea2980ab1df9148fbf10 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 1 May 2024 19:31:46 +0000 Subject: [PATCH 71/72] Hotfix to develop branch to remove duplicate test named 'point_stat_ugrid_mpas_config'. That was causing unit_ugrid.xml to fail because it was still looking for .txt output files that are no longer being generated. --- internal/test_unit/xml/unit_ugrid.xml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/internal/test_unit/xml/unit_ugrid.xml b/internal/test_unit/xml/unit_ugrid.xml index 1122340a72..80a6a53360 100644 --- a/internal/test_unit/xml/unit_ugrid.xml +++ b/internal/test_unit/xml/unit_ugrid.xml @@ -119,30 +119,4 @@ - - &MET_BIN;/point_stat - - BEG_DS -1800 - END_DS 1800 - OUTPUT_PREFIX UGRID_MPAS_CFG_OUT_TEMP - CONFIG_DIR &CONFIG_DIR; - - \ - &DATA_DIR_UGRID;/mpas/mpasout.2012-04-09_12.00.00_reduced.nc \ - &OUTPUT_DIR;/pb2nc/gdas1.20120409.t12z.prepbufr.nc \ - &CONFIG_DIR;/PointStatConfig_ugrid_no_dataset \ - -ugrid_config ${MET_BASE}/config/UGridConfig_mpas \ - -outdir &OUTPUT_DIR;/point_stat_ugrid -v 1 - - - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V.stat - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_fho.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_ctc.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_cts.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_cnt.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_eclv.txt - &OUTPUT_DIR;/point_stat_ugrid/point_stat_UGRID_MPAS_CFG_OUT_TEMP_000000L_20120409_120000V_mpr.txt - - - From 542b4ba9a1db69d445ecb3eb023d4c60cad291ea Mon Sep 17 00:00:00 2001 From: Dan Adriaansen Date: Tue, 7 May 2024 08:42:48 -0600 Subject: [PATCH 72/72] Feature 2748 document ugrid (#2869) * Initial documentation of the UGRID capability. * Fixes error in references, adds appendix to index, and adds sub-section for configuration entries and a table for metadata map items. * Corrects LFRic, rewords section on UGRID conventions, updates description of using GridStat, and removes mention of nodes. * Forgot one more mention of UGRID conventions. * Incorporates more suggestions from @willmayfield. * Switches to numerical table reference. --- docs/Users_Guide/appendixH.rst | 87 +++++++++++++++++++++++++++++ docs/Users_Guide/config_options.rst | 2 + docs/Users_Guide/grid-stat.rst | 11 ++-- docs/Users_Guide/index.rst | 1 + docs/Users_Guide/point-stat.rst | 15 +++-- docs/Users_Guide/refs.rst | 16 ++++++ 6 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 docs/Users_Guide/appendixH.rst diff --git a/docs/Users_Guide/appendixH.rst b/docs/Users_Guide/appendixH.rst new file mode 100644 index 0000000000..3fff53218a --- /dev/null +++ b/docs/Users_Guide/appendixH.rst @@ -0,0 +1,87 @@ +.. _appendixH: + +***************************** +Appendix H Unstructured Grids +***************************** + +Introduction +============ + +METv12.0.0+ includes limited support for using datasets on unstructured grids (UGRIDs) in the PointStat and GridStat tools. This support includes verifying UGRID forecasts against point observations (PointStat), and verifying UGRID forecasts regridded to a structured grid against gridded observations on a structured grid (GridStat). The implementation of UGRID support in METv12.0.0+ provides a mechanism for a user to describe the topology of their unstructured grid. Thus far, development to support datasets on unstructured grids has been driven by the LFRic (“elfrick”) NWP model (:ref:`Adams et al. 2019 `), and the Model for Prediction Across Scales (MPAS) NWP model (:ref:`Skamarock et al., 2012 `). However, the support for unstructured grids was implemented in such a way that additional unstructured grids can be utilized, with the appropriate mapping of the user's topology to the elements that MET requires. + +Unstructured Grid Files +======================= + +Support for UGRID files in NetCDF format is provided. MET will attempt to auto-detect UGRID files. If the file is CF-compliant and the “Conventions” global attribute is “UGRID” or “MPAS”, or if the global attribute “mesh_spec” is present, MET recognizes the file as a UGRID file. If the user is not using a supported UGRID, or a UGRID file that does not contain the required global attributes for autodetection, the user should set the **file_type** configuration entry to **NETCDF_UGRID**. In some cases, the UGRID topology is provided in an ancillary file separate from forecast variables. This is controlled via the **ugrid_coordinates_file** configuration entry. This file is checked first, and then the UGRID data file. If the same elements are found in both files, the information from the data file takes precedence, and thus it is recommended to leave **ugrid_coordinates_file** unset if all required elements are found in the data file. If both a data and coordinates file are provided, the shape of the latitude and longitude dimensions are cross-referenced as a limited enforcement measure that the coordinates file and data file belong to the same UGRID. + +Required Unstructured Grid Metadata +=================================== + +To correctly parse the UGRID topology, MET needs the following information that must be contained within the UGRID coordinates file or the UGRID data file. It is often the case that the variable names for these elements differ between UGRIDs. If the user is not using one of the supported UGRIDs, they will need to define the **ugrid_metadata_map** in a custom configuration file that they provide on the command line using the **-ugrid_config** command line argument, which tells MET the variable names that correspond to the following elements: + +.. _table_ugrid_metadata: + +.. list-table:: Required UGRID Metadata + :widths: auto + :header-rows: 1 + + * - Metadata Map Key + - Description + - Required + * - dim_face + - Dimension name for UGRID cells + - Required + * - lat_face + - Coordinate variable name for the latitude of each UGRID cell + - Required + * - lon_face + - Coordinate variable name for the longitude of each UGRID cell + - Required + * - dim_time + - Dimension name for the time coordinate + - Required + * - time + - Coordinate variable for time + - Required + * - dim_vert + - Dimension name for the vertical coordinate, if present + - Optional + * - vert_face + - Coordinate variable name for the vertical coordinate + - Optional + +Unstructured Grid Configuration Entries +======================================= + +In the PointStat and GridStat config files, a user can control aspects of the UGRID capability. Since the UGRID support in MET is optional, these items are not included in the default MET config files. If the user requires modification for any of the following, they must add them to their MET config file. + +ugrid_dataset +------------- + +If the UGRID dataset is supported by MET, then this item is set to the string identifying the UGRID. Currently supported ugrid_dataset options include “lfric”, and “mpas”. If this item is not set, the user must provide a separate UGRID configuration file on the command line using the **-ugrid_config** command line argument. + +ugrid_max_distance_km +--------------------- + +For PointStat, this is the distance from each UGRID cell center that PointStat will search outward to collect observations to use for verification. The default is 0 km, which by default will use the closest observation to the UGRID cell for verification. For GridStat, this is the distance from each forecast grid point to search for observation grid cells to include when interpolating to the forecast grid point locations. Currently, only the nearest point observation or gridded observation cell is used. See `Unstructured Grid Limitations`_ for additional details about interpolation when using GridStat. + +ugrid_coordinates_file +---------------------- + +The absolute path to the ancillary NetCDF file that describes the UGRID topology. This file is checked for the required UGRID metadata first, and the data file is checked second and takes precedence over this file if the same elements are found in both files. + +ugrid_metadata_map +------------------ + +The mapping dictionary which allows a user to specify the variable names of the required UGRID topology elements that are required by MET. For "lfric" and "mpas", **ugrid_metadata_map** comes pre-configured with MET and a user can simply set **ugrid_dataset**. Otherwise, the user must create a separate UGRID configuration file containing the **ugrid_metadata_map** containing the elements from :numref:`table_ugrid_metadata` and provide it on the command line using the **-ugrid_config** command line argument. + +Unstructured Grid Limitations +============================= + +We anticipate expanding the UGRID capabilities in MET in the near future. Until then, users are encouraged to be mindful of the following limitations: + +1. In GridStat, there is no support for verifying directly on a UGRID. The UGRID (either forecast, obs, or both) must be regridded to a structured verification grid prior to verification being performed. In most cases, gridded observations are on a structured grid and so the users are encouraged to regrid their UGRID forecast to the structured observation grid. If the user wishes to verify a UGRID observation against a UGRID forecast (for example, a UGRID model analysis), the user must define a custom verification grid tailored to their UGRID characteristics, being mindful that the regridding can be slow for large verification grids. The user is referred to :ref:`appendixB` for guidance on defining a structured verification grid. + +2. Data at cell edges are currently not supported, only those variables which have data at the cell centers are supported. Users should note in particular that wind components that are typically derived using data at cell edges are currently unsupported. + +3. No aggregation methods of point observations within the **ugrid_max_distance_km** are supported except NEAREST, and no aggregation methods of gridded observations within the **ugrid_max_distance_km** are supported except NEAREST. diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index ec76ecf7d5..fb6e4f47eb 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -1047,6 +1047,8 @@ to be verified. This dictionary may include the following entries: single model level. file_type = NETCDF_NCCF; NetCDF following the Climate Forecast (CF) convention. + file_type = NETCDF_UGRID; NetCDF containing data on an + unstructured grid. file_type = PYTHON_NUMPY; Run a Python script to load data into a NumPy array. file_type = PYTHON_XARRAY; Run a Python script to load data into diff --git a/docs/Users_Guide/grid-stat.rst b/docs/Users_Guide/grid-stat.rst index 22fe740a55..c09df58d54 100644 --- a/docs/Users_Guide/grid-stat.rst +++ b/docs/Users_Guide/grid-stat.rst @@ -172,6 +172,7 @@ The usage statement for the Grid-Stat tool is listed below: fcst_file obs_file config_file + [-ugrid_config config_file] [-outdir path] [-log file] [-v level] @@ -191,13 +192,15 @@ Required Arguments for grid_stat Optional Arguments for grid_stat ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4. The **-outdir path** indicates the directory where output files should be written. +4. The **-ugrid_config** option provides a way for a user to provide a separate config file with metadata about their UGRID. -5. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. +5. The **-outdir path** indicates the directory where output files should be written. -6. The **-v level** option indicates the desired level of verbosity. The contents of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging. +6. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. -7. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression. +7. The **-v level** option indicates the desired level of verbosity. The contents of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging. + +8. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression. An example of the grid_stat calling sequence is listed below: diff --git a/docs/Users_Guide/index.rst b/docs/Users_Guide/index.rst index ee3a5ff6dc..1df5c65e53 100644 --- a/docs/Users_Guide/index.rst +++ b/docs/Users_Guide/index.rst @@ -81,6 +81,7 @@ The National Center for Atmospheric Research (NCAR) is sponsored by NSF. The DTC appendixE appendixF appendixG + appendixH .. only:: html diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index d5f895a8aa..6c32537146 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -277,6 +277,7 @@ The usage statement for the Point-Stat tool is shown below: fcst_file obs_file config_file + [-ugrid_config config_file] [-point_obs file] [-obs_valid_beg time] [-obs_valid_end time] @@ -298,17 +299,19 @@ Required Arguments for point_stat Optional Arguments for point_stat ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4. The **-point_obs** file may be used to pass additional NetCDF point observation files to be used in the verification. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`. +5. The **-ugrid_config** option provides a way for a user to provide a separate config file with metadata about their UGRID. -5. The **-obs_valid_beg** time option in YYYYMMDD[_HH[MMSS]] format sets the beginning of the observation matching time window, overriding the configuration file setting. +5. The **-point_obs** file may be used to pass additional NetCDF point observation files to be used in the verification. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`. -6. The **-obs_valid_end** time option in YYYYMMDD[_HH[MMSS]] format sets the end of the observation matching time window, overriding the configuration file setting. +6. The **-obs_valid_beg** time option in YYYYMMDD[_HH[MMSS]] format sets the beginning of the observation matching time window, overriding the configuration file setting. -7. The **-outdir path** indicates the directory where output files should be written. +7. The **-obs_valid_end** time option in YYYYMMDD[_HH[MMSS]] format sets the end of the observation matching time window, overriding the configuration file setting. -8. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. +8. The **-outdir path** indicates the directory where output files should be written. -9. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity will increase the amount of logging. +9. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file. + +10. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity will increase the amount of logging. An example of the point_stat calling sequence is shown below: diff --git a/docs/Users_Guide/refs.rst b/docs/Users_Guide/refs.rst index 1c328014cb..00e682abad 100644 --- a/docs/Users_Guide/refs.rst +++ b/docs/Users_Guide/refs.rst @@ -10,6 +10,14 @@ References | Atlantic Basin. *Weather and Forecasting*, 13, 1005-1015. | +.. _Adams-2019: + +| Adams, S. V., R. W. Ford, M. Hambley, J.M. Hobson, I. Kavčič, C. M. Maynard, +| T. Melvin, E. H. Müller, S. Mullerworth, A. R. Porter, M. Rezny, B. J. Shipway, +| and R. Wong, 2019: LFRic: Meeting the challenges of scalability and performance +| portability in Weather and Climate models. *Journal of Parallel and Distributed Computing*, +| **132**, 383-396, doi: https://doi.org/10.1016/j.jpdc.2019.02.007. + .. _Ahijevych-2009: | Ahijevych, D., E. Gilleland, B.G. Brown, and E.E. Ebert, 2009: Application of @@ -333,6 +341,14 @@ References | and Recommendations. *Monthly Weather Review*, 145, 3397-3418. | +.. _Skamarock-2012: + +| Skamarock, W. C., J. B. Klemp, M. G. Duda, L. D. Fowler, S. Park, and +| T. Ringler, 2012: A Multiscale Nonhydrostatic Atmospheric Model Using +| Centroidal Voronoi Tesselations and C-Grid Staggering. *Mon. Wea. Rev.*, +| **140**, 3090-3105, doi: https://doi.org/10.1175/MWR-D-11-00215.1. +| + .. _Stephenson-2000: | Stephenson, D.B., 2000: Use of the "Odds Ratio" for diagnosing