Hi @nperez,
I gathered the portions of the code in Crossval_anomalies.R and Crossval_calibration.R that are used to save the results, cleaned them a little bit and put them in a function, found in modules/Saving/Saving_crossval.R (we can come up with a better name).
For now this function is still at the end of Crossval_anomalies.R and Crossval_calibration.R, but it could also be removed from there and called separately, to save everything at the end of the workflow including the metrics. It has a parameter module
for the name of the module used (e.g. "Anomalies", "Calibration"). This is to check what the user wants to save from the recipe and to create the subdirectory where the outputs are saved.
I also changed a couple more things I noticed, let me know if you agree:
In Crossval_calibration() and Crossval_anomalies:
- Compute the limits with full hindcast period even when forecast is not requested
In Crossval_Anomalies():
- Return limits computed with the full hindcast period in cat_lims (previously, it returned the limits computed within the cross-validation loop, with the syear dimension)
- Select central sday in anomalies before returning them (not only in full values)
In the saving functions:
- Ensure that the order of the dimensions of the netCDF is always (time, longitude, latitude)
Cheers,
Victòria