Read wind

readwind(
  date,
  time.resolution = c("6hourly"),
  xylim = NULL,
  lon180 = TRUE,
  magonly = FALSE,
  dironly = FALSE,
  uonly = FALSE,
  vonly = FALSE,
  latest = TRUE,
  returnfiles = FALSE,
  ...,
  inputfiles = NULL
)

Arguments

date

date or dates of data to read,

time.resolution

time resoution data to read, daily or monthly

xylim

spatial extents to crop from source data, can be anything accepted by extent, see Details

lon180

defaults to TRUE, to "rotate" Pacific view 0, 360 data to Atlantic view -180, 180

magonly

return just the magnitude from the U and V components

dironly

return just the direction from the U and V, in degrees N=0, E=90, S=180, W=270

uonly

return just the horizontal component of velocity, U

vonly

return just the vertical component of velocity, V

latest

if TRUE (and date not supplied) return the latest time available

returnfiles

ignore options and just return the file names and dates

...

Arguments passed on to raadtools

setNA

mask out land values (only applies to monthly time.resolution)

inputfiles

input the files data base to speed up initialization

Value

raster object

Details

Read wind data

The inputfiles argument may be used to speed up individual reads, see the examples. Note that this must then ignore the time.resolution argument, which is also set by windfiles - and no warning is given. If using this argument you must give the same time.resolution as was used to create the files data.frame.

Examples

# Speed up individual read calls. 
ff <- windfiles(time.resolution = "6hourly")
t1 <- system.time({readwind(max(ff$date))})
t2 <- system.time({readwind(max(ff$date), inputfiles = ff)})
if (FALSE) {
 dts <- seq(as.Date("2000-01-01"), by = "1 days", length = 350)
 library(animation)
 ani.start(ani.width = 800, ani.height = 800)
 for (i in seq_along(dts)) {
    x <- readwind(dts[i]);
    if (i == 1L) crds <- coordinates(x[[1]])
    plot(sqrt(x[[1]]^2 + x[[2]]^2), xlim = c(40, 180), ylim = c(-90, -20));
x1 <- crds[,1]
y1 <- crds[,2]
x2 <- crds[,1] + values(x[[1]])/4
y2 <- crds[,2] + values(x[[2]])/4
    arrows(x1, y1, x2, y2, length = 0.06);
    plot(m, add = TRUE)
}
ani.stop()



}