radarx.retrieve.vertical_profiles.mask_above_melting_layer#
- radarx.retrieve.vertical_profiles.mask_above_melting_layer(products, melting_layer, *, bottom='melting_layer_bottom', height=None, margin=0.0, beamwidth=None, variables=None)[source]#
Remove the products of rain-only retrievals above the melting layer.
The rain rates of
radarx.retrieve.rain_rate_z(),rain_rate_kdp,rain_rate_z_zdr,rain_rate_aand the drop size distribution parameters ofradarx.retrieve.dsd()hold for rain. Above the melting layer the radar sees snow and ice, and in it wet snow, for which the relations do not apply.radarx.retrieve.rain_rate()already leaves the gates of the hydrometeor classes without a relation (including the melting layer, “wet snow”) empty, but depends on the classification; this function makes a cap from a melting-layer height instead, for example frommelting_layer()(profiles of a QVP, with the time of the volume) ormelting_layer_ppi()(with the azimuth).A gate is removed where its height is above the bottom of the melting layer plus
margin. The bottom is the end of snow melting (Ryzhkov and Krause 2022 [1], p. 533), so below it there are no wet snow and no ice: the rain-only relations apply from there downward. Themargin(default 0 m) moves the cap, andbeamwidthmakes it use the lower edge of the beam instead of its centre, because a beam whose lower half is in rain and upper half in the layer is contaminated. Both are radarx’s definition and are not taken from a paper. Gates are kept where the melting layer is not known (NaN): the function does not assume that there is no melting layer.- Parameters:
products (
xarray.DataArray,xarray.Datasetorxarray.DataTree) – A rain-only product (DataArray), a sweep with such products (Dataset), or a volume. Datasets need theelevationandrangecoordinates (andaltitude) for the gate heights.melting_layer (
xarray.Dataset,xarray.DataArrayorfloat) – The bottom of the melting layer, in m above sea level: the output ofmelting_layer()ormelting_layer_ppi()(variablebottom), a DataArray, or a number. A DataArray or variable onazimuthis matched to the azimuths of the rays (nearest, circular); one without dimensions applies to all gates. Select one time of a time series first (isel(time=...)).bottom (
str, optional) – Variable of a Dataset that holds the bottom. Default"melting_layer_bottom".height (
xarray.DataArray, optional) – Height of the gates (m above sea level). By default the beam height ofqvp()(4/3 Earth model) from theelevation,rangeandaltitudecoordinates.margin (
float, optional) – Added to the bottom (m); gates above the sum are removed. Default 0.beamwidth (
float, optional) – Two-way half-power beam width (degrees). With it the height compared with the cap is the lower edge of the beam,height - 0.5 * width * range * cos(elevation). Default None: the centre of the beam.variables (
strorlistofstr, optional) – The variables of a Dataset to remove. Default: those ofRAIN_ONLY_PRODUCTSthe Dataset has.
- Returns:
xarray.DataArray,xarray.Datasetorxarray.DataTree– The products with NaN above the layer; other variables are unchanged. In a Dataset withRAIN_RATEandRAIN_RATE_FLAGthe flag is 4 (above_melting_layer) andRAIN_RATE_RELATION0 where an estimate was removed.
See also
melting_layer,melting_layer_ppi,radarx.retrieve.rain_rateNotes
Nothing here estimates the rain rate in the melting layer or above it: the relations scaled for wet snow and dry snow of Giangrande and Ryzhkov (2007) are listed in
radarx.retrieve.qpeand are chosen there withclass_relations.Dask. This function computes the dask array: the layer height is found from the data. The input is loaded into memory and the result is held in memory.
References
Examples
>>> ml = radarx.retrieve.melting_layer_ppi(dtree) >>> rr = radarx.retrieve.rain_rate_z(sweep) >>> rr = radarx.retrieve.mask_above_melting_layer(rr, ml, margin=-200.0)