R: Get a Tidal Prediction from a WebTide Database

webtide {oce} | R Documentation

## Get a Tidal Prediction from a WebTide Database

### Description

Get a tidal prediction from a WebTide database.

If `action="map"` then a map is drawn, with a dot for the lower-left corner of each triangle used in the finite-element tidal simulation upon which WebTide predictions are based. If `node` is missing, then `locator` is called, so that the user can indicate a spot of interest on the map, and this point is indicated on the map (and in the return value). If `node` is provided, however, the point is indicated but `locator` is not called. (This second style is of use in documenting interactive work after the fact.)

If `action="predict"` then either a node number or the longitude and latitude must be specified. If `plot=TRUE` (the default) then a plot is drawn, but no plot is produced otherwise. In either case, the (silent) return value is a list as described in the next section. The times used for prediction are specified with the `time` argument, and if this is not specified then a week following the present time is used.

Naturally, `webtide` will not work unless WebTide has been installed on the computer.

### Usage

    webtide(action = c("map", "predict"), longitude, latitude, node, time,
      basedir = getOption("webtide"), region = "nwatl", plot = TRUE, tformat,
      debug = getOption("oceDebug"), ...)

### Arguments

`action` | An indication of the action, either `action="map"` to draw a map or `action="predict"` to get a prediction; see ‘Details’.
`longitude` | longitude at which prediction is required (ignored if `node` is given).
`latitude` | latitude at which prediction is required (ignored if `node` is given).
`node` | node to look up; only needed if `longitude` and `latitude` are not given.
`time` | times at which prediction is to be made. If not supplied, this will be the week starting at the present time, incrementing by 15 minutes.
`basedir` | directory containing the `WebTide` application.
`region` | database region, given as a directory name in the WebTide directory. For example, `h3o` is for Halifax Harbour, `nwatl` is for the northwest Atlantic, and `sshelf` is for the Scotian Shelf and Gulf of Maine.
`plot` | boolean indicating whether to plot.
`tformat` | optional argument passed to `oce.plot.ts`, for plot types that call that function. (See `strptime` for the format used.)
`debug` | an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many `oce` functions. Generally, setting `debug=0` turns off the printing, while higher values suggest that more information be printed.
`...` | optional arguments passed to plotting functions. A common example is to set `xlim` and `ylim`, to focus a map region.

### Value

If `action="map"` and `plot=TRUE`, the return value is a list containing the index of the nearest node, along with the `latitude` and `longitude` of that node. If `action="map"` and `plot=FALSE`, the return value is a list of all nodes, longitude, and latitudes.

If `action="predict"`, the return value is a list containing a vector of times (`time`), as well as vectors of the predicted `elevation` in metres and the predicted horizontal components of velocity, `u` and `v`, along with the `node` number, and the `basedir` and `region` as supplied to this function.

### Caution

WebTide is not an open-source application, so the present function was designed based on little more than guesses about the WebTide file structure. Users should be on the lookout for odd results.

### Author(s)

Dan Kelley

### Source

The WebTide software may be downloaded for free at the Department of Fisheries and Oceans (Canada) website, which in February 2016 was `http://www.bio.gc.ca/science/research-recherche/ocean/webtide/index-en.php`, although this site seems not to be particularly static.

### Examples

    ## Not run:
    library(oce)
    prediction <- webtide("predict", longitude=-69.61, latitude=48.14)

    ## End(Not run)

[Package oce version 0.9-20 Index]