15
15
except ImportError :
16
16
dask_imported = False
17
17
18
- def forecast (R , V , n_timesteps , n_ens_members , n_cascade_levels ,
19
- kmperpixel , timestep , R_thr = None , extrap_method = "semilagrangian" ,
18
+ def forecast (R , V , n_timesteps , n_ens_members , n_cascade_levels , R_thr = None ,
19
+ kmperpixel = None , timestep = None , extrap_method = "semilagrangian" ,
20
20
decomp_method = "fft" , bandpass_filter_method = "gaussian" ,
21
21
noise_method = "nonparametric" , noise_stddev_adj = True , ar_order = 2 ,
22
22
vel_pert_method = None , conditional = False , use_precip_mask = True ,
@@ -41,16 +41,18 @@ def forecast(R, V, n_timesteps, n_ens_members, n_cascade_levels,
41
41
The number of ensemble members to generate.
42
42
n_cascade_levels : int
43
43
The number of cascade levels to use.
44
- kmperpixel : float
45
- Spatial resolution of the input data (kilometers/pixel).
46
- timestep : float
47
- Time step of the motion vectors (minutes).
48
44
49
45
Other Parameters
50
46
----------------
51
47
R_thr : float
52
48
Specifies the threshold value for minimum observable precipitation
53
49
intensity. Must be set if use_probmatching is True or conditional is True.
50
+ kmperpixel : float
51
+ Spatial resolution of the input data (kilometers/pixel). Required if
52
+ vel_pert_method is not None or mask_method is 'incremental'.
53
+ timestep : float
54
+ Time step of the motion vectors (minutes). Required if vel_pert_method is
55
+ not None or mask_method is 'incremental'.
54
56
extrap_method : {'semilagrangian'}
55
57
Name of the extrapolation method to use. See the documentation of
56
58
pysteps.advection.
@@ -148,15 +150,29 @@ def forecast(R, V, n_timesteps, n_ens_members, n_cascade_levels,
148
150
if use_probmatching and R_thr is None :
149
151
raise Exception ("use_probmatching=True but R_thr is not set" )
150
152
153
+ if kmperpixel is None :
154
+ if vel_pert_method is None :
155
+ raise Exception ("vel_pert_method is set but kmperpixel=None" )
156
+ if mask_method == "incremental" :
157
+ raise Exception ("mask_method='incremental' but kmperpixel=None" )
158
+
159
+ if timestep is None :
160
+ if vel_pert_method is None :
161
+ raise Exception ("vel_pert_method is set but timestep=None" )
162
+ if mask_method == "incremental" :
163
+ raise Exception ("mask_method='incremental' but timestep=None" )
164
+
151
165
print ("Computing STEPS nowcast:" )
152
166
print ("------------------------" )
153
167
print ("" )
154
168
155
169
print ("Inputs:" )
156
170
print ("-------" )
157
171
print ("input dimensions: %dx%d" % (R .shape [1 ], R .shape [2 ]))
158
- print ("km/pixel: %g" % kmperpixel )
159
- print ("time step: %d minutes" % timestep )
172
+ if kmperpixel is not None :
173
+ print ("km/pixel: %g" % kmperpixel )
174
+ if timestep is not None :
175
+ print ("time step: %d minutes" % timestep )
160
176
print ("" )
161
177
162
178
print ("Methods:" )
0 commit comments