From 92820a0275d3195a3c6149bf9aec9a2953694e6e Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 7 Jul 2022 16:49:01 -0600 Subject: [PATCH 01/10] Per #2204, add the sum option for point observation time summaries. --- docs/Users_Guide/config_options.rst | 7 ++- src/libcode/vx_summary/Makefile.am | 1 + src/libcode/vx_summary/summary_calc_sum.cc | 43 +++++++++++++++++ src/libcode/vx_summary/summary_calc_sum.h | 56 ++++++++++++++++++++++ src/libcode/vx_summary/summary_obs.cc | 4 ++ 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 src/libcode/vx_summary/summary_calc_sum.cc create mode 100644 src/libcode/vx_summary/summary_calc_sum.h diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index 9a2aab720d..0d0a22584d 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -2238,8 +2238,8 @@ one hour prior: The summaries will only be calculated for the specified GRIB codes. The supported summaries are "min" (minimum), "max" (maximum), "range", -"mean", "stdev" (standard deviation), "median" and "p##" (percentile, with -the desired percentile value specified in place of ##). +"mean", "stdev" (standard deviation), "median", "sum", and "p##" (percentile, +with the desired percentile value specified in place of ##). The "vld_freq" and "vld_thresh" options may be used to require that a certain ratio of observations must be present and contain valid data within the time @@ -2250,6 +2250,9 @@ setting "vld_thresh = 0.5" requires that at least 15 of the 30 expected observations be present and valid for a summary value to be written. The default "vld_thresh = 0.0" setting will skip over this logic. +When using the "sum" option, users should specify "vld_thresh = 1.0" to avoid +missing data values from affecting the resulting sum value. + The variable names are saved to NetCDF file if they are given instead of grib_codes which are not available for non GRIB input. The "obs_var" option was added and works like "grib_code" option (string value VS. int value). diff --git a/src/libcode/vx_summary/Makefile.am b/src/libcode/vx_summary/Makefile.am index 7e56dcc05f..0630de9d59 100644 --- a/src/libcode/vx_summary/Makefile.am +++ b/src/libcode/vx_summary/Makefile.am @@ -17,6 +17,7 @@ libvx_summary_a_SOURCES = \ summary_calc_mean.cc summary_calc_mean.h \ summary_calc_median.cc summary_calc_median.h \ summary_calc_min.cc summary_calc_min.h \ + summary_calc_sum.cc summary_calc_sum.h \ summary_calc_percentile.cc summary_calc_percentile.h \ summary_calc_range.cc summary_calc_range.h \ summary_calc_stdev.cc summary_calc_stdev.h \ diff --git a/src/libcode/vx_summary/summary_calc_sum.cc b/src/libcode/vx_summary/summary_calc_sum.cc new file mode 100644 index 0000000000..bac30c0873 --- /dev/null +++ b/src/libcode/vx_summary/summary_calc_sum.cc @@ -0,0 +1,43 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2022 +// ** 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 "summary_calc_sum.h" + +//////////////////////////////////////////////////////////////////////// + + + // + // Code for class SummaryCalcSum + // + + +//////////////////////////////////////////////////////////////////////// + + +SummaryCalcSum::SummaryCalcSum() : + SummaryCalc() +{ +} + +//////////////////////////////////////////////////////////////////////// + +SummaryCalcSum::~SummaryCalcSum() +{ +} + +//////////////////////////////////////////////////////////////////////// +// Protected/Private Methods +//////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_summary/summary_calc_sum.h b/src/libcode/vx_summary/summary_calc_sum.h new file mode 100644 index 0000000000..7cd69afc4c --- /dev/null +++ b/src/libcode/vx_summary/summary_calc_sum.h @@ -0,0 +1,56 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2022 +// ** University Corporation for Atmospheric Research (UCAR) +// ** National Center for Atmospheric Research (NCAR) +// ** Research Applications Lab (RAL) +// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + + +//////////////////////////////////////////////////////////////////////// + + +#ifndef __SUMMARYCALCSUM_H__ +#define __SUMMARYCALCSUM_H__ + + +//////////////////////////////////////////////////////////////////////// + + +#include + +#include "summary_calc.h" + +//////////////////////////////////////////////////////////////////////// + + +class SummaryCalcSum : public SummaryCalc +{ + +public: + + SummaryCalcSum(); + virtual ~SummaryCalcSum(); + + virtual string getType() const + { + return "SUM"; + } + + virtual double calcSummary(const NumArray &num_array) const + { + return num_array.sum(); + } + +}; + + +//////////////////////////////////////////////////////////////////////// + + +#endif /* __SUMMARYCALCSUM_H__ */ + + +//////////////////////////////////////////////////////////////////////// + + diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 799c72f6b7..7b43cad2a3 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -22,6 +22,7 @@ using namespace std; #include "summary_calc_mean.h" #include "summary_calc_median.h" #include "summary_calc_min.h" +#include "summary_calc_sum.h" #include "summary_calc_percentile.h" #include "summary_calc_range.h" #include "summary_calc_stdev.h" @@ -365,6 +366,9 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & else if (type == "median") { calculators.push_back(new SummaryCalcMedian); } + else if (type == 'sum') { + calculators.push_back(new SummaryCalcSum(type)); + } else if (type[0] == 'p') { calculators.push_back(new SummaryCalcPercentile(type)); } From 359f39322888639af98df6824128b64903a2805a Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 7 Jul 2022 17:05:50 -0600 Subject: [PATCH 02/10] Per #2204, fix string. --- src/libcode/vx_summary/summary_obs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 7b43cad2a3..49bdabeca1 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -366,7 +366,7 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & else if (type == "median") { calculators.push_back(new SummaryCalcMedian); } - else if (type == 'sum') { + else if (type == "sum") { calculators.push_back(new SummaryCalcSum(type)); } else if (type[0] == 'p') { From 14b24c0063c8a4949957f8b9a57bb53d38c347e2 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 7 Jul 2022 21:46:27 -0600 Subject: [PATCH 03/10] Fix --- src/libcode/vx_summary/summary_obs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 49bdabeca1..285f7777f5 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -367,7 +367,7 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & calculators.push_back(new SummaryCalcMedian); } else if (type == "sum") { - calculators.push_back(new SummaryCalcSum(type)); + calculators.push_back(new SummaryCalcSum); } else if (type[0] == 'p') { calculators.push_back(new SummaryCalcPercentile(type)); From b07d5d81746d3e02d415c6c64f20251996903406 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 7 Jul 2022 21:49:17 -0600 Subject: [PATCH 04/10] Per #2204, run bootstrap on senseca to regenerate Makefile.in which needs to be updated after adding files to the vx_summary library. --- src/libcode/vx_summary/Makefile.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libcode/vx_summary/Makefile.in b/src/libcode/vx_summary/Makefile.in index ddf415b649..1f3c6e2e39 100644 --- a/src/libcode/vx_summary/Makefile.in +++ b/src/libcode/vx_summary/Makefile.in @@ -112,6 +112,7 @@ am_libvx_summary_a_OBJECTS = libvx_summary_a-summary_calc.$(OBJEXT) \ libvx_summary_a-summary_calc_mean.$(OBJEXT) \ libvx_summary_a-summary_calc_median.$(OBJEXT) \ libvx_summary_a-summary_calc_min.$(OBJEXT) \ + libvx_summary_a-summary_calc_sum.$(OBJEXT) \ libvx_summary_a-summary_calc_percentile.$(OBJEXT) \ libvx_summary_a-summary_calc_range.$(OBJEXT) \ libvx_summary_a-summary_calc_stdev.$(OBJEXT) \ @@ -142,6 +143,7 @@ am__depfiles_remade = ./$(DEPDIR)/libvx_summary_a-summary_calc.Po \ ./$(DEPDIR)/libvx_summary_a-summary_calc_percentile.Po \ ./$(DEPDIR)/libvx_summary_a-summary_calc_range.Po \ ./$(DEPDIR)/libvx_summary_a-summary_calc_stdev.Po \ + ./$(DEPDIR)/libvx_summary_a-summary_calc_sum.Po \ ./$(DEPDIR)/libvx_summary_a-summary_key.Po \ ./$(DEPDIR)/libvx_summary_a-summary_obs.Po \ ./$(DEPDIR)/libvx_summary_a-time_summary_interval.Po @@ -357,6 +359,7 @@ libvx_summary_a_SOURCES = \ summary_calc_mean.cc summary_calc_mean.h \ summary_calc_median.cc summary_calc_median.h \ summary_calc_min.cc summary_calc_min.h \ + summary_calc_sum.cc summary_calc_sum.h \ summary_calc_percentile.cc summary_calc_percentile.h \ summary_calc_range.cc summary_calc_range.h \ summary_calc_stdev.cc summary_calc_stdev.h \ @@ -422,6 +425,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_calc_percentile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_calc_range.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_calc_stdev.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_calc_sum.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_key.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-summary_obs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_summary_a-time_summary_interval.Po@am__quote@ # am--include-marker @@ -516,6 +520,20 @@ libvx_summary_a-summary_calc_min.obj: summary_calc_min.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvx_summary_a-summary_calc_min.obj `if test -f 'summary_calc_min.cc'; then $(CYGPATH_W) 'summary_calc_min.cc'; else $(CYGPATH_W) '$(srcdir)/summary_calc_min.cc'; fi` +libvx_summary_a-summary_calc_sum.o: summary_calc_sum.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvx_summary_a-summary_calc_sum.o -MD -MP -MF $(DEPDIR)/libvx_summary_a-summary_calc_sum.Tpo -c -o libvx_summary_a-summary_calc_sum.o `test -f 'summary_calc_sum.cc' || echo '$(srcdir)/'`summary_calc_sum.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvx_summary_a-summary_calc_sum.Tpo $(DEPDIR)/libvx_summary_a-summary_calc_sum.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='summary_calc_sum.cc' object='libvx_summary_a-summary_calc_sum.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvx_summary_a-summary_calc_sum.o `test -f 'summary_calc_sum.cc' || echo '$(srcdir)/'`summary_calc_sum.cc + +libvx_summary_a-summary_calc_sum.obj: summary_calc_sum.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvx_summary_a-summary_calc_sum.obj -MD -MP -MF $(DEPDIR)/libvx_summary_a-summary_calc_sum.Tpo -c -o libvx_summary_a-summary_calc_sum.obj `if test -f 'summary_calc_sum.cc'; then $(CYGPATH_W) 'summary_calc_sum.cc'; else $(CYGPATH_W) '$(srcdir)/summary_calc_sum.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvx_summary_a-summary_calc_sum.Tpo $(DEPDIR)/libvx_summary_a-summary_calc_sum.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='summary_calc_sum.cc' object='libvx_summary_a-summary_calc_sum.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvx_summary_a-summary_calc_sum.obj `if test -f 'summary_calc_sum.cc'; then $(CYGPATH_W) 'summary_calc_sum.cc'; else $(CYGPATH_W) '$(srcdir)/summary_calc_sum.cc'; fi` + libvx_summary_a-summary_calc_percentile.o: summary_calc_percentile.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvx_summary_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvx_summary_a-summary_calc_percentile.o -MD -MP -MF $(DEPDIR)/libvx_summary_a-summary_calc_percentile.Tpo -c -o libvx_summary_a-summary_calc_percentile.o `test -f 'summary_calc_percentile.cc' || echo '$(srcdir)/'`summary_calc_percentile.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvx_summary_a-summary_calc_percentile.Tpo $(DEPDIR)/libvx_summary_a-summary_calc_percentile.Po @@ -733,6 +751,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_percentile.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_range.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_stdev.Po + -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_sum.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_key.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_obs.Po -rm -f ./$(DEPDIR)/libvx_summary_a-time_summary_interval.Po @@ -789,6 +808,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_percentile.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_range.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_stdev.Po + -rm -f ./$(DEPDIR)/libvx_summary_a-summary_calc_sum.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_key.Po -rm -f ./$(DEPDIR)/libvx_summary_a-summary_obs.Po -rm -f ./$(DEPDIR)/libvx_summary_a-time_summary_interval.Po From 9175aa3bbf2c53a864aff46b868c4cf91eb4d803 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 7 Jul 2022 22:08:42 -0600 Subject: [PATCH 05/10] Per #2022, add sum to the list of time_summary types to the default config file for the MET point processing tools. --- data/config/Ascii2NcConfig_default | 2 +- data/config/IODA2NCConfig_default | 2 +- data/config/Madis2NcConfig_default | 2 +- data/config/PB2NCConfig_default | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/config/Ascii2NcConfig_default b/data/config/Ascii2NcConfig_default index ed3a28a819..bfddd0edd6 100644 --- a/data/config/Ascii2NcConfig_default +++ b/data/config/Ascii2NcConfig_default @@ -25,7 +25,7 @@ time_summary = { width = 600; grib_code = [ 11, 204, 211 ]; obs_var = []; - type = [ "min", "max", "range", "mean", "stdev", "median", "p80" ]; + type = [ "min", "max", "range", "mean", "stdev", "median", "p80", "sum" ]; vld_freq = 0; vld_thresh = 0.0; } diff --git a/data/config/IODA2NCConfig_default b/data/config/IODA2NCConfig_default index b1ac078d9c..4f6e573e7a 100644 --- a/data/config/IODA2NCConfig_default +++ b/data/config/IODA2NCConfig_default @@ -117,7 +117,7 @@ time_summary = { width = 600; grib_code = []; obs_var = [ "TMP", "WDIR", "RH" ]; - type = [ "min", "max", "range", "mean", "stdev", "median", "p80" ]; + type = [ "min", "max", "range", "mean", "stdev", "median", "p80", "sum" ]; vld_freq = 0; vld_thresh = 0.0; } diff --git a/data/config/Madis2NcConfig_default b/data/config/Madis2NcConfig_default index 36a44cb8bc..406120ab27 100644 --- a/data/config/Madis2NcConfig_default +++ b/data/config/Madis2NcConfig_default @@ -25,7 +25,7 @@ time_summary = { width = 600; grib_code = [ 11, 204, 211 ]; obs_var = []; - type = [ "min", "max", "range", "mean", "stdev", "median", "p80" ]; + type = [ "min", "max", "range", "mean", "stdev", "median", "p80", "sum" ]; vld_freq = 0; vld_thresh = 0.0; } diff --git a/data/config/PB2NCConfig_default b/data/config/PB2NCConfig_default index f765d98ec3..dd2351eabe 100644 --- a/data/config/PB2NCConfig_default +++ b/data/config/PB2NCConfig_default @@ -148,7 +148,7 @@ time_summary = { width = 600; grib_code = []; obs_var = [ "TMP", "WDIR", "RH" ]; - type = [ "min", "max", "range", "mean", "stdev", "median", "p80" ]; + type = [ "min", "max", "range", "mean", "stdev", "median", "p80", "sum" ]; vld_freq = 0; vld_thresh = 0.0; } From f8ed9e60e40b267c7bfc33422c34a7fba0e4897d Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 8 Jul 2022 15:04:47 -0600 Subject: [PATCH 06/10] Per #2204, tweak the definition of the time summary time intervals. The existing logic was NOT including the last data timestamp in the list of times to be processed. Switching from < to <= logic includes that last data time stamp in the processing logic. --- src/libcode/vx_summary/summary_obs.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 285f7777f5..2c9eae536c 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -407,12 +407,12 @@ vector< TimeSummaryInterval > SummaryObs::getTimeIntervals( vector< TimeSummaryInterval > time_intervals; time_t interval_time = getIntervalTime(first_data_time, info.beg, info.end, info.step, info.width_beg, info.width_end); - while (interval_time < last_data_time) { + while (interval_time <= last_data_time) { // We need to process each day separately so that we can always start // at the indicated start time on each day. time_t day_end_time = getEndOfDay(interval_time); while (interval_time < day_end_time && - interval_time < last_data_time) + interval_time <= last_data_time) { // See if the current time is within the defined time intervals if (isInTimeInterval(interval_time, info.beg, info.end)) { From 6d5e4e12e623f8dc3387fd6730917f260fa8585c Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 8 Jul 2022 15:49:39 -0600 Subject: [PATCH 07/10] Per #2204, update the log messages and user's guide with comments about which end points are included in time_summary windows. --- docs/Users_Guide/config_options.rst | 11 +++++++++-- src/libcode/vx_summary/summary_obs.cc | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index 0d0a22584d..72578fb4bd 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -2236,8 +2236,15 @@ one hour prior: width = { beg = -3600; end = 0; } -The summaries will only be calculated for the specified GRIB codes. -The supported summaries are "min" (minimum), "max" (maximum), "range", +The summaries will only be calculated for the specified GRIB codes +or observation variable ("obs_var") names. + +When determining which observations fall within a time interval, data for the +beginning timestamp is included while data for the ending timestamp is excluded. +Users may need to adjust the "beg" and "end" settings in the "width" dictionary +to include the desired observations in each time interval. + +The supported time summaries are "min" (minimum), "max" (maximum), "range", "mean", "stdev" (standard deviation), "median", "sum", and "p##" (percentile, with the desired percentile value specified in place of ##). diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 2c9eae536c..6267a5e78c 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -177,11 +177,11 @@ bool SummaryObs::summarizeObs(const TimeSummaryInfo &summary_info) { mlog << Debug(3) << "Computing " << unix_to_yyyymmdd_hhmmss(time_interval->getBaseTime()) - << " time summary from " + << " time summary (" << unix_to_yyyymmdd_hhmmss(time_interval->getStartTime()) - << " to " + << " <= time < " << unix_to_yyyymmdd_hhmmss(time_interval->getEndTime()) - << ".\n"; + << ").\n"; // Initialize the map used to sort observations in this time period // into their correct summary groups From 497307dc1c47d4dab72ee8c1be5cc56b6743a922 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 8 Jul 2022 16:18:32 -0600 Subject: [PATCH 08/10] Per #2204, print a warning message if the user requests a time_summary sum when vld_thresh != 1.0. --- src/libcode/vx_summary/summary_obs.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index 6267a5e78c..a8fd7d6c24 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -368,6 +368,15 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & } else if (type == "sum") { calculators.push_back(new SummaryCalcSum); + + // Check for vld_thresh = 1.0 + if (!is_eq(info.vld_thresh, 1.0)) { + mlog << Warning << "\nIn the \"time_summary\" dictionary, " + << "consider setting \"vld_thresh\" (" << info.vld_thresh + << ") to 1.0 for the \"sum\" type to better handle " + << "missing data.\n\n"; + } + } else if (type[0] == 'p') { calculators.push_back(new SummaryCalcPercentile(type)); From a59b30d295fe71e446314afc6e6079b3d707fb5a Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 8 Jul 2022 16:38:37 -0600 Subject: [PATCH 09/10] Per #2204, add a new unit test to exercise the new sum option. --- .../config/Ascii2NcConfig_rain_01H_sum | 52 +++++++++++++++++++ internal/test_unit/xml/unit_ascii2nc.xml | 16 ++++++ 2 files changed, 68 insertions(+) create mode 100644 internal/test_unit/config/Ascii2NcConfig_rain_01H_sum diff --git a/internal/test_unit/config/Ascii2NcConfig_rain_01H_sum b/internal/test_unit/config/Ascii2NcConfig_rain_01H_sum new file mode 100644 index 0000000000..ca7aafdf4d --- /dev/null +++ b/internal/test_unit/config/Ascii2NcConfig_rain_01H_sum @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// ASCII2NC configuration file. +// +// For additional information, please see the MET User's Guide. +// +//////////////////////////////////////////////////////////////////////////////// + +// +// The parameters listed below are used to summarize the ASCII data read in +// + +// +// Time periods for the summarization +// obs_var (string array) is added and works like grib_code (int array) +// when the obs name is given instead of grib_code +// + +time_summary = { + flag = TRUE; + raw_data = FALSE; + beg = "00"; + end = "23"; + step = 3600; + width = { beg = -3599; end = 1; } + grib_code = [ ]; + obs_var = [ "rain" ]; + type = [ "sum" ]; + vld_freq = 15*60; + vld_thresh = 1.0; +} + +// +// Mapping of input little_r report types to output message types +// +message_type_map = [ + { key = "FM-12 SYNOP"; val = "ADPSFC"; }, + { key = "FM-13 SHIP"; val = "SFCSHP"; }, + { key = "FM-15 METAR"; val = "ADPSFC"; }, + { key = "FM-18 BUOY"; val = "SFCSHP"; }, + { key = "FM-281 QSCAT"; val = "ASCATW"; }, + { key = "FM-32 PILOT"; val = "ADPUPA"; }, + { key = "FM-35 TEMP"; val = "ADPUPA"; }, + { key = "FM-88 SATOB"; val = "SATWND"; }, + { key = "FM-97 ACARS"; val = "AIRCFT"; } +]; + +// +// Indicate a version number for the contents of this configuration file. +// The value should generally not be modified. +// +version = "V11.0.0"; diff --git a/internal/test_unit/xml/unit_ascii2nc.xml b/internal/test_unit/xml/unit_ascii2nc.xml index feef57c65d..01322961a8 100644 --- a/internal/test_unit/xml/unit_ascii2nc.xml +++ b/internal/test_unit/xml/unit_ascii2nc.xml @@ -101,4 +101,20 @@ + + &MET_BIN;/ascii2nc + \ + &DATA_DIR_OBS;/ascii/aws/aws_20220609_020000.txt \ + &DATA_DIR_OBS;/ascii/aws/aws_20220609_021500.txt \ + &DATA_DIR_OBS;/ascii/aws/aws_20220609_023000.txt \ + &DATA_DIR_OBS;/ascii/aws/aws_20220609_024500.txt \ + &DATA_DIR_OBS;/ascii/aws/aws_20220609_030000.txt \ + &OUTPUT_DIR;/ascii2nc/aws_2022060903_rain_01H_sum.nc \ + -config &CONFIG_DIR;/Ascii2NcConfig_rain_01H_sum + + + &OUTPUT_DIR;/ascii2nc/aws_2022060903_rain_01H_sum.nc + + + From daa698b918d029dcd12f6b180f18ab8340cb6b77 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Fri, 8 Jul 2022 16:53:42 -0600 Subject: [PATCH 10/10] Per #2204, just changes some tabs to spaces. --- src/libcode/vx_summary/summary_obs.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libcode/vx_summary/summary_obs.cc b/src/libcode/vx_summary/summary_obs.cc index a8fd7d6c24..f0d752a5c5 100644 --- a/src/libcode/vx_summary/summary_obs.cc +++ b/src/libcode/vx_summary/summary_obs.cc @@ -372,11 +372,10 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & // Check for vld_thresh = 1.0 if (!is_eq(info.vld_thresh, 1.0)) { mlog << Warning << "\nIn the \"time_summary\" dictionary, " - << "consider setting \"vld_thresh\" (" << info.vld_thresh - << ") to 1.0 for the \"sum\" type to better handle " - << "missing data.\n\n"; - } - + << "consider setting \"vld_thresh\" (" << info.vld_thresh + << ") to 1.0 for the \"sum\" type to better handle " + << "missing data.\n\n"; + } } else if (type[0] == 'p') { calculators.push_back(new SummaryCalcPercentile(type));