The model now creates default values for surface (both HL and LL) and intermediate + deep ocean carbon in ocean_component::init(), but it accepts and respects those data from INI files and/or R.
This PR adds functionality but shouldn't change any science results.
Via INI files:
Via R:
library(hector)
hc <- newcore("inst/input/hector_ssp245.ini")
fetchvars(hc, NA, OCEAN_PREIND_C_ID())
scenario year variable value units
1 Unnamed Hector core NA preind_interdeep_c 37100 Pg C
run(hc)
original <- fetchvars(hc, 1750:2300)
original$which <- "original"
setvar(hc, NA, OCEAN_PREIND_C_ID(), 38100, "Pg C")
fetchvars(hc, NA, OCEAN_PREIND_C_ID())
scenario year variable value units
1 Unnamed Hector core NA preind_interdeep_c 38100 Pg C
reset(hc)
run(hc)
changed <- fetchvars(hc, 1750:2300)
changed$which <- "changed"
shutdown(hc)
library(ggplot2)
ggplot(rbind(original, changed), aes(year, value, color = which)) + geom_line() + facet_wrap(~variable, scales="free")
One thing to note
Because of the logic of ocean_component::prepareToRun(), it was easiest to allow the user to set the preindustrial values of total surface and total intermediate + deep — NOT the individual high lat, low lat, intermediate, deep. As a result you can read the latter from R but you can't write them.
The model now creates default values for surface (both HL and LL) and intermediate + deep ocean carbon in
ocean_component::init()
, but it accepts and respects those data from INI files and/or R.This PR adds functionality but shouldn't change any science results.
Via INI files:
Via R:
One thing to note
Because of the logic of
ocean_component::prepareToRun()
, it was easiest to allow the user to set the preindustrial values of total surface and total intermediate + deep — NOT the individual high lat, low lat, intermediate, deep. As a result you can read the latter from R but you can't write them.Closes #530