Skip to content

Commit 40c512d

Browse files
authored
Merge pull request #298 from JGCRI/land-ocean-branch
Report land and ocean temperatures Version 2.2.1
2 parents 00c3da0 + 2819a2b commit 40c512d

14 files changed

+143
-4
lines changed

DESCRIPTION

Lines changed: 3 additions & 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: 2.2.0
3+
Version: 2.2.1
44
Authors@R: c(person("Robert", "Link", email = "[email protected]", role = c("aut", "cre")),
55
person("Corinne", "Hartin", email = "[email protected]", role = "aut"),
66
person("Ben", "Bond-Lamberty", email = "[email protected]", role = "aut"),
@@ -21,6 +21,8 @@ Suggests:
2121
knitr,
2222
rmarkdown,
2323
ggplot2,
24+
tidyr (>= 0.7),
25+
dplyr (>= 0.7),
2426
hectortools
2527
Remotes:
2628
jgcri/hectortools

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export(GLOBAL_TEMP)
6464
export(GLOBAL_TEMPEQ)
6565
export(HEAT_FLUX)
6666
export(LAND_CFLUX)
67+
export(LAND_TEMP)
6768
export(LIFETIME_SOIL)
6869
export(LIFETIME_STRAT)
6970
export(LL_DEBUG)
@@ -73,12 +74,14 @@ export(LL_WARNING)
7374
export(LUC_EMISSIONS)
7475
export(NATURAL_CH4)
7576
export(NATURAL_SO2)
77+
export(OCEAN_AIR_TEMP)
7678
export(OCEAN_C)
7779
export(OCEAN_CFLUX)
7880
export(OCEAN_C_DO)
7981
export(OCEAN_C_HL)
8082
export(OCEAN_C_IO)
8183
export(OCEAN_C_LL)
84+
export(OCEAN_SURFACE_TEMP)
8285
export(PCO2_HL)
8386
export(PCO2_LL)
8487
export(PH_HL)

R/RcppExports.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,24 @@ GLOBAL_TEMPEQ <- function() {
790790
.Call('_hector_GLOBAL_TEMPEQ', PACKAGE = 'hector')
791791
}
792792

793+
#' @describeIn temperature Average ocean surface temperature anomaly
794+
#' @export
795+
OCEAN_SURFACE_TEMP <- function() {
796+
.Call('_hector_OCEAN_SURFACE_TEMP', PACKAGE = 'hector')
797+
}
798+
799+
#' @describeIn temperature Average ocean air temperature anomaly
800+
#' @export
801+
OCEAN_AIR_TEMP <- function() {
802+
.Call('_hector_OCEAN_AIR_TEMP', PACKAGE = 'hector')
803+
}
804+
805+
#' @describeIn temperature Average land temperature anomaly
806+
#' @export
807+
LAND_TEMP <- function() {
808+
.Call('_hector_LAND_TEMP', PACKAGE = 'hector')
809+
}
810+
793811
#' @describeIn parameters Ocean heat diffusivity (\code{"cm2/s"})
794812
#' @export
795813
DIFFUSIVITY <- function() {

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Hector 2.2.1
2+
============
3+
* Report global averages for land temperature, ocean air
4+
temperature, and ocean surface temperature.
5+
* Fix bug that prevented CH4 emissions from being read.
6+
17
Hector 2.2.0
28
============
39
* Add a new parameter: VOLCANIC_SCALE. This parameter adjusts the

inst/include/component_data.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@
242242
// temperature component
243243
#define D_ECS "S"
244244
#define D_GLOBAL_TEMP "Tgav"
245+
#define D_LAND_TEMP "Tgav_land"
246+
#define D_OCEAN_SURFACE_TEMP "Tgav_ocean_ST"
247+
#define D_OCEAN_AIR_TEMP "Tgav_ocean_air"
245248
#define D_GLOBAL_TEMPEQ "Tgaveq"
246249
#define D_TGAV_CONSTRAIN "tgav_constrain"
247250
#define D_SO2D_B "so2d_b"

inst/include/h_util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* \brief The model version number to be included in logs and outputs.
2727
* \note This must be updated manually when the model version changes.
2828
*/
29-
#define MODEL_VERSION "2.2.0"
29+
#define MODEL_VERSION "2.2.1"
3030

3131
#define OUTPUT_DIRECTORY "output/"
3232

inst/include/temperature_component.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ class TemperatureComponent : public IModelComponent {
137137
unitval volscl; //!< volcanic forcing scaling factor, unitless
138138

139139
// Model outputs
140-
unitval tgav; //!< global temperature delta, deg C
140+
unitval tgav; //!< global average surface air temperature anomaly, deg C
141+
unitval tgav_land; //!< global average land surface air temperature anomaly, deg C
142+
unitval tgav_oceanair; //!< global average ocean surface air temperature anomaly, deg C
143+
unitval tgav_sst; //!< global average ocean surface (water) temperature anomaly, deg C
141144
unitval tgaveq; //!< equilibrium temp without ocean heat flux, currently set = tgav
142145
unitval flux_mixed; //!< heat flux into mixed layer of ocean, W/m2
143146
unitval flux_interior; //!< heat flux into interior layer of ocean, W/m2

man/temperature.Rd

Lines changed: 15 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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,36 @@ BEGIN_RCPP
13151315
return rcpp_result_gen;
13161316
END_RCPP
13171317
}
1318+
// OCEAN_SURFACE_TEMP
1319+
String OCEAN_SURFACE_TEMP();
1320+
RcppExport SEXP _hector_OCEAN_SURFACE_TEMP() {
1321+
BEGIN_RCPP
1322+
Rcpp::RObject rcpp_result_gen;
1323+
Rcpp::RNGScope rcpp_rngScope_gen;
1324+
rcpp_result_gen = Rcpp::wrap(OCEAN_SURFACE_TEMP());
1325+
return rcpp_result_gen;
1326+
END_RCPP
1327+
}
1328+
// OCEAN_AIR_TEMP
1329+
String OCEAN_AIR_TEMP();
1330+
RcppExport SEXP _hector_OCEAN_AIR_TEMP() {
1331+
BEGIN_RCPP
1332+
Rcpp::RObject rcpp_result_gen;
1333+
Rcpp::RNGScope rcpp_rngScope_gen;
1334+
rcpp_result_gen = Rcpp::wrap(OCEAN_AIR_TEMP());
1335+
return rcpp_result_gen;
1336+
END_RCPP
1337+
}
1338+
// LAND_TEMP
1339+
String LAND_TEMP();
1340+
RcppExport SEXP _hector_LAND_TEMP() {
1341+
BEGIN_RCPP
1342+
Rcpp::RObject rcpp_result_gen;
1343+
Rcpp::RNGScope rcpp_rngScope_gen;
1344+
rcpp_result_gen = Rcpp::wrap(LAND_TEMP());
1345+
return rcpp_result_gen;
1346+
END_RCPP
1347+
}
13181348
// DIFFUSIVITY
13191349
String DIFFUSIVITY();
13201350
RcppExport SEXP _hector_DIFFUSIVITY() {
@@ -1575,6 +1605,9 @@ static const R_CallMethodDef CallEntries[] = {
15751605
{"_hector_VOLCANIC_SCALE", (DL_FUNC) &_hector_VOLCANIC_SCALE, 0},
15761606
{"_hector_GLOBAL_TEMP", (DL_FUNC) &_hector_GLOBAL_TEMP, 0},
15771607
{"_hector_GLOBAL_TEMPEQ", (DL_FUNC) &_hector_GLOBAL_TEMPEQ, 0},
1608+
{"_hector_OCEAN_SURFACE_TEMP", (DL_FUNC) &_hector_OCEAN_SURFACE_TEMP, 0},
1609+
{"_hector_OCEAN_AIR_TEMP", (DL_FUNC) &_hector_OCEAN_AIR_TEMP, 0},
1610+
{"_hector_LAND_TEMP", (DL_FUNC) &_hector_LAND_TEMP, 0},
15781611
{"_hector_DIFFUSIVITY", (DL_FUNC) &_hector_DIFFUSIVITY, 0},
15791612
{"_hector_FLUX_MIXED", (DL_FUNC) &_hector_FLUX_MIXED, 0},
15801613
{"_hector_FLUX_INTERIOR", (DL_FUNC) &_hector_FLUX_INTERIOR, 0},

src/ch4_component.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ unitval CH4Component::getData( const std::string& varName,
172172
} else if( varName == D_PREINDUSTRIAL_CH4 ) {
173173
H_ASSERT( date == Core::undefinedIndex(), "Date not allowed for preindustrial CH4" );
174174
returnval = M0;
175+
} else if( varName == D_EMISSIONS_CH4 ) {
176+
H_ASSERT( date != Core::undefinedIndex(), "Date not allowed for CH4 emissions" );
177+
returnval = CH4_emissions.get( date );
175178
} else {
176179
H_THROW( "Caller is requesting unknown variable: " + varName );
177180
}

0 commit comments

Comments
 (0)