Skip to content

Commit 6d43dff

Browse files
committed
Adapt to change in io interface
1 parent db52a2d commit 6d43dff

File tree

5 files changed

+7
-26
lines changed

5 files changed

+7
-26
lines changed

examples/cascade_decomposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
ds.fn_ext, ds.timestep, 0, 0)
5959

6060
## read radar field files
61-
importer = stp.io.get_method(ds.importer)
61+
importer = stp.io.get_method(ds.importer, type="importer")
6262
R, _, metadata = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
6363
R = R.squeeze() # since this contains just one frame
6464
Rmask = np.isnan(R)

examples/ensemble_verification.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def cond_pars(pars):
188188

189189

190190
## read radar field files
191-
importer = stp.io.get_method(ds.importer)
191+
importer = stp.io.get_method(ds.importer, type="importer")
192192
R, _, metadata = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
193193
metadata0 = metadata.copy()
194194
metadata0["shape"] = R.shape[1:]
@@ -296,7 +296,7 @@ def export(X):
296296
ds.fn_ext, ds.timestep, 0, p["n_lead_times"])
297297

298298
## read radar field files
299-
importer = stp.io.get_method(ds.importer)
299+
importer = stp.io.get_method(ds.importer, type="importer")
300300
R_obs, _, metadata_obs = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
301301
R_obs = R_obs[1:,:,:]
302302
metadata_obs["timestamps"] = metadata_obs["timestamps"][1:]
@@ -338,20 +338,7 @@ def export(X):
338338
for i,lt in enumerate(p["v_leadtimes"]):
339339

340340
idlt = leadtimes == lt
341-
342-
if verification["doplot"]:
343-
## plot observation
344-
fig = plt.figure()
345-
im = stp.plt.plot_precip_field(R_obs[idlt,:,:].squeeze())
346-
plt.savefig(os.path.join(path_to_nwc, "%s_R_obs_%03d_%03d.png" % (startdate.strftime("%Y%m%d%H%M"), lt, p["v_accu"])))
347-
plt.close()
348-
349-
## plot forecast
350-
fig = plt.figure()
351-
im = stp.plt.plot_precip_field(R_fct[0, idlt, :, :].squeeze())
352-
plt.savefig(os.path.join(path_to_nwc, "%s_R_fct_%03d_%03d.png" % (startdate.strftime("%Y%m%d%H%M"), lt, p["v_accu"])))
353-
plt.close()
354-
341+
355342
## rank histogram
356343
R_fct_ = np.vstack([R_fct[j, idlt, :, :].flatten() for j in range(p["n_ens_members"])]).T
357344
stp.verification.ensscores.rankhist_accum(rankhists[lt],

examples/noise_generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
ds.fn_ext, ds.timestep, 0, 0)
6060

6161
## read radar field files
62-
importer = stp.io.get_method(ds.importer)
62+
importer = stp.io.get_method(ds.importer, type="importer")
6363
R, _, metadata = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
6464
R = R.squeeze() # since this contains just one frame
6565
Rmask = np.isnan(R)

examples/run_deterministic_nowcast.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
ds.fn_ext, ds.timestep, n_prvs_times, 0)
6666

6767
## read radar field files
68-
importer = stp.io.get_method(ds.importer)
68+
importer = stp.io.get_method(ds.importer, type="importer")
6969
R, _, metadata = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
7070
Rmask = np.isnan(R)
7171
print("The data array has size [nleadtimes,nrows,ncols] =", R.shape)
@@ -101,12 +101,6 @@
101101
R_fct, _ = transformer(R_fct, metadata, inverse=True)
102102
R, metadata = transformer(R, metadata, inverse=True)
103103

104-
Rplot=R.copy()
105-
Rplot[Rmask]=np.nan
106-
stp.plt.plot_precip_field(Rplot[-1,:,:], False, metadata)
107-
stp.plt.quiver(UV, metadata)
108-
plt.show()
109-
110104
## plot the nowcast...
111105
R[Rmask] = np.nan # reapply radar mask
112106
stp.plt.animate(R, nloops=2, timestamps=metadata["timestamps"],

examples/run_ensemble_nowcast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
ds.fn_ext, ds.timestep, n_prvs_times, 0)
7676

7777
## read radar field files
78-
importer = stp.io.get_method(ds.importer)
78+
importer = stp.io.get_method(ds.importer, type="importer")
7979
R, _, metadata = stp.io.read_timeseries(input_files, importer, **ds.importer_kwargs)
8080
Rmask = np.isnan(R)
8181

0 commit comments

Comments
 (0)