runsnowmodel: Runs the grid snow model

View source: R/Cppwrappers.R

runsnowmodelR Documentation

Runs the grid snow model

Description

The function 'runsnowmodel' runs the inbuilt snow model returning snow depth at each time increment

Usage

runsnowmodel(
  weather,
  micropoint,
  vegp,
  soilc,
  dtm,
  dtmc = NA,
  tme = NA,
  altcorrect = 0,
  snowenv = "Taiga",
  method = "fast",
  snowinitd = 0,
  snowinita = 0,
  zref = 2,
  windhgt = zref,
  stfact = 0.01
)

Arguments

weather

a data.frame or list of arrays of weather variables as provided to [runpointmodel()] or [runpointmodela()] (see details)

micropoint

an object of class micropoint or a list of objects of class micropoint as returned by [runpointmodel()], [runpointmodela()], [subsetpointmodel()] or [subsetpointmodela()]

vegp

an object of class vegparams as returned by [vegpfromhab()] (see details)

soilc

an object of class soilcharac as returned by [soilcfromtype()]

dtm

a SpatRaster object of elevations in metres (see details)

dtmc

a SpatRaster object giving the resolution, spatial extent, and projection of the climate data used when running [micropointa()]. Ignored if climate data used for running the point model are provided as a data.frame. Must give elevations in metres if 'altcorrect' > 0 or if setting runchecks to TRUE.

tme

POSIXlt object giving the dates and times for each weather variable stored in the array. Only rquired if 'weather' is a list of arrays.

altcorrect

a single numeric value indicating whether to apply an elevational lapse rate correction to temperatures (0 = no correction, 1 = fixed lapse rate correction, 2 = humidity-dependent variable lapse rate correction)

snowenv

one of 'Maritime', 'Prairie', 'Tundra', 'Taiga' or 'Alpine'. Used to compute snow density as a function of snow age following Sturm et al (2010) J Hydrometeorol, 11: 1380–94.

method

one of 'fast' or 'slow' and used when 'micropoint' is a subset of values returned by e.g. [subsetpointmodel()]. If 'fast' the full snow model is only run over days over which microclimate estimates are required and an approximation method is used to estimate evolving snow depth during days in which the model is not run. If 'slow' the full model is run for every hour and the resulting output subset to match 'micropoint'.

snowinitd

a single numeric value or matrix of values indicating initial snow depths (m) at the start of the model run

snowinita

a single numeric value or matrix of values indicating initial snow age (hours) at the start of the model run

zref

height above ground (m) of temperature measurements in weather

windhgt

height above ground (m) of wind speed data in weather

stfact

optional parameter indicating sensitivity of spatial snow re-distribution to terrain (0 = no terrain effect).

reqhgt

height above (postive) or below (negative) ground for which microclimate variables are required (m)

Details

weather data provided to 'runsnowmodel' must comprise hourly data for every hour, even if the input 'micropoint' is a subset version of the point model as returned by e.g. [subsetpointmodel()].

Value

Tc

Average temperature of snowpack (deg C)

Tg

Temperature of ground snow surface (deg C)

groundsnowdepth

Depth of ground-lying snow (m)

totalSWE

Total snow water equivelent of snow pack (mm)

snowden

Snow density (Kg / m^3)

Examples

climdata$temp <- climdata$temp - 8 # Make it colder so there is snow
# Run full snow model for every hour with default settings (takes ~90 seconds)
micropoint <- runpointmodel(climdata, reqhgt = 0.05, dtmcaerth, vegp, soilc) # Make it colder so there is snow
smod <- runsnowmodel(climdata, micropoint, vegp, soilc, dtmcaerth)
# Plot mean snow depth through time
sdepth <- apply(smod$groundsnowdepth, 3, mean, na.rm = TRUE)
plot(sdepth, type = "l")
# Plot spatial variation in snow depth when snow is at its deepest
n<-which.max(sdepth)
plot(rast(smod$groundsnowdepth[,,n]))  # spatial snow depth at maximum
# subset point model and run again
micropoint <- subsetpointmodel(micropoint)
# Run model using method = slow (takes ~90 seconds again as full model run and then subset)
smod <- runsnowmodel(climdata, micropoint, vegp, soilc, dtmcaerth, method = "slow")
# Run model using method = fast (takes ~4 seconds)
smod <- runsnowmodel(climdata, micropoint, vegp, soilc, dtmcaerth, method = "fast")

ilyamaclean/microclimf documentation built on Sept. 28, 2024, 4:55 p.m.