Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7ba5172
post v3.2.0 dev
kdorheim Feb 23, 2024
782bb7c
Fix a minor numeric inconsistency in the hector vignette
mgondan Apr 8, 2024
cb0dce9
Update hector.Rmd
mgondan Apr 8, 2024
62d012b
Merge pull request #739 from mgondan/patch-1
kdorheim Apr 9, 2024
ddfffa4
Addressing a handful of open github issues (#741)
kdorheim Jun 25, 2024
64af5df
Update simpleNbox-runtime.cpp
bpbond Dec 20, 2024
f2b1bc5
update from main
kdorheim Feb 26, 2025
1640018
Merge pull request #764 from JGCRI/refreeze_bug
kdorheim Feb 26, 2025
13b8536
Update old-new test data
kdorheim Feb 26, 2025
e8c1461
Break out RH (#773)
kdorheim Mar 24, 2025
6b5112c
append to previous PPR
kdorheim Mar 26, 2025
f6188f5
append to previous PPR
kdorheim Mar 26, 2025
1e640c4
Merge branch 'main' into dev
kdorheim Mar 28, 2025
68a7a0d
Alpha and Volscl impact RF output (#745) (#756)
kdorheim May 29, 2025
fa2be85
update the picontrol ini files with the new parameters
kdorheim May 29, 2025
f91b6ef
Modify the volcanic RF inputs (#781)
kdorheim Jun 5, 2025
dd65ff9
Enable natural CH4 to be time varying (#782)
kdorheim Jun 19, 2025
ccad18e
Easy get all hector variables (#784)
kdorheim Jul 29, 2025
5c704b5
update from main
kdorheim Jul 30, 2025
1a1f22b
Update Methane Sink Parameters (#786)
kdorheim Aug 18, 2025
c9a7db5
update version number for gcam testing
kdorheim Aug 20, 2025
ea5054e
Misc changes a head of V3.5.0 release (#788)
kdorheim Sep 5, 2025
4436e5d
Hector V3.5.0 Calibration (#789)
kdorheim Oct 16, 2025
5d4091c
update internal package data
kdorheim Oct 16, 2025
095162f
update internal package data
kdorheim Oct 16, 2025
029c2fd
Resolve merge conflict
kdorheim Oct 16, 2025
e98dc2d
Resolve merge conflict
kdorheim Oct 16, 2025
03f83d1
update version numbering and documentation
kdorheim Oct 20, 2025
9fa91b4
resolve merge conflict
kdorheim Oct 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/new_release_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Release
about: Checklist!
---

Since the dev branch only includes materials that have been peer-reviewed at least once this PR review process should be relatively smooth should. That being said, before merging this branch into main and the new release is created several things must be completed first.

* Open a PR into main branch, it should be titled with the new release number
* Let Leeyabot generate a report detailing how the Hector output has changed!
* Add text to the PR documenting the major model changes. The PR is going to serve as an important record
* Pass automated checks
* Change the version number in the DESCRIPTION file
* Update the NEWS.md, are links additional materials necessary? Does the release need a new naming file?
* Check to make sure the internal package data is up to date (fxntable, inputstable, unitstable)

After merging PR

* Create the release via zenodo
* Add the zenodo links to README / NEWS & push directly to main
* Create new dev branch & update the DESCRIPTION version number to support the pkgdown documentation for the developmental branch!
* Add archived outputstreams to release assets!

11 changes: 8 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hector
Title: The Hector Simple Climate Model
Version: 3.2.0
Version: 3.5.0
Authors@R: c(person("Kalyn", "Dorheim",
email = "kalyn.dorheim@pnnl.gov",
role = c("aut", "cre"),
Expand Down Expand Up @@ -31,6 +31,10 @@ Authors@R: c(person("Kalyn", "Dorheim",
email = "leeya.pressburger@pnnl.gov",
role = c("ctb", "dtc"),
comment = c(ORCID = "0000-0002-6850-2504")),
person("Peter", "Scully",
email = "ptrscll@gmail.com",
role = "ctb",
comment = c(ORCID = "0009-0007-0234-0366")),
person("Alexey", "Shiklomanov",
email = "alexey.shiklomanov@nasa.gov",
role = "ctb",
Expand All @@ -47,7 +51,8 @@ Description: Provides an R interface for the Hector Simple Climate
change model parameters and emissions inputs, run Hector, and
retrieve model outputs. Note that the package authors are not
identical to the C++ model authors.
Depends: R (>= 3.3)
Depends:
R (>= 3.5)
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand All @@ -70,7 +75,7 @@ Collate:
'units.R'
VignetteBuilder: knitr
Config/Needs/website: kableExtra, nleqslv
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
SystemRequirements: GNU make
URL: https://github.com/JGCRI/hector, https://jgcri.github.io/hector/
BugReports: https://github.com/JGCRI/hector/issues
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
S3method(format,hcore)
S3method(print,hcore)
export(AERO_SCALE)
export(ALL_VARS)
export(ATMOSPHERIC_CO2)
export(BETA)
export(C2F6_CONSTRAIN)
Expand Down Expand Up @@ -238,6 +239,8 @@ export(RHO_NH3)
export(RHO_OC)
export(RHO_SF6)
export(RHO_SO2)
export(RH_DETRITUS)
export(RH_SOIL)
export(SF6_CONSTRAIN)
export(SOIL_C)
export(SST)
Expand Down
17 changes: 17 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# hector 3.5.0

* Minor documentation changes
* Several variables/parameters were renamed, FCH4 -> RF_CH4, alpha -> aero_scalar, & volscl -> vol_scalar
* Change RF vol implementation so it is not negative in the future period
* Expose soil and detritus RH fluxes as possible Hector outputs, RH_DETRITUS() & RH_SOIL()
* Add ALL_VARS() which helps users fetch all Hector output variables
* Update [CH4] lifetime parameters
* Allow for time varying historical N2O and CH4 natural emissions
* New default parameter values for ocean heat diffusivity, CO2 fertilization, and heterotrophic respiration temperature sensitivity





# hector 3.2.0
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10698028.svg)](https://doi.org/10.5281/zenodo.10698028)

* Fully documented in Dorheim, K., Gering, S., Gieseke, R., Hartin, C., Pressburger, L., Shiklomanov, A. N., Smith, S. J., Tebaldi, C., Woodard, D. L., and Bond-Lamberty, B.: Hector V3.2.0: functionality and performance of a reduced-complexity climate model, Geosci. Model Dev., 17, 4855–4869, https://doi.org/10.5194/gmd-17-4855-2024, 2024.
* Correct aerosol forcing coefficients based on Zelinka et al. (2023)
* Enable permafrost module and recalibrate model's default parameterization

Expand Down
12 changes: 12 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,18 @@ RH <- function() {
.Call('_hector_RH', PACKAGE = 'hector')
}

#' @rdname carboncycle
#' @export
RH_DETRITUS <- function() {
.Call('_hector_RH_DETRITUS', PACKAGE = 'hector')
}

#' @rdname carboncycle
#' @export
RH_SOIL <- function() {
.Call('_hector_RH_SOIL', PACKAGE = 'hector')
}

#' @describeIn parameters Preindustrial CO2 concentration (\code{"ppmv CO2"})
#' @export
PREINDUSTRIAL_CO2 <- function() {
Expand Down
5 changes: 5 additions & 0 deletions R/aadoc.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,8 @@ NULL
#' \item{string}{String of variable name}
#' }
"fxntable"

#' A vector containing all the hector output names.
#'
#' @format A vector of length 82.
"all_vars"
184 changes: 93 additions & 91 deletions R/biome.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ create_biome <- function(core, biome,
npp_flux0,
warmingfactor, beta, q10_rh,
f_nppv, f_nppd, f_litterd) {
create_biome_impl(core, biome)
setvar(core, 0, VEG_C(biome), veg_c0, "Pg C")
setvar(core, 0, DETRITUS_C(biome), detritus_c0, "Pg C")
setvar(core, 0, SOIL_C(biome), soil_c0, "Pg C")
setvar(core, 0, PERMAFROST_C(biome), permafrost_c0, "Pg C")
setvar(core, NA, NPP_FLUX0(biome), npp_flux0, "Pg C/yr")
setvar(core, NA, WARMINGFACTOR(biome), warmingfactor, NA)
setvar(core, NA, BETA(biome), beta, NA)
setvar(core, NA, Q10_RH(biome), q10_rh, NA)
setvar(core, NA, F_NPPV(biome), f_nppv, NA)
setvar(core, NA, F_NPPD(biome), f_nppd, NA)
setvar(core, NA, F_LITTERD(biome), f_litterd, NA)
invisible(core)
create_biome_impl(core, biome)
setvar(core, 0, VEG_C(biome), veg_c0, "Pg C")
setvar(core, 0, DETRITUS_C(biome), detritus_c0, "Pg C")
setvar(core, 0, SOIL_C(biome), soil_c0, "Pg C")
setvar(core, 0, PERMAFROST_C(biome), permafrost_c0, "Pg C")
setvar(core, NA, NPP_FLUX0(biome), npp_flux0, "Pg C/yr")
setvar(core, NA, WARMINGFACTOR(biome), warmingfactor, NA)
setvar(core, NA, BETA(biome), beta, NA)
setvar(core, NA, Q10_RH(biome), q10_rh, NA)
setvar(core, NA, F_NPPV(biome), f_nppv, NA)
setvar(core, NA, F_NPPD(biome), f_nppd, NA)
setvar(core, NA, F_LITTERD(biome), f_litterd, NA)
invisible(core)
}

#' Create new biomes by splitting up an existing biome
Expand Down Expand Up @@ -67,64 +67,66 @@ split_biome <- function(core,
fpermafrost_c = fveg_c,
fnpp_flux0 = fveg_c,
...) {
stopifnot(
length(old_biome) == 1,
old_biome %in% get_biome_list(core),
!any(new_biomes %in% get_biome_list(core)),
length(fveg_c) == length(new_biomes),
length(fdetritus_c) == length(new_biomes),
length(fsoil_c) == length(new_biomes),
length(fpermafrost_c) == length(new_biomes),
length(fnpp_flux0) == length(new_biomes),
sum(fveg_c) == 1, all(fveg_c > 0),
sum(fdetritus_c) == 1, all(fdetritus_c > 0),
sum(fsoil_c) == 1, all(fsoil_c > 0),
sum(fpermafrost_c) == 1, all(fpermafrost_c >= 0),
sum(fnpp_flux0) == 1, all(fnpp_flux0 > 0)
)
stopifnot(
length(old_biome) == 1,
old_biome %in% get_biome_list(core),
!any(new_biomes %in% get_biome_list(core)),
length(fveg_c) == length(new_biomes),
length(fdetritus_c) == length(new_biomes),
length(fsoil_c) == length(new_biomes),
length(fpermafrost_c) == length(new_biomes),
length(fnpp_flux0) == length(new_biomes),
sum(fveg_c) == 1, all(fveg_c > 0),
sum(fdetritus_c) == 1, all(fdetritus_c > 0),
sum(fsoil_c) == 1, all(fsoil_c > 0),
sum(fpermafrost_c) == 1, all(fpermafrost_c >= 0),
sum(fnpp_flux0) == 1, all(fnpp_flux0 > 0)
)

# If user supplied values in ... for warmingfactor, etc., use those
# Otherwise use the old biome's values
cv <- get_biome_inits(core, old_biome) # current values
dots <- list(...)
# We can't use ifelse for this because return shape may differ
pick <- function(x, y) { if (is.null(x)) y else x } # nolint
warmingfactor <- pick(dots$warmingfactor, cv[["warmingfactor"]])
beta <- pick(dots$beta, cv[["beta"]])
q10_rh <- pick(dots$q10_rh, cv[["q10_rh"]])
f_nppv <- pick(dots$f_nppv, cv[["f_nppv"]])
f_nppd <- pick(dots$f_nppd, cv[["f_nppd"]])
f_litterd <- pick(dots$f_litterd, cv[["f_litterd"]])
# If user supplied values in ... for warmingfactor, etc., use those
# Otherwise use the old biome's values
cv <- get_biome_inits(core, old_biome) # current values
dots <- list(...)
# We can't use ifelse for this because return shape may differ
pick <- function(x, y) {
if (is.null(x)) y else x
} # nolint
warmingfactor <- pick(dots$warmingfactor, cv[["warmingfactor"]])
beta <- pick(dots$beta, cv[["beta"]])
q10_rh <- pick(dots$q10_rh, cv[["q10_rh"]])
f_nppv <- pick(dots$f_nppv, cv[["f_nppv"]])
f_nppd <- pick(dots$f_nppd, cv[["f_nppd"]])
f_litterd <- pick(dots$f_litterd, cv[["f_litterd"]])

# This allows users to split the `global` biome without having to
# rename it first. Otherwise, we hit an error about using non-global
# biomes when a "global" biome is present.
if (old_biome == "global") {
invisible(rename_biome(core, "global", "_zzz"))
old_biome <- "_zzz"
}
# This allows users to split the `global` biome without having to
# rename it first. Otherwise, we hit an error about using non-global
# biomes when a "global" biome is present.
if (old_biome == "global") {
invisible(rename_biome(core, "global", "_zzz"))
old_biome <- "_zzz"
}

mapply(
create_biome,
biome = new_biomes,
veg_c0 = cv[["veg_c"]] * fveg_c,
detritus_c0 = cv[["detritus_c"]] * fdetritus_c,
soil_c0 = cv[["soil_c"]] * fsoil_c,
permafrost_c0 = cv[["permafrost_c"]] * fpermafrost_c,
npp_flux0 = cv[["npp_flux0"]] * fnpp_flux0,
warmingfactor = warmingfactor,
beta = beta,
q10_rh = q10_rh,
f_nppv = f_nppv,
f_nppd = f_nppd,
f_litterd = f_litterd,
MoreArgs = list(core = core)
)
mapply(
create_biome,
biome = new_biomes,
veg_c0 = cv[["veg_c"]] * fveg_c,
detritus_c0 = cv[["detritus_c"]] * fdetritus_c,
soil_c0 = cv[["soil_c"]] * fsoil_c,
permafrost_c0 = cv[["permafrost_c"]] * fpermafrost_c,
npp_flux0 = cv[["npp_flux0"]] * fnpp_flux0,
warmingfactor = warmingfactor,
beta = beta,
q10_rh = q10_rh,
f_nppv = f_nppv,
f_nppd = f_nppd,
f_litterd = f_litterd,
MoreArgs = list(core = core)
)

delete_biome_impl(core, old_biome)
delete_biome_impl(core, old_biome)

reset(core, 0)
invisible(core)
reset(core, 0)
invisible(core)
}

#' Retrieve the initial conditions and parameters for a given biome
Expand All @@ -136,29 +138,29 @@ split_biome <- function(core,
#' @return Named numeric vector of biome initial conditions and parameters
#' @author Alexey Shiklomanov
get_biome_inits <- function(core, biome) {
# `fetchvars` requires date to be between start and end date, so
# we need to call the lower-level `sendmessage` method here.
current_data_1 <- rbind.data.frame(
sendmessage(core, GETDATA(), VEG_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), DETRITUS_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), SOIL_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), PERMAFROST_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), THAWEDP_C(biome), 0, NA, "")
)
current_data_2 <- fetchvars(core, NA, c(
NPP_FLUX0(biome),
F_LITTERD(biome),
F_NPPD(biome),
F_NPPV(biome),
BETA(biome),
Q10_RH(biome),
WARMINGFACTOR(biome)
))[, -1]
current_data <- rbind.data.frame(current_data_1, current_data_2)
current_values <- current_data[["value"]]
names(current_values) <- gsub(paste0(biome, BIOME_SPLIT_CHAR()), "",
current_data[["variable"]],
fixed = TRUE
)
current_values
# `fetchvars` requires date to be between start and end date, so
# we need to call the lower-level `sendmessage` method here.
current_data_1 <- rbind.data.frame(
sendmessage(core, GETDATA(), VEG_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), DETRITUS_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), SOIL_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), PERMAFROST_C(biome), 0, NA, ""),
sendmessage(core, GETDATA(), THAWEDP_C(biome), 0, NA, "")
)
current_data_2 <- fetchvars(core, NA, c(
NPP_FLUX0(biome),
F_LITTERD(biome),
F_NPPD(biome),
F_NPPV(biome),
BETA(biome),
Q10_RH(biome),
WARMINGFACTOR(biome)
))[, -1]
current_data <- rbind.data.frame(current_data_1, current_data_2)
current_values <- current_data[["value"]]
names(current_values) <- gsub(paste0(biome, BIOME_SPLIT_CHAR()), "",
current_data[["variable"]],
fixed = TRUE
)
current_values
}
37 changes: 28 additions & 9 deletions R/fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,33 @@
#' getfxn("beta")
#' getfxn("q10_rh")
getfxn <- function(str) {
rows <- match(str, hector::fxntable$string)
rslt <- hector::fxntable$fxn[rows]
if (any(is.na(rows))) {
warning(
"Functions for the following are not found: ",
paste(str[is.na(rslt)], collapse = ", ")
)
}
as.character(rslt)
}


rows <- match(str, hector::fxntable$string)
rslt <- hector::fxntable$fxn[rows]
if (any(is.na(rows))) {
warning(
"Functions for the following are not found: ",
paste(str[is.na(rslt)], collapse = ", ")
)
}
as.character(rslt)
#' Get all of the possible Hector output variables
#'
#' This function returns all of the possible hector output variables
#' that can be accessed with \code{\link{fetchvars}}.
#' @return Character vector of variable names.
#' @export
#' @family outputs
#' @examples
#' \dontrun{
#' ini <- system.file(package = "hector", "input/hector_ssp245.ini")
#' hc <- newcore(ini)
#' run(hc)
#' out <- fetchvars(core = hc, dates = 1900:2100, vars = ALL_VARS())
#' print(out)
#' }
ALL_VARS <- function() {
hector::all_vars
}
Loading
Loading