monocongo/climate_indices

SPEI fitting parameters from historical run for use with projections

rb4844 opened this issue · 1 comments

Hi,

SPEI: I want to be able to use the same historical calibration period (1981-2010) and apply it to future data sets (but not as one continuous gridded time series) so that the future SPEI results can be compared to the historical SPEI.

From the documentation (https://climate-indices.readthedocs.io/en/latest/), in the table under ‘Indices Processing’,

save_params
Save distribution fitting variables to this file path. The fittings NetCDF is to be used as input when using the load_params option. [NOTE: only for use with the spi entrypoint for SPI.]

But I got, after trying to add save_params to the command line:

usage: process_climate_indices [-h] --index
                               {spi,spei,pnp,scaled,pet,palmers,all}
                               --periodicity {monthly,daily}
                               [--scales [SCALES [SCALES ...]]]
                               [--calibration_start_year CALIBRATION_START_YEAR]
                               [--calibration_end_year CALIBRATION_END_YEAR]
                               [--netcdf_precip NETCDF_PRECIP]
                               [--var_name_precip VAR_NAME_PRECIP]
                               [--netcdf_temp NETCDF_TEMP]
                               [--var_name_temp VAR_NAME_TEMP]
                               [--netcdf_pet NETCDF_PET]
                               [--var_name_pet VAR_NAME_PET]
                               [--netcdf_awc NETCDF_AWC]
                               [--var_name_awc VAR_NAME_AWC]
                               --output_file_base OUTPUT_FILE_BASE
                               [--multiprocessing {single,all_but_one,all}]
process_climate_indices: error: unrecognized arguments: --save_params

Which does not list save_params as an option.

Does save_params work with SPEI and if so how? It reads as though it may be only works for SPI? Otherwise, is there a way I can save the fitting parameters? I think these are the alphas and betas in indices.py. However, I don’t understand how to modify the code to save these.

This may be connected to issue #447 but it's not clear if this has been resolved or a solution found?
Many thanks.

I have a PR that extends the spi script to do this, but it was a bit of a hack and I never felt it was "correct". You can check it out at #458.