@@ -777,7 +777,7 @@ def __check_inputs(self):
777777 self .__params .filter_kwargs = deepcopy (self .__config .filter_kwargs )
778778
779779 if self .__config .noise_kwargs is None :
780- self .__params .noise_kwargs = dict ()
780+ self .__params .noise_kwargs = { "win_fun" : "tukey" }
781781 else :
782782 self .__params .noise_kwargs = deepcopy (self .__config .noise_kwargs )
783783
@@ -1092,16 +1092,31 @@ def transform_to_lagrangian(precip, i):
10921092
10931093 self .__precip_models = np .stack (temp_precip_models )
10941094
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+
10951110 # Check for zero input fields in the radar and NWP data.
10961111 self .__params .zero_precip_radar = blending .utils .check_norain (
1097- self . __precip ,
1112+ masked_precip ,
10981113 self .__config .precip_threshold ,
10991114 self .__config .norain_threshold ,
11001115 )
11011116 # The norain fraction threshold used for nwp is the default value of 0.0,
11021117 # since nwp does not suffer from clutter.
11031118 self .__params .zero_precip_model_fields = blending .utils .check_norain (
1104- self . __precip_models ,
1119+ masked_precip_models ,
11051120 self .__config .precip_threshold ,
11061121 self .__config .norain_threshold ,
11071122 )
0 commit comments