Skip to content

Commit 941dc8d

Browse files
authored
Enable global mean surface temperature as Hector output (#701)
Save global mean surface temperature and return it as Hector output. Update the Hector version in preparation for a new release.
1 parent 2f4d29a commit 941dc8d

13 files changed

+62
-9
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: hector
22
Title: The Hector Simple Climate Model
3-
Version: 3.0.1
3+
Version: 3.1.0
44
Authors@R: c(person("Kalyn", "Dorheim",
55
email = "[email protected]",
66
role = c("aut", "cre"),

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export(F_LITTERD)
107107
export(F_NPPD)
108108
export(F_NPPV)
109109
export(GLOBAL_TAS)
110+
export(GMST)
110111
export(HALON1211_CONSTRAIN)
111112
export(HALON1301_CONSTRAIN)
112113
export(HALON2402_CONSTRAIN)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# hector 3.1.0
2+
3+
Return global mean surface temperature as a Hector output.
4+
15
# hector 3.0.1
26

37
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7617326.svg)](https://doi.org/10.5281/zenodo.7617326)

R/RcppExports.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,12 @@ GLOBAL_TAS <- function() {
14981498
.Call('_hector_GLOBAL_TAS', PACKAGE = 'hector')
14991499
}
15001500

1501+
#' @describeIn temperature Global mean surface temperature anomaly
1502+
#' @export
1503+
GMST <- function() {
1504+
.Call('_hector_GMST', PACKAGE = 'hector')
1505+
}
1506+
15011507
#' @describeIn temperature Average sea surface temperature anomaly
15021508
#' @export
15031509
SST <- function() {

inst/include/component_data.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@
394394
#define D_LAND_TAS "land_tas"
395395
#define D_SST "sst"
396396
#define D_OCEAN_TAS "ocean_tas"
397+
#define D_GMST "gmst"
397398
#define D_LO_WARMING_RATIO "lo_warming_ratio"
398399
#define D_DIFFUSIVITY "diff"
399400
#define D_AERO_SCALE "alpha"

inst/include/temperature_component.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class TemperatureComponent : public IModelComponent {
133133

134134
// Time series arrays that are updated with each DOECLIM time-step
135135
std::vector<double> temp;
136+
std::vector<double> temp_surface;
136137
std::vector<double> temp_landair;
137138
std::vector<double> temp_sst;
138139
std::vector<double> heatflux_mixed;
@@ -148,7 +149,8 @@ class TemperatureComponent : public IModelComponent {
148149
unitval volscl; //!< volcanic forcing scaling factor, unitless
149150

150151
// Model outputs
151-
unitval tas; //!< global average surface air temperature anomaly, deg C
152+
unitval tas; //!< global average air temperature anomaly, deg C
153+
unitval gmst_val; //!< global average surface temperature anomaly, deg C
152154
unitval tas_land; //!< average air temperature anomaly over land, deg C
153155
unitval tas_ocean; //!< global average ocean surface air temperature anomaly,
154156
//!< deg C

man/temperature.Rd

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,16 @@ BEGIN_RCPP
25072507
return rcpp_result_gen;
25082508
END_RCPP
25092509
}
2510+
// GMST
2511+
String GMST();
2512+
RcppExport SEXP _hector_GMST() {
2513+
BEGIN_RCPP
2514+
Rcpp::RObject rcpp_result_gen;
2515+
Rcpp::RNGScope rcpp_rngScope_gen;
2516+
rcpp_result_gen = Rcpp::wrap(GMST());
2517+
return rcpp_result_gen;
2518+
END_RCPP
2519+
}
25102520
// SST
25112521
String SST();
25122522
RcppExport SEXP _hector_SST() {
@@ -2993,6 +3003,7 @@ static const R_CallMethodDef CallEntries[] = {
29933003
{"_hector_AERO_SCALE", (DL_FUNC) &_hector_AERO_SCALE, 0},
29943004
{"_hector_VOLCANIC_SCALE", (DL_FUNC) &_hector_VOLCANIC_SCALE, 0},
29953005
{"_hector_GLOBAL_TAS", (DL_FUNC) &_hector_GLOBAL_TAS, 0},
3006+
{"_hector_GMST", (DL_FUNC) &_hector_GMST, 0},
29963007
{"_hector_SST", (DL_FUNC) &_hector_SST, 0},
29973008
{"_hector_OCEAN_TAS", (DL_FUNC) &_hector_OCEAN_TAS, 0},
29983009
{"_hector_LAND_TAS", (DL_FUNC) &_hector_LAND_TAS, 0},

src/csv_outputstream_visitor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ void CSVOutputStreamVisitor::visit(TemperatureComponent *c) {
231231
if (!core->outputEnabled(c->getComponentName()))
232232
return;
233233
STREAM_MESSAGE(csvFile, c, D_GLOBAL_TAS);
234+
STREAM_MESSAGE(csvFile, c, D_GMST);
234235
STREAM_MESSAGE(csvFile, c, D_FLUX_MIXED);
235236
STREAM_MESSAGE(csvFile, c, D_FLUX_INTERIOR)
236237
STREAM_MESSAGE(csvFile, c, D_HEAT_FLUX);

src/rcpp_constants.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,11 @@ String VOLCANIC_SCALE() { return D_VOLCANIC_SCALE; }
14441444
// [[Rcpp::export]]
14451445
String GLOBAL_TAS() { return D_GLOBAL_TAS; }
14461446

1447+
//' @describeIn temperature Global mean surface temperature anomaly
1448+
//' @export
1449+
// [[Rcpp::export]]
1450+
String GMST() { return D_GMST; }
1451+
14471452
//' @describeIn temperature Average sea surface temperature anomaly
14481453
//' @export
14491454
// [[Rcpp::export]]

0 commit comments

Comments
 (0)