diff --git a/docs/history.md b/docs/history.md index cdcd5e49..a6e17616 100644 --- a/docs/history.md +++ b/docs/history.md @@ -4,6 +4,7 @@ * ENH: Adding test to `open_datatree` function for all backends. Adding "scan_name" to nexradlevel2 datatree attributes ({pull}`238`) by [@aladinor](https://github.com/aladinor) * FIX: Improving performance of `open_nexradlevel2_datatree` function and adding tests for `sweep` parameter. ({issue}`239`) ({pull}`240`) by [@aladinor](https://github.com/aladinor) +* FIX: Keeping attributes at each variable when using `open_nexradlevel2_datatree`. ({issue}`241`) ({pull}`242`) by [@aladinor](https://github.com/aladinor) ## 0.8.0 (2024-11-04) diff --git a/xradar/io/backends/nexrad_level2.py b/xradar/io/backends/nexrad_level2.py index ec9cb2f7..4434bf49 100644 --- a/xradar/io/backends/nexrad_level2.py +++ b/xradar/io/backends/nexrad_level2.py @@ -1642,7 +1642,7 @@ def open_nexradlevel2_datatree( # todo: refactor _assign_root and _get_subgroup to recieve dict instead of list of datasets. # avoiding remove the attributes in the following line sweep_dict = { - sweep_path: sweep_dict[sweep_path].drop_attrs() + sweep_path: sweep_dict[sweep_path].drop_attrs(deep=False) for sweep_path in sweep_dict.keys() } dtree = dtree | sweep_dict