Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
source('modules/Loading/GRIB/GrbLoad.R')
source('modules/Loading//Loading_GRIB.R')
source("tools/libs.R") # for prepare_outputs.R
#TODO: remove this line when new s2dv_cube() is in CSTools
source('modules/Loading/GRIB/s2dv_cube.R')
library(yaml)
library(clock)
recipe <- "modules/Loading/testing_recipes/recipe_GRIB_system5_era5.yml"
recipe <- prepare_outputs(recipe)
# Load datasets
data <- load_datasets(recipe)
str(data)
#============================
# Test the remaining modules
#============================
source("modules/Calibration/Calibration.R")
source("modules/Skill/Skill.R")
source("modules/Saving/Saving.R")
source("modules/Visualization/Visualization.R")
# Calibrate data
suppressWarnings({invisible(capture.output(
calibrated_data <- calibrate_datasets(recipe, data)
))})
#pryr::mem_used()
#975 MB
# Compute skill metrics
suppressWarnings({invisible(capture.output(
skill_metrics <- compute_skill_metrics(recipe, calibrated_data)
))})
suppressWarnings({invisible(capture.output(
probs <- compute_probabilities(recipe, calibrated_data)
))})
# Saving
suppressWarnings({invisible(capture.output(
save_data(recipe = recipe, data = calibrated_data,
skill_metrics = skill_metrics, probabilities = probs,
archive = read_yaml("conf/archive_GRIB.yml")$archive)
))})
# Plotting
suppressWarnings({invisible(capture.output(
plot_data(recipe = recipe, data = calibrated_data,
skill_metrics = skill_metrics, probabilities = probs,
significance = T,
archive = read_yaml("conf/archive_GRIB.yml")$archive)
))})
outdir <- get_dir(recipe)