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
tthe earlier volume is advected forward byt - t0and the later one backward byt1 - t, both along the storm motion, and the two are blended with weights1 - fandf, wheref = (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:
obj_t0, obj_t1 (
xarray.Datasetorxarray.DataArray) – Gridded volumes on the same grid, each with a scalartime.times (
datetime-likeor array-like ofdatetime-like) – Target times betweenobj_t0.timeandobj_t1.time.motion (
xarray.Dataset, optional) – Storm motion fromestimate_motion(). Default: estimated from the two volumes.field (
str, optional) – Field used to estimate the motion (seeestimate_motion()).method, min_weight, x, y, engine, n_threads – See
advect().**motion_kwargs – Passed to
estimate_motion()whenmotionis not given.
- Returns:
xarray.Datasetorxarray.DataArray– The advected fields with a newtimedimension.- 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.
See also
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)