[NOTE TO SELF: This branch should be merged after dev-skill-anomalies
]
Hi @aho,
This branch contains enhancements to compute_probabilities() (computes fcst probabilities if a fcst is present), as well as save_data() and plot_data(). I have also changed the arguments of some functions to improve consistency and make the modules more easily interchangeable, since this was done on top of the development of the Anomalies module. I will be making a few more changes in the near future, but for now:
- calibrate_datasets() returns a list of s2dv_cube objects including not just hcst and fcst but also obs
- skill_metrics() arguments are now reduced to
recipe
anddata
, wheredata
is a list of s2dv_cubes containing at least the hcst and obs. - compute_probabilities() arguments are also
recipe
anddata
. Ifdata
only has a hcst, it returns a list with elements$percentiles
and$probs
like before.If
dataalso contains a fcst,
$probs_fcstis returned as well.
$probs_fcsthas the same structure as
$probs`... but for the forecast (lol). - As a consequence of this,
calibrated_data
argument will most likely be deprecated in save_data() and plot_data() (but I haven't done that yet).
An example with these changes:
# Load datasets
data <- load_datasets(recipe)
# Calibrate datasets
calibrated_data <- calibrate_datasets(recipe, data)
# Compute skill metrics
skill_metrics <- compute_skill_metrics(recipe, calibrated_data)
# Compute percentiles and probability bins
probabilities <- compute_probabilities(recipe, calibrated_data)
# Export all data to netCDF
save_data(recipe, data, calibrated_data, skill_metrics, probabilities)
# Plot data
plot_data(recipe, data, calibrated_data, skill_metrics, probabilities,
significance = T)
Right now what needs to be tested is that the forecast probabilities are correctly computed, saved and plotted in the decadal case where there is more than one forecast year. The decadal unit tests need to be adapted as well.
Let me know if you have any questions or comments.
Thanks,
Victòria