Skip to content

Commit

Permalink
Per #3030, update Series-Analysis config file by adding the gradient …
Browse files Browse the repository at this point in the history
…dictionary and an entry for output_stats.gradient. Update the conf_info source code to parse them. Still need to update OTHER Series-Analysis config files and also update the logic in series_analysis.cc to compute GRAD statistics.
  • Loading branch information
JohnHalleyGotway committed Dec 9, 2024
1 parent 23fc4ad commit c7a1582
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions data/config/SeriesAnalysisConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -155,6 +168,7 @@ output_stats = {
pstd = [];
pjc = [];
prc = [];
grad = [];
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
20 changes: 20 additions & 0 deletions src/tools/core/series_analysis/series_analysis_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/tools/core/series_analysis/series_analysis_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7a1582

Please sign in to comment.