astropenguin / xarray-dataclasses

:zap: xarray data creation by data classes
https://astropenguin.github.io/xarray-dataclasses/
MIT License
71 stars 4 forks source link

Support data variable naming by annotation #147

Closed astropenguin closed 2 years ago

astropenguin commented 2 years ago

Support data variable naming by annotation as an easy way of general data variable names in Dataset creation:

from typing import Annotated

@dataclass
class ColorImage(AsDataset):
    """2D color image as Dataset."""

    red: Annotated[Data[X, Y, float], "Red image"]
    green: Annotated[Data[X, Y, float], "Green image"]
    blue: Annotated[Data[X, Y, float], "Blue image"]