Skip to content

Commit

Permalink
Make NDCube.meta have same shape as NDCube if meta is axis-aware.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRyanIrish committed Jul 2, 2024
1 parent 2373209 commit 6d38c67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ndcube/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

__all__ = ["NDMeta"]
__all__ = ["NDMeta", "NDMetaABC"]


class NDMetaABC(collections.abc.Mapping):
Expand Down
5 changes: 5 additions & 0 deletions ndcube/ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from ndcube import utils
from ndcube.extra_coords.extra_coords import ExtraCoords, ExtraCoordsABC
from ndcube.global_coords import GlobalCoords, GlobalCoordsABC
from ndcube.meta import NDMetaABC
from ndcube.mixins import NDCubeSlicingMixin
from ndcube.ndcube_sequence import NDCubeSequence
from ndcube.utils.exceptions import warn_deprecated, warn_user
Expand Down Expand Up @@ -399,6 +400,10 @@ def __init__(self, data, wcs=None, uncertainty=None, mask=None, meta=None,
global_coords = deepcopy(global_coords)
self._global_coords = global_coords

# If meta is axis-aware, make it to have same shape as cube.
if isinstance(self.meta, NDMetaABC):
self.meta.data_shape = self.shape

@property
def extra_coords(self):
# Docstring in NDCubeABC.
Expand Down

0 comments on commit 6d38c67

Please sign in to comment.