-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi there!
I am currently trying to use Matilda/Hector to score my 100 ensemble runs against observed global temperatures. When I try and define a new criterion for observational data, I am met with scored runs all equal to 0.01. I am trying to set my own criterion because when I attempt to use the inbuilt
criterion_gmst_obs()
The error below is returned.
Error in score_runs(results_100, criterion_gmst_obs(), score_ramp, w1 = 2, : criterion year and variable combination not represented in data
Any ideas why the criterion_gmst_obs()
would return such an error? My ideal fix is solving this so I dont have to fuss with creating my own criterion
Also, am I correct to think this criterion of global_tas included in the vignette (shown below) uses a generated sequence of values as opposed to actual observational data? Either way, using the snippet below I still receive scored values of 0.01 for all 100 observations.
my_criterion <- new_criterion(GLOBAL_TAS(), years = 1951:2000, obs_values = seq(0.4, 1.0, length.out = 50)
Thank you for your help!! Code pasted below.
ini_file <- system.file("input/hector_ssp245.ini", package = "hector")
core <- newcore(ini_file, name="SSP_245")
core
set.seed(2455)
param_sets <- generate_params (core = core, draws = 100)
print(param_sets)
results_100 <- iterate_model(core = core, params = param_sets, save_years = 1850:2100)
print(results_100)
#temp data from the HADcrut analysis
temp_data <- read.csv("HADCRUT_1950-2023.csv", header = TRUE)
#Tried both of these options to no avail
#1- user_temp_criterion1 <- new_criterion(var = "global_tas", years = temp_data$Year,
obs_values = temp_data$global_tas)
#2-my_criterion <- new_criterion(GLOBAL_TAS(),
years = 1951:2000,
obs_values = seq(0.4, 1.0, length.out = 50))
scored_runs_my <- score_runs(results_100, criterion = my_criterion, score_ramp, w1= 2, w2 = 20)
score_results <- merge(results_100, scored_runs_my, by = "run_number")
ggplot(data = score_results) +
geom_line(aes(x = year, y = value, group = run_number, color = weights)) +
scale_color_continuous() +
facet_wrap(~variable, scales = "free_y")
Thank you for your time and apologies if I missed anything in the explanation!
Willy