xradar.util.map_over_sweeps#

xradar.util.map_over_sweeps(func)[source]#

Decorator to apply a function only to sweep nodes in a DataTree.

The function is applied to the sweep nodes (sweep_*), all other nodes are left unchanged.

Parameters:

func (callable()) – A function that operates on an xarray Dataset. The function must accept a Dataset as its first argument and return a modified Dataset.

Returns:

callable() – A function that can be applied to all sweep nodes in a DataTree.

Examples

>>> @map_over_sweeps
>>> def calculate_rain_rate(ds, ref_field='DBZH'):
>>>     # Function logic to calculate rain rate
>>>     return ds