-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Would it be possible for a dataclass AsDataArray
to deduce the shape of the Data from the coordinates, ie:
@dataclass
class Image(AsDataArray):
"""2D image as DataArray."""
x: Coord[X, int]
y: Coord[Y, int]
data: Data[tuple[X, Y], float]
In this case, the coordinates are not optional.
To do that, the classmethod shaped
should allow shape
to be optional, and use the shape from the kwargs.
(Could extends the case where shape
is a dict and fallback to the value specified in the dict)
if isinstance(shape, None):
shape = tuple(kwargs[dim].size for dim in entry.dims)
Happy to open a PR, if you want.
Metadata
Metadata
Assignees
Labels
No labels