CST_PeriodPET: Compute the Potential Evapotranspiration

View source: R/PeriodPET.R

CST_PeriodPETR Documentation

Compute the Potential Evapotranspiration

Description

Compute the Potential evapotranspiration (PET) that is the amount of evaporation and transpiration that would occur if a sufficient water source were available. This function calculate PET according to the Thornthwaite, Hargreaves or Hargreaves-modified equations.

Usage

CST_PeriodPET(
  data,
  pet_method = "hargreaves",
  time_dim = "syear",
  leadtime_dim = "time",
  lat_dim = "latitude",
  na.rm = FALSE,
  ncores = NULL
)

Arguments

data

A named list with the needed s2dv_cube objects containing the seasonal forecast experiment in the 'data' element for each variable. Specific variables are needed for each method used in computing the Potential Evapotranspiration (see parameter 'pet_method'). The accepted variable names are fixed in order to be recognized by the function. The accepted name corresponding to the Minimum Temperature is 'tmin', for Maximum Temperature is 'tmax', for Mean Temperature is 'tmean' and for Precipitation is 'pr'. The accepted variable names for each method are: For 'hargreaves': 'tmin' and 'tmax'; for 'hargreaves_modified' are 'tmin', 'tmax' and 'pr'; for method 'thornthwaite' 'tmean' is required. The units for temperature variables ('tmin', 'tmax' and 'tmean') need to be in Celcius degrees; the units for precipitation ('pr') need to be in mm/month. Currently the function works only with monthly data from different years.

pet_method

A character string indicating the method used to compute the potential evapotranspiration. The accepted methods are: 'hargreaves' and 'hargreaves_modified', that require the data to have variables tmin and tmax; and 'thornthwaite', that requires variable 'tmean'.

time_dim

A character string indicating the name of the temporal dimension. By default, it is set to 'syear'.

leadtime_dim

A character string indicating the name of the temporal dimension. By default, it is set to 'time'.

lat_dim

A character string indicating the name of the latitudinal dimension. By default it is set by 'latitude'.

na.rm

A logical value indicating whether NA values should be removed from data. It is FALSE by default.

ncores

An integer value indicating the number of cores to use in parallel computation.

Details

This function is build to be compatible with other tools in that work with 's2dv_cube' object class. The input data must be this object class. If you don't work with 's2dv_cube', see PeriodPET. For more information on the SPEI calculation, see functions CST_PeriodStandardization and CST_PeriodAccumulation.

Examples

dims <- c(time = 3, syear = 3, ensemble = 1, latitude = 1)
exp_tasmax <- array(rnorm(360, 27.73, 5.26), dim = dims)
exp_tasmin <- array(rnorm(360, 14.83, 3.86), dim = dims)
exp_prlr <- array(rnorm(360, 21.19, 25.64), dim = dims)
end_year <- 2012
dates_exp <- as.POSIXct(c(paste0(2010:end_year, "-08-16"), 
                         paste0(2010:end_year, "-09-15"), 
                         paste0(2010:end_year, "-10-16")), "UTC")
dim(dates_exp) <- c(syear = 3, time = 3)
lat <- c(40)
exp1 <- list('tmax' = exp_tasmax, 'tmin' = exp_tasmin, 'pr' = exp_prlr)
res <- PeriodPET(data = exp1, lat = lat, dates = dates_exp)


CSIndicators documentation built on Nov. 20, 2023, 5:07 p.m.