diff --git a/data/config/SeriesAnalysisConfig_default b/data/config/SeriesAnalysisConfig_default index 81b2a388f..0b1c2314f 100644 --- a/data/config/SeriesAnalysisConfig_default +++ b/data/config/SeriesAnalysisConfig_default @@ -125,6 +125,19 @@ mask = { poly = ""; } +//////////////////////////////////////////////////////////////////////////////// + +// +// Gradient statistics +// May be set separately in each "obs.field" entry +// +gradient = { + dx = [ 1 ]; + dy = [ 1 ]; +} + +//////////////////////////////////////////////////////////////////////////////// + // // Number of grid points to be processed concurrently. Set smaller to use less // memory but increase the number of passes through the data. If set <= 0, all @@ -155,6 +168,7 @@ output_stats = { pstd = []; pjc = []; prc = []; + grad = []; } //////////////////////////////////////////////////////////////////////////////// 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 fd19bf61b..921165012 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.cc +++ b/src/tools/core/series_analysis/series_analysis_conf_info.cc @@ -80,6 +80,8 @@ void SeriesAnalysisConfInfo::clear() { mask_poly_file.clear(); mask_poly_name.clear(); mask_area.clear(); + grad_dx.clear(); + grad_dy.clear(); block_size = bad_data_int; vld_data_thresh = bad_data_double; hss_ec_value = bad_data_double; @@ -188,6 +190,7 @@ void SeriesAnalysisConfInfo::process_config(GrdFileType ftype, bool do_cnt = (output_stats[STATLineType::sl1l2].n() + output_stats[STATLineType::sal1l2].n() + output_stats[STATLineType::cnt].n()) > 0; + bool do_grad = output_stats[STATLineType::grad].n() > 0; // Conf: fcst.field and obs.field fdict = conf.lookup_array(conf_key_fcst_field); @@ -339,6 +342,23 @@ void SeriesAnalysisConfInfo::process_config(GrdFileType ftype, } } // end for i + // Parse gradients + if(do_grad) { + + // Conf: gradient + grad_dx = conf.lookup_int_array(conf_key_dx); + grad_dy = conf.lookup_int_array(conf_key_dy); + + // Check for the same length + if(grad_dx.n() != grad_dy.n()) { + mlog << Error << "\nSeriesAnalysisConfInfo::process_config() -> " + << "The gradient dx and dy arrays must have " + << "the same length (" << grad_dx.n() << " != " + << grad_dy.n() << ").\n\n"; + exit(1); + } + } + // Conf: block_size block_size = conf.lookup_int(conf_key_block_size); 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 01aff1609..43f1cc8b4 100644 --- a/src/tools/core/series_analysis/series_analysis_conf_info.h +++ b/src/tools/core/series_analysis/series_analysis_conf_info.h @@ -72,6 +72,9 @@ class SeriesAnalysisConfInfo { ConcatString mask_poly_name; // Name of masking poly area MaskPlane mask_area; + IntArray grad_dx; // Gradient step size in the X direction + IntArray grad_dy; // Gradient step size in the Y direction + int block_size; // Number of grid points to read concurrently double vld_data_thresh; // Minimum valid data ratio for each point double hss_ec_value; // HSS expected correct value