Skip to content

Releases: astropenguin/xarray-dataclasses

v1.8.0 (2024-06-13)

13 Jun 11:26
eeabc34
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.7.0...v1.8.0

v1.7.0 (2023-10-16)

16 Oct 12:13
433e67e
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.6.0...v1.7.0

v1.6.0 (2023-06-09)

08 Jun 16:58
74f9401
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.5.0...v1.6.0

v1.5.0 (2023-02-02)

02 Feb 10:11
102c962
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.4.0...v1.5.0

v1.4.0 (2023-01-18)

18 Jan 13:17
a847e67
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.3.2...v1.4.0

v1.3.2 (2023-01-16)

16 Jan 10:37
c52fc12
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.3.1...v1.3.2

v1.3.1 (2022-09-05)

05 Sep 08:08
e1e259f
Compare
Choose a tag to compare

This release fixes the name of CITATION file (.ctf → .cff) and package description in README (no code updates).

What's Changed

Full Changelog: v1.3.0...v1.3.1

v1.3.0 (2022-09-05)

05 Sep 07:58
0ebccca
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.2.0...v1.3.0

v1.2.0 (2022-06-09)

08 Jun 15:33
8508b6e
Compare
Choose a tag to compare

From this release, special type hints (Attr, Coord, Data, Name) can be used within union types.
This would be useful if you want to customize values after dataclass object creation (__post_init__).
The following example automatically sets ranged values to x and y coordinates if they are not specified.

import numpy as np
from dataclasses import dataclass
from typing import Literal, Optional
from xarray_dataclasses import AsDataArray, Coord, Data


X = Literal["x"]
Y = Literal["y"]


@dataclass
class Image(AsDataArray):
    """2D image as DataArray."""

    data: Data[tuple[X, Y], float]
    x: Optional[Coord[X, int]] = None
    y: Optional[Coord[Y, int]] = None

    def __post_init__(self) -> None:
        """Set ranged values to x and y."""
        shape = np.shape(self.data)

        if self.x is None:
            self.x = np.arange(shape[0])

        if self.y is None:
            self.y = np.arange(shape[1])

What's Changed

Full Changelog: v1.1.0...v1.2.0

v1.1.0 (2022-04-14)

14 Apr 12:29
130db6c
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.0...v1.1.0