radarx.io.imd.to_cfradial2#
- radarx.io.imd.to_cfradial2(ds, **kwargs)[source]#
Convert a CfRadial1 Dataset to a CfRadial2 hierarchical structure using xarray’s native DataTree.
- Parameters:
ds (
xarray.Dataset
) – The input dataset in CfRadial1 format to be converted.**kwargs (
dict
, optional) – Additional keyword arguments to customize the conversion process: - first_dim : str, default ‘auto’Specifies the first dimension of the sweeps.
- optionalbool, default True
Whether to include optional fields.
- site_coordsbool, default True
Whether to include site coordinates.
- sweepint or None, default None
Specifies a particular sweep to extract.
- Returns:
DataTree
– An xarray DataTree object representing the dataset in CfRadial2 format.
Notes
The hierarchical structure of the resulting DataTree will include: - “/” (root): Contains required global attributes and general metadata. - “/radar_parameters”: Radar parameter data, if available. - “/georeferencing_correction”: Georeferencing correction data, if available. - “/radar_calibration”: Radar calibration data, if available. - “/sweep_X”: Individual sweep data for each sweep (e.g., “/sweep_0”, “/sweep_1”).
Missing groups (e.g., calibration) will not be included in the DataTree.
This function leverages helper functions _get_required_root_dataset, _get_subgroup, _get_radar_calibration, and _get_sweep_groups.
Examples
>>> dtree = to_cfradial2(ds) >>> print(dtree) DataTree('root') ├── DataTree('radar_parameters') ├── DataTree('georeferencing_correction') ├── DataTree('radar_calibration') ├── DataTree('sweep_0') ├── DataTree('sweep_1') ├── ...
See also
-