Skip to content

geoarray.coords

What a carrier's dims mean. The 1-D axes live in a carrier's coords and slice with their dim; the grid coordinates describe the spatial dims.

1-D axes

geoarray.coords.SpectralAxis dataclass

Spectral channels on the band dim: names, wavelengths, FWHM.

Parameters:

Name Type Description Default
names tuple[str, ...]

One name per band ("B11"), unique.

required
wavelength_nm tuple[float, ...] | None

Centre wavelength of each band, in nm.

None
fwhm_nm tuple[float, ...] | None

Full width at half maximum of each band, in nm.

None

Raises:

Type Description
ValueError

Names repeat, or a wavelength / FWHM list has another length.

Example

swir = SpectralAxis(names=("B11", "B12"), wavelength_nm=(1610.0, 2190.0)) swir.dim, swir.size, swir.isel([1]).names ('band', 2, ('B12',))

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class SpectralAxis:
    """Spectral channels on the ``band`` dim: names, wavelengths, FWHM.

    Args:
        names: One name per band (``"B11"``), unique.
        wavelength_nm: Centre wavelength of each band, in nm.
        fwhm_nm: Full width at half maximum of each band, in nm.

    Raises:
        ValueError: Names repeat, or a wavelength / FWHM list has another
            length.

    Example:
        >>> swir = SpectralAxis(names=("B11", "B12"), wavelength_nm=(1610.0, 2190.0))
        >>> swir.dim, swir.size, swir.isel([1]).names
        ('band', 2, ('B12',))
    """

    names: tuple[str, ...]
    wavelength_nm: tuple[float, ...] | None = None
    fwhm_nm: tuple[float, ...] | None = None

    dim: ClassVar[str] = "band"

    def __post_init__(self) -> None:
        names = tuple(str(n) for n in self.names)
        if len(set(names)) != len(names):
            raise ValueError(f"SpectralAxis names repeat: {names}")
        object.__setattr__(self, "names", names)
        for field in ("wavelength_nm", "fwhm_nm"):
            values = _floats(getattr(self, field), field)
            _require_size(field, values, len(names))
            object.__setattr__(self, field, values)

    @property
    def size(self) -> int:
        """The number of bands."""
        return len(self.names)

    @property
    def labels(self) -> tuple[str, ...]:
        """The band names."""
        return self.names

    def isel(self, index: Any) -> SpectralAxis:
        """The bands at ``index`` (a slice, or a list / array of positions)."""
        p = _positions(index, self.size)
        return SpectralAxis(
            _take(self.names, p), _take(self.wavelength_nm, p), _take(self.fwhm_nm, p)
        )

labels property

The band names.

size property

The number of bands.

isel(index)

The bands at index (a slice, or a list / array of positions).

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def isel(self, index: Any) -> SpectralAxis:
    """The bands at ``index`` (a slice, or a list / array of positions)."""
    p = _positions(index, self.size)
    return SpectralAxis(
        _take(self.names, p), _take(self.wavelength_nm, p), _take(self.fwhm_nm, p)
    )

geoarray.coords.VariableAxis dataclass

Physical quantities on the variable dim: names and units.

Parameters:

Name Type Description Default
names tuple[str, ...]

One name per variable ("t2m"), unique.

required
units tuple[str, ...] | None

The unit of each variable ("K", "hPa").

None
Example

met = VariableAxis(names=("t2m", "psfc"), units=("K", "hPa")) met.isel(slice(1, None)).units ('hPa',)

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class VariableAxis:
    """Physical quantities on the ``variable`` dim: names and units.

    Args:
        names: One name per variable (``"t2m"``), unique.
        units: The unit of each variable (``"K"``, ``"hPa"``).

    Example:
        >>> met = VariableAxis(names=("t2m", "psfc"), units=("K", "hPa"))
        >>> met.isel(slice(1, None)).units
        ('hPa',)
    """

    names: tuple[str, ...]
    units: tuple[str, ...] | None = None

    dim: ClassVar[str] = "variable"

    def __post_init__(self) -> None:
        names = tuple(str(n) for n in self.names)
        if len(set(names)) != len(names):
            raise ValueError(f"VariableAxis names repeat: {names}")
        units = None if self.units is None else tuple(str(u) for u in self.units)
        _require_size("units", units, len(names))
        object.__setattr__(self, "names", names)
        object.__setattr__(self, "units", units)

    @property
    def size(self) -> int:
        """The number of variables."""
        return len(self.names)

    @property
    def labels(self) -> tuple[str, ...]:
        """The variable names."""
        return self.names

    def isel(self, index: Any) -> VariableAxis:
        """The variables at ``index``."""
        p = _positions(index, self.size)
        return VariableAxis(_take(self.names, p), _take(self.units, p))

labels property

The variable names.

size property

The number of variables.

isel(index)

The variables at index.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def isel(self, index: Any) -> VariableAxis:
    """The variables at ``index``."""
    p = _positions(index, self.size)
    return VariableAxis(_take(self.names, p), _take(self.units, p))

geoarray.coords.VerticalAxis dataclass

Shared vertical levels on the level dim.

A level dim is for samples on one vertical grid (TROPOMI's retrieval layers, EN4 depths); a point with its own vertical position has a z leaf on GeoPoints instead.

Parameters:

Name Type Description Default
values tuple[float, ...]

One value per level, in vertical.units.

required
vertical Vertical

What the values measure.

required
Example

depth = Vertical(kind="depth", units="m", positive="down") VerticalAxis(values=(5.0, 15.0, 25.0), vertical=depth).isel([0, 2]).values (5.0, 25.0)

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class VerticalAxis:
    """Shared vertical levels on the ``level`` dim.

    A ``level`` dim is for samples on one vertical grid (TROPOMI's retrieval
    layers, EN4 depths); a point with its own vertical position has a ``z``
    leaf on `GeoPoints` instead.

    Args:
        values: One value per level, in ``vertical.units``.
        vertical: What the values measure.

    Example:
        >>> depth = Vertical(kind="depth", units="m", positive="down")
        >>> VerticalAxis(values=(5.0, 15.0, 25.0), vertical=depth).isel([0, 2]).values
        (5.0, 25.0)
    """

    values: tuple[float, ...]
    vertical: Vertical

    dim: ClassVar[str] = "level"

    def __post_init__(self) -> None:
        object.__setattr__(self, "values", _floats(self.values, "values") or ())

    @property
    def size(self) -> int:
        """The number of levels."""
        return len(self.values)

    @property
    def labels(self) -> tuple[float, ...]:
        """The level values."""
        return self.values

    def isel(self, index: Any) -> VerticalAxis:
        """The levels at ``index``."""
        return VerticalAxis(
            _take(self.values, _positions(index, self.size)), self.vertical
        )

labels property

The level values.

size property

The number of levels.

isel(index)

The levels at index.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def isel(self, index: Any) -> VerticalAxis:
    """The levels at ``index``."""
    return VerticalAxis(
        _take(self.values, _positions(index, self.size)), self.vertical
    )

geoarray.coords.Vertical dataclass

What a vertical coordinate measures, in CF terms.

Parameters:

Name Type Description Default
kind str

"height", "depth", "pressure" or "level".

required
units str

"m", "hPa", "1", …

required
positive str

CF positive: "up" or "down".

required
datum str | None

The reference surface ("EGM2008"), or None.

None
Example

Vertical(kind="depth", units="m", positive="down").positive 'down'

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class Vertical:
    """What a vertical coordinate measures, in CF terms.

    Args:
        kind: ``"height"``, ``"depth"``, ``"pressure"`` or ``"level"``.
        units: ``"m"``, ``"hPa"``, ``"1"``, …
        positive: CF ``positive``: ``"up"`` or ``"down"``.
        datum: The reference surface (``"EGM2008"``), or ``None``.

    Example:
        >>> Vertical(kind="depth", units="m", positive="down").positive
        'down'
    """

    kind: str
    units: str
    positive: str
    datum: str | None = None

    def __post_init__(self) -> None:
        if self.kind not in _VERTICAL_KINDS:
            raise ValueError(
                f"Vertical kind is one of {_VERTICAL_KINDS}, got {self.kind!r}"
            )
        if self.positive not in ("up", "down"):
            raise ValueError(
                f"Vertical positive is 'up' or 'down', got {self.positive!r}"
            )

geoarray.coords.TimeAxis dataclass

Shared acquisition times on the time dim.

Parameters:

Name Type Description Default
stamps Any

One time per entry: datetime64 values, ISO strings, or anything np.asarray(..., dtype="datetime64[ns]") takes.

required

Hashes and compares by value. A moving platform (along-track altimetry, Argo) has one time per point instead: a time leaf on GeoPoints.

On a carrier the stamps are a pytree leaf, as int64 nanoseconds since the epoch: a new set of dates of the same length reuses the compiled program. On the host they are datetime64[ns] labels; on a JAX carrier (GeoArray.to_jax) a JAX int64 array; inside jit a tracer, whose labels are None (select times outside jit).

Example

dates = TimeAxis(stamps=["2026-06-01", "2026-06-11"]) dates.size, str(dates.labels[1]) (2, '2026-06-11T00:00:00.000000000')

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True, eq=False)
class TimeAxis:
    """Shared acquisition times on the ``time`` dim.

    Args:
        stamps: One time per entry: ``datetime64`` values, ISO strings, or
            anything ``np.asarray(..., dtype="datetime64[ns]")`` takes.

    Hashes and compares by value. A moving platform (along-track altimetry,
    Argo) has one time per point instead: a ``time`` leaf on `GeoPoints`.

    On a carrier the stamps are a pytree leaf, as ``int64`` nanoseconds
    since the epoch: a new set of dates of the same length reuses the
    compiled program. On the host they are ``datetime64[ns]`` labels; on a
    JAX carrier (`GeoArray.to_jax`) a JAX ``int64`` array; inside ``jit``
    a tracer, whose `labels` are ``None`` (select times outside ``jit``).

    Example:
        >>> dates = TimeAxis(stamps=["2026-06-01", "2026-06-11"])
        >>> dates.size, str(dates.labels[1])
        (2, '2026-06-11T00:00:00.000000000')
    """

    stamps: Any

    dim: ClassVar[str] = "time"

    def __post_init__(self) -> None:
        stamps = _frozen(self.stamps, "datetime64[ns]")
        if stamps.ndim != 1:
            raise ValueError(f"TimeAxis stamps are 1-D, got shape {stamps.shape}")
        object.__setattr__(self, "stamps", stamps)

    @classmethod
    def from_leaf(cls, stamps: Any) -> TimeAxis:
        """A TimeAxis around ``int64`` nanoseconds (NumPy, JAX or a tracer).

        No validation or copy: for pytree unflattening and backend moves.
        """
        t = object.__new__(cls)
        object.__setattr__(t, "stamps", stamps)
        return t

    def as_leaf(self) -> Any:
        """The stamps as ``int64`` nanoseconds since the epoch, for a pytree leaf."""
        if isinstance(self.stamps, np.ndarray) and self.stamps.dtype.kind == "M":
            return self.stamps.view(np.int64)
        return self.stamps

    def _host_ns(self) -> np.ndarray | None:
        """The stamps as host ``int64`` ns, or ``None`` under a trace."""
        if is_traced(self.stamps):
            return None
        return np.asarray(self.as_leaf(), dtype=np.int64)

    @property
    def size(self) -> int:
        """The number of times."""
        return int(self.stamps.shape[0])

    @property
    def labels(self) -> tuple[np.datetime64, ...] | None:
        """The stamps as ``numpy.datetime64[ns]``; ``None`` when traced."""
        ns = self._host_ns()
        return None if ns is None else tuple(ns.view("datetime64[ns]"))

    def isel(self, index: Any) -> TimeAxis:
        """The times at ``index`` (on the stamps' own backend)."""
        positions = np.asarray(_positions(index, self.size), dtype=int)
        picked = self.stamps[positions]
        if isinstance(picked, np.ndarray):
            # an indexed copy is writable: freeze it, as the constructor does
            picked.setflags(write=False)
        return TimeAxis.from_leaf(picked)

    def to_host(self) -> TimeAxis:
        """This axis with ``datetime64[ns]`` NumPy stamps."""
        ns = self._host_ns()
        if ns is None:
            raise TypeError("TimeAxis.to_host needs concrete stamps, not a tracer")
        return TimeAxis(ns.view("datetime64[ns]"))

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, TimeAxis):
            return False
        mine, theirs = self._host_ns(), other._host_ns()
        if mine is None or theirs is None:
            return self is other
        return bool(np.array_equal(mine, theirs))

    def __hash__(self) -> int:
        ns = self._host_ns()
        if ns is None:
            raise TypeError("a traced TimeAxis is not hashable")
        return hash(("TimeAxis", _array_digest(ns)))

    def __repr__(self) -> str:
        labels = self.labels
        if labels is None:
            return f"TimeAxis(size={self.size}, traced)"
        if not labels:
            return "TimeAxis(size=0)"
        return f"TimeAxis(size={self.size}, {labels[0]} … {labels[-1]})"

labels property

The stamps as numpy.datetime64[ns]; None when traced.

size property

The number of times.

as_leaf()

The stamps as int64 nanoseconds since the epoch, for a pytree leaf.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def as_leaf(self) -> Any:
    """The stamps as ``int64`` nanoseconds since the epoch, for a pytree leaf."""
    if isinstance(self.stamps, np.ndarray) and self.stamps.dtype.kind == "M":
        return self.stamps.view(np.int64)
    return self.stamps

from_leaf(stamps) classmethod

A TimeAxis around int64 nanoseconds (NumPy, JAX or a tracer).

No validation or copy: for pytree unflattening and backend moves.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@classmethod
def from_leaf(cls, stamps: Any) -> TimeAxis:
    """A TimeAxis around ``int64`` nanoseconds (NumPy, JAX or a tracer).

    No validation or copy: for pytree unflattening and backend moves.
    """
    t = object.__new__(cls)
    object.__setattr__(t, "stamps", stamps)
    return t

isel(index)

The times at index (on the stamps' own backend).

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def isel(self, index: Any) -> TimeAxis:
    """The times at ``index`` (on the stamps' own backend)."""
    positions = np.asarray(_positions(index, self.size), dtype=int)
    picked = self.stamps[positions]
    if isinstance(picked, np.ndarray):
        # an indexed copy is writable: freeze it, as the constructor does
        picked.setflags(write=False)
    return TimeAxis.from_leaf(picked)

to_host()

This axis with datetime64[ns] NumPy stamps.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def to_host(self) -> TimeAxis:
    """This axis with ``datetime64[ns]`` NumPy stamps."""
    ns = self._host_ns()
    if ns is None:
        raise TypeError("TimeAxis.to_host needs concrete stamps, not a tracer")
    return TimeAxis(ns.view("datetime64[ns]"))

geoarray.coords.Coordinate

Bases: Protocol

What a 1-D coordinate of a carrier dim provides.

dim names the dim it describes, size its length; labels are the exact labels sel looks up (or None); isel slices it with its dim (a slice, or a list / 1-D array of positions; an integer drops the dim, so the carrier drops the coordinate instead).

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@runtime_checkable
class Coordinate(Protocol):
    """What a 1-D coordinate of a carrier dim provides.

    ``dim`` names the dim it describes, ``size`` its length; ``labels`` are
    the exact labels `sel` looks up (or ``None``); ``isel`` slices it with
    its dim (a slice, or a list / 1-D array of positions; an integer drops
    the dim, so the carrier drops the coordinate instead).
    """

    @property
    def dim(self) -> str: ...

    @property
    def size(self) -> int: ...

    @property
    def labels(self) -> tuple[Any, ...] | None: ...

    def isel(self, index: Any) -> Coordinate: ...

Grids

geoarray.coords.PixelGrid dataclass

An affine pixel grid on the y x dims: shape, CRS, pixel convention.

The transform itself is a leaf on the carrier, so a new scene of the same shape and CRS reuses the compiled program.

Parameters:

Name Type Description Default
shape tuple[int, int]

(H, W).

required
crs CRS | None

Anything pyproj.CRS.from_user_input takes, or None.

required
convention str

"area" when the transform maps pixel edges (GDAL, rasterio), "point" when it maps pixel centres. Carriers store "area"; GeoArray.from_coords shifts a "point" transform by half a pixel.

'area'
Example

grid = PixelGrid(shape=(600, 600), crs="EPSG:32613") grid.dims, grid.crs.to_epsg() (('y', 'x'), 32613)

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class PixelGrid:
    """An affine pixel grid on the ``y x`` dims: shape, CRS, pixel convention.

    The transform itself is a leaf on the carrier, so a new scene of the same
    shape and CRS reuses the compiled program.

    Args:
        shape: ``(H, W)``.
        crs: Anything ``pyproj.CRS.from_user_input`` takes, or ``None``.
        convention: ``"area"`` when the transform maps pixel edges (GDAL,
            rasterio), ``"point"`` when it maps pixel centres. Carriers store
            ``"area"``; `GeoArray.from_coords` shifts a ``"point"`` transform
            by half a pixel.

    Example:
        >>> grid = PixelGrid(shape=(600, 600), crs="EPSG:32613")
        >>> grid.dims, grid.crs.to_epsg()
        (('y', 'x'), 32613)
    """

    shape: tuple[int, int]
    crs: pyproj.CRS | None
    convention: str = "area"

    dims: ClassVar[tuple[str, str]] = ("y", "x")

    def __post_init__(self) -> None:
        object.__setattr__(self, "shape", _shape2(self.shape, "PixelGrid"))
        object.__setattr__(self, "crs", as_crs(self.crs))
        if self.convention not in ("area", "point"):
            raise ValueError(
                f"PixelGrid convention is 'area' or 'point', got {self.convention!r}"
            )

    def area_transform(self, transform: Any) -> Any:
        """``transform`` in the area convention carriers store.

        A point-convention transform maps pixel (j, i) to its centre, so the
        edge transform is T shifted by half a pixel: c′ = c − (a + b)/2,
        f′ = f − (d + e)/2. An area transform is returned as it is.
        """
        if self.convention == "area":
            return transform
        if not hasattr(transform, "ndim"):
            # a tuple (a Grid's transform): the helper indexes with [..., i]
            transform = np.asarray(transform, dtype=np.float64)
        return shift_scale_transform(transform, -0.5, -0.5)

    def centres(self, transform: Any) -> tuple[Any, Any]:
        """Map coordinates ``(x, y)`` of every pixel centre, each ``(H, W)``.

        x_ij = a·(j + ½) + b·(i + ½) + c, y_ij = d·(j + ½) + e·(i + ½) + f for
        an area transform; without the ½ for a point transform.
        """
        offset = 0.5 if self.convention == "area" else 0.0
        h, w = self.shape
        jj, ii = np.meshgrid(np.arange(w) + offset, np.arange(h) + offset)
        return apply_transform(transform, jj, ii)

area_transform(transform)

transform in the area convention carriers store.

A point-convention transform maps pixel (j, i) to its centre, so the edge transform is T shifted by half a pixel: c′ = c − (a + b)/2, f′ = f − (d + e)/2. An area transform is returned as it is.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def area_transform(self, transform: Any) -> Any:
    """``transform`` in the area convention carriers store.

    A point-convention transform maps pixel (j, i) to its centre, so the
    edge transform is T shifted by half a pixel: c′ = c − (a + b)/2,
    f′ = f − (d + e)/2. An area transform is returned as it is.
    """
    if self.convention == "area":
        return transform
    if not hasattr(transform, "ndim"):
        # a tuple (a Grid's transform): the helper indexes with [..., i]
        transform = np.asarray(transform, dtype=np.float64)
    return shift_scale_transform(transform, -0.5, -0.5)

centres(transform)

Map coordinates (x, y) of every pixel centre, each (H, W).

x_ij = a·(j + ½) + b·(i + ½) + c, y_ij = d·(j + ½) + e·(i + ½) + f for an area transform; without the ½ for a point transform.

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
def centres(self, transform: Any) -> tuple[Any, Any]:
    """Map coordinates ``(x, y)`` of every pixel centre, each ``(H, W)``.

    x_ij = a·(j + ½) + b·(i + ½) + c, y_ij = d·(j + ½) + e·(i + ½) + f for
    an area transform; without the ½ for a point transform.
    """
    offset = 0.5 if self.convention == "area" else 0.0
    h, w = self.shape
    jj, ii = np.meshgrid(np.arange(w) + offset, np.arange(h) + offset)
    return apply_transform(transform, jj, ii)

geoarray.coords.SwathGrid dataclass

A swath in sensor geometry on the row col dims: shape and CRS.

Rows run along track, columns across; per-pixel lat/lon are leaves on the carrier.

Example

SwathGrid(shape=(1280, 1242), crs="EPSG:4326").dims ('row', 'col')

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class SwathGrid:
    """A swath in sensor geometry on the ``row col`` dims: shape and CRS.

    Rows run along track, columns across; per-pixel lat/lon are leaves on
    the carrier.

    Example:
        >>> SwathGrid(shape=(1280, 1242), crs="EPSG:4326").dims
        ('row', 'col')
    """

    shape: tuple[int, int]
    crs: pyproj.CRS | None

    dims: ClassVar[tuple[str, str]] = ("row", "col")

    def __post_init__(self) -> None:
        object.__setattr__(self, "shape", _shape2(self.shape, "SwathGrid"))
        object.__setattr__(self, "crs", as_crs(self.crs))

geoarray.coords.CurvilinearGrid dataclass

A model grid with fixed 2-D lat/lon (ORCA) on the row col dims.

Unlike a swath, the lat/lon never change between calls, so they are static; hashes and compares by value.

Parameters:

Name Type Description Default
lat Any

(row, col) latitudes.

required
lon Any

(row, col) longitudes.

required
crs CRS | None

The CRS of lat/lon ("EPSG:4326").

required
Example

import numpy as np lat, lon = np.meshgrid(np.arange(3.0), np.arange(4.0), indexing="ij") CurvilinearGrid(lat, lon, "EPSG:4326").shape (3, 4)

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True, eq=False)
class CurvilinearGrid:
    """A model grid with fixed 2-D lat/lon (ORCA) on the ``row col`` dims.

    Unlike a swath, the lat/lon never change between calls, so they are
    static; hashes and compares by value.

    Args:
        lat: ``(row, col)`` latitudes.
        lon: ``(row, col)`` longitudes.
        crs: The CRS of lat/lon (``"EPSG:4326"``).

    Example:
        >>> import numpy as np
        >>> lat, lon = np.meshgrid(np.arange(3.0), np.arange(4.0), indexing="ij")
        >>> CurvilinearGrid(lat, lon, "EPSG:4326").shape
        (3, 4)
    """

    lat: Any
    lon: Any
    crs: pyproj.CRS | None

    dims: ClassVar[tuple[str, str]] = ("row", "col")

    def __post_init__(self) -> None:
        lat = _frozen(self.lat, np.float64)
        lon = _frozen(self.lon, np.float64)
        if lat.ndim != 2 or lat.shape != lon.shape:
            raise ValueError(
                f"CurvilinearGrid lat/lon are 2-D of one shape, got {lat.shape} "
                f"and {lon.shape}"
            )
        object.__setattr__(self, "lat", lat)
        object.__setattr__(self, "lon", lon)
        object.__setattr__(self, "crs", as_crs(self.crs))

    @property
    def shape(self) -> tuple[int, int]:
        """``(row, col)``."""
        return _shape2(self.lat.shape, "CurvilinearGrid")

    def __eq__(self, other: object) -> bool:
        return (
            isinstance(other, CurvilinearGrid)
            and self.crs == other.crs
            and bool(np.array_equal(self.lat, other.lat, equal_nan=True))
            and bool(np.array_equal(self.lon, other.lon, equal_nan=True))
        )

    def __hash__(self) -> int:
        return hash(("CurvilinearGrid", self.crs, _array_digest(self.lat, self.lon)))

shape property

(row, col).

geoarray.coords.PointAxis dataclass

Scattered samples on the obs dim: N and the CRS of their xy.

Example

PointAxis(size=40, crs="EPSG:4326").dims ('obs',)

Source code in packages/geotoolz-array/src/geoarray/_src/coords.py
@dataclasses.dataclass(frozen=True)
class PointAxis:
    """Scattered samples on the ``obs`` dim: N and the CRS of their xy.

    Example:
        >>> PointAxis(size=40, crs="EPSG:4326").dims
        ('obs',)
    """

    size: int
    crs: pyproj.CRS | None

    dims: ClassVar[tuple[str]] = ("obs",)

    def __post_init__(self) -> None:
        if int(self.size) < 0:
            raise ValueError(f"PointAxis size is non-negative, got {self.size}")
        object.__setattr__(self, "size", int(self.size))
        object.__setattr__(self, "crs", as_crs(self.crs))