Radar fields#
pylawr ships a handy data structure, the RadarField.
This is basically a better xarray.DataArray.
Accessor#
As soon as you import pylawr, every xarray.DataArray has
an accessor attribute lawr:
import pylawr
import xarray
da = xarray.DataArray(3)
da.lawr
This accessor returns the exact same array but as a RadarField.
Tag system#
To be able to track what has happened to a RadarField, there is a tag
system. Use the property pylawr.RadarField.tags to get or set the field’s
tags at once. Internally they are just stored in the
xarray.DataArray.attrs dict. To add/remove single tags, use
add_tag() and remove_tag().
There are also convenience functions tag_array(), untag_array() and
array_has_tag() for easy handling of multiple array types.
Array conversion#
The accessor also has some additional methods to convert the RadarField
into another variable.
It is possible to convert the reflectivity to rain rate
and vice versa (with inverse=True) with the zr_convert() method. If no
arguments are given, then the normal Z/R relationship is assumed. To convert from
decibel units into linear units and vice versa, the
db_to_linear()
method can be used. With the to_z() method, the radar field can be converted
into linear reflectivity for any set radar variable (e.g. decibel rain rate).
The to_dbz() method allows to convert the radar field into reflectivity
with dBZ as unit.
The variable of an array can be set with the
set_variable() method. Based
on the pylawr.utilities.conventions.naming_convention, the metadata
(e.g. unit or short name) of the
array are set accordingly.
API References#
|
RadarField is a xarray.DataArray accessor to extend xarray for radar processing. |
|
Get a verified grid from the array and given grid. |
|
Remove a tag from an array with |
|
Check if an array has a given tag |
|
Attempt to |