rtide is an R package to calculate tide heights based on tide station
harmonics.
It includes the harmonics data for 1293 US stations.
To install the latest release from CRAN
install.packages("rtide")To install the developmental version from GitHub
# install.packages("pak")
pak::pak("millerlp/rtide")library(tibble)
library(rtide)
#> rtide is not suitable for navigation
data <- rtide::tide_height(
"Monterey Harbor",
from = as.Date("2016-07-13"), to = as.Date("2016-07-15"),
minutes = 10L, tz = "America/Los_Angeles"
)
print(data)
#> # A tibble: 432 × 3
#> Station DateTime TideHeight
#> <chr> <dttm> <dbl>
#> 1 Monterey, Monterey Harbor, California 2016-07-13 00:00:00 0.523
#> 2 Monterey, Monterey Harbor, California 2016-07-13 00:10:00 0.505
#> 3 Monterey, Monterey Harbor, California 2016-07-13 00:20:00 0.489
#> 4 Monterey, Monterey Harbor, California 2016-07-13 00:30:00 0.476
#> 5 Monterey, Monterey Harbor, California 2016-07-13 00:40:00 0.465
#> 6 Monterey, Monterey Harbor, California 2016-07-13 00:50:00 0.457
#> 7 Monterey, Monterey Harbor, California 2016-07-13 01:00:00 0.452
#> 8 Monterey, Monterey Harbor, California 2016-07-13 01:10:00 0.449
#> 9 Monterey, Monterey Harbor, California 2016-07-13 01:20:00 0.449
#> 10 Monterey, Monterey Harbor, California 2016-07-13 01:30:00 0.451
#> # ℹ 422 more rowslibrary(ggplot2)
library(scales)ggplot(data = data, aes(x = DateTime, y = TideHeight)) +
geom_line() +
scale_x_datetime(
name = "Date",
labels = date_format("%d %b %Y", tz = "America/Los_Angeles")
) +
scale_y_continuous(name = "Tide Height (m)") +
ggtitle("Monterey Harbour")Tide heights can be also obtained using rtide through a shiny interface developed by Seb Dalgarno.
Please report any issues.
Pull requests are always welcome.
The harmonics data was converted from
https://github.com/millerlp/rtide/blob/main/data-raw/harmonics-dwf-20251228-free.tar.xz,
NOAA web site data processed by David Flater for
XTide. The code to calculate tide
heights from the harmonics is based on XTide.
The harmonic constituent data for the various tide stations are updated
yearly by the XTide maintainer. The rtide package originally used a
harmonic data base from 2015. An updated harmonic constituent database
file from 2025-12-28 has been incorporated into rtide as of
v0.0.12.9000 (August 2026), which adds many new tide stations, as well
as slightly changing the harmonic constituent values for many stations.
As a result, tide height predictions produced with earlier versions of
the rtide package (v0.0.12 and earlier) may produce slightly different
values than the predictions generated by the new harmonic data base.
Those differences may typically only amount to a centimeter or less.
