micro_global: Global implementation of the microclimate model

View source: R/micro_global.R

micro_globalR Documentation

Global implementation of the microclimate model

Description

An implementation of the NicheMapR microclimate model that uses the global climate database derived from "New, M., Lister, D., Hulme, M. and Makin, I., 2002: A high-resolution data set of surface climate over global land areas. Climate Research 21:1-25" It also optionally uses a global monthly soil moisture estimate from NOAA CPC Soil Moisture http://140.172.38.100/psd/thredds/catalog/Datasets/cpcsoil/catalog.html Aerosol attenuation can also be computed based on the Global Aerosol Data Set (GADS) Koepke, P., M. Hess, I. Schult, and E. P. Shettle. 1997. Global Aerosol Data Set. Max-Planck-Institut for Meteorologie, Hamburg by choosing the option 'run.gads <- 1' (Fortran version, quicker but may crash on some systems) or 'run.gads <- 2' (R version)

Usage

micro_global(loc = c(-89.40123, 43.07305), timeinterval = 12, nyears = 1, soiltype = 4,
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, ...)

Arguments

loc

Longitude and latitude (decimal degrees)

timeinterval

The number of time intervals to generate predictions for over a year (must be 12 <= x <=365)

nyears

The number of years to run

soiltype

Soil type: Rock = 0, sand = 1, loamy sand = 2, sandy loam = 3, loam = 4, silt loam = 5, sandy clay loam = 6, clay loam = 7, silt clay loam = 8, sandy clay = 9, silty clay = 10, clay = 11, user-defined = 12, based on Campbell and Norman 1990 Table 9.1.

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 use (%) (can be a single value or a vector of daily values)

dem

A digital elevation model used produced by microclima function 'get_dem' via R package 'elevatr' (internally generated via same function based on 'loc' if dem = NA and terrain/elevatr/microclima != 0)

Usrhyt

Local height (m) at which air temperature, wind speed and humidity are to be computed for organism of interest

...

Additional arguments, see Details

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

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

lamb = 0, Return wavelength-specific solar radiation output?

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)

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

elevatr = 0, Use elevatr package to get high resolution elevation for location? 1 = yes, 0 = no

terrain = 0, Use elevatr package to adjust horizon angles, slope and aspect? 1 = yes, 0 = no

microclima = 0, Use microclima and elevatr package to compute diffuse fraction of solar radiation (1) and adjust solar radiation for terrain (2)? 0 = no

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)

General additional parameters:

ERR = 1.5, Integrator error tolerance for soil temperature calculations

Refhyt = 1.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)

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, 1, 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

TAI = 0, Vector of 111 values, one per wavelenght bin, for solar attenuation - used to overide GADS

windfac = 1, factor to multiply wind speed by e.g. to simulate forest

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.

Soil moisture mode parameters:

runmoist = 0, 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/m^3) (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)

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

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/m^3), (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, m^3 kg-1 s-1

RL = 2e+6, resistance per unit length of leaf, m^3 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 = 0, 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

rainfrac = 0.5, fraction of rain that falls on the first day of the month (decimal % with 0 meaning rain falls evenly) - this parameter allows something other than an even intensity of rainfall when interpolating the montly rainfall data)

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 = 24*365*nyears, ncol = 3), matrix of 1. tide state (0=out, 1=in), 2. Water temperature (°C) and 3. Wave splash (0=yes, 1=no)

Outputs:

ndays - number of days for which predictions are made

longlat - longitude and latitude for which simulation was run (decimal degrees)

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 (%)

dem - digital elevation model obtained via 'get_dem' using package 'elevatr' (m)

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

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', 1.2m default)

  • 5 RHLOC - relative humidity (%) at local height (specified by 'Usrhyt' variable)

  • 6 RH - relative humidity (%) at reference height (specified by 'Refhyt', 1.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', 1.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

Value

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

Examples

micro <- micro_global() # run the model with default location (Madison, Wisconsin) and settings

metout <- as.data.frame(micro$metout) # above ground microclimatic conditions, min shade
shadmet <- as.data.frame(micro$shadmet) # above ground microclimatic conditions, max shade
soil <- as.data.frame(micro$soil) # soil temperatures, minimum shade
shadsoil <- as.data.frame(micro$shadsoil) # soil temperatures, maximum shade

minshade <- micro$minshade[1]
maxshade <- micro$maxshade[1]

# plotting above-ground conditions in minimum shade
with(metout, {plot(TALOC ~ micro$dates, xlab = "Date and Time", ylab = "Air Temperature (°C)"
, type = "l", main = paste("air temperature, ", minshade, "% shade",sep = ""))})
with(metout, {points(TAREF ~ micro$dates, xlab = "Date and Time", ylab = "Air Temperature (°C)"
, type = "l",lty = 2, col = 'blue')})
with(metout, {plot(RHLOC ~ micro$dates, xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l",ylim = c(0, 100),main = paste("humidity, ",minshade, "% shade",sep=""))})
with(metout, {points(RH ~ micro$dates, xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l",col = 'blue',lty = 2, ylim = c(0, 100))})
with(metout, {plot(TSKYC ~ micro$dates, xlab = "Date and Time", ylab = "Sky Temperature (°C)"
,  type = "l", main = paste("sky temperature, ", minshade, "% shade", sep=""))})
with(metout, {plot(VREF ~ micro$dates, xlab = "Date and Time",  ylab = "Wind Speed (m/s)"
,  type = "l", main = "wind speed", col = 'blue',ylim = c(0, 15))})
with(metout, {points(VLOC ~ micro$dates, xlab = "Date and Time", ylab = "Wind Speed (m/s)"
,  type = "l", lty = 2)})
with(metout, {plot(ZEN ~ micro$dates,xlab = "Date and Time", ylab = "Zenith Angle of Sun (deg)"
,  type = "l", main = "solar angle, sun")})
with(metout, {plot(SOLR ~ micro$dates,xlab = "Date and Time", ylab = "Solar Radiation (W/m2)"
,  type = "l", main = "solar radiation")})

# plotting soil temperature for minimum shade
for(i in 1:10){
 if(i == 1){
   plot(soil[,i + 2] ~ micro$dates, xlab = "Date and Time", ylab = "Soil Temperature (°C)"
   ,col = i, type = "l", main = paste("soil temperature ", minshade, "% shade", sep=""))
 }else{
   points(soil[,i + 2] ~ micro$dates, xlab = "Date and Time", ylab = "Soil Temperature
    (°C)", col = i, type = "l")
 }
}

# plotting above-ground conditions in maximum shade
with(shadmet,{plot(TALOC ~ micro$dates,xlab = "Date and Time", ylab = "Air Temperature (°C)"
, type = "l", main = "air temperature, sun")})
with(shadmet,{points(TAREF ~ micro$dates,xlab = "Date and Time", ylab = "Air Temperature (°C)"
, type = "l", lty = 2, col = 'blue')})
with(shadmet,{plot(RHLOC ~ micro$dates,xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l", ylim = c(0, 100),main = "humidity, shade")})
with(shadmet,{points(RH ~ micro$dates,xlab = "Date and Time", ylab = "Relative Humidity (%)"
, type = "l", col = 'blue',lty = 2, ylim = c(0, 100))})
with(shadmet,{plot(TSKYC ~ micro$dates,xlab = "Date and Time", ylab = "Sky Temperature (°C)",
 type = "l", main = "sky temperature, shade")})

# plotting soil temperature for maximum shade
for(i in 1:10){
 if(i == 1){
   plot(shadsoil[,i + 2] ~ micro$dates, xlab = "Date and Time", ylab = "Soil Temperature
    (°C)", col = i, type = "l", main = paste("soil temperature ", maxshade, "% shade", sep=""))
 }else{
   points(shadsoil[,i + 2] ~ micro$dates, xlab = "Date and Time", ylab = "Soil Temperature
    (°C)", col = i, type = "l")
 }
}

mrke/NicheMapR documentation built on April 3, 2024, 10:05 a.m.