-
Notifications
You must be signed in to change notification settings - Fork 13
Description
The drought index model in drought_index.py is lacking instructions about how to run and a test. This matters since it is a bit non-standard because a 'pre-chunking' step is needed. This is a quick overview to be integrated.
The drought indicator's SPEI calculation requires a long time series of data for a fitting process which is specific to a given location; for that part of the calculation it is efficient to have data chunked by latitudes and longitudes therefore. However in many cases data is provided for all latitudes and longitudes for a given projected year. The pre-chunking step converts annual data into chunked time-series.
The pre-chunked data is written to a Zarr store. This can be specified, e.g. for using a local store:
path = "<dir for chunked data>"
local_store = LocalZarrWorkingStore(path)
model = DroughtIndicator(local_store)
To then pre-chunk for a single batch item:
item = BatchItem(gcm=model.gcms[0], scenario=model.scenarios[3], central_years=model.central_years)
progress = ProgressStore(dir="<dir for progress>", id=item.gcm + "_" + item.scenario)
model.pre_chunk(item)
Finally to run we define the target as usual
target=OscZarr()
model.run_single(item, target=target, progress_store=progress)