fes_calculate: Performs a calculation with a FES2014 instance

Description Usage Arguments Value See Also Examples

View source: R/Rfes2014.R

Description

Performs a calculation with a FES2014 instance

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
fes_calculate(hdl, ...)

## S3 method for class 'double'
fes_calculate(hdl, lat, long, epoch_sec, ...)

## S3 method for class 'list'
fes_calculate(hdl, lat, long, epoch_sec, ...)

## S3 method for class 'data.frame'
fes_calculate(hdl, data, epoch_sec = NULL,
  latCol = "lat", lonCol = "lon", epochSecCol = "epoch_sec", ...)

## S3 method for class 'matrix'
fes_calculate(hdl, data, epoch_sec = NULL,
  latCol = "lat", lonCol = "lon", epochSecCol = "epoch_sec", ...)

## S3 method for class 'tbl_df'
fes_calculate(hdl, data, epoch_sec = NULL,
  latCol = "lat", lonCol = "lon", epochSecCol = "epoch_sec", ...)

Arguments

hdl

<extptr>; a FES2014 handle

...

Parameters passed to generic methods

lat

double/list; a double (or list of) representing latitudes

long

double/list; a double (or list of) representing longitudes

epoch_sec

integer/list; an integer (or list of) representing seconds since POSIX epoch (1970/01/01 00:00:00 UTC). Negative numbers are accepted

data

data.frame/tibble/matrix; a data.frame, matrix or tibble containing 3 columns (lat/lon/epoch_sec) or 2 columns (lat/long) with the epoch_sec parameter. Column names can be provided as extra parameters.

latCol

string; name of the latitude column in data

lonCol

string; name of the longitude column in data

epochSecCol

string; name of the timestamps column in data

Value

A list containing h, hLongPeriod and samples for the lat, long, timestamp tuple

A data.frame, matrix or tibble containing h, hLongPeriod and samples for each lat, long, timestamp tuple

See Also

fes_new; as.POSIXct for timestamps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
hdl <- fes_new("ocean", "memory", "data/fes2014/eastward_velocity.ini")
res <- fes_calculate(hdl, 50.10, -2.40, 1570536000)
print(res)
fes_delete(hdl)

# To get a unix timestamp from Sys.time():
epoch_secs <- as.integer(Sys.time())

# To get a unix timestamp from Sys.Date() or a Date() object:
epoch_secs <- as.integer(as.POSIXct(Sys.Date(), tx = "UTC"))

# fes_calculate can also take data.frames/tibbles:
df <- data.frame(
  lat = c(50.10, 50.20),
  long = c(-2.40, -2.40),
  epoch_sec = c(1570536000, 1570536000)
)
res <- fes_calculate(hld, df, lonCol = "long")
res <- fes_calculate(hld, dplyr::as_tibble(df), lonCol = "long")

## End(Not run)

avsdev-cw/Rfes2014 documentation built on Nov. 3, 2019, 2:04 p.m.