Skip to content

Commit

Permalink
Corrected average non additive method
Browse files Browse the repository at this point in the history
  • Loading branch information
pstradio committed May 20, 2022
1 parent 7e33f9c commit 91e9b77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qa4sm_reader/img.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def _metric_stats(self, metric, id=None) -> list:
# The number of observations are needed for the averaging of correlation values
for Var in self._iter_vars(type="metric",
filter_parms={'metric': 'n_obs'}):
nobs = Var.values
nobs = Var.values[Var.varname]

# get stats by metric
for Var in self._iter_vars(type="metric", filter_parms=filters):
Expand Down
4 changes: 2 additions & 2 deletions src/qa4sm_reader/plotting_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,8 @@ def output_dpi(res,
return float(dpi)


def average_non_additive(values: Union[pd.Series, np.array], nobs: pd.Series) -> float:
def average_non_additive(values: Union[pd.Series, np.array],
nobs: pd.Series) -> float:
"""
Calculate the average of non-additive values, such as correlation
scores, as recommended in:
Expand All @@ -1647,7 +1648,6 @@ def average_non_additive(values: Union[pd.Series, np.array], nobs: pd.Series) ->

# Transform to Fisher's z-scores
z_scores = np.arctanh(values)

# Remove the entries where there are NaNs
mask = np.isfinite(values) & np.isfinite(nobs)
z_scores = z_scores[mask]
Expand Down

0 comments on commit 91e9b77

Please sign in to comment.