pylawr.functions.transform#

pylawr.functions.transform._set_max_trunc_radius(remapper, trunc_radius)[source]#
pylawr.functions.transform.correct_attenuation(refl_pattern, refl_dwd=None)[source]#

This method corrects reflectivity measurements of weather radars that operate in attenuation-influenced frequency bands (X-band) using observations from less attenuated radar systems (C-band). If the data of the less attenuated radar system is not available the gate-by-gate correction procedures based on [Kraemer et al., 2008] with correct_attenuation_constrained is applied.

Parameters
Returns

pylawr.functions.transform.correct_attenuation_dual(refl_attenuated, refl_robust)[source]#

This method corrects reflectivity measurements of weather radars that operate in attenuation-influenced frequency bands (X-band) using observations from less attenuated radar systems (C-band) based on [Lengfeld et al., 2016].

Parameters
  • refl_attenuated (xarray.DataArray) – Radar field of attenuation-influenced weather radar

  • refl_robust (xarray.DataArray) – Radar field of less attenuated weather radar

Returns

pylawr.functions.transform.correct_attenuation_dwd(refl, constraint_pia_arg=20.0)[source]#

Gate-by-Gate attenuation correction for a single weather radar based on modification of [Kraemer et al., 2008] according to the iterative estimation of k-Z relationship. The parameters are tuned for C-band by ourselves using MRR WMH measurements of the years 2013 to 2020 covering 10252 fit values. This method uses wradlib method wradlib.atten.correct_attenuation_constrained() to calculate additive correction.

Parameters
  • refl (xarray.DataArray) – Radar field of reflectivity in decibel (dBZ).

  • constraint_pia_arg (float, optional) – Constraint of the PIA in dB. A higher constraint is more likely to result in an unstable attenuation correction.

Returns

pylawr.functions.transform.correct_attenuation_lawr(refl, constraint_pia_arg=10.0)[source]#

Gate-by-Gate attenuation correction for a single weather radar based on modification of [Kraemer et al., 2008] according to the iterative estimation of k-Z relationship. The parameters are tuned for X-band by ourselves using MRR WMH measurements of the years 2013 to 2020 covering 108056 fit values. This method uses wradlib method wradlib.atten.correct_attenuation_constrained() to calculate additive correction.

Parameters
  • refl (xarray.DataArray) – Radar field of reflectivity in decibel (dBZ).

  • constraint_pia_arg (float, optional) – Constraint of the PIA in dB. A higher constraint is more likely to result in an unstable attenuation correction.

Returns

  • refl_corrected (xarray.DataArray) – Attenuation corrected radar field. If the PIA estimate is valid/finite.

  • pia (xarray.DataArray) – Path integrated attenuation field.

pylawr.functions.transform.extrapolation_offline(now, prev_refl, next_refl, extrapolator)[source]#

Extrapolates two reflectivity fields to required time step for offline processing. We extrapolate from the previous reflectivity field and analogous from the following, next reflectivity field to required time step, thus the mean of the two extrapolated fields is the reflectivity field of the needed time step.

Parameters
  • now (numpy.datetime64) – Current time step within time interval of prev_refl and next_refl.

  • prev_refl (DataArray) – Reflectivity array from previous time step.

  • next_refl (DataArray) – Reflectivity array from next time step.

  • extrapolator (Extrapolator) – Fitted extrapolator to given arrays.

Returns

refl – Reflectivity array from current time step.

Return type

DataArray

pylawr.functions.transform.interpolate_center_no_rain(refl_array, center_len=1500)[source]#
pylawr.functions.transform.interpolate_missing(reflectivity, remapper=None, trunc_radius=2, zero_thres=0.34, zero_field=(11, 11))[source]#

Interpolate missing values of given reflectivity array with given remapper. The truncation radius defines the maximum distance in decorrelation lengths of source points for interpolation. The maximum distance for remapper is set to this value.

Parameters
  • reflectivity (xarray.DataArray) – The remapper is fitted to this reflectivity array and NaN values are interpolated in this array.

  • remapper (child of BaseRemap or None) – This remapper is used to fill missing values within given reflectivity. If no remapper is given, a new NearestNeighbor remapper is created. Default is None.

  • trunc_radius (float or None, optional) – If no points within this truncation radius are found, no interpolation is possible. If this truncation radius is None, no truncation is done. If this radius is a float (default = 2), then the truncation will be performed for trunc_radius * decorrelation length of the remapper.

  • zero_field (tuple(int)) – The size of the local receptive field to search for valid values, which have rain. If the number of rain values is below a given threshold, the missing values are set to zero. Default is (31, 31).

  • zero_thres (float, optional) – If the number of rain values within a local receptive field is below this threshold, the missing values are set to zero. Default is 0.34.

Returns

  • refl_filtered (xarray.DataArray) – Reflectivity with interpolated values. All values are either filled with no rain if a given criterion is reached or interpolated by given remapper.

  • remapper (child of BaseRemap) – This remapper was used to fill holes within given reflectivity.

Warning

Given remapper is fitted to given reflectivity array.

To use a truncation length, it is necessary that a parameter named decorrelation is registered within given kriging instance. At the moment, truncation is only possible for kriging. If you want to use truncation for other algorithms, you have to manually set max_dist for this algorithm.

pylawr.functions.transform.remove_clutter_dwd(reflectivity)[source]#

Remove clutter from given reflectivity field of DWD. The clutter is removed with pre-initialized filter_gabella. The clutter detection is tuned for the C band radars.

Parameters

reflectivity (xarray.DataArray) – The cluttermaps are fitted to this reflectivity array and clutter is removed from this array.

Returns

  • refl_filtered (xarray.DataArray) – Reflectivity with filtered clutter. All clutter values are set to np.nan.

  • cluttermap (pylawr.filter.cluttermap.ClutterMap) – This fitted clutter map was used to filter given reflectivity array.

pylawr.functions.transform.remove_clutter_lawr(reflectivity)[source]#

Remove clutter from given reflectivity field of lawr. The clutter is removed with pre-initialized TDBZFilter, SPINFilter. The clutter detection is tuned for the X band radars.

Parameters

reflectivity (xarray.DataArray) – The cluttermaps are fitted to this reflectivity array and clutter is removed from this array.

Returns

  • refl_filtered (xarray.DataArray) – Reflectivity with filtered clutter. All clutter values are set to np.nan.

  • cluttermap (OrderedDict(str,) – pylawr.filter.cluttermap.ClutterMap) These filters were used in this order to filter the clutter out of the reflectivity.

pylawr.functions.transform.remove_noise(reflectivity, noise_remover=None)[source]#

Remove background noise from given reflectivity field.

Parameters
  • reflectivity (xarray.DataArray) – The noise level is determined from this reflectivity array and noise is removed from this array. If this array has no beam expansion tag, it is assumed that the beam expansion effect is corrected.

  • noise_remover (pylawr.filter.noiseremover.NoiseRemover or None) – This noise remover is fitted to given reflectivity and further used to remove noise from given reflectivity. If no noise_remover is given a new noise remover is created and fitted. Default is None.

Returns

  • refl_filtered (xarray.DataArray) – Reflectivity with filtered noise. The noise level was determined for given reflectivity.

  • noise_remover (pylawr.filter.noiseremover.NoiseRemover) – The fitted noise remover. If no noise_remover was given as argument, this is a new noise remover.