Skip to content

Commit

Permalink
Update get_axis_coords() to return copy of coords not memory ref
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Sep 26, 2022
1 parent 1371626 commit ec0bb8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xcdat/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def get_axis_coord(
"attr set."
)

dim_coords = obj[dim_coord_keys if len(dim_coord_keys) > 1 else dim_coord_keys[0]]
dim_coords = obj[
dim_coord_keys if len(dim_coord_keys) > 1 else dim_coord_keys[0]
].copy()

return dim_coords

Expand All @@ -137,6 +139,7 @@ def get_axis_dim(obj: Union[xr.Dataset, xr.DataArray], axis: CFAxisKey) -> str:
str
The dimension for an axis.
"""
# FIXME: This breaks if xr.Dataset because there can be multiple dim names.
return str(get_axis_coord(obj, axis).name)


Expand Down

0 comments on commit ec0bb8b

Please sign in to comment.