Repository navigation
ValueError: conflicting sizes for dimension np.str_('time') #857
Replies: 1 comment
|
Your printed dataset has three dimensions ( Since import xarray as xr
import rioxarray # registers the .rio accessor
with xr.open_dataset("TerraClimate_Data.nc", decode_coords="all") as ds:
pet = ds["pet"]
print(pet.sizes)
print(pet.rio.crs)
print(pet.rio.bounds())This is a documented loading path: rioxarray with xarray-opened NetCDF. The exception describes a different issue: the Rasterio-backed result has 372 time slices but a time-coordinate array of length 12. Those lengths cannot describe the same dimension. The printed xarray output alone does not establish whether that mismatch originates in file metadata, GDAL's interpretation, or a rioxarray/version issue. This loading workaround does not repair or diagnose that mismatch. Verified with Python 3.14.7 / rioxarray 0.24.0 / xarray 2026.9.0 / Rasterio 1.5.2 (GDAL 3.12.2), using a small synthetic NetCDF written with SciPy 1.18.1. The exact example retained all 372 time coordinates for six variables, with the expected CRS, bounds, and data values. I have not tested your original file or reproduced its 372-versus-12 exception. Prepared and checked with OpenAI Codex assistance. |
Uh oh!
There was an error while loading. Please reload this page.
Below is the code snippet to reproduce the issue
Error:
printing
xdsI get:If I understand correctly this does not seem like 4D data so what might be the issue here?
All reactions