radarx.utils.combine_nexrad_sweeps#

radarx.utils.combine_nexrad_sweeps(dtree)[source]#

Combine radar sweeps with identical fixed angles into a new DataTree, aligning and merging datasets where necessary.

Parameters:

dtree (xarray.DataTree) – Input DataTree containing radar sweeps as child nodes. Each sweep is expected to be a dataset with a sweep_fixed_angle coordinate.

Returns:

xarray.DataTree – A new DataTree with combined sweeps. Sweeps with identical fixed angles are merged, and the resulting sweeps are re-indexed in order.

Notes

  • Sweeps with identical fixed angles are grouped and merged. The sweep with the largest range is used as the primary dataset, and smaller sweeps are aligned and merged into it.

  • If variable names conflict (e.g., DBZH), variables from secondary datasets are renamed (e.g., DBZH_SHORT) to avoid overwrites.

  • Sweeps are re-assigned with new sequential sweep numbers in the output DataTree.

  • Nodes that are not sweeps are retained in the new DataTree.

Examples

Combine sweeps in a radar DataTree:

>>> combined_dtree = combine_sweeps(radar_dtree)