coastalNCEP: Calculates coastal effects from NCEP data

View source: R/datatools.R

coastalNCEPR Documentation

Calculates coastal effects from NCEP data

Description

Calculates coastal effects from NCEP data

Usage

coastalNCEP(
  landsea,
  ncephourly,
  steps = 8,
  use.raster = T,
  zmin = 0,
  plot.progress = T,
  tidyr = F
)

Arguments

landsea

a raster object with NAs (representing sea) or any non-NA value and a projection system defined.

ncephourly

a dataframe of hourly climate data as returned by hourlyNCEP().

steps

an optional integer. Coastal effects are calculated in specified directions upwind. Steps defines the total number of directions used. If the default 8 is specified, coastal effects are calculated at 45º intervals.

use.raster

an optional logical value indicating whether to mask the output values by landsea.

zmin

optional assumed sea-level height. Values below this are set to zmin

plot.progress

logical value indicating whether to produce plots to track progress.

tidyr

logical value indicating whether to download 30m resolution digital elevation data and use these data to improve the assignment of land and sea pixels in landsea.

Details

coastalNCEP downloads digital elevation and varying resolutions to calculate coastal effects by applying a variant of invls() over a greater extent then that specified by landsea, but the resulting outputs are cropped to the same extent as landsea. Land temperatyres as a function of coastal exposure and sea-surface temperature data are then calculated. Sea surface temperature data are automatically downloaded from the NOAA.

Value

a three-dimension array of hourly temperature values for each pixel of landsea

Examples

library(raster)
# Download NCEP data
ll <- latlongfromraster(dtm100m)
tme <-as.POSIXlt(c(0:31) * 3600 * 24, origin = "2015-03-15", tz = "GMT")
ncephourly<-hourlyNCEP(NA, ll$lat, ll$long, tme)
aout <- coastalNCEP(dtm100m, ncephourly)
# Calculate mean temperature and convert to raster
mtemp <- if_raster(apply(aout, c(1, 2), mean), dtm100m)
plot(mtemp, main = "Mean temperature")

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