View source: R/micro_access_s2.R
micro_access_s2 | R Documentation |
An implementation of the NicheMapR microclimate model that uses the ACCESS-S2 daily seasonal weather forecast and specifically uses the following variables: rain, tmax, tmin, rain, vpr, radn.
micro_USA(loc = c(-117.8919161, 36.582016), dstart = "01/01/2016", dfinish = "31/12/2016",
REFL = 0.15, slope = 0, aspect = 0, DEP = c(0, 2.5, 5, 10, 15, 20, 30, 50, 100, 200), minshade = 0, maxshade = 90,
Usrhyt = 0.01, ...)
loc |
Longitude and latitude (decimal degrees) |
dstart |
First day to run, date in format "d/m/Y" e.g. "01/01/2016" |
dfinish |
Last day to run, date in format "d/m/Y" e.g. "31/12/2016" |
dem |
A digital elevation model produced by microclima function 'get_dem' via R package 'elevatr' (internally generated via same function based on 'loc' if NA) |
dem.res |
Requested resolution of the DEM from elevatr, m |
pixels |
Number of pixels along one edge of square requested of DEM requested from elevatr, # |
ensemble |
Forecast ensemble to use |
REFL |
Soil solar reflectance, decimal % |
elev |
Elevation, if to be user specified (m) |
slope |
Slope in degrees |
aspect |
Aspect in degrees (0 = north) |
DEP |
Soil depths at which calculations are to be made (cm), must be 10 values starting from 0, and more closely spaced near the surface |
minshade |
Minimum shade level to use (%) (can be a single value or a vector of daily values) |
maxshade |
Maximum shade level to us (%) (can be a single value or a vector of daily values) |
Usrhyt |
Local height (m) at which air temperature, wind speed and humidity are to be computed for organism of interest |
... |
Additional arguments, see Details |
Parameters controlling how the model runs:
runshade
= 1, Run the microclimate model twice, once for each shade level (1) or just once for the minimum shade (0)?
clearsky
= 0, Run for clear skies (1) or with observed cloud cover (0)
run.gads
= 1, Use the Global Aerosol Database? 1=yes (Fortran version), 2=yes (R version), 0=no
lamb
= 0, Return wavelength-specific solar radiation output?
IR
= 0, Clear-sky longwave radiation computed using Campbell and Norman (1998) eq. 10.10 (includes humidity) (0) or Swinbank formula (1)
solonly
= 0, Only run SOLRAD to get solar radiation? 1=yes, 0=no
IUV
= 0, Use gamma function for scattered solar radiation? (computationally intensive)
Soil_Init
= NA, initial soil temperature at each soil node, °C (if NA, will use the mean air temperature to initialise)
microclima
= 0, Use microclima and elevatr package to adjust solar radiation for terrain? 1 = yes, 0 = no
write_input
= 0, Write csv files of final input to folder 'csv input' in working directory? 1=yes, 0=no
writecsv
= 0, Make Fortran code write output as csv files? 1=yes, 0=no
windfac
= 1, factor to multiply wind speed by e.g. to simulate forest
adiab_cor
= 1, use adiabatic lapse rate correction? 1=yes, 0=no
warm
= 0, warming offset vector, °C (negative values mean cooling). Can supply a single value or a vector the length of the number of days to be simulated.
spatial
= "C:/Users/mrke/OneDrive - The University of Melbourne/Documents/Spatial_Data/ACCESS-S2/20240701_", choose location of ACCESS-S2 data and specify the prefix
access_sw
= "C:/Users/mrke/OneDrive - The University of Melbourne/Documents/Spatial_Data/", choose location of spatial data
soilgrids
= 0, query soilgrids.org database for soil hydraulic properties?
message
= 0, allow the Fortran integrator to output warnings? (1) or not (0)
fail
= nyears x 24 x 365, how many restarts of the integrator before the Fortran program quits (avoids endless loops when solutions can't be found)
save
= 0, don't save forcing data (0), save the forcing data (1) or read previously saved data (2)
General additional parameters:
ERR
= 1.5, Integrator error tolerance for soil temperature calculations
Refhyt
= 2, Reference height (m), reference height at which air temperature, wind speed and relative humidity input data are measured
RUF
= 0.004, Roughness height (m), e.g. smooth desert is 0.0003, closely mowed grass may be 0.001, bare tilled soil 0.002-0.006, current allowed range: 0.00001 (snow) - 0.02 m.
ZH
= 0, heat transfer roughness height (m) for Campbell and Norman air temperature/wind speed profile (invoked if greater than 0, 0.02 * canopy height in m if unknown)
D0
= 0, zero plane displacement correction factor (m) for Campbell and Norman air temperature/wind speed profile (0.6 * canopy height in m if unknown)
Z01
= 0, Top (1st) segment roughness height(m) - IF NO EXPERIMENTAL WIND PROFILE DATA SET THIS TO ZERO! (then RUF and Refhyt used)
Z02
= 0, 2nd segment roughness height(m) - IF NO EXPERIMENTAL WIND PROFILE DATA SET THIS TO ZERO! (then RUF and Refhyt used).
ZH1
= 0, Top of (1st) segment, height above surface(m) - IF NO EXPERIMENTAL WIND PROFILE DATA SET THIS TO ZERO! (then RUF and Refhyt used).
ZH2
= 0, 2nd segment, height above surface(m) - IF NO EXPERIMENTAL WIND PROFILE DATA SET THIS TO ZERO! (then RUF and Refhyt used).
EC
= 0.0167238, Eccenricity of the earth's orbit (current value 0.0167238, ranges between 0.0034 to 0.058)
SLE
= 0.95, Substrate longwave IR emissivity (decimal %), typically close to 1
Thcond
= 2.5, Soil minerals thermal conductivity, single value or vector of 10 specific to each depth (W/mK)
Density
= 2.56, Soil minerals density, single value or vector of 10 specific to each depth (Mg/m3)
SpecHeat
= 870, Soil minerals specific heat, single value or vector of 10 specific to each depth (J/kg-K)
BulkDensity
= 1.3, Soil bulk density (Mg/m3), single value or vector of 10 specific to each depth
PCTWET
= 0, % of ground surface area acting as a free water surface (overridden if soil moisture model is running)
rainwet
= 1.5, mm of rainfall causing the ground to be 90% wet for the day
cap
= 1, organic cap present on soil surface? (cap has lower conductivity - 0.2 W/mC - and higher specific heat 1920 J/kg-K)
CMH2O
= 1, Precipitable cm H2O in air column, 0.1 = very dry; 1.0 = moist air conditions; 2.0 = humid, tropical conditions (note this is for the whole atmospheric profile, not just near the ground)
hori
= rep(0,24), Horizon angles (degrees), from 0 degrees azimuth (north) clockwise in 15 degree intervals
lapse_min
= 0.0039 Lapse rate for minimum air temperature (degrees C/m)
lapse_max
= 0.0077 Lapse rate for maximum air temperature (degrees C/m)
TIMAXS
= c(1.0, 1.0, 0.0, 0.0), Time of Maximums for Air Wind RelHum Cloud (h), air & Wind max's relative to solar noon, humidity and cloud cover max's relative to sunrise
TIMINS
= c(0, 0, 1, 1), Time of Minimums for Air Wind RelHum Cloud (h), air & Wind min's relative to sunrise, humidity and cloud cover min's relative to solar noon
timezone
= 0, Use GNtimezone function in package geonames to correct to local time zone (excluding daylight saving correction)? 1=yes, 0=no
Soil moisture mode parameters:
runmoist
= 1, Run soil moisture model? 1=yes, 0=no 1=yes, 0=no (note that this may cause slower runs)
PE
= rep(1.1,19), Air entry potential (J/kg) (19 values descending through soil for specified soil nodes in parameter
DEP
and points half way between)
KS
= rep(0.0037,19), Saturated conductivity, (kg s/m3) (19 values descending through soil for specified soil nodes in parameter
DEP
and points half way between)
BB
= rep(4.5,19), Campbell's soil 'b' parameter (-) (19 values descending through soil for specified soil nodes in parameter
DEP
and points half way between)
BD
= rep(1.3,19), Soil bulk density (Mg/m3) (19 values descending through soil for specified soil nodes in parameter
DEP
and points half way between)
DD
= rep(2.56,19), Soil density (Mg/m3) (19 values descending through soil for specified soil nodes in parameter DEP and points half way between)
DEP
and points half way between)
maxpool
= 10000, Max depth for water pooling on the surface (mm), to account for runoff
rainmult
= 1, Rain multiplier for surface soil moisture (-), used to induce runon
rainoff
= 0, Rain offset (mm), used to induce changes in rainfall from GRIDMET values. Can be a single value or a vector matching the number of days to simulate. If negative values are used, rainfall will be prevented from becomming negative.
evenrain
= 0, Spread daily rainfall evenly across 24hrs (1) or one event at midnight (0)
SoilMoist_Init
= c(0.1,0.12,0.15,0.2,0.25,0.3,0.3,0.3,0.3,0.3), initial soil water content at each soil node, m3/m3
L
= c(0,0,8.2,8.0,7.8,7.4,7.1,6.4,5.8,4.8,4.0,1.8,0.9,0.6,0.8,0.4,0.4,0,0)*10000, root density (m/m3), (19 values descending through soil for specified soil nodes in parameter
R1
= 0.001, root radius, m
RW
= 2.5e+10, resistance per unit length of root, m3 kg-1 s-1
RL
= 2e+6, resistance per unit length of leaf, m3 kg-1 s-1
PC
= -1500, critical leaf water potential for stomatal closure, J kg-1
SP
= 10, stability parameter for stomatal closure equation, -
IM
= 1e-06, maximum allowable mass balance error, kg
MAXCOUNT
= 500, maximum iterations for mass balance, -
LAI
= 0.1, leaf area index (can be a single value or a vector of daily values), used to partition traspiration/evaporation from PET
microclima.LAI
= 0, leaf area index, used by package microclima for radiation calcs
microclima.LOR
= 1, leaf orientation for package microclima radiation calcs
Snow mode parameters:
snowmodel
= 1, run the snow model 1=yes, 0=no (note that this may cause slower runs)
snowtemp
= 1.5, Temperature (°C) at which precipitation falls as snow
snowdens
= 0.375, snow density (mg/m3), overridden by densfun
densfun
= c(0.5979, 0.2178, 0.001, 0.0038), slope and intercept of model of snow density as a linear function of snowpack age if first two values are nonzero, and following the exponential function of Sturm et al. 2010 J. of Hydromet. 11:1380-1394 if all values are non-zero; if it is c(0,0,0,0) then fixed density used
snowmelt
= 1, proportion of calculated snowmelt that doesn't refreeze
undercatch
= 1, undercatch multipier for converting rainfall to snow
rainmelt
= 0.0125, paramter in equation that melts snow with rainfall as a function of air temp
snowcond
= 0, effective snow thermal conductivity W/mC (if zero, uses inbuilt function of density)
intercept
= max(maxshade) / 100 * 0.3, snow interception fraction for when there's shade (0-1)
grasshade
= 0, if 1, means shade is removed when snow is present, because shade is cast by grass/low shrubs
Intertidal mode parameters:
shore
Include tide effects? If 1, the matrix
tides
is used to specify tide presence, sea water temperature and presence of wavesplash
tides
= matrix(data = 0, nrow = length(seq(as.POSIXct(dstart, format = '
Outputs:
ndays
- number of days for which predictions are made
longlat
- longitude and latitude for which simulation was run (decimal degrees)
dates
- vector of dates (hourly, POSIXct, timezone = America/Los_Angeles)
dates2
- vector of dates (daily, POSIXct, timezone = America/Los_Angeles)
nyears
- number of years for which predictions are made
RAINFALL
- vector of daily rainfall (mm)
elev
- elevation at point of simulation (m)
minshade
- minimum shade for each day of simulation (%)
maxshade
- maximum shade for each day of simulation (%)
DEP
- vector of depths used (cm)
diffuse_frac
- vector of hourly values of the fraction of total solar radiation that is diffuse (-), computed by microclima if microclima > 0
dem
- digital elevation model used to get elevation and terrain features
metout/shadmet variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3 TALOC - air temperature (°C) at local height (specified by 'Usrhyt' variable)
4 TAREF - air temperature (°C) at reference height (specified by 'Refhyt', 2m default)
5 RHLOC - relative humidity (%) at local height (specified by 'Usrhyt' variable)
6 RH - relative humidity (%) at reference height (specified by 'Refhyt', 2m default)
7 VLOC - wind speed (m/s) at local height (specified by 'Usrhyt' variable)
8 VREF - wind speed (m/s) at reference height (specified by 'Refhyt', 2m default)
9 SNOWMELT - snowmelt (mm)
10 POOLDEP - water pooling on surface (mm)
11 PCTWET - soil surface wetness (%)
12 ZEN - zenith angle of sun (degrees - 90 = below the horizon)
13 SOLR - solar radiation (W/m2) (unshaded, horizontal plane)
14 TSKYC - sky radiant temperature (°C)
15 DEW - dew fall (mm / h)
16 FROST - frost (mm / h)
17 SNOWFALL - snow predicted to have fallen (cm)
18 SNOWDEP - predicted snow depth (cm)
19 SNOWDENS - snow density (g/cm3)
soil and shadsoil variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 D0cm ... - soil temperature (°C) at each of the 10 specified depths
if soil moisture model is run i.e. parameter runmoist = 1
soilmoist and shadmoist variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 WC0cm ... - soil moisture (m3/m3) at each of the 10 specified depths
soilpot and shadpot variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 PT0cm ... - soil water potential (J/kg = kPa = bar/100) at each of the 10 specified depths
humid and shadhumid variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 RH0cm ... - soil relative humidity (decimal %), at each of the 10 specified depths
plant and shadplant variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3 TRANS - plant transpiration rate (g/m2/h)
4 LEAFPOT - leaf water potential (J/kg = kPa = bar/100)
5-14 RPOT0cm ... - root water potential (J/kg = kPa = bar/100), at each of the 10 specified depths
tcond and shadtcond variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 TC0cm ... - soil thermal conductivity (W/m-K), at each of the 10 specified depths
specheat and shadspecheat variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 SP0cm ... - soil specific heat capacity (J/kg-K), at each of the 10 specified depths
densit and shaddensit variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-12 DE0cm ... - soil density (Mg/m3), at each of the 10 specified depths
if snow model is run i.e. parameter snowmodel = 1
sunsnow and shdsnow variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-10 SN1 ... - snow temperature (°C), at each of the potential 8 snow layers (layer 8 is always the bottom - need metout$SNOWDEP to interpret which depth in the snow a given layer represents)
if wavelength-specific solar output is selected i.e. parameter lamb = 1
solar output variables
drlam (direct solar), drrlam (direct Rayleigh solar) and srlam (scattered solar) variables:
1 DOY - day-of-year
2 TIME - time of day (mins)
3-113 290, ..., 4000 - irradiance (W/(m2 nm)) at each of 111 wavelengths from 290 to 4000 nm
metout The above ground micrometeorological conditions under the minimum specified shade
shadmet The above ground micrometeorological conditions under the maximum specified shade
soil Hourly predictions of the soil temperatures under the minimum specified shade
shadsoil Hourly predictions of the soil temperatures under the maximum specified shade
soilmoist Hourly predictions of the soil moisture under the minimum specified shade
shadmoist Hourly predictions of the soil moisture under the maximum specified shade
soilpot Hourly predictions of the soil water potential under the minimum specified shade
shadpot Hourly predictions of the soil water potential under the maximum specified shade
humid Hourly predictions of the soil humidity under the minimum specified shade
shadhumid Hourly predictions of the soil humidity under the maximum specified shade
plant Hourly predictions of plant transpiration, leaf water potential and root water potential under the minimum specified shade
shadplant Hourly predictions of plant transpiration, leaf water potential and root water potential under the maximum specified shade
sunsnow Hourly predictions of snow temperature under the minimum specified shade
shadsnow Hourly predictions snow temperature under the maximum specified shade
tcond Hourly predictions of the soil thermal conductivity under the minimum specified shade
shadtcond Hourly predictions of the soil thermal conductivity under the maximum specified shade
specheat Hourly predictions of the soil specific heat capacity under the minimum specified shade
shadspecheat Hourly predictions of soil specific heat capacity under the maximum specified shade
densit Hourly predictions of the soil density under the minimum specified shade
shaddensit Hourly predictions of the soil density under the maximum specified shade
library(NicheMapR)
dstart <- "01/07/2024"
dfinish <- "31/12/2024"
ensemble <- 1
micro<-micro_access_s2(dstart = dstart, dfinish = dfinish, ensemble = ensemble) # run the model at the default location
metout<-as.data.frame(micro$metout) # above ground microclimatic conditions, min shade
soil<-as.data.frame(micro$soil) # soil temperatures, minimum shade
soilmoist<-as.data.frame(micro$soilmoist) # soil temperatures, minimum shade
# append dates
dates <- micro$dates
metout <- cbind(dates, metout)
soil <- cbind(dates, soil)
soilmoist <- cbind(dates, soilmoist)
minshade<-micro$minshade
# plotting above-ground conditions in minimum shade
with(metout, {plot(TALOC ~ dates,xlab = "Date and Time", ylab = "Temperature (°C)"
, type = "l", main = paste("air and sky temperature, ", minshade, "% shade", sep = ""), ylim = c(-20, 60))})
with(metout, {points(TAREF ~ dates,xlab = "Date and Time", ylab = "Temperature (°C)"
, type = "l", lty = 2,col = 'blue')})
with(metout, {points(TSKYC ~ dates,xlab = "Date and Time", ylab = "Temperature (°C)"
, type = "l", col = 'light blue', main = paste("sky temperature, ", minshade, "% shade", sep = ""))})
with(metout, {plot(RHLOC ~ dates, xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l", ylim = c(0, 100), main = paste("humidity, ", minshade, "% shade", sep = ""))})
with(metout, {points(RH ~ dates, xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l", col = 'blue', lty = 2, ylim = c(0, 100))})
with(metout, {plot(VREF ~ dates, xlab = "Date and Time", ylab = "Wind Speed (m/s)"
, type = "l", main = "wind speed", ylim = c(0, 15))})
with(metout, {points(VLOC ~ dates, xlab = "Date and Time", ylab = "Wind Speed (m/s)"
, type = "l", lty = 2, col = 'blue')})
with(metout, {plot(SOLR ~ dates, xlab = "Date and Time", ylab = "Solar Radiation (W/m2)"
, type = "l", main = "solar radiation")})
with(metout, {plot(SNOWDEP ~ dates, xlab = "Date and Time", ylab = "Snow Depth (cm)"
, type = "l", main = "snow depth")})
# plotting soil temperature
for(i in 1:10){
if(i==1){
plot(soil[,i+3] ~ soil[,1], xlab = "Date and Time", ylab = "Soil Temperature (°C)"
,col = i,type = "l", main = paste("soil temperature ", minshade, "% shade", sep = ""))
}else{
points(soil[, i + 3] ~ soil[, 1], xlab = "Date and Time", ylab = "Soil Temperature
(°C)", col = i, type = "l")
}
}
# plotting soil moisture
for(i in 1:10){
if(i==1){
plot(soilmoist[,i+3] * 100 ~ soilmoist[, 1], xlab = "Date and Time", ylab = "Soil Moisture (% volumetric)"
,col = i,type = "l", main = paste("soil moisture ", minshade, "% shade", sep = ""))
}else{
points(soilmoist[,i+3] * 100 ~ soilmoist[, 1], xlab = "Date and Time", ylab = "Soil Moisture
(%)", col = i, type = "l")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.