radarx.retrieve.gauge.gauge_adjust#
- radarx.retrieve.gauge.gauge_adjust(obj, gauges, *, method='ked', variogram=None, model='exponential', n_lags=None, max_lag=None, n_neighbours=20, radius=None, min_value=0.0, min_pairs=5, clip=True, k=None, x=None, y=None, site=None, n_threads=None, engine='auto')[source]#
Adjust a radar rain field to rain gauges.
- Parameters:
obj (
xarray.DataArray) – The radar rain field (an accumulation or a rate) on a grid(y, x)or on any layout with 2-D coordinates, optionally with leading dimensions such astime. Radar and gauges must have the same units. Pixels that are NaN stay NaN.gauges (
xarray.DataArray) – The gauge values on a station dimension with the coordinates of the stations (x,yin metres east and north of the radar, orlon,latin degrees), and the same leading dimensions asradar. NaN marks a missing value; a time with fewer thanmin_pairsusable gauges returns the radar field unchanged.method (
{"mfb", "rda", "brandes", "ok", "conditional", "ked"}, optional) – Default"ked", the best method of Goudenhoofdt and Delobbe (2009). Seeradarx.retrieve.gaugefor the methods.variogram (
dictorxarray.Dataset, optional) – Kriging methods only. A fixed variogram:{"model": ..., "nugget": ..., "partial_sill": ..., "range": ...}("slope"replaces"partial_sill"for the linear model), or the result ofgauge_variogram(). By default the variogram is fitted to the gauges for every time. A fixed variogram makes the kriging weights the same for all times, which is much faster for long series.model (
{"linear", "spherical", "exponential", "gaussian"}, optional) – Variogram model of the automatic fit. Default"exponential".n_lags, max_lag (optional) – Lags of the empirical variogram, see
gauge_variogram().n_neighbours (
intorNone, optional) – Kriging methods only: number of nearest gauges used at each pixel, at least 3 (default 20, as Goudenhoofdt and Delobbe 2009).None: all gauges, with one matrix factorization for all pixels.radius (
float, optional) – Radius (m) over which the radar is averaged at the gauges, seeradar_at_gauges().min_value (
float, optional) – Pairs of gauge and radar value count only if both exceed this value ("mfb","rda","brandes"). Default 0: both positive. Goudenhoofdt and Delobbe (2009) use 1 mm for daily accumulations.min_pairs (
int, optional) – Fewest pairs ("mfb","rda","brandes") or gauges (kriging methods) for which a time is adjusted, at least 2. Default 5. The paper requires 10 pairs per day.clip (
bool, optional) – Set negative results to zero. DefaultTrue.k (
float, optional) –"brandes"only: the smoothing parameter of the weights \(\exp(-d^2/k)\) (m2). Default \(1/(2\delta)\) with the density \(\delta\) of the pairs per area of the bounding box of the radar pixels.x, y, site (optional) – See
radar_at_gauges()."rda"needs the position of the radar: the origin ofxandy, orsitefor geographic coordinates.n_threads (
int, optional) – Threads for the compiled kernels. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use."auto"(default) prefers the compiled kernel and falls back to NumPy.
- Returns:
xarray.Dataset–RAIN_ADJUSTED(float32, the units and dimensions ofradar);GAUGES_USED(number of pairs or gauges used per time, 0 where the radar field is returned unchanged);RAIN_ADJUSTED_STD(kriging standard deviation, in the units ofradar;"ok","conditional","ked");MEAN_FIELD_BIAS("mfb");ADJUSTMENT_FACTOR(the factor field of"rda"and"brandes"). The attributes name the method and, for kriging, the variogram model and the number of pixels where the drift was constant and ordinary kriging was used instead (ked_fallback).- Raises:
TypeError – If
radarorgaugesis not a DataArray.ValueError – For an unknown
method,modelorengine,min_pairsbelow 2,n_neighboursbelow 3, coordinates or dimensions that do not match, a radar field without finite values, or"rda"without the position of the radar.
Notes
The adjusted field of
"ok"is the gauge-only interpolation on the pixels where the radar is finite."ked"and"conditional"need the radar value at the gauges, so a gauge outside the radar field (or without a finite value withinradius) is left out.The methods are those of Goudenhoofdt and Delobbe (2009) without the static local bias correction. How radarx fits the variogram, which gauges it uses and what it does for a constant drift is listed in
radarx.retrieve.gauge; the methods are not reproduced against the data of the paper (not available), but against closed-form kriging solutions and independent solvers (see the tests).Dask. This function computes the dask array: kriging needs every gauge and the whole field of each time. The input is loaded into memory and the result is held in memory.
References
Goudenhoofdt, E., and L. Delobbe, 2009: Evaluation of radar-gauge merging methods for quantitative precipitation estimates. Hydrol. Earth Syst. Sci., 13 (2), 195-203, https://doi.org/10.5194/hess-13-195-2009
Sinclair, S., and G. Pegram, 2005: Combining radar and rain gauge rainfall estimates using conditional merging. Atmos. Sci. Lett., 6 (1), 19-22, https://doi.org/10.1002/asl.85
Brandes, E. A., 1975: Optimizing rainfall estimates with the aid of radar. J. Appl. Meteor., 14 (7), 1339-1345, https://doi.org/10.1175/1520-0450(1975)014<1339:OREWTA>2.0.CO;2
Smith, J. A., and W. F. Krajewski, 1991: Estimation of the mean field bias of radar rainfall estimates. J. Appl. Meteor., 30 (4), 397-412, https://doi.org/10.1175/1520-0450(1991)030<0397:EOTMFB>2.0.CO;2
Wackernagel, H., 2003: Multivariate Geostatistics. 3rd ed. Springer, https://doi.org/10.1007/978-3-662-05294-5
Cressie, N., 1985: Fitting variogram models by weighted least squares. J. Int. Assoc. Math. Geol., 17 (5), 563-586, https://doi.org/10.1007/BF01032109
Examples
>>> merged = gauge_adjust(rain, gauges, method="ked") >>> merged.RAIN_ADJUSTED.plot() >>> merged = rain.radarx.gauge_adjust(gauges, method="conditional")