From 1fcbbef38ba1637ce8bfba6d77cf3b2cd9c5fd79 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:23:07 -0700 Subject: [PATCH 1/9] #1996 Initialize PT_new --- met/src/basic/vx_config/threshold.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/met/src/basic/vx_config/threshold.cc b/met/src/basic/vx_config/threshold.cc index bf317733ff..78147f1071 100644 --- a/met/src/basic/vx_config/threshold.cc +++ b/met/src/basic/vx_config/threshold.cc @@ -1128,7 +1128,7 @@ else { // adjust PT by the requested frequency bias amount // - double PT_new; + double PT_new = 0.; if ( fbias_fcst ) { if ( op == thresh_le || op == thresh_lt ) PT_new = PT * fbias_val; From 2e48bfab4b87ebffcb7563f660d3e07c31e58eda Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:34:39 -0700 Subject: [PATCH 2/9] #1996 Removed AllocInc --- met/src/basic/vx_log/concat_string.cc | 21 --------------------- met/src/basic/vx_log/concat_string.h | 8 -------- 2 files changed, 29 deletions(-) diff --git a/met/src/basic/vx_log/concat_string.cc b/met/src/basic/vx_log/concat_string.cc index 2f4e6550dd..198f17ff66 100644 --- a/met/src/basic/vx_log/concat_string.cc +++ b/met/src/basic/vx_log/concat_string.cc @@ -50,8 +50,6 @@ ConcatString::ConcatString() init_from_scratch(); -set_alloc_inc(default_cs_alloc_inc); - } @@ -64,8 +62,6 @@ ConcatString::ConcatString(int _alloc_inc) init_from_scratch(); -set_alloc_inc(_alloc_inc); - } @@ -237,23 +233,6 @@ void ConcatString::assign(const ConcatString & c) memcpy(FloatFormat, c.FloatFormat, sizeof(FloatFormat)); Precision = c.Precision; - AllocInc = c.AllocInc; -} - - -//////////////////////////////////////////////////////////////////////// - - -void ConcatString::set_alloc_inc(int _alloc_inc) - -{ - -if ( _alloc_inc < min_cs_alloc_inc ) _alloc_inc = min_cs_alloc_inc; - -AllocInc = _alloc_inc; - -return; - } diff --git a/met/src/basic/vx_log/concat_string.h b/met/src/basic/vx_log/concat_string.h index 29903f8e40..03424effbc 100644 --- a/met/src/basic/vx_log/concat_string.h +++ b/met/src/basic/vx_log/concat_string.h @@ -71,10 +71,6 @@ class ConcatString { void assign(const ConcatString &); - void extend(int); - - int AllocInc; - int Precision; char FloatFormat[16]; @@ -102,8 +98,6 @@ class ConcatString { // set stuff // - void set_alloc_inc(int); - void set_precision(int); // @@ -207,8 +201,6 @@ inline int ConcatString::precision() const { return ( Precision ); } inline const char * ConcatString::float_format() const { return ( FloatFormat ); } -inline int ConcatString::alloc_inc() const { return ( AllocInc ); } - inline bool ConcatString::empty() const { return ( s ? s->empty() : true ); } inline bool ConcatString::nonempty() const { return ( s ? !s->empty() : false ); } From cd1f7c93694617991688711a733bb28cd18b4dfb Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:40:53 -0700 Subject: [PATCH 3/9] #1996 call missing var->getVar --- met/src/libcode/vx_nc_util/nc_utils.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/met/src/libcode/vx_nc_util/nc_utils.cc b/met/src/libcode/vx_nc_util/nc_utils.cc index 50c3ff778e..8d1505875d 100644 --- a/met/src/libcode/vx_nc_util/nc_utils.cc +++ b/met/src/libcode/vx_nc_util/nc_utils.cc @@ -129,6 +129,9 @@ bool get_att_value(const NcAtt *att, double &att_val) { int get_att_value_int(const NcAtt *att) { int value = bad_data_int; static const char *method_name = "get_att_value_int(NcAtt) -> "; + + if (IS_INVALID_NC_P(att)) return value; + switch (att->getType().getId()) { case NC_BYTE: ncbyte b_value; @@ -221,7 +224,7 @@ bool get_att_value_chars(const NcAtt *att, ConcatString &value) { long long get_att_value_llong(const NcAtt *att) { long long value = bad_data_int; - att->getValues(&value); + if (IS_VALID_NC_P(att)) att->getValues(&value); return value; } @@ -229,7 +232,7 @@ long long get_att_value_llong(const NcAtt *att) { double get_att_value_double(const NcAtt *att) { double value = bad_data_double; - att->getValues(&value); + if (IS_VALID_NC_P(att)) att->getValues(&value); return value; } @@ -1658,6 +1661,8 @@ bool get_nc_data(NcVar *var, float *data) { fill_value = get_att_value_char(att_fill_value); } + var->getVar(packed_data); + if (unsigned_value) { int value; int positive_cnt = 0; From 802a273173a60a75d05abfeec8454134cdfae0ef Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:41:28 -0700 Subject: [PATCH 4/9] #1996 initialize interp_wdth --- met/src/libcode/vx_statistics/pair_base.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/met/src/libcode/vx_statistics/pair_base.cc b/met/src/libcode/vx_statistics/pair_base.cc index 45bf5696a5..a8f2f2ff83 100644 --- a/met/src/libcode/vx_statistics/pair_base.cc +++ b/met/src/libcode/vx_statistics/pair_base.cc @@ -71,6 +71,7 @@ void PairBase::clear() { msg_typ.clear(); msg_typ_vals.clear(); + interp_wdth = 0; interp_mthd = InterpMthd_None; interp_shape = GridTemplateFactory::GridTemplate_None; From ffb89fd3d6ac17fb080d108bbc29f4043b2c6988 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:42:49 -0700 Subject: [PATCH 5/9] #1996 initialize data_azi_mean[ir] --- met/src/libcode/vx_tc_util/vx_tc_nc_util.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/met/src/libcode/vx_tc_util/vx_tc_nc_util.cc b/met/src/libcode/vx_tc_util/vx_tc_nc_util.cc index 7bd51ffbbe..40a6feedc1 100644 --- a/met/src/libcode/vx_tc_util/vx_tc_nc_util.cc +++ b/met/src/libcode/vx_tc_util/vx_tc_nc_util.cc @@ -512,6 +512,7 @@ void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, data_azi_mean = new double[grid.range_n()]; for(int ir = 0; ir < grid.range_n(); ir++) { + data_azi_mean[ir] = 0.; for(int ia = 0; ia < grid.azimuth_n(); ia++) { int i = ir * grid.azimuth_n() + ia; int i_rev = (grid.range_n() - ir - 1) * grid.azimuth_n() + ia; From 079eeca5478bfacef29ea054e49d576e217801ca Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Wed, 29 Dec 2021 13:44:55 -0700 Subject: [PATCH 6/9] #1996 Check if cur_job is null --- met/src/tools/tc_utils/tc_stat/tc_stat.cc | 35 ++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/met/src/tools/tc_utils/tc_stat/tc_stat.cc b/met/src/tools/tc_utils/tc_stat/tc_stat.cc index 5595e02b93..7a6b6e4d4b 100644 --- a/met/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/met/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -165,6 +165,7 @@ void process_jobs() { ConcatString jobstring; int i, n_jobs; TCLineCounts n; + const char *method_name = "process_jobs() -> ": // Open the output file open_out_file(); @@ -193,27 +194,29 @@ void process_jobs() { // Allocate a new job cur_job = factory.new_tc_stat_job(jobstring.c_str()); + if (cur_job) { + // Set the job output file stream + cur_job->JobOut = tc_stat_out; - // Set the job output file stream - cur_job->JobOut = tc_stat_out; + // Set the output precision + cur_job->set_precision(conf_info.Conf.output_precision()); - // Set the output precision - cur_job->set_precision(conf_info.Conf.output_precision()); + // Serialize the current job + mlog << Debug(2) + << "\nProcessing Job " << i+1 << ": " + << cur_job->serialize() << "\n"; - // Serialize the current job - mlog << Debug(2) - << "\nProcessing Job " << i+1 << ": " - << cur_job->serialize() << "\n"; + // Initialize counts + memset(&n, 0, sizeof(TCLineCounts)); - // Initialize counts - memset(&n, 0, sizeof(TCLineCounts)); + // Do the job + cur_job->do_job(tcst_files, n); - // Do the job - cur_job->do_job(tcst_files, n); - - mlog << Debug(2) - << "Job " << i+1 << " used " << n.NKeep << " out of " - << n.NRead << " lines read.\n"; + mlog << Debug(2) << method_name + << "Job " << i+1 << " used " << n.NKeep << " out of " + << n.NRead << " lines read.\n"; + } + else mlog << Debug(1) << method_name << "job is missing\n"; mlog << Debug(3) << "Total lines read = " << n.NRead << "\n" From 0ce26dd273156207adec6377293b370d4d3fe05e Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 6 Jan 2022 17:09:44 -0700 Subject: [PATCH 7/9] #1996 Removed Nalloc --- met/src/basic/vx_log/string_array.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/met/src/basic/vx_log/string_array.h b/met/src/basic/vx_log/string_array.h index 6563f68e2e..3662719197 100644 --- a/met/src/basic/vx_log/string_array.h +++ b/met/src/basic/vx_log/string_array.h @@ -37,8 +37,6 @@ class StringArray { std::vector s; - int Nalloc; - int MaxLength; bool IgnoreCase; From 6ae622d075128f3d6f5100be977e955948bd04cf Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 6 Jan 2022 17:10:12 -0700 Subject: [PATCH 8/9] #1996 Initialized MaxLength --- met/src/basic/vx_log/string_array.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/met/src/basic/vx_log/string_array.cc b/met/src/basic/vx_log/string_array.cc index 21419fbe6c..57f90dac49 100644 --- a/met/src/basic/vx_log/string_array.cc +++ b/met/src/basic/vx_log/string_array.cc @@ -131,6 +131,7 @@ void StringArray::init_from_scratch() { IgnoreCase = 0; +MaxLength = 0; clear(); From 663fbfd636052a992a512ba4fc4684a35bf7f02b Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Thu, 6 Jan 2022 17:16:34 -0700 Subject: [PATCH 9/9] #1996 Check if cur_job is null --- met/src/tools/tc_utils/tc_stat/tc_stat.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/met/src/tools/tc_utils/tc_stat/tc_stat.cc b/met/src/tools/tc_utils/tc_stat/tc_stat.cc index 7a6b6e4d4b..e1793ec194 100644 --- a/met/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/met/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -165,7 +165,7 @@ void process_jobs() { ConcatString jobstring; int i, n_jobs; TCLineCounts n; - const char *method_name = "process_jobs() -> ": + const char *method_name = "process_jobs() -> "; // Open the output file open_out_file();