pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.5k stars 1.04k forks source link

from_array() got an unexpected keyword argument 'inline_array' #8917

Closed Shiviiii23 closed 3 months ago

Shiviiii23 commented 3 months ago

What happened?

I got the error: from_array() got an unexpected keyword argument 'inline_array' for this line in xarray: data = da.from_array( data, chunks, name=name, lock=lock, inline_array=inline_array, **kwargs )

lines 1230 and 1231 in xarray/core/variable.py

What did you expect to happen?

No response

Minimal Complete Verifiable Example

No response

MVCE confirmation

Relevant log output

No response

Anything else we need to know?

No response

Environment

welcome[bot] commented 3 months ago

Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!

max-sixty commented 3 months ago

Please edit with an MCVE. More info is in the issue template

Shiviiii23 commented 3 months ago

Hello, here is the MCVE: I was trying to follow ICEYE's tutorial to make an icecube: grd_datacube = GRDDatacube.build(cube_config, test_dir_grds)

and this is the error stack trace:

04/06/2024 06:23:21 PM - sar_datacube_metadata.py - [INFO] - Building the metadata from the folder /Users/_shivi/Desktop/bhumi/icecube/tests/resources/grd_stack using GRD processing rasters for cubes: 0%| | 0/3 [00:00<?, ?it/s]

TypeError Traceback (most recent call last)

in ----> 1 grd_datacube = GRDDatacube.build(cube_config, test_dir_grds) ~/Desktop/bhumi/icecube/icecube/bin/sar_cube/grd_datacube.py in build(cls, cube_config, raster_dir) 78 def build(cls, cube_config: CubeConfig, raster_dir: str): 79 grd_datacube = GRDDatacube(cube_config, RASTER_DTYPE) ---> 80 ds = grd_datacube.create(cls.PRODUCT_TYPE, raster_dir) 81 grd_datacube.xrdataset = ds 82 return grd_datacube ~/Desktop/bhumi/icecube/icecube/utils/common_utils.py in time_it(*args, **kwargs) 111 def time_it(*args, **kwargs): 112 time_started = time.time() --> 113 return_value = func(*args, **kwargs) 114 time_elapsed = time.time() 115 logger.info( ~/Desktop/bhumi/icecube/icecube/bin/sar_cube/sar_datacube.py in create(self, product_type, raster_dir) 48 # assert_metadata_exists(metadata_object.metadata_df) 49 self.set_xarray_dtype(metadata_object.metadata_df) ---> 50 ds = self.create_by_metadata(metadata_object) 51 self.xrdataset = ds 52 return ds ~/Desktop/bhumi/icecube/icecube/bin/sar_cube/sar_datacube.py in create_by_metadata(self, metadata) 135 ) 136 --> 137 raster_xrdataset, cur_metadata = self.compute_layer_xrdataset( 138 raster_fpath, metadata 139 ) ~/Desktop/bhumi/icecube/icecube/bin/sar_cube/grd_datacube.py in compute_layer_xrdataset(self, raster_path, metadata) 112 113 def compute_layer_xrdataset(self, raster_path, metadata) -> Tuple[xr.Dataset, dict]: --> 114 i_xr_array, grd_metadata = self._create_xdarray_with_ICEYE_GRD(raster_path) 115 return xr.Dataset({NAME_INTENSITY_BAND: i_xr_array}), grd_metadata 116 ~/Desktop/bhumi/icecube/icecube/bin/sar_cube/grd_datacube.py in _create_xdarray_with_ICEYE_GRD(self, grd_fpath) 125 # use Dask to load the array 126 array_dask = da.squeeze( --> 127 xr.open_rasterio( 128 grd_fpath, chunks={"band": 1, "x": self.chunks[0], "y": self.chunks[1]} 129 ) ~/opt/anaconda3/lib/python3.8/site-packages/xarray/backends/rasterio_.py in open_rasterio(filename, parse_coordinates, chunks, cache, lock, **kwargs) 376 token = tokenize(filename, mtime, chunks) 377 name_prefix = f"open_rasterio-{token}" --> 378 result = result.chunk(chunks, name_prefix=name_prefix, token=token) 379 380 # Make the file closeable ~/opt/anaconda3/lib/python3.8/site-packages/xarray/core/dataarray.py in chunk(self, chunks, name_prefix, token, lock, inline_array, **chunks_kwargs) 1324 chunks = either_dict_or_kwargs(chunks, chunks_kwargs, "chunk") 1325 -> 1326 ds = self._to_temp_dataset().chunk( 1327 chunks, 1328 name_prefix=name_prefix, ~/opt/anaconda3/lib/python3.8/site-packages/xarray/core/dataset.py in chunk(self, chunks, name_prefix, token, lock, inline_array, **chunks_kwargs) 2261 ) 2262 -> 2263 variables = { 2264 k: _maybe_chunk(k, v, chunks, token, lock, name_prefix) 2265 for k, v in self.variables.items() ~/opt/anaconda3/lib/python3.8/site-packages/xarray/core/dataset.py in (.0) 2262 2263 variables = { -> 2264 k: _maybe_chunk(k, v, chunks, token, lock, name_prefix) 2265 for k, v in self.variables.items() 2266 } ~/opt/anaconda3/lib/python3.8/site-packages/xarray/core/dataset.py in _maybe_chunk(name, var, chunks, token, lock, name_prefix, overwrite_encoded_chunks, inline_array) 283 token2 = tokenize(name, token if token else var._data, chunks) 284 name2 = f"{name_prefix}{name}-{token2}" --> 285 var = var.chunk(chunks, name=name2, lock=lock, inline_array=inline_array) 286 287 if overwrite_encoded_chunks and var.chunks is not None: ~/opt/anaconda3/lib/python3.8/site-packages/xarray/core/variable.py in chunk(self, chunks, name, lock, inline_array, **chunks_kwargs) 1227 chunks = tuple(chunks.get(n, s) for n, s in enumerate(self.shape)) 1228 -> 1229 data = da.from_array( 1230 data, chunks, name=name, lock=lock, inline_array=inline_array, **kwargs 1231 ) TypeError: from_array() got an unexpected keyword argument 'inline_array'
max-sixty commented 3 months ago

Sorry — we need a block of text that can be copied into a python prompt and reproduce the error. I appreciate it may take some work, but it is the only way we can engage.

To the extent this is from deep inside icecube, it might be worth addressing this with them

Shiviiii23 commented 3 months ago

Hi, these are the steps I took:

https://iceye-ltd.github.io/icecube/installation/ - I followed all the steps on this website to install and then I tried to follow the steps here:

https://iceye-ltd.github.io/icecube/examples/Ex1_SARDatacube/

My code fails at the line "grd_datacube = GRDDatacube.build(cube_config, test_dir_grds)" producing the above error. Thank you!

max-sixty commented 3 months ago

OK — we're keen to help, but we need a very small example to assess whether it's a bug with xarray. Otherwise it's not possible for us to prioritize the most important issues.

If anyone can see the issue from looking at the text above, please ofc feel free to comment, but I'll close in the meantime.