Nowcasting#

The pylawr package makes possible to extrapolate weather radar fields on a very short term timescale. The extrapolation is required if you want to process radar measurements of several weather radars with different time stamps, e.g. our X-band weather radars and the C-band radars operated by the German Meteorological Service measure with different time resolutions (30 s vs. 5 min). The Dual radar attenuation correction requires approximately simultaneous reflectivity fields, therefore we need to shift the C-band measurements.

Extrapolation#

The class Extrapolator can be used to extrapolate a field based on two previous fields using template matching (skimage.feature.match_template()). The template matching finds similar areas between two fields, for further information see Template Matching of scikit-image. Based on the distance between similar pixels, a vector of pixel movement between two time steps is calculated. With the vector, the current field can be shifted to a field of a following time step.

The Extrapolator tags the extrapolated array with TAG_EXTRAPOLATION, which indicates that an extrapolation was applied.

Note

Please note, the extrapolation is only defined for reflectivities on a CartesianGrid.

Some example for low-level API application is shown below. Two C-band measurements of with different timestamps (five minutes difference) are used to extrapolate the latest measurement to 30 seconds in the future.

grid_extrapolation = CartesianGrid(start=-30000, nr_points=600)

extrapol_remapper = NearestNeighbor(1)
extrapol_remapper.fit(dwd_grid, grid_extrapolation)

dwd_extrapol_remapper = NearestNeighbor(1)
dwd_extrapol_remapper.fit(grid_extrapolation, dwd_grid)

dwd_regridded = extrapol_remapper.remap(dwd_field)
old_dwd_regridded = extrapol_remapper.remap(old_dwd_field)

extrapolator = Extrapolator()
extrapolator.fit(array=dwd_regridded, array_pre=old_dwd_regridded,
                 grid=grid_extrapolation)
extrapolator.transform(dwd_regridded,
                       time=(dwd_field.time.values[0] +
                             np.timedelta64(30, 's')))


dwd_extrapolated = dwd_extrapol_remapper.remap(dwd_extrapolated)

pylawr.transform.temporal.Extrapolator([...])

This class can be used to extrapolate a field based on two previous fields using template matching.

Functional API#

The functional API can be used for simplified handling of the Extrapolator within this pylawr package.

The online processing requires a fitted Extrapolator with given reflectivity and a path to the previous reflectivity field, which is implemented within fit_extrapolator().

When processing weather radar data offline the past and future is known, it’s possible to fit an extrapolate_offline. The :py:mod:`~pylawr.transform.temporal.Extrapolator is applied to both fields and then the weighted average is returned as extrapolated field. The weights are based on a linear dynamics assumptions and anti-proportional from array time to the interpolation time.

pylawr.functions.fit.fit_extrapolator(...[, ...])

Fits an extrapolator with given reflectivity and path to old reflectivity.

pylawr.functions.fit.extrapolate_offline(...)

Fits an extrapolator for temporal interpolation between two given arrays.