climate_indices
climate_indices copied to clipboard
IndexError encountered when computing SPI
Describe the bug I encountered an "IndexError: index 159 is out of bounds for axis 1 with size 159" when attempting to use the SPI computation function from the climate-indices Python package.
To Reproduce Steps to reproduce the behavior:
-
Installed the climate-indices package in a conda environment.
-
Ran the following command:
spi --periodicity monthly --scales 1 2 3 6 9 12 24 36 48 --calibration_start_year 1981 --calibration_end_year 2023 --netcdf_precip /path/to/my/netcdf/precip_data.nc --var_name_precip precip --output_file_base /path/to/my/output/CHIRPS --multiprocessing all --save_params /path/to/my/output/CHIRPS_fitting.nc --overwrite
- Encountered the following error:
IndexError: index 159 is out of bounds for axis 1 with size 159
The full traceback is as follows:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/user/miniconda3/envs/climate_indices/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/user/miniconda3/envs/climate_indices/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/home/user/miniconda3/envs/climate_indices/lib/python3.7/site-packages/climate_indices/__spi__.py", line 1212, in _apply_to_subarray_gamma
periodicity=args["periodicity"],
IndexError: index 159 is out of bounds for axis 1 with size 159
"""
File "climate_indices/__spi__.py", line 1502, in main
_compute_write_index(kwrgs)
File "climate_indices/__spi__.py", line 700, in _compute_write_index
args=args,
File "climate_indices/__spi__.py", line 1007, in _parallel_fitting
pool.map(_apply_to_subarray_gamma, chunk_params)
File "multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "multiprocessing/pool.py", line 657, in get
raise self._value
IndexError: index 159 is out of bounds for axis 1 with size 159
Expected behavior I expected the climate-indices package to compute the SPI without any issues.
Desktop (please complete the following information):
- OS: Ubuntu 22.04.1 LTS
- Version of climate-indices used: latest version from pip
Additional Context I was following this guideline on computing SPI using CHIRPS data.