From d8572b9aac058efb5fa602d82b9bfd551b6943d9 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Fri, 2 Feb 2024 16:58:42 +0000 Subject: [PATCH 01/32] 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/32] #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 c78860291efe269d275efc786a6d7926f6323c37 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 14 Feb 2024 14:43:24 -0700 Subject: [PATCH 03/32] Feature #2395 wdir (#2820) * Per #2395, add new columns to VL1L2, VAL1L2, and VCNT line types for wind direction statistics. Work still in progress. * Per #2395, write the new VCNT columns to the output and document the additions to the VL1L2, VAL1L2, and VCNT columns. * Per #2395, add the definition of new statistics to Appendix G. * Per #2395, update file version history. * Per #2395, tweak warning message about zero wind vectors and update grid-stat and point-stat to log calls to the do_vl1l2() function. * Per #2395, refine the weights for wind direction stats, ignoring the undefined directions. * Update src/tools/core/stat_analysis/aggr_stat_line.cc * Update src/tools/core/stat_analysis/parse_stat_line.cc * Update src/tools/core/stat_analysis/aggr_stat_line.cc --- data/table_files/met_header_columns_V12.0.txt | 6 +- docs/Users_Guide/appendixG.rst | 167 +++++++++---- docs/Users_Guide/point-stat.rst | 30 +++ internal/test_unit/hdr/met_12_0.hdr | 6 +- src/basic/vx_util/stat_column_defs.h | 16 +- src/libcode/vx_stat_out/stat_columns.cc | 60 ++++- src/libcode/vx_statistics/met_stats.cc | 228 ++++++++++++------ src/libcode/vx_statistics/met_stats.h | 32 +-- src/tools/core/grid_stat/grid_stat.cc | 3 + src/tools/core/point_stat/point_stat.cc | 3 + .../core/stat_analysis/aggr_stat_line.cc | 17 ++ .../core/stat_analysis/parse_stat_line.cc | 8 + 12 files changed, 421 insertions(+), 155 deletions(-) diff --git a/data/table_files/met_header_columns_V12.0.txt b/data/table_files/met_header_columns_V12.0.txt index bf218d00bc..7ed1e5a187 100644 --- a/data/table_files/met_header_columns_V12.0.txt +++ b/data/table_files/met_header_columns_V12.0.txt @@ -27,9 +27,9 @@ V12.0 : STAT : RELP : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V12.0 : STAT : SAL1L2 : 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 FABAR OABAR FOABAR FFABAR OOABAR MAE V12.0 : STAT : SL1L2 : 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 FBAR OBAR FOBAR FFBAR OOBAR MAE V12.0 : STAT : SSVAR : 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_BIN BIN_i BIN_N VAR_MIN VAR_MAX VAR_MEAN FBAR OBAR FOBAR FFBAR OOBAR FBAR_NCL FBAR_NCU FSTDEV FSTDEV_NCL FSTDEV_NCU OBAR_NCL OBAR_NCU OSTDEV OSTDEV_NCL OSTDEV_NCU PR_CORR PR_CORR_NCL PR_CORR_NCU ME ME_NCL ME_NCU ESTDEV ESTDEV_NCL ESTDEV_NCU MBIAS MSE BCMSE RMSE -V12.0 : STAT : VAL1L2 : 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 UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR -V12.0 : STAT : VL1L2 : 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 UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR -V12.0 : STAT : VCNT : 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 FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU +V12.0 : STAT : VAL1L2 : 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 UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR DIRA_ME DIRA_MAE DIRA_MSE +V12.0 : STAT : VL1L2 : 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 UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR DIR_ME DIR_MAE DIR_MSE +V12.0 : STAT : VCNT : 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 FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU DIR_ME DIR_ME_BCL DIR_ME_BCU DIR_MAE DIR_MAE_BCL DIR_MAE_BCU DIR_MSE DIR_MSE_BCL DIR_MSE_BCU DIR_RMSE DIR_RMSE_BCL DIR_RMSE_BCU V12.0 : STAT : GENMPR : 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 INDEX STORM_ID PROB_LEAD PROB_VAL AGEN_INIT AGEN_FHR AGEN_LAT AGEN_LON AGEN_DLAND BGEN_LAT BGEN_LON BGEN_DLAND GEN_DIST GEN_TDIFF INIT_TDIFF DEV_CAT OPS_CAT V12.0 : STAT : SSIDX : 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 FCST_MODEL REF_MODEL N_INIT N_TERM N_VLD SS_INDEX diff --git a/docs/Users_Guide/appendixG.rst b/docs/Users_Guide/appendixG.rst index c2811fe4fa..821a4a4c5d 100644 --- a/docs/Users_Guide/appendixG.rst +++ b/docs/Users_Guide/appendixG.rst @@ -46,7 +46,6 @@ In the same manner, we can compare the directions of two different nonzero vecto __________________________ - Now let us specialize this discussion of vectors to verification of wind vector data. We will denote the forecast wind vector by :math:`\mathbf{F}`, and the observed wind vector by **O**. These are two-dimensional horizontal vectors with *u* and *v* components as follows: .. math:: \mathbf{F} = (u_f,v_f) \text{ and } \mathbf{O} = (u_o,v_o) @@ -71,35 +70,33 @@ Now let us look at the definitions of the vector statistics produced by MET: _________________________ - FBAR and OBAR are the average values of the forecast and observed wind speed. .. math:: - \text{FBAR} = \frac{1}{N} \sum_i s_{fi} - - \text{OBAR} = {1 \over N} \sum_i s_{oi} + \text{FBAR} = \frac{1}{N} \sum_i s_{fi} -_________________________ + \text{OBAR} = {1 \over N} \sum_i s_{oi} +_________________________ FS_RMS and OS_RMS are the root-mean-square values of the forecast and observed wind speeds. .. only:: latex - .. math:: - - \text{FS\_RMS} = [ \frac{1}{N} \sum_i s_{fi}^2]^{1/2} + .. math:: + + \text{FS\_RMS} = [ \frac{1}{N} \sum_i s_{fi}^2]^{1/2} - \text{OS\_RMS} = [\frac{1}{N} \sum_i s_{oi}^2]^{1/2} + \text{OS\_RMS} = [\frac{1}{N} \sum_i s_{oi}^2]^{1/2} .. only:: html - .. math:: - - \text{FS_RMS} = [ \frac{1}{N} \sum_i s_{fi}^2]^{1/2} + .. math:: - \text{OS_RMS} = [\frac{1}{N} \sum_i s_{oi}^2]^{1/2} + \text{FS_RMS} = [ \frac{1}{N} \sum_i s_{fi}^2]^{1/2} + + \text{OS_RMS} = [\frac{1}{N} \sum_i s_{oi}^2]^{1/2} ___________________________ @@ -107,13 +104,12 @@ MSVE and RMSVE are, respectively, the mean squared, and root mean squared, lengt .. math:: - \text{MSVE} = \frac{1}{N} \sum_i | \mathbf{F}_i - \mathbf{O}_i|^2 + \text{MSVE} = \frac{1}{N} \sum_i | \mathbf{F}_i - \mathbf{O}_i|^2 - \text{RMSVE} = \sqrt{MSVE} + \text{RMSVE} = \sqrt{MSVE} ____________________________ - FSTDEV and OSTDEV are the standard deviations of the forecast and observed wind speeds. .. math:: \text{FSTDEV } = \frac{1}{N} \sum_i (s_{fi} - \text{FBAR})^2 = \frac{1}{N} \sum_i s_{fi}^2 - \text{FBAR}^2 @@ -125,91 +121,84 @@ ___________________________ FDIR and ODIR are the direction (angle) of :math:`\mathbf{F}_a \text{ and } \mathbf{O}_a` with respect to the grid directions. .. math:: \text{FDIR } = \text{ direction angle of } \mathbf{F}_a - - \text{ODIR} = \text{ direction angle of } \mathbf{O}_a -________________________ + \text{ODIR} = \text{ direction angle of } \mathbf{O}_a +________________________ FBAR_SPEED and OBAR_SPEED are the lengths of the average forecast and observed wind vectors. Note that this is *not* the same as the average forecast and observed wind speeds (*ie.,* the length of an average vector :math:`\neq` the average length of the vector). .. only:: latex - .. math:: - - \text{FBAR\_SPEED } = | \mathbf{F}_a | - - \text{OBAR\_SPEED } = | \mathbf{O}_a | + .. math:: + + \text{FBAR\_SPEED } = | \mathbf{F}_a | + + \text{OBAR\_SPEED } = | \mathbf{O}_a | .. only:: html - .. math:: - - \text{FBAR_SPEED } = | \mathbf{F}_a | - - \text{OBAR_SPEED } = | \mathbf{O}_a | + .. math:: + \text{FBAR_SPEED } = | \mathbf{F}_a | -________________________ + \text{OBAR_SPEED } = | \mathbf{O}_a | +________________________ VDIFF_SPEED is the length (*ie. speed*) of the vector difference between the average forecast and average observed wind vectors. .. only:: latex - .. math:: \text{VDIFF\_SPEED } = | \mathbf{F}_a - \mathbf{O}_a | + .. math:: \text{VDIFF\_SPEED } = | \mathbf{F}_a - \mathbf{O}_a | .. only:: html - .. math:: \text{VDIFF_SPEED } = | \mathbf{F}_a - \mathbf{O}_a | + .. math:: \text{VDIFF_SPEED } = | \mathbf{F}_a - \mathbf{O}_a | .. only:: latex - Note that this is *not* the same as the difference in lengths (speeds) of the average forecast and observed wind vectors. That quantity is called SPEED_ERR (see below). There is a relationship between these two statistics however: using some of the results obtained in the introduction to this appendix, we can say that :math:`| | \mathbf{F}_a | - | \mathbf{O}_a | | \leq | \mathbf{F}_a - \mathbf{O}_a |` or, equivalently, that :math:`\vert \text{SPEED\_ERR } \vert \leq \text{VDIFF\_SPEED. }` + Note that this is *not* the same as the difference in lengths (speeds) of the average forecast and observed wind vectors. That quantity is called SPEED_ERR (see below). There is a relationship between these two statistics however: using some of the results obtained in the introduction to this appendix, we can say that :math:`| | \mathbf{F}_a | - | \mathbf{O}_a | | \leq | \mathbf{F}_a - \mathbf{O}_a |` or, equivalently, that :math:`\vert \text{SPEED\_ERR } \vert \leq \text{VDIFF\_SPEED. }` .. only:: html - Note that this is *not* the same as the difference in lengths (speeds) of the average forecast and observed wind vectors. That quantity is called SPEED_ERR (see below). There is a relationship between these two statistics however: using some of the results obtained in the introduction to this appendix, we can say that :math:`| | \mathbf{F}_a | - | \mathbf{O}_a | | \leq | \mathbf{F}_a - \mathbf{O}_a |` or, equivalently, that :math:`\vert \text{SPEED_ERR } \vert \leq \text{VDIFF_SPEED. }` + Note that this is *not* the same as the difference in lengths (speeds) of the average forecast and observed wind vectors. That quantity is called SPEED_ERR (see below). There is a relationship between these two statistics however: using some of the results obtained in the introduction to this appendix, we can say that :math:`| | \mathbf{F}_a | - | \mathbf{O}_a | | \leq | \mathbf{F}_a - \mathbf{O}_a |` or, equivalently, that :math:`\vert \text{SPEED_ERR } \vert \leq \text{VDIFF_SPEED. }` _________________________ - -VDIFF_DIR is the direction of the vector difference of the average forecast and average observed wind vectors. Note that this is {\it not} the same as the difference in direction of the average forecast and average observed wind vectors. This latter quantity would be FDIR :math:`-` ODIR. +VDIFF_DIR is the direction of the vector difference of the average forecast and average observed wind vectors. Note that this is *not* the same as the difference in direction of the average forecast and average observed wind vectors. This latter quantity would be FDIR :math:`-` ODIR. .. only:: latex - .. math:: \text{VDIFF\_DIR } = \text{ direction of } (\mathbf{F}_a - \mathbf{O}_a) + .. math:: \text{VDIFF\_DIR } = \text{ direction of } (\mathbf{F}_a - \mathbf{O}_a) .. only:: html - .. math:: \text{VDIFF_DIR } = \text{ direction of } (\mathbf{F}_a - \mathbf{O}_a) + .. math:: \text{VDIFF_DIR } = \text{ direction of } (\mathbf{F}_a - \mathbf{O}_a) _________________________ - SPEED_ERR is the difference in the lengths (speeds) of the average forecast and average observed wind vectors. (See the discussion of VDIFF_SPEED above.) .. only:: latex - .. math:: \text{SPEED\_ERR } = | \mathbf{F}_a | - | \mathbf{O}_a | = \text{ FBAR\_SPEED } - \text{ OBAR\_SPEED } + .. math:: \text{SPEED\_ERR } = | \mathbf{F}_a | - | \mathbf{O}_a | = \text{ FBAR\_SPEED } - \text{ OBAR\_SPEED } .. only:: html - .. math:: \text{SPEED_ERR } = | \mathbf{F}_a | - | \mathbf{O}_a | = \text{ FBAR_SPEED } - \text{ OBAR_SPEED } - + .. math:: \text{SPEED_ERR } = | \mathbf{F}_a | - | \mathbf{O}_a | = \text{ FBAR_SPEED } - \text{ OBAR_SPEED } ___________________________ - SPEED_ABSERR is the absolute value of SPEED_ERR. Note that we have SPEED_ABSERR :math:`\leq` VDIFF_SPEED (see the discussion of VDIFF_SPEED above). .. only:: latex - .. math:: \text{SPEED\_ABSERR } = \vert \text{SPEED\_ERR } \vert + .. math:: \text{SPEED\_ABSERR } = \vert \text{SPEED\_ERR } \vert .. only:: html - .. math:: \text{SPEED_ABSERR } = \vert \text{SPEED_ERR } \vert + .. math:: \text{SPEED_ABSERR } = \vert \text{SPEED_ERR } \vert __________________________ @@ -217,20 +206,96 @@ DIR_ERR is the signed angle between the directions of the average forecast and a .. only:: latex - .. math:: \text{DIR\_ERR } = \text{ direction between } N(\mathbf{F}_a) \text{ and } N(\mathbf{O}_a) + .. math:: \text{DIR\_ERR } = \text{ direction between } N(\mathbf{F}_a) \text{ and } N(\mathbf{O}_a) .. only:: html - .. math:: \text{DIR_ERR } = \text{ direction between } N(\mathbf{F}_a) \text{ and } N(\mathbf{O}_a) + .. math:: \text{DIR_ERR } = \text{ direction between } N(\mathbf{F}_a) \text{ and } N(\mathbf{O}_a) __________________________ - + DIR_ABSERR is the absolute value of DIR_ERR. In other words, it's an unsigned angle rather than a signed angle. .. only:: latex - .. math:: \text{DIR\_ABSERR } = \vert \text{DIR\_ERR } \vert + .. math:: \text{DIR\_ABSERR } = \vert \text{DIR\_ERR } \vert + +.. only:: html + + .. math:: \text{DIR_ABSERR } = \vert \text{DIR_ERR } \vert + +__________________________ + +The following statistics are computed by comparing the forecast and observed wind directions for each individual matched pair. + +For each point, the directed angle difference in degrees is computed between the forecast and observed wind vectors and rescaled to the range from -180, exclusive, to 180, inclusive. + +.. math:: + + N(\mathbf{F}_i) - N(\mathbf{O}_i) \in (-180, 180] + +Note however that the direction of the zero vector is undefined. Points for which the forecast or observed wind direction is undefined are excluded from the analysis and result in a warning message being printed. The "wind_thresh" and "wind_logic" configuration options, described in :numref:`config_options`, can be used to filter the wind vectors down to a subset that meet the specified wind speed threshold. + +__________________________ + +DIR_ME is the average of the signed difference between the forecast and observed wind directions. + +.. only:: latex + + .. math:: + + \text{DIR\_ME} = \frac{1}{N} \sum_i (N(\mathbf{F}_i) - N(\mathbf{O}_i)) .. only:: html - .. math:: \text{DIR_ABSERR } = \vert \text{DIR_ERR } \vert + .. math:: + + \text{DIR_ME} = \frac{1}{N} \sum_i (N(\mathbf{F}_i) - N(\mathbf{O}_i)) + +__________________________ + +DIR_MAE is the average of the absolute value of the difference between the forecast and observed wind directions. + +.. only:: latex + + .. math:: + + \text{DIR\_MAE} = \frac{1}{N} \sum_i | N(\mathbf{F}_i) - N(\mathbf{O}_i) | + +.. only:: html + + .. math:: + + \text{DIR_MAE} = \frac{1}{N} \sum_i | N(\mathbf{F}_i) - N(\mathbf{O}_i) | + +__________________________ + +DIR_MSE is the average of the squared difference between the forecast and observed wind directions. + +.. only:: latex + + .. math:: + + \text{DIR\_MSE} = \frac{1}{N} \sum_i (N(\mathbf{F}_i) - N(\mathbf{O}_i))^2 + +.. only:: html + + .. math:: + + \text{DIR_MSE} = \frac{1}{N} \sum_i (N(\mathbf{F}_i) - N(\mathbf{O}_i))^2 + +__________________________ + +DIR_RMSE is the square root of the average squared difference between the forecast and observed wind directions. + +.. only:: latex + + .. math:: + + \text{DIR\_RMSE} = \sqrt{DIR\_MSE} + +.. only:: html + + .. math:: + + \text{DIR_RMSE} = \sqrt{DIR\_MSE} diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index 4258e8057f..d5f895a8aa 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -1285,6 +1285,15 @@ The first set of header columns are common to all of the output files generated * - 34 - O_SPEED_BAR - Mean observed wind speed + * - 35 + - DIR_ME + - Mean wind direction difference, from -180 to 180 degrees + * - 36 + - DIR_MAE + - Mean absolute wind direction difference + * - 37 + - DIR_MSE + - Mean squared wind direction difference .. _table_PS_format_info_VAL1L2: @@ -1331,6 +1340,15 @@ The first set of header columns are common to all of the output files generated * - 34 - OA_SPEED_BAR - Mean observed wind speed anomaly + * - 35 + - DIRA_ME + - Mean wind direction anomaly difference, from -180 to 180 degrees + * - 36 + - DIRA_MAE + - Mean absolute wind direction anomaly difference + * - 37 + - DIRA_MSE + - Mean squared wind direction anomaly difference .. _table_PS_format_info_VCNT: @@ -1410,6 +1428,18 @@ The first set of header columns are common to all of the output files generated * - 85-87 - ANOM_CORR_UNCNTR, :raw-html:`
` ANOM_CORR_UNCNTR_BCL, :raw-html:`
` ANOM_CORR_UNCNTR_BCU - Uncentered vector Anomaly Correlation excluding mean error including bootstrap upper and lower confidence limits + * - 88-90 + - DIR_ME, :raw-html:`
` DIR_ME_BCL, :raw-html:`
` DIR_ME_BCU + - Mean direction difference, from -180 to 180 degrees, including bootstrap upper and lower confidence limits + * - 91-93 + - DIR_MAE, :raw-html:`
` DIR_MAE_BCL, :raw-html:`
` DIR_MAE_BCU + - Mean absolute direction difference including bootstrap upper and lower confidence limits + * - 94-96 + - DIR_MSE, :raw-html:`
` DIR_MSE_BCL, :raw-html:`
` DIR_MSE_BCU + - Mean squared direction difference including bootstrap upper and lower confidence limits + * - 97-99 + - DIR_RMSE, :raw-html:`
` DIR_RMSE_BCL, :raw-html:`
` DIR_RMSE_BCU + - Root mean squared direction difference including bootstrap upper and lower confidence limits .. _table_PS_format_info_MPR: diff --git a/internal/test_unit/hdr/met_12_0.hdr b/internal/test_unit/hdr/met_12_0.hdr index 888df0f61d..d6bf9fb0b9 100644 --- a/internal/test_unit/hdr/met_12_0.hdr +++ b/internal/test_unit/hdr/met_12_0.hdr @@ -27,9 +27,9 @@ RELP : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L SAL1L2 : 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 FABAR OABAR FOABAR FFABAR OOABAR MAE SL1L2 : 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 FBAR OBAR FOBAR FFBAR OOBAR MAE SSVAR : 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_BIN BIN_i BIN_N VAR_MIN VAR_MAX VAR_MEAN FBAR OBAR FOBAR FFBAR OOBAR FBAR_NCL FBAR_NCU FSTDEV FSTDEV_NCL FSTDEV_NCU OBAR_NCL OBAR_NCU OSTDEV OSTDEV_NCL OSTDEV_NCU PR_CORR PR_CORR_NCL PR_CORR_NCU ME ME_NCL ME_NCU ESTDEV ESTDEV_NCL ESTDEV_NCU MBIAS MSE BCMSE RMSE -VL1L2 : 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 UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR -VAL1L2 : 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 UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR -VCNT : 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 FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU +VL1L2 : 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 UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR DIR_ME DIR_MAE DIR_MSE +VAL1L2 : 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 UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR DIRA_ME DIRA_MAE DIRA_MSE +VCNT : 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 FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU DIR_ME DIR_ME_BCL DIR_ME_BCU DIR_MAE DIR_MAE_BCL DIR_MAE_BCU DIR_MSE DIR_MSE_BCL DIR_MSE_BCU DIR_RMSE DIR_RMSE_BCL DIR_RMSE_BCU GENMPR : 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 INDEX STORM_ID PROB_LEAD PROB_VAL AGEN_INIT AGEN_FHR AGEN_LAT AGEN_LON AGEN_DLAND BGEN_LAT BGEN_LON BGEN_DLAND GEN_DIST GEN_TDIFF INIT_TDIFF DEV_CAT OPS_CAT SSIDX : 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 FCST_MODEL REF_MODEL N_INIT N_TERM N_VLD SS_INDEX MODE_SOA : 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 N_VALID GRID_RES OBJECT_ID OBJECT_CAT CENTROID_X CENTROID_Y CENTROID_LAT CENTROID_LON AXIS_ANG LENGTH WIDTH AREA AREA_THRESH CURVATURE CURVATURE_X CURVATURE_Y COMPLEXITY INTENSITY_10 INTENSITY_25 INTENSITY_50 INTENSITY_75 INTENSITY_90 INTENSITY_50 INTENSITY_SUM diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index f77e2200cb..909441b5ba 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -124,14 +124,16 @@ static const char * vl1l2_columns [] = { "TOTAL", "UFBAR", "VFBAR", "UOBAR", "VOBAR", "UVFOBAR", "UVFFBAR", "UVOOBAR", "F_SPEED_BAR", - "O_SPEED_BAR" + "O_SPEED_BAR", "DIR_ME", "DIR_MAE", + "DIR_MSE" }; static const char * val1l2_columns [] = { - "TOTAL", "UFABAR", "VFABAR", - "UOABAR", "VOABAR", "UVFOABAR", - "UVFFABAR", "UVOOABAR", "FA_SPEED_BAR", - "OA_SPEED_BAR" + "TOTAL", "UFABAR", "VFABAR", + "UOABAR", "VOABAR", "UVFOABAR", + "UVFFABAR", "UVOOABAR", "FA_SPEED_BAR", + "OA_SPEED_BAR", "DIRA_ME", "DIRA_MAE", + "DIRA_MSE" }; @@ -158,6 +160,10 @@ static const char * vcnt_columns [] = { "ANOM_CORR", "ANOM_CORR_NCL", "ANOM_CORR_NCU", "ANOM_CORR_BCL", "ANOM_CORR_BCU", "ANOM_CORR_UNCNTR", "ANOM_CORR_UNCNTR_BCL", "ANOM_CORR_UNCNTR_BCU", + "DIR_ME", "DIR_ME_BCL", "DIR_ME_BCU", + "DIR_MAE", "DIR_MAE_BCL", "DIR_MAE_BCU", + "DIR_MSE", "DIR_MSE_BCL", "DIR_MSE_BCU", + "DIR_RMSE", "DIR_RMSE_BCL", "DIR_RMSE_BCU" }; static const char * pct_columns [] = { diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index bd1dd46218..034c3c1961 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -2901,7 +2901,8 @@ void write_sl1l2_cols(const SL1L2Info &sl1l2_info, // Scalar L1L2 Line Type (SL1L2) // Dump out the SL1L2 line: // TOTAL, FBAR, OBAR, - // FOBAR, FFBAR, OOBAR + // FOBAR, FFBAR, OOBAR, + // MAE // at.set_entry(r, c+0, // Total Count sl1l2_info.scount); @@ -2974,7 +2975,8 @@ void write_vl1l2_cols(const VL1L2Info &vl1l2_info, // TOTAL, UFBAR, VFBAR, // UOBAR, VOBAR, UVFOBAR, // UVFFBAR, UVOOBAR F_SPEED_BAR, - // O_SPEED_BAR, + // O_SPEED_BAR, DIR_ME, DIR_MAE, + // DIR_MSE // at.set_entry(r, c+0, // Total Count @@ -3007,6 +3009,15 @@ void write_vl1l2_cols(const VL1L2Info &vl1l2_info, at.set_entry(r, c+9, // O_SPEED_BAR vl1l2_info.o_speed_bar); + at.set_entry(r, c+10, // DIR_ME + vl1l2_info.dir_bar); + + at.set_entry(r, c+11, // DIR_MAE + vl1l2_info.absdir_bar); + + at.set_entry(r, c+12, // DIR_MSE + vl1l2_info.dir2_bar); + return; } @@ -3018,10 +3029,11 @@ void write_val1l2_cols(const VL1L2Info &vl1l2_info, // // Vector Anomaly L1L2 Line Type (VAL1L2) // Dump out the VAL1L2 line: - // TOTAL, UFABAR, VFABAR, - // UOABAR, VOABAR, UVFOABAR, - // UVFFABAR, UVOOABAR, FA_SPEED_BAR, - // OA_SPEED_BAR + // TOTAL, UFABAR, VFABAR, + // UOABAR, VOABAR, UVFOABAR, + // UVFFABAR, UVOOABAR, FA_SPEED_BAR, + // OA_SPEED_BAR, DIRA_ME, DIRA_MAE, + // DIRA_MSE // at.set_entry(r, c+0, // Total Anomaly Count @@ -3054,6 +3066,15 @@ void write_val1l2_cols(const VL1L2Info &vl1l2_info, at.set_entry(r, c+9, // OA_SPEED_BAR vl1l2_info.oa_speed_bar); + at.set_entry(r, c+10, // DIRA_ME + vl1l2_info.dira_bar); + + at.set_entry(r, c+11, // DIRA_MAE + vl1l2_info.absdira_bar); + + at.set_entry(r, c+12, // DIRA_MSE + vl1l2_info.dira2_bar); + return; } @@ -3084,10 +3105,17 @@ void write_vcnt_cols(const VL1L2Info &vcnt_info, int i, // SPD_ABSERR, SPD_ABSERR_BCL, SPD_ABSERR_BCU, // DIR_ERR, DIR_ERR_BCL, DIR_ERR_BCU, // DIR_ABSERR, DIR_ABSERR_BCL, DIR_ABSERR_BCU, - // ANOM_CORR, ANOM_CORR_NCL, ANOM_CORR_NCU, ANOM_CORR_BCL, ANOM_CORR_BCU - // ANOM_CORR_UNCNTR, ANOM_CORR_UNCNTR_BCL, ANOM_CORR_UNCNTR_BCU + // ANOM_CORR, ANOM_CORR_NCL, ANOM_CORR_NCU, + // ANOM_CORR_BCL, ANOM_CORR_BCU + // ANOM_CORR_UNCNTR, ANOM_CORR_UNCNTR_BCL, ANOM_CORR_UNCNTR_BCU, + // DIR_ME, DIR_ME_BCL, DIR_ME_BCU, + // DIR_MAE, DIR_MAE_BCL, DIR_MAE_BCU, + // DIR_MSE, DIR_MSE_BCL, DIR_MSE_BCU, + // DIR_RMSE, DIR_RMSE_BCL, DIR_RMSE_BCU // + // TODO: MET #963 Compute the VCNT bootstrap CI's + at.set_entry(r, c++, max(vcnt_info.vcount, // TOTAL vcnt_info.vacount)); @@ -3173,6 +3201,22 @@ void write_vcnt_cols(const VL1L2Info &vcnt_info, int i, at.set_entry(r, c++, (string)na_str); // ANOM_CORR_UNCNTR_BCL at.set_entry(r, c++, (string)na_str); // ANOM_CORR_UNCNTR_BCU + at.set_entry(r, c++, vcnt_info.DIR_ME.v); // DIR_ME + at.set_entry(r, c++, (string)na_str); // DIR_ME_BCL + at.set_entry(r, c++, (string)na_str); // DIR_ME_BCU + + at.set_entry(r, c++, vcnt_info.DIR_MAE.v); // DIR_MAE + at.set_entry(r, c++, (string)na_str); // DIR_MAE_BCL + at.set_entry(r, c++, (string)na_str); // DIR_MAE_BCU + + at.set_entry(r, c++, vcnt_info.DIR_MSE.v); // DIR_MSE + at.set_entry(r, c++, (string)na_str); // DIR_MSE_BCL + at.set_entry(r, c++, (string)na_str); // DIR_MSE_BCU + + at.set_entry(r, c++, vcnt_info.DIR_RMSE.v); // DIR_RMSE + at.set_entry(r, c++, (string)na_str); // DIR_RMSE_BCL + at.set_entry(r, c++, (string)na_str); // DIR_RMSE_BCU + return; } diff --git a/src/libcode/vx_statistics/met_stats.cc b/src/libcode/vx_statistics/met_stats.cc index fd50117173..a33f1adc73 100644 --- a/src/libcode/vx_statistics/met_stats.cc +++ b/src/libcode/vx_statistics/met_stats.cc @@ -1362,7 +1362,7 @@ VL1L2Info & VL1L2Info::operator+=(const VL1L2Info &c) { v_info.allocate_n_alpha(n_alpha); for(int i=0; i 0) { v_info.uf_bar = (uf_bar*vcount + c.uf_bar*c.vcount) /v_info.vcount; @@ -1374,20 +1374,26 @@ VL1L2Info & VL1L2Info::operator+=(const VL1L2Info &c) { v_info.uvoo_bar = (uvoo_bar*vcount + c.uvoo_bar*c.vcount) /v_info.vcount; v_info.f_speed_bar = (f_speed_bar*vcount + c.f_speed_bar*c.vcount)/v_info.vcount; v_info.o_speed_bar = (o_speed_bar*vcount + c.o_speed_bar*c.vcount)/v_info.vcount; + v_info.dir_bar = (dir_bar*vcount + c.dir_bar*c.vcount) /v_info.vcount; + v_info.absdir_bar = (absdir_bar*vcount + c.absdir_bar*c.vcount) /v_info.vcount; + v_info.dir2_bar = (dir2_bar*vcount + c.dir2_bar*c.vcount) /v_info.vcount; } - v_info.vacount = vacount + c.vacount; + v_info.vacount = vacount + c.vacount; if(v_info.vacount > 0) { - v_info.ufa_bar = (ufa_bar*vacount + c.ufa_bar*c.vacount) /v_info.vacount; - v_info.vfa_bar = (vfa_bar*vacount + c.vfa_bar*c.vacount) /v_info.vacount; - v_info.uoa_bar = (uoa_bar*vacount + c.uoa_bar*c.vacount) /v_info.vacount; - v_info.voa_bar = (voa_bar*vacount + c.voa_bar*c.vacount) /v_info.vacount; - v_info.uvfoa_bar = (uvfoa_bar*vacount + c.uvfoa_bar*c.vacount)/v_info.vacount; - v_info.uvffa_bar = (uvffa_bar*vacount + c.uvffa_bar*c.vacount)/v_info.vacount; - v_info.uvooa_bar = (uvooa_bar*vacount + c.uvooa_bar*c.vacount)/v_info.vacount; + v_info.ufa_bar = (ufa_bar*vacount + c.ufa_bar*c.vacount) /v_info.vacount; + v_info.vfa_bar = (vfa_bar*vacount + c.vfa_bar*c.vacount) /v_info.vacount; + v_info.uoa_bar = (uoa_bar*vacount + c.uoa_bar*c.vacount) /v_info.vacount; + v_info.voa_bar = (voa_bar*vacount + c.voa_bar*c.vacount) /v_info.vacount; + v_info.uvfoa_bar = (uvfoa_bar*vacount + c.uvfoa_bar*c.vacount) /v_info.vacount; + v_info.uvffa_bar = (uvffa_bar*vacount + c.uvffa_bar*c.vacount) /v_info.vacount; + v_info.uvooa_bar = (uvooa_bar*vacount + c.uvooa_bar*c.vacount) /v_info.vacount; v_info.fa_speed_bar = (fa_speed_bar*vacount + c.fa_speed_bar*c.vacount)/v_info.vacount; v_info.oa_speed_bar = (oa_speed_bar*vacount + c.oa_speed_bar*c.vacount)/v_info.vacount; + v_info.dira_bar = (dira_bar*vacount + c.dira_bar*c.vacount) /v_info.vacount; + v_info.absdira_bar = (absdira_bar*vacount + c.absdira_bar*c.vacount) /v_info.vacount; + v_info.dira2_bar = (dira2_bar*vacount + c.dira2_bar*c.vacount) /v_info.vacount; } v_info.compute_stats(); @@ -1416,24 +1422,20 @@ void VL1L2Info::zero_out() { // VL1L2 Quantities // - uf_bar = 0.0; - vf_bar = 0.0; - uo_bar = 0.0; - vo_bar = 0.0; - uvfo_bar = 0.0; - uvff_bar = 0.0; - uvoo_bar = 0.0; - f_speed_bar = 0.0; - o_speed_bar = 0.0; - - f_bar = 0.0; - o_bar = 0.0; - me = 0.0; - mse = 0.0; - rmse = 0.0; - speed_bias = 0.0; - - vcount = 0; + uf_bar = 0.0; + vf_bar = 0.0; + uo_bar = 0.0; + vo_bar = 0.0; + uvfo_bar = 0.0; + uvff_bar = 0.0; + uvoo_bar = 0.0; + f_speed_bar = 0.0; + o_speed_bar = 0.0; + dir_bar = 0.0; + absdir_bar = 0.0; + dir2_bar = 0.0; + + vcount = 0; // // VAL1L2 Quantities @@ -1448,6 +1450,9 @@ void VL1L2Info::zero_out() { uvooa_bar = 0.0; fa_speed_bar = 0.0; oa_speed_bar = 0.0; + dira_bar = 0.0; + absdira_bar = 0.0; + dira2_bar = 0.0; vacount = 0; @@ -1459,6 +1464,8 @@ void VL1L2Info::zero_out() { void VL1L2Info::clear() { n = 0; + n_dir_undef = 0; + n_dira_undef = 0; n_alpha = 0; if(alpha) { delete [] alpha; alpha = (double *) 0; } @@ -1486,6 +1493,10 @@ void VL1L2Info::clear() { DIR_ABSERR.clear(); ANOM_CORR.clear(); ANOM_CORR_UNCNTR.clear(); + DIR_ME.clear(); + DIR_MAE.clear(); + DIR_MSE.clear(); + DIR_RMSE.clear(); zero_out(); @@ -1504,27 +1515,26 @@ void VL1L2Info::assign(const VL1L2Info &c) { logic = c.logic; n = c.n; + n_dir_undef = c.n_dir_undef; + n_dira_undef = c.n_dira_undef; allocate_n_alpha(c.n_alpha); for(i=0; i 0) { + dir_bar /= dir_wgt_sum; + absdir_bar /= dir_wgt_sum; + dir2_bar /= dir_wgt_sum; + } + + // Normalize anomalous wind direction differences + if(dira_wgt_sum > 0) { + dira_bar /= dira_wgt_sum; + absdira_bar /= dira_wgt_sum; + dira2_bar /= dira_wgt_sum; + } + if(vcount > 0) compute_stats(); - // Check for 0 points + // Check for zero points if(vcount == 0) { uf_bar = bad_data_double; @@ -1681,11 +1735,9 @@ void VL1L2Info::set(const PairDataPoint &pd_u_all, uvoo_bar = bad_data_double; f_speed_bar = bad_data_double; o_speed_bar = bad_data_double; - - me = bad_data_double; - mse = bad_data_double; - rmse = bad_data_double; - speed_bias = bad_data_double; + dir_bar = bad_data_double; + absdir_bar = bad_data_double; + dir2_bar = bad_data_double; FBAR.v = bad_data_double; OBAR.v = bad_data_double; @@ -1716,9 +1768,11 @@ void VL1L2Info::set(const PairDataPoint &pd_u_all, ANOM_CORR.v = bad_data_double; ANOM_CORR_UNCNTR.v = bad_data_double; - } - else { - rmse = sqrt(mse); + + DIR_ME.v = bad_data_double; + DIR_MAE.v = bad_data_double; + DIR_MSE.v = bad_data_double; + DIR_RMSE.v = bad_data_double; } if(vacount == 0) { @@ -1731,6 +1785,9 @@ void VL1L2Info::set(const PairDataPoint &pd_u_all, uvooa_bar = bad_data_double; fa_speed_bar = bad_data_double; oa_speed_bar = bad_data_double; + dira_bar = bad_data_double; + absdira_bar = bad_data_double; + dira2_bar = bad_data_double; } return; @@ -1772,6 +1829,10 @@ void VL1L2Info::allocate_n_alpha(int i) { DIR_ABSERR.allocate_n_alpha(n_alpha); ANOM_CORR.allocate_n_alpha(n_alpha); ANOM_CORR_UNCNTR.allocate_n_alpha(n_alpha); + DIR_ME.allocate_n_alpha(n_alpha); + DIR_MAE.allocate_n_alpha(n_alpha); + DIR_MSE.allocate_n_alpha(n_alpha); + DIR_RMSE.allocate_n_alpha(n_alpha); } return; @@ -1820,6 +1881,20 @@ void VL1L2Info::compute_stats() { uf_bar*uo_bar + vf_bar*vo_bar); DIR_ABSERR.v = fabs(DIR_ERR.v); + + // Print undefined wind direction warning message + if(n_dir_undef > 0) { + mlog << Warning << "\nVL1L2Info::compute_stats() -> " + << "Skipping " << n_dir_undef << " of " << vcount + << " vector pairs for which the direction difference is undefined.\n" + << "Set the \"wind_thresh\" and \"wind_logic\" configuration options " + << "to exclude zero vectors.\n\n"; + } + + DIR_ME.v = dir_bar; + DIR_MAE.v = absdir_bar; + DIR_MSE.v = dir2_bar; + DIR_RMSE.v = sqrt(dir2_bar); } if(vacount > 0) { @@ -1837,6 +1912,15 @@ void VL1L2Info::compute_stats() { } ANOM_CORR_UNCNTR.v = compute_anom_corr_uncntr(uvffa_bar, uvooa_bar, uvfoa_bar); + + // Print undefined wind direction warning message + if(n_dira_undef > 0) { + mlog << Warning << "\nVL1L2Info::compute_stats() -> " + << "Skipping " << n_dira_undef << " of " << vacount + << " anomaly vector pairs for which the direction difference is undefined.\n" + << "Set the \"wind_thresh\" and \"wind_logic\" configuration options " + << "to exclude zero vectors.\n\n"; + } } // Compute parametric confidence intervals @@ -1932,6 +2016,10 @@ double VL1L2Info::get_stat(const char *stat_name) { else if(strcmp(stat_name, "DIR_ABSERR" ) == 0) v = DIR_ABSERR.v; else if(strcmp(stat_name, "ANOM_CORR" ) == 0) v = ANOM_CORR.v; else if(strcmp(stat_name, "ANOM_CORR_UNCNTR") == 0) v = ANOM_CORR_UNCNTR.v; + else if(strcmp(stat_name, "DIR_ME" ) == 0) v = DIR_ME.v; + else if(strcmp(stat_name, "DIR_MAE" ) == 0) v = DIR_MAE.v; + else if(strcmp(stat_name, "DIR_MSE" ) == 0) v = DIR_MSE.v; + else if(strcmp(stat_name, "DIR_RMSE" ) == 0) v = DIR_RMSE.v; else { mlog << Error << "\nVL1L2Info::get_stat() -> " << "unknown continuous statistic name \"" << stat_name diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index f17a0c867a..f0715d45b3 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -276,6 +276,10 @@ class VL1L2Info { // Number of points int n; + + // Number of points for which the wind direction difference is undefined + int n_dir_undef; + int n_dira_undef; // VL1L2 Quantities @@ -291,6 +295,10 @@ class VL1L2Info { double f_speed_bar; double o_speed_bar; + double dir_bar; // Average direction difference in (-180, +180] + double absdir_bar; // Average absolute direction difference + double dir2_bar; // Average squared direction difference + // Vector continuous statistics derived from VL1L2 and VAL1L2 partial sums CIInfo FBAR; @@ -322,21 +330,11 @@ class VL1L2Info { CIInfo ANOM_CORR; CIInfo ANOM_CORR_UNCNTR; - - // - // Extra VL1L2 quantities - // - - double f_bar; // fcst wind speed - double o_bar; // obs wind speed - - double me; // mean error - - double mse; // mean squared error - - double rmse; // root mean squared error - - double speed_bias; + + CIInfo DIR_ME; + CIInfo DIR_MAE; + CIInfo DIR_MSE; + CIInfo DIR_RMSE; int vcount; @@ -353,6 +351,10 @@ class VL1L2Info { double fa_speed_bar; double oa_speed_bar; + double dira_bar; // Average anomalous direction difference in (-180, +180] + double absdira_bar; // Average anomalous absolute direction difference + double dira2_bar; // Average anomalous squared direction difference + int vacount; // Compute sums diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index d2f137ff0c..c65ca49109 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -2253,6 +2253,9 @@ void do_vl1l2(VL1L2Info *&v_info, int i_vx, const PairDataPoint *pd_v_ptr) { int i, j; + mlog << Debug(2) + << "Computing Vector Partial Sums and Continuous Vector Statistics.\n"; + // Check that the number of pairs are the same if(pd_u_ptr->n_obs != pd_v_ptr->n_obs) { mlog << Error << "\ndo_vl1l2() -> " diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index 474fdde6ec..6c50ea880c 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -1632,6 +1632,9 @@ void do_vl1l2(VL1L2Info *&v_info, int i_vx, const PairDataPoint *pd_u_ptr, const PairDataPoint *pd_v_ptr) { int i, j; + mlog << Debug(2) + << "Computing Vector Partial Sums and Continuous Vector Statistics.\n"; + // // Check that the number of pairs are the same // diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 5edf0a5025..99b5906429 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -37,6 +37,8 @@ // -out_thresh and -out_line_type options. // 017 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR // line types. +// 018 02/13/24 Halley Gotway MET #2395 Add wind direction stats +// to VL1L2, VAL1L2, and VCNT. // //////////////////////////////////////////////////////////////////////// @@ -2139,6 +2141,21 @@ void aggr_mpr_wind_lines(LineDataFile &f, STATAnalysisJob &job, it->second.pd_v.f_na[i]*it->second.pd_v.f_na[i]); v_info.o_speed_bar = sqrt(it->second.pd_u.o_na[i]*it->second.pd_u.o_na[i] + it->second.pd_v.o_na[i]*it->second.pd_v.o_na[i]); + + double d_diff = angle_difference( + it->second.pd_u.f_na[i], it->second.pd_v.f_na[i], + it->second.pd_u.o_na[i], it->second.pd_v.o_na[i]); + + if(is_bad_data(d_diff)) { + v_info.n_dir_undef = 1; + } + else { + v_info.n_dir_undef = 0; + v_info.dir_bar = d_diff; + v_info.absdir_bar = abs(d_diff); + v_info.dir2_bar = d_diff*d_diff; + } + aggr.vl1l2_info += v_info; // diff --git a/src/tools/core/stat_analysis/parse_stat_line.cc b/src/tools/core/stat_analysis/parse_stat_line.cc index 77758a91bd..57bc92eb46 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.cc +++ b/src/tools/core/stat_analysis/parse_stat_line.cc @@ -31,6 +31,8 @@ // 011 01/24/20 Halley Gotway Add RPS line type. // 012 11/10/22 Halley Gotway MET #2339 Add SEEPS and SEEPS_MPR // line types. +// 013 02/13/24 Halley Gotway MET #2395 Add wind direction stats +// to VL1L2, VAL1L2, and VCNT. // //////////////////////////////////////////////////////////////////////// @@ -234,6 +236,9 @@ void parse_vl1l2_line(STATLine &l, VL1L2Info &v_info) { v_info.uvoo_bar = atof(l.get_item("UVOOBAR")); v_info.f_speed_bar = atof(l.get_item("F_SPEED_BAR")); v_info.o_speed_bar = atof(l.get_item("O_SPEED_BAR")); + v_info.dir_bar = atof(l.get_item("DIR_ME")); + v_info.absdir_bar = atof(l.get_item("DIR_MAE")); + v_info.dir2_bar = atof(l.get_item("DIR_MSE")); v_info.compute_stats(); @@ -256,6 +261,9 @@ void parse_val1l2_line(STATLine &l, VL1L2Info &v_info) { v_info.uvooa_bar = atof(l.get_item("UVOOABAR")); v_info.fa_speed_bar = atof(l.get_item("FA_SPEED_BAR")); v_info.oa_speed_bar = atof(l.get_item("OA_SPEED_BAR")); + v_info.dira_bar = atof(l.get_item("DIRA_ME")); + v_info.absdira_bar = atof(l.get_item("DIRA_MAE")); + v_info.dira2_bar = atof(l.get_item("DIRA_MSE")); v_info.compute_stats(); From 67ee04eb96d5156bf228856ef47b2050e7ce6e7d Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 15 Feb 2024 08:50:31 -0700 Subject: [PATCH 04/32] Recent changes to branch protection rules for the develop branch have broken the logic of the update_truth.yml GHA workflow. Instead of submitting a PR to merge develop into develop-ref directly, use an intermediate update_truth_for_develop branch. --- .github/workflows/update_truth.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_truth.yml b/.github/workflows/update_truth.yml index 4b8c310dd7..adb67ecacc 100644 --- a/.github/workflows/update_truth.yml +++ b/.github/workflows/update_truth.yml @@ -45,10 +45,12 @@ jobs: git config --global user.email "97135045+metplus-bot@users.noreply.github.com" echo git checkout ${branch_name} git checkout ${branch_name} + echo git checkout -b update_truth_for_${branch_name} + git checkout -b update_truth_for_${branch_name} echo git merge -s ours origin/${branch_name}-ref git merge -s ours origin/${branch_name}-ref - echo git push origin ${branch_name} - git push origin ${branch_name} + echo git push origin update_truth_for_${branch_name} + git push origin update_truth_for_${branch_name} - name: Create Pull Request run: gh pr create --base $BASE --body "$BODY" --title "$TITLE" From b558794ac458c3e90922b3896305d62a82529064 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 22 Feb 2024 13:58:30 -0700 Subject: [PATCH 05/32] 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 06/32] #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 07/32] #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 08/32] #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 09/32] #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 10/32] #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 11/32] #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 12/32] #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 13/32] #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 14/32] #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 15/32] #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 16/32] #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 17/32] #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 18/32] #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 19/32] #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 20/32] #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 21/32] #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 22/32] #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 23/32] #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 24/32] #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 25/32] #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 26/32] #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 27/32] 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 28/32] 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 29/32] 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 30/32] 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 31/32] 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 98af717b10a4ecbc758c7bb0c31270b55da2d7fa Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 27 Mar 2024 08:31:03 -0600 Subject: [PATCH 32/32] 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;