Skip to content

identical returns False after read-write round trip #141

Description

@martibosch

Following #26.

The identical method returns False after a read-write round trip following the user guide instructions.

Reproducible example:

import geopandas as gpd
import xarray as xr
import xvec  # noqa: F401

cube = xr.Dataset(
    data_vars={"temperature": [20, 20, 20], "relative_humidity": [60, 60, 60]},
    coords={
        "geometry": gpd.points_from_xy(
            [6.7928, 6.1278, 7.3303], [47.0838, 46.2475, 46.2186]
        )
    },
).xvec.set_geom_indexes("geometry", crs="epsg:4326")

encoded = cube.xvec.encode_cf()
encoded.to_zarr("cube.zarr", mode="w")
roundtripped = xr.open_zarr("cube.zarr").xvec.decode_cf()
print("identical: ", roundtripped.identical(encoded))
print(
    "identical (no geometry): ",
    cube.drop_vars("geometry").identical(roundtripped.drop_vars("geometry")),
)

outputs:

identical:  False
identical (no geometry):  True

also note that I am getting this warning:

/path/to/pixi/env/lib/python3.13/site-packages/zarr/api/asynchronous.py:247: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.
  warnings.warn(

versions:
geopandas 1.1.2
numpy 2.3.5
xarray 2026.1.0
xvec 0.5.2
zarr 3.1.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions