dask: Dask reshape size error
What happened:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-119-47f24d3281a7> in <module>
----> 1 geotiff_rs = dask.array.reshape(geotiff_flat, (geotiff_flat.shape[2]*geotiff_flat.shape[3], geotiff_flat.shape[0] * geotiff_flat.shape[1]))
~\AppData\Local\Continuum\anaconda3\envs\pangeo3\lib\site-packages\dask\array\reshape.py in reshape(x, shape)
176
177 if reduce(mul, shape, 1) != x.size:
--> 178 raise ValueError("total size of new array must be unchanged")
179
180 if x.shape == shape:
ValueError: total size of new array must be unchanged
What you expected to happen:
Reshape DataArray
Minimal Complete Verifiable Example:
geotiff_rs = dask.array.reshape(geotiff_flat, (geotiff_flat.shape[2]*geotiff_flat.shape[3], geotiff_flat.shape[0] * geotiff_flat.shape[1]))
Anything else we need to know?:
Environment:
- Dask version: 2.3.0
- Python version: 3.8.6
- Operating System: Windows10
- Install method (conda, pip, source): conda
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
Xarray expects dimension names, not axes numbers.
A reshape in xarray land is
stack
: https://xarray.pydata.org/en/stable/generated/xarray.Dataset.stack.html?highlight=stack#xarray.Dataset.stack Can you try and that and open an issue on Xarray’s discussions if you still have trouble?