radarx.retrieve.qc.apply_mask#
- radarx.retrieve.qc.apply_mask(obj, mask=None, data_vars=None, *, nodata='auto', **kwargs)[source]#
Set non-meteorological gates to NaN.
- Parameters:
obj (
xarray.Datasetorxarray.DataTree) – A sweep, a single sweep node (dtree["sweep_0"]) or a volume withsweep_*groups.mask (
xarray.Dataset,xarray.DataTreeorxarray.DataArray, optional) – The output ofecho_mask()forobj(or its booleanMETEO_MASK, True for gates to keep). By default it is computed withecho_mask()and**kwargs.data_vars (
strorlistofstr, optional) – Fields to mask. Default: all floating point fields on(azimuth, range)(or(elevation, range)). In a volume, sweeps without a field or without a mask are left unchanged.nodata (
{"auto", "nexrad"}orNone, optional) –"auto"(default) also masks the no-data codes of NEXRAD Level II fields decoded by xradar in NEXRAD data (DBZH<= -32,ZDR<= -12.9,RHOHV<= 0.21,PHIDP< 0,VRADH<= -63.9), so that every masked field holds NaN at gates without data;"nexrad"always does, None never does. Also passed toecho_mask().**kwargs – Options of
echo_mask()whenmaskis not given.
- Returns:
xarray.Datasetorxarray.DataTree– A copy ofobjwith the masked fields (attributes kept).
Notes
Dask and extra dimensions. The fields may have extra leading dimensions (for example
timeorvolume): each sweep is processed on its own and the result has the same extra dimensions. Dask arrays stay lazy: the result is a dask array and nothing is computed until it is (the sweep dimensions are rechunked into one chunk).References
No published method is implemented here: the function applies the mask of
echo_mask(), whose Notes and References state how that classification relates to Gourley et al. (2007), Krause (2016), Park et al. (2009) and Steiner and Smith (2002). The NEXRAD no-data codes it masks are those decoded by xradar, not values from a paper.Examples
>>> clean = radarx.retrieve.apply_mask(dtree, data_vars=["DBZH", "ZDR"]) >>> clean = dtree.radarx.apply_mask()