calc_cc: Calculate cloud cover

View source: R/calc_cc.R

calc_ccR Documentation

Calculate cloud cover

Description

Calculate cloud cover using latitude, air temperature, relative humidity (or dewpoint temperature) and short wave radiation using the calculations from Martin and McCutcheon (1999).

Usage

calc_cc(date, airt, relh = NULL, dewt = NULL, swr, lat, lon, elev, daily = F)

Arguments

date

vector; Dates in as.POSixct class

airt

vector; Air temperature values which correspond to the vector of dates

relh

vector; Relative humidity values which correspond to the vector of dates

dewt

vector; Dewpoint temperature values which correspond to the vector of dates. Used instead of relative humidity

swr

vector; Short-wave radiation values which correspond to the vector of dates

lat

numeric; Latitude position (in decimal)

lon

numeric; Longitude position (in decimal)

elev

numeric; elevation in metres above sea level

daily

deprecated; logical; Is the data on a daily timestep. Defaults to FALSE

Value

vector of cloud cover values which correspond to the vector of dates supplied

Examples

 met_file <- system.file('extdata/met_file.dat', package = 'GOTMr')
 swr_file <- system.file('extdata/swr_input_file.dat', package = 'GOTMr')
 met <- read.delim(met_file)
 met[,1] <- as.POSIXct(met[,1], tz = 'UTC')
 swr <- read.delim(swr_file)
 swr[,1] <- as.POSIXct(swr[,1], tz = 'UTC')
 met <- merge(met, swr, by = 1)
 cc <- calc_cc(date = met[,1], airt = met$AirT, dewt = met$DewT, swr = met$SWR, lat = 53, lon = -9.5, elev = 14, daily = F)
 plot(cc)

aemon-j/gotmtools documentation built on April 12, 2024, 4:35 p.m.