radarx.retrieve.imerg.match_imerg#

radarx.retrieve.imerg.match_imerg(obj, imerg, *, interval='30min', time_label='start', min_coverage=0.5, min_time_coverage=0.8, output='rate')[source]#

Average a radar rain rate onto the grid and time steps of IMERG.

Parameters:
  • obj (xarray.DataArray) – Radar rain rate (mm/h) on a radar grid, (time, y, x) or (y, x), with the 2-D coordinates lon and lat (or longitude and latitude), or x and y with a crs_wkt grid mapping as the grids of radarx have. NaN is outside the coverage of the radar.

  • imerg (xarray.DataArray) – IMERG rain rate (mm/h), (time, lat, lon) in any order, or without time.

  • interval (str, float or numpy.timedelta64, optional) – Length of an IMERG step: a string like "30min" or "1h", seconds or a timedelta. Default "30min".

  • time_label ({"start", "end", "center"}, optional) – The time of an IMERG value is the start, the end or the centre of its step. Default "start".

  • min_coverage (float, optional) – Smallest fraction of the radar pixels that fit into a cell that must have a value. Default 0.5.

  • min_time_coverage (float, optional) – Smallest fraction of a step that the scans of a pixel must cover. Default 0.8.

  • output ({"rate", "accumulation"}, optional) – "rate" (default): mean rate in mm/h. "accumulation": mm in the step.

Returns:

xarray.Dataset – On the cells of IMERG that hold radar pixels (cropped to their bounding box, lat and lon ascending) and the steps of IMERG: radar, imerg, radar_coverage (fraction of the pixels that fit into the cell that have a value) and radar_time_coverage (mean fraction of the step covered).

Raises:
  • TypeError – If an input is not a DataArray.

  • ValueError – For unknown options, a radar without time for an IMERG with several steps, a grid that is not regular, or radar pixels outside the IMERG grid.

Notes

Dask. This function computes the dask array: the scans of every step and the cells of the coarse grid are averaged in memory. The input is loaded into memory and the result is held in memory.

References

Huffman, G. J., D. T. Bolvin, D. Braithwaite, K.-L. Hsu, R. J. Joyce, C. Kidd, E. J. Nelkin, S. Sorooshian, E. F. Stocker, J. Tan, D. B. Wolff, and P. Xie, 2020: Integrated Multi-satellitE Retrievals for the Global Precipitation Measurement (GPM) mission (IMERG). Satellite Precipitation Measurement, Springer, 343-353, https://doi.org/10.1007/978-3-030-24568-9_19

Examples

>>> both = radarx.retrieve.match_imerg(rain_rate, imerg["precipitation"])
>>> radarx.retrieve.match_statistics(both.imerg, both.radar, threshold=0.5)