interpolate_tides: Calculate estimated tide heights

View source: R/interpolate_tides.R

interpolate_tidesR Documentation

Calculate estimated tide heights

Description

This function interpolates tides at given time points for any port covered by the National Hydrographic Institute, or for which a tidal table is provided.

Usage

interpolate_tides(
  date_times = NULL,
  port_id = 19,
  tides = NULL,
  timezone = "local",
  digits = 2
)

Arguments

date_times

A character vector with the format yyyy-mm-dd hh:mm:ss OR a POSIXct vector of date-time points for which tidal height will be estimated.

port_id

The id code for the desired port (use port_list to see a list, Faro-Olhão is the default)

timezone

The timezone used for 'date_times'. Must be one of "local" (which includes time changes due to daylight savings) or "UTC".

tidal_table

OPTIONAL A table with the tidal events and time at which they occur. If provided, the port_id will be ignored

Details

There are 2 main ways to use the function: 1) Provide a port ID and the function will query the National Hydrographic Institute for the required tidal tables.

2) Provide your own tidal table. Great if you want to save a table from 'get_tides' and then run the code several times without constantly querying the API, share it with other people or use the function without internet access. You can also use custom tidal tables, but in that case checking the integrity of the tidal table is mostly up to you.

Returns the expected tide height at those time-points, for that port based on the method provided by the Portuguese National Hydrographic Institute.

Examples

Retrieve the information for the Faro - Olhao port, for the 7 days after March 5th of 2020.
sampling_times <- c("2020-03-13 15:15:00", "2020-03-09 16:15:00")
interpolate_tides(port_id = 19, date_times = sampling_times, timezone = "local")

MarcioFCMartins/tidytides documentation built on Nov. 5, 2023, 4:07 a.m.