Skip to content

process_climate_indices crashes if daily input data does not end on Dec. 31 #575

@david-e-rupp

Description

@david-e-rupp

Describe the bug
I'm trying to update SPI daily using the most recent data every day. However, if the ppt input data does not end on Dec. 31, process_climate_indices fails. I have tried using data files that end on other days (Dec. 31, Jan. 31, Feb. 22, etc.) but they all fail.

One solution could be to create a file that ends at the end of this year but is filled with made of up values for future days (i.e., zero), but I rather not if there is a better way.

Expected behavior
I expect SPI to be calculated for every day in the input even if the record does not end on Dec. 31.

Screenshots
Here is the call to process_climate_indices and just snippet of the error message:

process_climate_indices --index spi --periodicity daily --netcdf_precip ppt_1981-01-01_2025-01-31.nc --var_name_precip prcp --output_file_base test --scales 30 --calibration_start_year 1991 --calibration_end_year 2020 --multiprocessing all

prismcpx6 498% ./spi_daily_test.bash
2025-02-23 08:07:51 INFO Start time: 2025-02-23 08:07:51.604848
2025-02-23 08:07:51 INFO Computing 30-day SPI/Pearson
2025-02-23 08:07:51 ERROR Failed to complete
Traceback (most recent call last):
....
/climate_indices/utils.py", line 367, in transform_to_366day
all_leap[all_leap_index: (all_leap_index + 59)] = original[original_index: (original_index + 59)]
ValueError: could not broadcast input array from shape (31,) into shape (59,)

Desktop (please complete the following information):

  • OS: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions