R/ccmp_wind.R
read_ccmp.Rd
RSS CCMP_RT V2.1 derived surface winds (Level 3.0)
read_ccmp(
date,
time.resolution = c("6hourly"),
xylim = NULL,
lon180 = FALSE,
magonly = FALSE,
dironly = FALSE,
uonly = FALSE,
vonly = FALSE,
nobsonly = FALSE,
latest = TRUE,
returnfiles = FALSE,
...,
inputfiles = NULL
)
date or dates of data to read, see Details
time resolution (6hourly)
spatial extents to crop from source data, can be anything accepted by extent
, see Details
return just the magnitude from the U and V components
return just the direction from the U and V, in degrees N=0, E=90, S=180, W=270
return just the U component of velocity
return just the V component of velocity components, in degrees (0 north, 90 east, 180 south, 270 west)
if TRUE (and date not supplied) return the latest time available, otherwise the earliest
ignore options and just return the file names and dates
passed to brick, primarily for filename
CCMP wind data is read from files managed by
ccmp_files
. Dates are matched to file names by
finding the nearest match in time within a short duration. By
default only one time step is returned with both U and V
components. Multiple dates can be returned for magnitude or
direction, U or V only or N-obs only.
This is the " RSS VAM 6-hour analyses starting from the NCEP GFS wind analyses"
See References.
## read a single time slice, direction only
x <- read_ccmp(dironly = TRUE)
## get a local extent for a zoom plot and plot the directions [0,360) as an image with arrows
e <- extent(projectExtent(raster(extent(130, 150, -50, -30), crs = "+proj=longlat"), projection(x)))
x <- crop(read_ccmp(), e)
crds <- coordinates(x)
scale <- 0.05
vlen <- function(x) sqrt(x[[1]]^2 + x[[2]]^2)
plot(vlen(crop(x, e)))
x1 <- crds[,1]
y1 <- crds[,2]
x2 <- crds[,1] + values(x[[1]]) * scale
y2 <- crds[,2] + values(x[[2]]) * scale
arrows(x1, y1, x2, y2, length = 0.02)
## faster if we get the file list first
ccfiles <- ccmp_files()
earliest <- read_ccmp(ccfiles$date[1:16], xylim = e, magonly = TRUE, inputfiles = ccfiles)
plot(earliest, col = hcl.colors(64), zlim = c(0, 20))