Skip to content

Commit

Permalink
Updated metadata bug in annual_average
Browse files Browse the repository at this point in the history
- Dim and coord metadata was not preserved for DataArray
  objects when performing an annual average
  • Loading branch information
jkrasting committed Feb 7, 2024
1 parent 5d7e11c commit 7ce16ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/momlevel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def _find_ann_midpoint(year, calendar=calendar):
for var in list(result.variables):
result[var].attrs = xobj[var].attrs if var in list(xobj.variables) else {}

for coord in list(result.coords):
result[coord].attrs = xobj[coord].attrs if coord in list(xobj.coords) else {}

for dim in list(result.dims):
result[dim].attrs = xobj[dim].attrs if dim in list(xobj.dims) else {}

result.attrs = xobj.attrs

return result
Expand Down

0 comments on commit 7ce16ab

Please sign in to comment.