monocongo/climate_indices

"TypeError: from_array() got an unexpected keyword argument 'meta'" for SPI calculation

Opened this issue · 6 comments

Hi! I have been trying to calculate the SPI following the ARSET training, but I am getting an issue right at the end while calculating the SPI. I am using anaconda 3.7 because I couldn't install the NCO package with anaconda 3.8. I ran the command with GitBash as well as with Anaconda prompt, but I received the same error mentioned below. Can someone please help me with this? I would be grateful to you.

The command line I entered and the error I received are as follow.

(indices_env) D:\climate_indices\src\climate_indices>process_climate_indices --index spi --periodicity monthly --netcdf_precip ./data/IMERG_concat_ncpdq.nc4 --var_name_precip precipitation --output_file_base ./data/IMERG --scales 3 --calibration_start_year 2000 --calibration_end_year 2019 --multiprocessing all

c:\users\dell\anaconda3\lib\site-packages\dask\config.py:168: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
data = yaml.load(f.read()) or {}
c:\users\dell\anaconda3\lib\site-packages\distributed\config.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
defaults = yaml.load(f)
2021-06-23 08:16:39 INFO Start time: 2021-06-23 08:16:39.699631
2021-06-23 08:16:39 INFO Computing 3-month SPI/Pearson
2021-06-23 08:16:39 ERROR Failed to complete
Traceback (most recent call last):
File "c:\users\dell\anaconda3\lib\site-packages\climate_indices_main_.py", line 1684, in main
compute_write_index(kwrgs)
File "c:\users\dell\anaconda3\lib\site-packages\climate_indices_main
.py", line 722, in compute_write_index
dataset = xr.open_mfdataset(files, chunks=chunks)
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 912, in open_mfdataset
datasets = [open
(p, **open_kwargs) for p in paths]
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 912, in
datasets = [open_(p, **open_kwargs) for p in paths]
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 511, in open_dataset
**kwargs,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 324, in _dataset_from_backend_dataset
**extra_tokens,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 295, in _chunk_ds
token=token,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\core\dataset.py", line 433, in maybe_chunk
var = var.chunk(chunks, name=name2, lock=lock)
File "c:\users\dell\anaconda3\lib\site-packages\xarray\core\variable.py", line 1068, in chunk
data = da.from_array(data, chunks, name=name, lock=lock, **kwargs)
TypeError: from_array() got an unexpected keyword argument 'meta'
Traceback (most recent call last):
File "c:\users\dell\anaconda3\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\dell\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Dell\Anaconda3\Scripts\process_climate_indices.exe_main
.py", line 9, in
File "c:\users\dell\anaconda3\lib\site-packages\climate_indices_main
.py", line 1684, in main
compute_write_index(kwrgs)
File "c:\users\dell\anaconda3\lib\site-packages\climate_indices_main
.py", line 722, in compute_write_index
dataset = xr.open_mfdataset(files, chunks=chunks)
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 912, in open_mfdataset
datasets = [open
(p, **open_kwargs) for p in paths]
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 912, in
datasets = [open(p, **open_kwargs) for p in paths]
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 511, in open_dataset
**kwargs,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 324, in _dataset_from_backend_dataset
**extra_tokens,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\backends\api.py", line 295, in _chunk_ds
token=token,
File "c:\users\dell\anaconda3\lib\site-packages\xarray\core\dataset.py", line 433, in _maybe_chunk
var = var.chunk(chunks, name=name2, lock=lock)
File "c:\users\dell\anaconda3\lib\site-packages\xarray\core\variable.py", line 1068, in chunk
data = da.from_array(data, chunks, name=name, lock=lock, **kwargs)
TypeError: from_array() got an unexpected keyword argument 'meta'
SS_Gitbash

Can you please reference the ARSET training materials you're following? The last time they used this package in their training materials they used an out-of-date version which led to numerous unnecessary issues, so I'd like to make sure we're not dealing with that again.

Yeah, I noticed that the new package is a bit different than the one they used in the videos of the ARSET training - Applications of GPM IMERG Reanalysis for Assessing Extreme Dry and Wet Periods (January 28, 2020 - February 04, 2020). They have updated their handouts with the new Climate_Indices packages procedures, but I still ended up with this issue here.

Do not use the package they have provided as it is an out-of-date version. Install climate-indices into your Python environment like so:

$ pip install climate-indices

That's it really. Now you can issue commands to compute indices as described here

I have followed all the steps mentioned in the climate_indices package link for the initial package set-up. I re-did it just now as well, but I am still getting the same TypeError: from_array() got an unexpected keyword argument 'meta' while running the SPI code :(

I installed Anaconda (Anaconda3-2019.10-Windows-x86_64.exe) and I have followed your instruction for the environment set up too. But I am getting another issue right now. I am not sure if it is related to the climate-indices package or my anaconda version. :( Please have a look at this issue.

SS_IMERG