@@ -777,7 +777,7 @@ def __check_inputs(self):
777
777
self .__params .filter_kwargs = deepcopy (self .__config .filter_kwargs )
778
778
779
779
if self .__config .noise_kwargs is None :
780
- self .__params .noise_kwargs = dict ()
780
+ self .__params .noise_kwargs = { "win_fun" : "tukey" }
781
781
else :
782
782
self .__params .noise_kwargs = deepcopy (self .__config .noise_kwargs )
783
783
@@ -1092,16 +1092,31 @@ def transform_to_lagrangian(precip, i):
1092
1092
1093
1093
self .__precip_models = np .stack (temp_precip_models )
1094
1094
1095
+ if self .__params .noise_kwargs ["win_fun" ] is not None :
1096
+ tapering = utils .tapering .compute_window_function (
1097
+ self .__precip .shape [1 ],
1098
+ self .__precip .shape [2 ],
1099
+ self .__params .noise_kwargs ["win_fun" ],
1100
+ )
1101
+ else :
1102
+ tapering = np .ones ((self .__precip .shape [1 ], self .__precip .shape [2 ]))
1103
+
1104
+ tapering_mask = tapering == 0.0
1105
+ masked_precip = self .__precip .copy ()
1106
+ masked_precip [:, tapering_mask ] = np .nanmin (self .__precip )
1107
+ masked_precip_models = self .__precip_models .copy ()
1108
+ masked_precip_models [:, :, tapering_mask ] = np .nanmin (self .__precip_models )
1109
+
1095
1110
# Check for zero input fields in the radar and NWP data.
1096
1111
self .__params .zero_precip_radar = blending .utils .check_norain (
1097
- self . __precip ,
1112
+ masked_precip ,
1098
1113
self .__config .precip_threshold ,
1099
1114
self .__config .norain_threshold ,
1100
1115
)
1101
1116
# The norain fraction threshold used for nwp is the default value of 0.0,
1102
1117
# since nwp does not suffer from clutter.
1103
1118
self .__params .zero_precip_model_fields = blending .utils .check_norain (
1104
- self . __precip_models ,
1119
+ masked_precip_models ,
1105
1120
self .__config .precip_threshold ,
1106
1121
self .__config .norain_threshold ,
1107
1122
)
0 commit comments