@@ -91,7 +91,7 @@ def forecast(
91
91
the stationarity of the AR process cannot be guaranteed.
92
92
ar_window_radius : int, optional
93
93
The radius of the window to use for determining the parameters of the
94
- autoregressive model.
94
+ autoregressive model. Set to None to disable localization.
95
95
r_vil_window_radius : int, optional
96
96
The radius of the window to use for determining the R(VIL) relation.
97
97
Applicable if rainrate is not None.
@@ -179,7 +179,11 @@ def forecast(
179
179
print ("parallel threads: %d" % num_workers )
180
180
print ("number of cascade levels: %d" % n_cascade_levels )
181
181
print ("order of the ARI(p,1) model: %d" % ar_order )
182
- print ("ARI(p,1) window radius: %d" % ar_window_radius )
182
+ if type (ar_window_radius ) == int :
183
+ print ("ARI(p,1) window radius: %d" % ar_window_radius )
184
+ else :
185
+ print ("ARI(p,1) window radius: none" )
186
+
183
187
print ("R(VIL) window radius: %d" % r_vil_window_radius )
184
188
185
189
if measure_time :
@@ -381,11 +385,18 @@ def _moving_window_corrcoef(x, y, window_radius):
381
385
y [~ mask ] = 0.0
382
386
mask = mask .astype (float )
383
387
384
- n = gaussian_filter (mask , window_radius , mode = "constant" )
388
+ if window_radius is not None :
389
+ n = gaussian_filter (mask , window_radius , mode = "constant" )
390
+
391
+ ssx = gaussian_filter (x ** 2 , window_radius , mode = "constant" )
392
+ ssy = gaussian_filter (y ** 2 , window_radius , mode = "constant" )
393
+ sxy = gaussian_filter (x * y , window_radius , mode = "constant" )
394
+ else :
395
+ n = np .mean (mask )
385
396
386
- ssx = gaussian_filter (x ** 2 , window_radius , mode = "constant" )
387
- ssy = gaussian_filter (y ** 2 , window_radius , mode = "constant" )
388
- sxy = gaussian_filter (x * y , window_radius , mode = "constant" )
397
+ ssx = np . mean (x ** 2 )
398
+ ssy = np . mean (y ** 2 )
399
+ sxy = np . mean (x * y )
389
400
390
401
stdx = np .sqrt (ssx / n )
391
402
stdy = np .sqrt (ssy / n )
0 commit comments