issues: 2132500634
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2132500634 | I_kwDOAMm_X85_G2Ca | 8742 | Y-axis is reversed when using to_zarr() | 7837535 | closed | 0 | 3 | 2024-02-13T14:48:30Z | 2024-04-28T20:08:13Z | 2024-04-28T20:08:13Z | NONE | What happened?When I export a dataset to NetCDF and Zarr, the y axis appears to have been reversed with gdalinfo. I also cannot build a vrt file with the Zarr file since it complains about positive NS axis, but this works fine with the NetCDF file. Example NetCDF file as input: in.nc.zip gdalinfo on output NetCDF file:
gdalinfo on output Zarr file:
The main issue is that the origin and y-axis direction is reversed, as you can see from the origin and pixel size. I have tried taking the CRS from the netcdf and adding it to the Zarr file as a What did you expect to happen?Origin, pixel size and corner coords should match those in the netcdf file.
Minimal Complete Verifiable Example```Python import xarray as xr from pyproj import CRS ds = xr.open_dataset("in.nc") Optionally take copy CRS to Zarr (produces and error, but does work)crs_wkt = CRS.from_cf(ds["projection_lambert"].attrs).to_wkt() ds["air_temperature_2m"] = ds["air_temperature_2m"].assign_attrs(_CRS={"wkt": crs_wkt}) ds.to_zarr("out.zarr") ds.to_netcdf("out.nc") ``` MVCE confirmation
Relevant log outputNo response Anything else we need to know?No response Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0]
python-bits: 64
OS: Linux
OS-release: 6.5.0-15-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.9.3-development
xarray: 2024.1.1
pandas: 2.2.0
numpy: 1.26.4
scipy: None
netCDF4: 1.6.5
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.16.1
cftime: 1.6.3
nc_time_axis: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 68.2.2
pip: 23.3.1
conda: None
pytest: None
mypy: None
IPython: None
sphinx: None
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8742/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |