Skip to content

Commit

Permalink
FIX: Cfradial1 writer
Browse files Browse the repository at this point in the history
  • Loading branch information
syedhamidali committed Aug 31, 2024
1 parent 22f4331 commit f872798
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions xradar/io/export/cfradial1.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ def _main_info_mapper(dtree):
xarray.Dataset
Dataset containing the mapped radar information.
"""
dataset = (
dtree.root.to_dataset()
.drop_vars("sweep_group_name", errors="ignore")
.rename({"sweep_fixed_angle": "fixed_angle"})
)
dataset = dtree.root.to_dataset().drop_vars("sweep_group_name", errors="ignore")

# Only rename 'sweep_fixed_angle' if it exists in the dataset
if "sweep_fixed_angle" in dataset.variables:
dataset = dataset.rename({"sweep_fixed_angle": "fixed_angle"})

return dataset


Expand All @@ -102,7 +103,7 @@ def _variable_mapper(dtree, dim0=None):
"""

sweep_info = _sweep_info_mapper(dtree)
vol_info = _main_info_mapper(dtree).drop_vars("fixed_angle")
vol_info = _main_info_mapper(dtree).drop_vars("fixed_angle", errors='ignore')
sweep_datasets = []
for grp in dtree.groups:
if "sweep" in grp:
Expand Down

0 comments on commit f872798

Please sign in to comment.