-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError encountered when computing SPI #527
Comments
Hi @jessefriend thanks for this error report. If you can please re-install the Also if you can please post a link to the dataset used for |
Hi @monocongo, thanks for the fast feedback. I tried running it again with the development branch and still ran into the same issue. Here is a link to the dataset on WeTransfer: Here is a description of it:
|
Hello @monocongo , i have looked into the same issue (I am colleague with @jessefriend ) and i realized the climatology_dataset (CHIRP) expects expected_dims_3d_climate = {"lat", "lon", "time"}
here
next, the code climate_indices/src/climate_indices/__spi__.py Lines 276 to 280 in a7ee9ef
did not catch this difference a = {'lat', 'lon', 'time'}
b = {'time', 'lon', 'lat'}
a == b
True while something like these would for x, y in zip(a, b):
assert x == y hope this helps |
I can confirm this issue is gone when I changed the data dimensions within the netCDF to {'lat', 'lon', 'time'} |
@iferencik You have found a sleeper bug, thank you! We're comparing the two as sets, which have no order, but the order is important, as in this case. I will leave this issue open for now as a reminder to fix this. @jessefriend Thanks for your fast follow-up to confirm that this is fixed for you now. Getting the data cleaned and ready for processing is tricky, and I had lots of issues trying to handle that for users by including some wrangling in the processing scripts, but this proved to be problematic since it used NCO and that package is not well-supported on Windows. |
I am running into the same problem when following the tutorial also followed by jessefriend. @monocongo is the bug supposed to be solved in the current version (2.0.0)? Thank you.
This is the output of ncdump -h of my input .nc file:
|
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:
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
IndexError: index 159 is out of bounds for axis 1 with size 159
The full traceback is as follows:
Expected behavior
I expected the climate-indices package to compute the SPI without any issues.
Desktop (please complete the following information):
Additional Context
I was following this guideline on computing SPI using CHIRPS data.
The text was updated successfully, but these errors were encountered: