You can(not) install the released version of codos from CRAN with:
install.packages("codos")
And the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("special-uor/codos", "dev")
cat(paste0("
-----
Note: Some of the equations on this document are not displayed properly (due to a server issue), check out the [README-extended.pdf](README-extended.pdf).
-----
"))
Note: Some of the equations on this document are not displayed properly (due to a server issue), check out the README-extended.pdf.
vpd
is given by mean daily growing season temperature, tmp
[°C]
and moisture index, mi
[-]. Using the CRU TS 4.04 dataset
(University of East Anglia Climatic Research Unit et al. 2020) we found
the following relation:
The steps performed were:
- Generate a monthly climatology for the period between 1961 and 1990
(inclusive). Variables used:
cld
,pre
,tmn
,tmx
,vap
.
# Monthly climatology for `tmn`
codos::monthly_clim("cru_ts4.04.1901.2019.tmn.dat.nc", "tmn", 1961, 1990)
Output file:
"cru_ts4.04.1901.2019.tmn.dat-clim-1961-1990.nc"
- Interpolate the monthly data to daily. Variables used:
cld
,pre
,tmn
,tmx
,vap
.
# Monthly to daily interpolation for `tmn`
codos::nc_int("cru_ts4.04.1901.2019.tmn.dat-clim-1961-1990.nc", "tmn")
Output file:
"cru_ts4.04.1901.2019.tmn.dat-clim-1961-1990-int.nc"
- Calculate daily temperature,
tmp
. Variables used:tmn
andtmx
.
codos::daily_temp(tmin = list(filename = "cru_ts4.04.1901.2019.tmn.dat-clim-1961-1990-int.nc",
id = "tmn"),
tmax = list(filename = "cru_ts4.04.1901.2019.tmx.dat-clim-1961-1990-int.nc",
id = "tmx"),
output_filename = "cru_ts4.04-clim-1961-1990-daily.tmp.nc")
- Calculate mean growing season for daily temperature
codos::nc_gs("cru_ts4.04-clim-1961-1990-daily.tmp.nc", "tmp", thr = 0)
Output file:
"cru_ts4.04-clim-1961-1990-daily.tmp-gs.nc"
- Calculate potential evapotranspiration (
pet
)
Install SPLASH
(unofficial R package) as follows:
remotes::install_github("villegar/splash", "dev")
Or, download from the official source: https://bitbucket.org/labprentice/splash.
elv <- codos:::nc_var_get("halfdeg.elv.nc", "elv")$data
tmp <- codos:::nc_var_get("cru_ts4.04.1901.2019.daily.tmp.nc", "tmp")$data
cld <- codos:::nc_var_get("cru_ts4.04.1901.2019.cld.dat-clim-1961-1990-int.nc",
"cld")$data
codos::splash_evap(output_filename = "cru_ts4.04-clim-1961-1990-pet.nc",
elv, # Elevation, 720x360 grid
sf = 1 - cld / 100,
tmp,
year = 1961, # Reference year
lat = codos::lat,
lon = codos::lon)
Output file:
"cru_ts4.04-clim-1961-1990-pet.nc"
- Calculate moisture index (
mi
)
pet <- codos:::nc_var_get("cru_ts4.04-clim-1961-1990-pet.nc",
"pet")$data
pre <- codos:::nc_var_get("cru_ts4.04.1901.2019.pre.dat-new-clim-1961-1990-int.nc",
"pre")$data
codos::nc_mi(output_filename = "cru_ts4.04-clim-1961-1990-mi.nc",
pet, # potential evapotranspiration
pre) # precipitation
Output file:
"cru_ts4.04-clim-1961-1990-mi.nc"
- Approximate
vpd
tmp <- codos:::nc_var_get("cru_ts4.04-clim-1961-1990-daily.tmp.nc",
"tmp")$data
vap <- codos:::nc_var_get("cru_ts4.04.1901.2019.vap.dat-clim-1961-1990-int.nc",
"vap")$data
output_filename <- file.path(path, "cru_ts4.04-clim-1961-1990-vpd-tmp.nc")
codos::nc_vpd(output_filename, tmp, vap)
Output file:
"cru_ts4.04-clim-1961-1990-vpd-tmp.nc"
- Find the coeffients for the following equation
mi <- codos:::nc_var_get("cru_ts4.04-clim-1961-1990-mi.nc", "mi")$data
Tmp <- codos:::nc_var_get("cru_ts4.04-clim-1961-1990-daily.tmp-gs.nc", "tmp")$data
vpd <- codos:::nc_var_get("cru_ts4.04-clim-1961-1990-vpd-tmp-gs.nc", "vpd")$data
# Apply ice mask
mi[codos:::ice_mask] <- NA
Tmp[codos:::ice_mask] <- NA
vpd[codos:::ice_mask] <- NA
# Filter low temperatures, Tmp < 5
mi[Tmp < 5] <- NA
Tmp[Tmp < 5] <- NA
# Create data frame
df <- tibble::tibble(Tmp = c(Tmp),
vpd = c(vpd),
MI = c(mi))
# Filter grid cells with missing Tmp, vpd, or MI
df <- df[!is.na(df$Tmp) & !is.na(df$vpd) & !is.na(df$MI), ]
# Linear approximation
lmod <- lm(log(vpd) ~ Tmp + MI, data = df)
# Non-linear model
exp_mod <- nls(vpd ~ a * exp(kTmp * Tmp - kMI * MI),
df,
start = list(a = exp(coef(lmod)[1]),
kTmp = coef(lmod)[2],
kMI = coef(lmod)[3]),
control = list(maxiter = 200))
Summary statistics:
summary(exp_mod)
coefficients(exp_mod)
The following equations were used:
where:
- ratio of water lost to carbon fixed [–]
- vapour pressure deficit [Pa]
- ambient CO2 partial pressure [Pa]
- ratio of leaf-internal to ambient CO2 partial pressures [–]
- stomatal sensitivity factor [Pa1/2]
- photorespiratory compensation point [Pa]: a function of temperature and elevation
- ratio of cost factors for carboxylation and transpiration = 146 [–]
- effective Michaelis constant of Rubisco [Pa]: a function of temperature and elevation
- viscosity of water relative to its value at 25°C [–]
And the equilibrium relation:
where:
- past temperature (assume equal to reconstructed value) [K]
- past MI (unknown) [–]
- past ambient CO2 partial pressure [Pa], adjusted for elevation
- present temperature [K]
- reconstructed MI [–]
- ‘recent’ ambient CO2 partial pressure [Pa], adjusted for elevation
Steps in the solution:
where:
Using codos
, all the steps translate to a simple function call
corrected_mi <- codos::corrected_mi(present_t,
past_temp,
recon_mi,
modern_co2,
past_co2)
Note that this function takes temperatures in [°C] and ambient
CO partial pressures
in
[] (unless, scale_factor
is overwritten,
e.g. scale_factor = 1
to use ambient
CO partial pressures
in [Pa]).
More details:
?codos::corrected_mi
University of East Anglia Climatic Research Unit, Ian C. Harris, Philip D. Jones, and Tim Osborn. 2020. CRU TS4.04: Climatic Research Unit (CRU) Time-Series (TS) Version 4.04 of High-Resolution Gridded Data of Month-by-Month Variation in Climate (Jan. 1901- Dec. 2019). Centre for Environmental Data Analysis. https://catalogue.ceda.ac.uk/uuid/89e1e34ec3554dc98594a5732622bce9.