Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1583 skip_mean #2090

Merged
merged 1 commit into from Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions met/src/basic/vx_util/num_array.cc
Expand Up @@ -269,6 +269,27 @@ int NumArray::has(double d, bool forward) const
////////////////////////////////////////////////////////////////////////


bool NumArray::is_const(double d) const

{

bool status = true;

for (int j=0; j<n_elements(); ++j) {
if ( !is_eq(e[j], d) ) {
status = false;
break;
}
}

return ( status && n_elements() > 0 );

}


////////////////////////////////////////////////////////////////////////


void NumArray::add(int k)

{
Expand Down
2 changes: 2 additions & 0 deletions met/src/basic/vx_util/num_array.h
Expand Up @@ -62,6 +62,8 @@ class NumArray {
int has(int, bool forward=true) const;
int has(double, bool forward=true) const;

bool is_const(double) const;

void add(int);
void add(double);
void add(const NumArray &);
Expand Down
8 changes: 3 additions & 5 deletions met/src/libcode/vx_statistics/ens_stats.cc
Expand Up @@ -228,9 +228,6 @@ void ECNTInfo::set(const PairDataEnsemble &pd) {
// Store the number of ensemble members
n_ens = pd.n_ens;

// HiRA data has no ensemble mean
bool skip_mean = pd.mn_na.has(bad_data_double);

// Compute empirical CRPS scores
crps_emp = pd.crps_emp_na.wmean(pd.wgt_na);
crpscl_emp = pd.crpscl_emp_na.wmean(pd.wgt_na);
Expand Down Expand Up @@ -260,8 +257,9 @@ void ECNTInfo::set(const PairDataEnsemble &pd) {
}
}

// Compute ensemble mean based statistics
if(!skip_mean) {
// Compute ensemble mean based statistics, if possible
// HiRA stores the ensemble mean as bad data
if(!pd.mn_na.is_const(bad_data_double)) {

// Compute ME and RMSE values
fbar = obar = ffbar = oobar = fobar = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions met/src/libcode/vx_statistics/pair_data_ensemble.cc
Expand Up @@ -628,9 +628,9 @@ void PairDataEnsemble::compute_ssvar() {
ssvar_bin_map bins;
NumArray cur;

// SSVAR requires valid ensemble mean input
// HiRA stores the ensemble mean as bad data
// Do not compute SSVAR when bad data is present
if(mn_na.has(bad_data_double)) return;
if(mn_na.is_const(bad_data_double)) return;

// Check number of points
if(o_na.n() != mn_na.n()) {
Expand Down