|
57 | 57 | # Upscale data to 2 km to limit memory usage |
58 | 58 | R, metadata = dimension.aggregate_fields_space(R, metadata, 2000) |
59 | 59 |
|
| 60 | +# Plot the rainfall field |
| 61 | +plot_precip_field(R, geodata=metadata) |
| 62 | + |
60 | 63 | # Log-transform the data to unit of dBR, set the threshold to 0.1 mm/h |
61 | 64 | R = transformation.dB_transform(R, threshold=0.1, zerovalue=-15.0)[0] |
62 | 65 |
|
|
93 | 96 | R_f = transformation.dB_transform(R_f, threshold=-10.0, inverse=True)[0] |
94 | 97 |
|
95 | 98 | # Plot the S-PROG forecast |
96 | | -figure() |
97 | | -bm = plot_precip_field(R_f[-1, :, :], geodata=metadata, title="S-PROG") |
| 99 | +plot_precip_field(R_f[-1, :, :], geodata=metadata, title="S-PROG") |
98 | 100 |
|
99 | 101 | ############################################################################### |
100 | 102 | # As we can see from the figure above, the forecast produced by S-PROG is a |
|
120 | 122 | R[-3:, :, :], |
121 | 123 | V, |
122 | 124 | n_leadtimes, |
123 | | - n_ens_members=n_ens_members, |
| 125 | + n_ens_members, |
124 | 126 | n_cascade_levels=6, |
125 | 127 | R_thr=-10.0, |
126 | | - kmperpixel=1.0, |
127 | | - timestep=5, |
| 128 | + kmperpixel=2.0, |
| 129 | + timestep=timestep, |
128 | 130 | decomp_method="fft", |
129 | 131 | bandpass_filter_method="gaussian", |
130 | 132 | noise_method="nonparametric", |
|
139 | 141 |
|
140 | 142 | # Plot the ensemble mean |
141 | 143 | R_f_mean = np.mean(R_f[:, -1, :, :], axis=0) |
142 | | -figure() |
143 | | -bm = plot_precip_field(R_f_mean, geodata=metadata, title="Ensemble mean") |
| 144 | +plot_precip_field(R_f_mean, geodata=metadata, title="Ensemble mean") |
144 | 145 |
|
145 | 146 | ############################################################################### |
146 | 147 | # The mean of the ensemble displays similar properties as the S-PROG |
147 | 148 | # forecast seen above, although the degree of smoothing strongly depends on |
148 | 149 | # the ensemble size. In this sense, the S-PROG forecast can be seen as |
149 | | -# the mean forecast from an ensemble of infinite size. |
| 150 | +# the mean of an ensemble of infinite size. |
150 | 151 |
|
151 | 152 | # Plot the first two realizations |
152 | 153 | fig = figure() |
153 | 154 | for i in range(2): |
154 | 155 | ax = fig.add_subplot(121 + i) |
155 | 156 | ax.set_title("Member %02d" % i) |
156 | | - bm = plot_precip_field(R_f[i, -1, :, :], geodata=metadata) |
| 157 | + plot_precip_field(R_f[i, -1, :, :], geodata=metadata, colorbar=False, axis="off") |
157 | 158 | tight_layout() |
158 | 159 |
|
159 | 160 | ############################################################################### |
160 | 161 | # As we can see from these two members of the ensemble, the stochastic forecast |
161 | 162 | # mantains the same variance as in the observed rainfall field. |
| 163 | + |
| 164 | +############################################################################### |
162 | 165 | # Finally, it is possible to derive probabilities from our ensemble forecast. |
163 | 166 |
|
164 | 167 | # Compute exceedence probabilities for a 0.5 mm/h threshold |
165 | 168 | P = excprob(R_f[:, -1, :, :], 0.5) |
166 | 169 |
|
167 | 170 | # Plot the field of probabilities |
168 | | -figure() |
169 | | -bm = plot_precip_field( |
| 171 | +plot_precip_field( |
170 | 172 | P, |
171 | 173 | geodata=metadata, |
172 | 174 | drawlonlatlines=False, |
|
176 | 178 | title="Exceedence probability", |
177 | 179 | ) |
178 | 180 |
|
179 | | -# sphinx_gallery_thumbnail_number = 3 |
| 181 | +# sphinx_gallery_thumbnail_number = 5 |
0 commit comments