checkinputs: Check format and values in model inputs

View source: R/dataprep.R

checkinputsR Documentation

Check format and values in model inputs

Description

The function 'checkinputs' checks all the inputs into the model and returns errors and warnings

Usage

checkinputs(weather, vegp, soilc, dtm, windhgt = 2)

Arguments

weather

a data.frame of weather variables (see details)

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 (see details)

windhgt

height above ground (m) of wind speed measurement

precip

a vector of daily precipitation

daily

optional logical indicating whether input weather data are daily

tstep

one of 'hour' or 'day' indicating whether data are hourly or daily

Details

The format and and units of 'weather' must follow that in the example dataset 'climdata'. The array of Plant Area index values in 'vegp' must of the same x and y dims as 'dtm' but can contain any number of repeated measures up to the number of entries in 'weather'. Data are interpolated to the time increment of 'weather'. Other vegetation paramaters, including vegetation height are assumed time-invarient. The SpatRaster datasets in 'soilc' must have the same x and y dims as 'dtm'. The x,y and z units of 'dtm' must be all be in metres and the coordinate reference system must be defined.

Value

a list of checked inputs

Examples

# No warnings or errors given:
checks<-checkinputs(climdata, vegp, soilc, dtmcaerth)
# Warning given (not run)
# weather<-climdata
# weather$relhum[1]<-101
# checks<-checkinputs(weather, vegp, soilc, dtmcaerth)
# Error given (NB not run)
# weather<-climdata
# weather$pres<-weather$pres*1000
# checks<-checkinputs(weather, vegp, soilc, dtmcaerth)
# Error given for vegp (not run)
# vegp2<-vegp
# vegp2$clump<-1
# checks<-checkinputs(climdata, vegp2, soilc, dtmcaerth)
# Warning given for vegp (not run)
# vegp2<-vegp
# vegp2$pai<-vegp$pai*10
# checks<-checkinputs(climdata, vegp2, soilc, dtmcaerth)

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