Skip to content

Commit

Permalink
allow weights to become negative (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenImhoff committed Jul 4, 2022
1 parent 90e42cf commit 63cf198
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pysteps/blending/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,10 +1467,8 @@ def calculate_weights_spn(correlations, cov):
# Calculate the noise weight
else:
noise_weight = np.asarray(np.sqrt(1.0 - weights.dot(correlations)))[0]
# Make sure the weights are positive, otherwise weight = 0.0
weights = np.where(weights < 0.0, 0.0, weights)[0]
# Finally, add the noise_weights to the weights variable.
weights = np.concatenate((weights, noise_weight), axis=0)
weights = np.concatenate((np.array(weights)[0], noise_weight), axis=0)

# Otherwise, the weight equals the correlation on that scale level and
# the noise component weight equals 1 - this weight. This only occurs for
Expand Down

0 comments on commit 63cf198

Please sign in to comment.