Skip to content

Commit

Permalink
fix tests by removing redundant statement and add print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenImhoff committed Apr 22, 2024
1 parent b105ff1 commit 4fd7add
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
24 changes: 4 additions & 20 deletions pysteps/blending/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,26 +523,8 @@ def forecast(
precip, velocity, ar_order, xy_coords, extrapolator, extrap_kwargs, num_workers
)

# 2. Initialize the noise method
np.random.seed(seed)
pp, generate_noise, noise_std_coeffs = _init_noise(
precip,
precip_thr,
n_cascade_levels,
bp_filter,
decompositor,
fft,
noise_method,
noise_kwargs,
noise_stddev_adj,
measure_time,
num_workers,
seed,
)

# 3. Perform the cascade decomposition for the input precip fields and
# 2. Perform the cascade decomposition for the input precip fields and
# and, if necessary, for the (NWP) model fields

# 2.1 Compute the cascade decompositions of the input precipitation fields
(
precip_cascade,
Expand Down Expand Up @@ -574,7 +556,9 @@ def forecast(
zero_precip_radar = blending.utils.check_norain(precip, precip_thr, norain_thr)
# The norain fraction threshold used for nwp is the default value of 0.0,
# since nwp does not suffer from clutter.
zero_model_fields = blending.utils.check_norain(precip_models_pm, precip_thr)
zero_model_fields = blending.utils.check_norain(
precip_models_pm, precip_thr, norain_thr
)

# 2.3.1 If precip is below the norain threshold and precip_models_pm is zero,
# we consider it as no rain in the domain.
Expand Down
3 changes: 3 additions & 0 deletions pysteps/blending/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ def load_NWP(input_nc_path_decomp, input_path_velocities, start_time, n_timestep
# Append the output list
R_d.append(decomp_dict_)

ncf_decomp.close()
return R_d, uv


Expand Down Expand Up @@ -552,4 +553,6 @@ def check_norain(precip_arr, precip_thr=None, norain_thr=0.0):
precip_thr = np.nanmin(precip_arr)
rain_pixels = precip_arr[precip_arr > precip_thr]
norain = rain_pixels.size / precip_arr.size <= norain_thr
print("Field is below no rain fraction :", norain)
print("rain fraction is :", rain_pixels.size / precip_arr.size)
return norain

0 comments on commit 4fd7add

Please sign in to comment.