hourlyNCEP: Interpolate NCEP data for running microclima to hourly

View source: R/datatools.R

hourlyNCEPR Documentation

Interpolate NCEP data for running microclima to hourly

Description

hourlyNCEP optionally downloads the required NCEP climate and radiation forcing data required for running microclima and interpolates 4x daily data to hourly.

Usage

hourlyNCEP(ncepdata = NA, lat, long, tme, reanalysis2 = FALSE)

Arguments

ncepdata

an optional data frame of climate variables as returned by get_NCEP().

lat

the latitude of the location for which data are required. Ignored if ncepdata provided.

long

the longitude of the location for which data are required. Ignored if ncepdata provided.

tme

a POSIXlt object covering the duration for which data are required. Ignored if ⁠ncepdata`` provided. Hourly data are returned irrespective of the time interval of ⁠tme⁠.Ignored if ⁠ncepdata' provided.

reanalysis2

Logical. Should data be obtained from the Reanalysis II dataset (default) or from Reanalysis I (data prior to 1979). Ignored if ncepdata provided.

Details

If ncepdata is not provided, then get_NCEP() is called and data are downloaded from NCEP Atmospheric Model Intercomparison Project (Kanamitso et al 2002). Six-hourly data are interpolated as follows. Pressure, humidity and the u and v wind vectors are converted to hourly using spline interpolation. Wind speeed and direction and then calculated and adjusted to give values at 1 m using windheight(). The diffuse radiation proportion is calculated using difprop(), and hourly obtained by adusting for the direction of the solar beam and airmass thickness using functions siflat() and airmasscoef(). Hourly temperature are derived using hourlytemp() and longwave radiation by splining emissivity values.

Value

a dataframe with the following variables:

obs_time

POSIXlt object of times in UTC

temperature

emperatures at 2m (ºC)

humidity

specific humidity at 2m (Kg / Kg)

pressure

surface pressure (Pa)

windspeed

wind speed at 2m (metres per second

winddir

wind direction (degrees from N)

emissivity

emissivity of the atmosphere (0 - 1, downlong / uplong)

netlong

Net longwave radiation (MJ m-2 hr-1)

uplong

Upward longwave radiation (MJ m-2 hr-1)

downlong

Downward longwave radiation (MJ m-2 hr-1)

rad_dni

Direct radiation normal to the solar beam (MJ m-2 hr-1)

rad_dif

Diffuse radiation (MJ m-2 hr-1)

szenith

the zenith angle (degrees)

cloudcover

cloud cover (Percentage)

See Also

get_NCEP()

Examples

tme <- as.POSIXlt(c(0:30) * 24 * 3600, origin ="2015-01-15 00:00", tz = "UTC")
# NB takes a while to download data
hdata<- hourlyNCEP(NA, 50, -5, tme)
head(hdata)
plot(temperature ~ as.POSIXct(obs_time), data = hdata, type = "l", xlab = "Month")
plot(rad_dif ~ as.POSIXct(obs_time), data = hdata, type = "l", xlab = "Month")

ilyamaclean/microclima documentation built on Oct. 31, 2023, 11:41 p.m.