cmpute_availabilitymatrix throws ValueError (coords is not dict-like)
Version Checks (indicate both or one)
-
[X] I have confirmed this bug exists on the lastest release of Atlite.
-
[ ] I have confirmed this bug exists on the current
masterbranch of Atlite.
Issue Description
I am trying to run the examples/landuse-availability.ipynb
The cell in which the availability matrix is calculated throws the following error:
ValueError Traceback (most recent call last) Cell In[11], line 1 ----> 1 A = cutout.availabilitymatrix(shapes, excluder) 2 A
File c:\Users\olive\miniconda3\envs\atlite-test\Lib\site-packages\atlite\gis.py:761, in compute_availabilitymatrix(cutout, shapes, excluder, nprocesses, disable_progressbar) 759 availability = np.stack(availability)[:, ::-1] # flip axis, see Notes 760 coords = [(shapes.index), ("y", cutout.data.y.data), ("x", cutout.data.x.data)] --> 761 return xr.DataArray(availability, coords=coords)
File c:\Users\olive\miniconda3\envs\atlite-test\Lib\site-packages\xarray\core\dataarray.py:479, in DataArray.init(self, data, coords, dims, name, attrs, indexes, fastpath) 477 data = _check_data_shape(data, coords, dims) 478 data = as_compatible_data(data) --> 479 coords, dims = _infer_coords_and_dims(data.shape, coords, dims) 480 variable = Variable(dims, data, attrs, fastpath=True) 482 if not isinstance(coords, Coordinates):
File c:\Users\olive\miniconda3\envs\atlite-test\Lib\site-packages\xarray\core\dataarray.py:163, in _infer_coords_and_dims(shape, coords, dims) 156 """All the logic for creating a new DataArray""" 158 if ( 159 coords is not None 160 and not utils.is_dict_like(coords) 161 and len(coords) != len(shape) 162 ): --> 163 raise ValueError( 164 f"coords is not dict-like, but it has {len(coords)} items, " 165 f"which does not match the {len(shape)} dimensions of the " 166 "data" 167 ) 169 if isinstance(dims, str): 170 dims = (dims,)
ValueError: coords is not dict-like, but it has 3 items, which does not match the 4 dimensions of the data
Any idea how this could be solved?
And in the meantime: Do you know a combination of package versions for which this issue should not occur?
Reproducible Example
examples/landuse-availability.ipynb
Expected Behavior
No response
Installed Versions
name: atlite-test channels:
- conda-forge
- defaults dependencies:
- affine=2.4.0=pyhd8ed1ab_0
- asttokens=2.4.1=pyhd8ed1ab_0
- atlite=0.2.14=pyhd8ed1ab_0
- attrs=24.2.0=pyh71513ae_0
- aws-c-auth=0.7.31=hdb8b6b4_2
- aws-c-cal=0.7.4=h891f644_2
- aws-c-common=0.9.29=h2466b09_0
- aws-c-compression=0.2.19=h891f644_2
- aws-c-event-stream=0.4.3=h9d4aeba_4
- aws-c-http=0.8.10=h4d3606f_2
- aws-c-io=0.14.19=h5c5bb51_1
- aws-c-mqtt=0.10.7=h98e454b_2
- aws-c-s3=0.6.7=h23cec54_0
- aws-c-sdkutils=0.1.19=h891f644_4
- aws-checksums=0.1.20=h891f644_1
- aws-crt-cpp=0.28.3=h97eb5cb_8
- aws-sdk-cpp=1.11.407=h1b410ea_1
- blosc=1.21.6=h85f69ea_0
- bokeh=3.6.0=pyhd8ed1ab_0
- bottleneck=1.4.2=py312h1a27103_0
- branca=0.7.2=pyhd8ed1ab_0
- brotli=1.1.0=h2466b09_2
- brotli-bin=1.1.0=h2466b09_2
- brotli-python=1.1.0=py312h275cf98_2
- bzip2=1.0.8=h2466b09_7
- c-ares=1.34.2=h2466b09_0
- ca-certificates=2024.8.30=h56e8100_0
- cads-api-client=1.4.4=pyhd8ed1ab_0
- cdsapi=0.7.3=pyhd8ed1ab_0
- certifi=2024.8.30=pyhd8ed1ab_0
- cffi=1.17.1=py312h4389bb4_0
- cftime=1.6.4=py312h1a27103_1
- charset-normalizer=3.4.0=pyhd8ed1ab_0
- click=8.1.7=win_pyh7428d3b_0
- click-plugins=1.1.1=py_0
- cligj=0.7.2=pyhd8ed1ab_1
- cloudpickle=3.1.0=pyhd8ed1ab_1
- colorama=0.4.6=pyhd8ed1ab_0
- comm=0.2.2=pyhd8ed1ab_0
- contourpy=1.3.0=py312hd5eb7cc_2
- cpython=3.12.7=py312hd8ed1ab_0
- cycler=0.12.1=pyhd8ed1ab_0
- cytoolz=1.0.0=py312h4389bb4_1
- dask=2024.10.0=pyhd8ed1ab_0
- dask-core=2024.10.0=pyhd8ed1ab_0
- dask-expr=1.1.16=pyhd8ed1ab_0
- debugpy=1.8.7=py312h275cf98_0
- decorator=5.1.1=pyhd8ed1ab_0
- distributed=2024.10.0=pyhd8ed1ab_0
- exceptiongroup=1.2.2=pyhd8ed1ab_0
- executing=2.1.0=pyhd8ed1ab_0
- folium=0.17.0=pyhd8ed1ab_0
- fonttools=4.54.1=py312h4389bb4_0
- freetype=2.12.1=hdaf720e_2
- freexl=2.0.0=h8276f4a_0
- fsspec=2024.9.0=pyhff2d567_0
- geopandas=1.0.1=pyhd8ed1ab_1
- geopandas-base=1.0.1=pyha770c72_1
- geos=3.13.0=h5a68840_0
- geotiff=1.7.3=h496ac4d_3
- h2=4.1.0=pyhd8ed1ab_0
- hdf4=4.2.15=h5557f11_7
- hdf5=1.14.4=nompi_hd5d9e70_101
- hpack=4.0.0=pyh9f0ad1d_0
- hyperframe=6.0.1=pyhd8ed1ab_0
- idna=3.10=pyhd8ed1ab_0
- importlib-metadata=8.5.0=pyha770c72_0
- importlib_metadata=8.5.0=hd8ed1ab_0
- iniconfig=2.0.0=pyhd8ed1ab_0
- intel-openmp=2024.2.1=h57928b3_1083
- ipykernel=6.29.5=pyh4bbf305_0
- ipython=8.28.0=pyh7428d3b_0
- jedi=0.19.1=pyhd8ed1ab_0
- jinja2=3.1.4=pyhd8ed1ab_0
- joblib=1.4.2=pyhd8ed1ab_0
- jupyter_client=8.6.3=pyhd8ed1ab_0
- jupyter_core=5.7.2=pyh5737063_1
- kiwisolver=1.4.7=py312hd5eb7cc_0
- krb5=1.21.3=hdf4eb48_0
- lcms2=2.16=h67d730c_0
- lerc=4.0.0=h63175ca_0
- libabseil=20240722.0=cxx17_he0c23c2_1
- libaec=1.1.3=h63175ca_0
- libarchive=3.7.4=haf234dc_0
- libarrow=17.0.0=ha019072_22_cpu
- libarrow-acero=17.0.0=hac47afa_22_cpu
- libarrow-dataset=17.0.0=hac47afa_22_cpu
- libarrow-substrait=17.0.0=ha9530af_22_cpu
- libblas=3.9.0=18_win64_mkl
- libbrotlicommon=1.1.0=h2466b09_2
- libbrotlidec=1.1.0=h2466b09_2
- libbrotlienc=1.1.0=h2466b09_2
- libcblas=3.9.0=18_win64_mkl
- libcrc32c=1.1.2=h0e60522_0
- libcurl=8.10.1=h1ee3ff0_0
- libdeflate=1.22=h2466b09_0
- libevent=2.1.12=h3671451_1
- libexpat=2.6.3=he0c23c2_0
- libffi=3.4.2=h8ffe710_5
- libgdal-core=3.9.2=h042995d_7
- libgoogle-cloud=2.30.0=ha00044d_0
- libgoogle-cloud-storage=2.30.0=he5eb982_0
- libgrpc=1.65.5=ha20e22e_0
- libhwloc=2.11.1=default_h8125262_1000
- libiconv=1.17=hcfcfb64_2
- libjpeg-turbo=3.0.0=hcfcfb64_1
- libkml=1.3.0=h538826c_1021
- liblapack=3.9.0=18_win64_mkl
- libnetcdf=4.9.2=nompi_he239ae6_115
- libparquet=17.0.0=h59f2d37_22_cpu
- libpng=1.6.44=h3ca93ac_0
- libprotobuf=5.27.5=hcaed137_2
- libre2-11=2024.07.02=h4eb7d71_1
- librttopo=1.1.0=hd4c2148_17
- libsodium=1.0.20=hc70643c_0
- libspatialite=5.1.0=h939089a_11
- libsqlite=3.46.1=h2466b09_0
- libssh2=1.11.0=h7dfc565_0
- libthrift=0.21.0=hbe90ef8_0
- libtiff=4.7.0=hfc51747_1
- libutf8proc=2.8.0=h82a8f57_0
- libwebp-base=1.4.0=hcfcfb64_0
- libxcb=1.16=h013a479_1
- libxml2=2.12.7=h0f24e4e_4
- libzip=1.11.1=h25f2845_0
- libzlib=1.3.1=h2466b09_2
- locket=1.0.0=pyhd8ed1ab_0
- lz4=4.3.3=py312h0608a1d_1
- lz4-c=1.9.4=hcfcfb64_0
- lzo=2.10=hcfcfb64_1001
- m2w64-gcc-libgfortran=5.3.0=6
- m2w64-gcc-libs=5.3.0=7
- m2w64-gcc-libs-core=5.3.0=7
- m2w64-gmp=6.1.0=2
- m2w64-libwinpthread-git=5.0.0.4634.697f757=2
- mapclassify=2.8.1=pyhd8ed1ab_0
- markupsafe=3.0.2=py312h31fea79_0
- matplotlib-base=3.9.2=py312h90004f6_1
- matplotlib-inline=0.1.7=pyhd8ed1ab_0
- minizip=4.0.6=hb638d1e_0
- mkl=2022.1.0=h6a75c08_874
- msgpack-python=1.1.0=py312hd5eb7cc_0
- msys2-conda-epoch=20160418=1
- multiurl=0.3.1=pyhd8ed1ab_0
- munkres=1.1.4=pyh9f0ad1d_0
- nest-asyncio=1.6.0=pyhd8ed1ab_0
- netcdf4=1.7.1=nompi_py312h57e6fe7_103
- networkx=3.4.1=pyhd8ed1ab_0
- numexpr=2.8.7=mkl_py312h73deb7f_3
- numpy=1.26.4=py312h8753938_0
- openjpeg=2.5.2=h3d672ee_0
- openssl=3.3.2=h2466b09_0
- orc=2.0.2=h1c5a4bf_1
- packaging=24.1=pyhd8ed1ab_0
- pandas=2.2.3=py312h72972c8_1
- parso=0.8.4=pyhd8ed1ab_0
- partd=1.4.2=pyhd8ed1ab_0
- pcre2=10.44=h3d7b363_2
- pickleshare=0.7.5=py_1003
- pillow=10.4.0=py312h381445a_1
- pip=24.2=pyh8b19718_1
- platformdirs=4.3.6=pyhd8ed1ab_0
- pluggy=1.5.0=pyhd8ed1ab_0
- progressbar2=4.5.0=pyhd8ed1ab_0
- proj=9.5.0=hd9569ee_0
- prompt-toolkit=3.0.48=pyha770c72_0
- psutil=6.0.0=py312h4389bb4_2
- pthread-stubs=0.4=hcd874cb_1001
- pthreads-win32=2.9.1=h2466b09_4
- pure_eval=0.2.3=pyhd8ed1ab_0
- pyarrow=17.0.0=py312h7e22eef_1
- pyarrow-core=17.0.0=py312h6a9c419_1_cpu
- pycparser=2.22=pyhd8ed1ab_0
- pygments=2.18.0=pyhd8ed1ab_0
- pyogrio=0.10.0=py312h8705084_0
- pyparsing=3.2.0=pyhd8ed1ab_1
- pyproj=3.7.0=py312ha24589b_0
- pysocks=1.7.1=pyh0701188_6
- pytest=8.3.3=pyhd8ed1ab_0
- python=3.12.7=hce54a09_0_cpython
- python-dateutil=2.9.0=pyhd8ed1ab_0
- python-tzdata=2024.2=pyhd8ed1ab_0
- python-utils=3.8.2=pyhd8ed1ab_0
- python_abi=3.12=5_cp312
- pytz=2024.1=pyhd8ed1ab_0
- pywin32=307=py312h275cf98_3
- pyyaml=6.0.2=py312h4389bb4_1
- pyzmq=26.2.0=py312hd7027bb_3
- qhull=2020.2=hc790b64_5
- rasterio=1.4.1=py312h1701b51_0
- re2=2024.07.02=hd3b24a8_1
- requests=2.32.3=pyhd8ed1ab_0
- scikit-learn=1.5.2=py312h816cc57_1
- scipy=1.14.1=py312h1f4e10d_0
- setuptools=75.1.0=pyhd8ed1ab_0
- shapely=2.0.6=py312h0c580ee_2
- six=1.16.0=pyh6c4a22f_0
- snappy=1.2.1=h23299a8_0
- snuggs=1.4.7=pyhd8ed1ab_1
- sortedcontainers=2.4.0=pyhd8ed1ab_0
- sqlite=3.46.1=h2466b09_0
- stack_data=0.6.2=pyhd8ed1ab_0
- tbb=2021.13.0=hc790b64_0
- tblib=3.0.0=pyhd8ed1ab_0
- threadpoolctl=3.5.0=pyhc1e730c_0
- tk=8.6.13=h5226925_1
- tomli=2.0.2=pyhd8ed1ab_0
- toolz=1.0.0=pyhd8ed1ab_0
- tornado=6.4.1=py312h4389bb4_1
- tqdm=4.66.5=pyhd8ed1ab_0
- traitlets=5.14.3=pyhd8ed1ab_0
- typing-extensions=4.12.2=hd8ed1ab_0
- typing_extensions=4.12.2=pyha770c72_0
- tzdata=2024b=hc8b5060_0
- ucrt=10.0.22621.0=h57928b3_1
- uriparser=0.9.8=h5a68840_0
- urllib3=2.2.3=pyhd8ed1ab_0
- vc=14.3=h8a93ad2_22
- vc14_runtime=14.40.33810=hcc2c482_22
- vs2015_runtime=14.40.33810=h3bf8584_22
- wcwidth=0.2.13=pyhd8ed1ab_0
- wheel=0.44.0=pyhd8ed1ab_0
- win_inet_pton=1.1.0=pyh7428d3b_7
- xarray=2024.9.0=pyhd8ed1ab_1
- xerces-c=3.2.5=he0c23c2_2
- xorg-libxau=1.0.11=hcd874cb_0
- xorg-libxdmcp=1.1.3=hcd874cb_0
- xyzservices=2024.9.0=pyhd8ed1ab_0
- xz=5.2.6=h8d14728_0
- yaml=0.2.5=h8ffe710_2
- zeromq=4.3.5=ha9f60a1_6
- zict=3.0.0=pyhd8ed1ab_0
- zipp=3.20.2=pyhd8ed1ab_0
- zlib=1.3.1=h2466b09_2
- zstandard=0.23.0=py312h7606c53_1
- zstd=1.5.6=h0ea2cb4_0 prefix: C:\Users\olive\miniconda3\envs\atlite-test