|
3 | 3 | STEPS nowcast |
4 | 4 | ============= |
5 | 5 |
|
6 | | -This tutorial shows how to compute and plot an ensemble nowcast using Finnish |
| 6 | +This tutorial shows how to compute and plot an ensemble nowcast using Swiss |
7 | 7 | radar data. |
8 | 8 |
|
9 | 9 | """ |
10 | 10 |
|
11 | 11 | from pylab import * |
12 | 12 | from datetime import datetime |
13 | | -from pysteps.io.archive import find_by_date |
14 | | -from pysteps.io.importers import import_fmi_pgm |
15 | | -from pysteps.io.readers import read_timeseries |
| 13 | +from pysteps import io, nowcasts, rcparams |
16 | 14 | from pysteps.motion.lucaskanade import dense_lucaskanade |
17 | | -from pysteps import nowcasts, rcparams |
18 | 15 | from pysteps.postprocessing.ensemblestats import excprob |
19 | 16 | from pysteps.utils import conversion, transformation |
20 | 17 | from pysteps.visualization import plot_precip_field |
|
28 | 25 | # Read precipitation field |
29 | 26 | # ------------------------ |
30 | 27 | # |
31 | | -# First thing, the sequence of Finnish radar composites is imported, converted and |
| 28 | +# First thing, the sequence of Swiss radar composites is imported, converted and |
32 | 29 | # transformed into units of dBR. |
33 | 30 |
|
34 | | -date = datetime.strptime("201609281600", "%Y%m%d%H%M") |
35 | | -data_source = "fmi" |
| 31 | + |
| 32 | + |
| 33 | +date = datetime.strptime("201701311200", "%Y%m%d%H%M") |
| 34 | +data_source = "mch" |
36 | 35 |
|
37 | 36 | # Load data source config |
38 | 37 | root_path = rcparams.data_sources[data_source]["root_path"] |
|
44 | 43 | timestep = rcparams.data_sources[data_source]["timestep"] |
45 | 44 |
|
46 | 45 | # Find the radar files in the archive |
47 | | -inputfns = find_by_date( |
48 | | - date, root_path, path_fmt, fn_pattern, fn_ext, timestep, num_prev_files=9 |
| 46 | +fns = io.find_by_date( |
| 47 | + date, root_path, path_fmt, fn_pattern, fn_ext, timestep, num_prev_files=2, |
49 | 48 | ) |
50 | 49 |
|
51 | 50 | # Read the data from the archive |
52 | | -Z, _, metadata = read_timeseries(inputfns, import_fmi_pgm, gzipped=True) |
| 51 | +importer = io.get_method(importer_name, "importer") |
| 52 | +R, _, metadata = io.read_timeseries(fns, importer, **importer_kwargs) |
53 | 53 |
|
54 | | -# Convert to rain rate using the finnish Z-R relationship |
55 | | -R = conversion.to_rainrate(Z, metadata, 223.0, 1.53)[0] |
| 54 | +# Convert to rain rate |
| 55 | +R, metadata = conversion.to_rainrate(R, metadata) |
56 | 56 |
|
57 | 57 | # Log-transform the data to unit of dBR, set the threshold to 0.1 mm/h |
58 | 58 | R = transformation.dB_transform(R, threshold=0.1, zerovalue=-15.0)[0] |
|
0 commit comments