readcurr: Read AVISO ocean current data

readcurrR Documentation

Read AVISO ocean current data

Description

Current data is read from files managed by currentsfiles. 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.

Usage

readcurr(
  date,
  time.resolution = c("daily"),
  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, see Details

time.resolution

time resolution to read

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 U component of velocity

vonly

return just the V component of velocity components, in degrees (0 north, 90 east, 180 south, 270 west)

latest

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

returnfiles

ignore options and just return the file names and dates

...

passed to brick, primarily for filename

Details

This is the "DT merged all satellites Global Ocean Gridded SSALTO/DUACS Sea Surface Height L4 product and derived variables" See References.

Value

raster object with the "U" (meridional/horizontal/X) and "V" (zonal/vertical/Y) components of velocity in m/s. Setting either of the (mutually exclusive) magonly and dironly arguments returns the magnitude (in m/s) or direction (in degrees relative to North) of the velocity vectors.

Note

These data for daily files are stored in longitude/latitude projection on the sphere between longitudes in the Pacific view [0, 360], the default behaviour is to reset this to Atlantic view [-180, 180] with lon180.

References

http://marine.copernicus.eu

See Also

icefiles for details on the repository of data files, raster for the return value

Examples

## read a single time slice, and plot the directions [0,360) as an image with arrows
x <- readcurr(dironly = TRUE)
## get a local extent for a zoom plot
e <- extent(projectExtent(raster(extent(130, 150, -50, -30), crs = "+proj=longlat"), projection(x)))
x <- crop(readcurr(), e)
crds <- coordinates(x)
scale <- 1.5
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[[1]]) * scale
arrows(x1, y1, x2, y2, length = 0.03)

AustralianAntarcticDivision/raadtools documentation built on Feb. 14, 2024, 6:28 a.m.