Update the parameters and equations used in Hectors forcing componet from the AR5 standards to the AR6 standards. I’ve started implementing these chages in Hector. Overall AR6 Hector output is much cooler than Hector 2.5 I will be going through the different forcing components to try and determine what is causing the change.
Up next I am going to try running Hector with the ssp to see how historical Hector compares with the RF values from AR6.
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(hector)
library(data.table)
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
theme_set(theme_bw())
COLOR_THEME <- c("H-AR6" = "red", "H25" = "grey", "IPCC" = "black")
## library(hector) # note this is a speicifc branch krd_epa2
DIR <- "/Users/dorh012/projects/2021/EPA_Hector" # define the analysis directory
# Hector 2.5 RCP 4.5 results
read.csv(list.files(DIR, "Hector_25_rcp45.csv", full.names = TRUE)) %>%
select(scenario, year, variable, value, units) ->
Hector_25_results
# Hector with new RF
# we have to use a non standard ini file because we added NH3 to be consistent with AR6
ini <- file.path(DIR, "input", "hector_rcp45.ini")
core <- newcore(ini, name = "H-AR6")
run(core)
## Hector core: H-AR6
## Start date: 1745
## End date: 2300
## Current date: 2300
## Input file: /Users/dorh012/Documents/2021/EPA_Hector/input/hector_rcp45.ini
vars_to_save <- c(RF_CO2(), RF_N2O(),
RF_BC(), RF_OC(), RF_SO2(),
RF_VOL(), RF_CH4(), GLOBAL_TEMP(),
RF_CF4(), RF_C2F6(), RF_HFC23(), RF_HFC32(), RF_HFC4310(),
RF_HFC125(), RF_HFC134A(), RF_HFC143A(), RF_HFC227EA(),
RF_HFC245FA(), RF_SF6(), RF_CFC11(), RF_CFC12(), RF_CFC113(),
RF_CFC114(), RF_CFC115(), RF_CCL4(), RF_CH3CCL3(), RF_HCFC22(),
RF_HCFC141B(), RF_HCFC142B(), RF_HALON1211(), RF_HALON1301(),
RF_HALON2402(), RF_CH3CL(), RF_CH3BR(), RF_TOTAL(), RF_NH3(),
EMISSIONS_CH4(), ATMOSPHERIC_CH4(), HEAT_FLUX())
Hector_AR6_results <- fetchvars(core,
dates = 1750:2100,
vars = vars_to_save)
data <- rbind(Hector_25_results, Hector_AR6_results)
# Hector 2.5 RCP 4.5 results
read.csv(list.files(DIR, "Hector_25_rcp45-const.csv", full.names = TRUE)) %>%
select(scenario, year, variable, value, units) ->
Hector_25_results_const
# Hector with new RF
# we have to use a non standard ini file because we added NH3 to be consistent with AR6
ini <- file.path(DIR, "input", "hector_const.ini")
core <- newcore(ini, name = "H-AR6")
run(core)
## Hector core: H-AR6
## Start date: 1745
## End date: 2300
## Current date: 2300
## Input file: /Users/dorh012/Documents/2021/EPA_Hector/input/hector_const.ini
vars_to_save <- c(RF_CO2(), RF_TOTAL(), GLOBAL_TEMP())
Hector_AR6_results_const <- fetchvars(core,
dates = 1750:2100,
vars = vars_to_save)
data_const <- rbind(Hector_25_results_const, Hector_AR6_results_const)
bind_rows(Hector_25_results, Hector_AR6_results) %>%
filter(variable == RF_TOTAL()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == HEAT_FLUX()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
bind_rows(Hector_25_results, Hector_AR6_results) %>%
filter(variable == GLOBAL_TEMP()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable)+
scale_color_manual(values = COLOR_THEME)
So because CO2 RF is so important & is affected by the temperature feedbacks we have to do this comparison with the CO2 constraints on (no temperature carbon feedbacks on). This is the pattern of change we expected from the inital comparison that calulated RF based on Hector outputs.
IPCC text says that CO2 RF is higher, which is consistent with what we see here.
data_const %>%
filter(variable == RF_CO2()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
labs(title = "Hector with CO2 constraints") +
scale_color_manual(values = COLOR_THEME)
Text says the changes in CH4 RF should increase between AR5 & AR6, consistent with the changes in Hector CH4 RF.
# KALYN may want to do this with constrainted CO2!!
data %>%
filter(variable == RF_CH4()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
Text says the changes in N2O RF should increase between AR5 & AR6, consistent with the changes in Hector N2O RF.
data %>%
filter(variable == RF_N2O()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
STEVE - line 46 of 7-34 is BC RF supposed to weaken & OC strengthen?
data %>%
filter(variable == RF_BC()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == RF_OC()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
bind_rows(filter(Hector_25_results, variable %in% c("FSO2d", "FSO2", "FSO2i")),
filter(Hector_AR6_results, variable %in% c(RF_SO2(), RF_ACI()))) %>%
ggplot(aes(year, value, color = variable)) +
geom_line() +
facet_grid(units ~ scenario)
data %>%
filter(variable == RF_NH3()) %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
labs(title = "Notes: Hector 2.5 does include NH3 RF") +
scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCF4") %>%
ggplot(aes(year, value, color = scenario)) +
geom_line() +
facet_grid(units ~ variable) +
scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FC2F6") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC23") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC32") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC4310") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC125") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC134a") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC143a") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC227ea") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHFC245fa") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FSF6") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCFC11") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCFC12") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCFC114") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCFC115") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCCl4") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCH3CCl3") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHCFC22") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHCFC141b") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FHCFC142b") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "Fhalon1211") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "Fhalon1301") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "Fhalon2402") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCH3Cl") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
data %>%
filter(variable == "FCH3Br") %>%
ggplot(aes(year, value, color = scenario, linetype = scenario)) +
geom_line() +
facet_grid(units ~ variable) + scale_color_manual(values = COLOR_THEME)
In this section we compare IPCC RF results with output from the Hector V3 (using AR6 RF information). In most cases the IPCC results will have three lines a central output with a 5 and 95% output.
Load the IPCC AR6 data.
format_data <- function(path){
x <- gsub(pattern = ".csv", replacement = "", x = basename(path))
xx <- unlist(strsplit(x, split = "_"))
if (length(xx) == 3 ){
out <- as.data.frame(matrix(xx, nrow = 1, dimnames = list(NULL, c("output", "scn", "time"))))
}
if (length(xx) == 4 ){
out <- as.data.frame(matrix(xx, nrow = 1, dimnames = list(NULL, c("output", "scn", "time", "percent"))))
}
return(out)
}
get_cmip_data <- function(path){
dat <- read.csv(path, stringsAsFactors = FALSE)
info <- format_data(path)
dat %>%
melt(id.vars = c( "year"),
variable.name = "variable", value.name = "value") %>%
cbind(info) ->
out
return(out)
}
AR6_dir <- "/Users/dorh012/Documents/2021/Chapter-7/data_output"
files <- list.files(file.path(AR6_dir,"SSPs"), pattern = "ERF", full.names = TRUE)
files %>%
lapply(get_cmip_data) %>%
bind_rows() %>%
select(year, variable, value, scenario = scn, percent) ->
ar6_data
ar6_names <- c("co2","ch4","n2o","o3","h2o_stratospheric","aerosol.cloud_interactions",
"volcanic","total", "HFC.134a","HFC.23","HFC.32","HFC.125","HFC.143a",
"HFC.227ea", "HFC.245fa", "SF6","CF4","CFC.11", "CFC.113",
"CFC.114", "CFC.115")
hector_names <- c(RF_CO2(), RF_CH4(), RF_N2O(), RF_O3_TROP(), RF_H2O_STRAT(), RF_ACI(),
RF_VOL() ,RF_TOTAL(), RF_HFC134A(),RF_HFC23(), RF_HFC32(), RF_HFC125(),
RF_HFC143A(), RF_HFC227EA(), RF_HFC245FA(), RF_SF6(), RF_CF4(),
RF_CFC11(), RF_CFC113(), RF_CFC114(), RF_CFC115())
ar6_data %>%
filter(variable %in% ar6_names) %>%
left_join(data.frame(variable = ar6_names,
hvar = hector_names)) %>%
select(year, variable = hvar, value, scenario, percent) ->
ar6_results
Run Hector(with AR6 forcing) with the ssp scenanrios.
run_hector_ssp <- function(ini){
hector_names <- c(RF_CO2(),RF_CH4(),RF_N2O(),RF_O3_TROP(),RF_H2O_STRAT(),RF_ACI(),RF_VOL(),RF_TOTAL(),
RF_HFC134A(),RF_HFC23(),
RF_HFC32(),RF_HFC125(),RF_HFC143A(),RF_HFC227EA(),RF_HFC245FA(),RF_SF6(),RF_CF4(),RF_CFC11(),
RF_CFC113(),
RF_CFC114(),RF_CFC115(), RF_BC(), RF_SO2(), RF_OC(), RF_NH3())
name <- gsub(pattern = "hector_|.ini", replacement = "", x = basename(ini))
core <- newcore(ini, name = name)
run(core, runtodate = 2050)
out <- fetchvars(core, 1750:2100, hector_names)
return(out)
}
list.files("/Users/dorh012/projects/2021/EPA_Hector/input", pattern = "ini", full.names = TRUE) %>%
lapply(run_hector_ssp) %>%
bind_rows() ->
hector_out
hector_out$source <- 'H-AR6'
ar6_results$source <- 'IPCC'
comp_data <- bind_rows(ar6_results, hector_out) %>%
filter(scenario %in% c("ssp119", "ssp126", "ssp245"))
var <- RF_TOTAL()
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
var <- RF_CO2()
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var, subtitle = 'Hector is emission driven') +
scale_color_manual(values = COLOR_THEME)
var <- RF_CO2()
comp_data %>%
filter(variable == var & source == "IPCC") %>%
filter(year <= 2050) %>%
filter(scenario %in% c("ssp119", "ssp245")) ->
IPCC_data
hector_out %>%
filter(scenario %in% c("ssp119_const", "ssp245_const")) %>%
mutate(scenario = gsub(scenario, pattern = "_const", replacement = "")) %>%
filter(year <= 2050) %>%
filter(variable == var) %>%
mutate(source = "H-AR6") ->
hector_const_co2
bind_rows(hector_const_co2, IPCC_data) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line(alpha = 0.5) +
facet_wrap("scenario") +
labs(title = var, subtitle = 'Hector is CO2 conc driven') +
scale_color_manual(values = COLOR_THEME)
Awesome! When CO2 concenatrions are constrained Hector CO2 RF hits the IPCC MEAN! whoot whoot
var <- RF_N2O()
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
var <- RF_N2O()
comp_data %>%
filter(variable == var & source == "IPCC") %>%
filter(year <= 2050) %>%
filter(scenario %in% c("ssp119", "ssp245")) ->
IPCC_data
hector_out %>%
filter(scenario %in% c("ssp119_const", "ssp245_const")) %>%
mutate(scenario = gsub(scenario, pattern = "_const", replacement = "")) %>%
filter(year <= 2050) %>%
filter(variable == var) %>%
mutate(source = "H-AR6") ->
hector_const_co2
bind_rows(hector_const_co2, IPCC_data) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line(alpha = 0.5) +
facet_wrap("scenario") +
labs(title = var, subtitle = 'Hector is N2O conc driven') +
scale_color_manual(values = COLOR_THEME)
var <- RF_CH4()
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
var <- RF_CH4()
comp_data %>%
filter(variable == var & source == "IPCC") %>%
filter(year <= 2050) %>%
filter(scenario %in% c("ssp119", "ssp245")) ->
IPCC_data
hector_out %>%
filter(scenario %in% c("ssp119_const", "ssp245_const")) %>%
mutate(scenario = gsub(scenario, pattern = "_const", replacement = "")) %>%
filter(year <= 2050) %>%
filter(variable == var) %>%
mutate(source = "H-AR6") ->
hector_const_co2
bind_rows(hector_const_co2, IPCC_data) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line(alpha = 0.5) +
facet_wrap("scenario") +
labs(title = var, subtitle = 'Hector is CH4 conc driven') +
scale_color_manual(values = COLOR_THEME)
var <- "Fvol"
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line(alpha = 0.5) +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
var <- RF_ACI()
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
# var <- RF_ACI()
# comp_data %>%
# filter(variable == var) %>%
# filter(year %in% 2005:2014) %>%
# group_by(scenario, variable, percent) %>%
# summarise(value = mean(value))
hector_out %>%
filter(variable %in% c(RF_BC(), RF_OC(), RF_NH3(), RF_SO2())) %>%
group_by(year, scenario) %>%
summarise(value = sum(value)) %>%
mutate(variable = 'aerosol.radiation_interactions') %>%
mutate(source = "H-AR6") ->
hector_ari
## `summarise()` regrouping output by 'year' (override with `.groups` argument)
ar6_data %>%
filter(scenario %in% c("ssp119", "ssp126", "ssp245")) %>%
filter(variable == 'aerosol.radiation_interactions') %>%
mutate(source = "IPCC") ->
ipcccc_ari
bind_rows(hector_ari, ipcccc_ari) %>%
filter(scenario %in% c("ssp119", "ssp126", "ssp245")) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_vline(xintercept = 2015)+
geom_line() +
facet_wrap("scenario") +
labs(title = "aerosol.radiation_interactions") +
scale_color_manual(values = COLOR_THEME)
var <-"FO3_trop"
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)
var <- "FH2O_strat"
comp_data %>%
filter(variable == var) %>%
filter(year <= 2050) %>%
ggplot(aes(year, value, color = source, line = percent)) +
geom_line() +
facet_wrap("scenario") +
labs(title = var) +
scale_color_manual(values = COLOR_THEME)