radarx.retrieve.advection.interpolate_time#

radarx.retrieve.advection.interpolate_time(obj_t0, obj_t1, times, motion=None, *, field=None, method='linear', min_weight=0.5, x='x', y='y', n_threads=None, engine='auto', **motion_kwargs)[source]#

Advection-corrected time interpolation between two gridded volumes.

Following the moving frame of reference of Gal-Chen (1982) [1], at every target time t the earlier volume is advected forward by t - t0 and the later one backward by t1 - t, both along the storm motion, and the two are blended with weights 1 - f and f, where f = (t - t0) / (t1 - t0). Echoes therefore move smoothly between the two observations instead of fading out in one place and in at another, as with plain linear interpolation. Where only one of the two advected fields is defined, it is used alone. The forward-backward blend is radarx’s own construction. The pysteps library (Pulkkinen et al. 2019 [2]) provides advection-based extrapolation for precipitation nowcasting. The blend of two volumes is not taken from that paper.

Parameters:
Returns:

xarray.Dataset or xarray.DataArray – The advected fields with a new time dimension.

Raises:

ValueError – If a volume has no time, a target time lies outside the two volumes, or no motion could be estimated.

Notes

Dask. This function computes the dask array: it moves the whole fields of two times. The input is loaded into memory and the result is held in memory.

References

Examples

>>> import pandas as pd
>>> times = pd.date_range(grid0.time.values, grid1.time.values, freq="60s")
>>> frames = radarx.retrieve.interpolate_time(grid0, grid1, times)