View source: R/read_importsealevels.R
read_importsealevels | R Documentation |
Under NOAA Tides and Currents, there is the NOAA Center for Operational Oceanographic Products and Services (CO-OPS). This function uses the CO-OPS Data Retrieval API to extract see level data by station.
read_importsealevels(
path_csv,
download_latest = TRUE,
df_stations = sealevelstations[, c("station_id", "station_name")],
api_url = "https://api.tidesandcurrents.noaa.gov/api/prod/datagetter",
beg_int = 19010101,
end_int = as.integer(format(lubridate::today(), "%Y%m%d")),
product = "monthly_mean",
datum = "stnd",
time_zone = "lst",
units = "metric"
)
path_csv |
chr string path of CSV file to store tabular output. (Overwrites existing file.) |
download_latest |
logical to download latest. (Overwrites existing file.) |
df_stations |
data frame of stations with column |
api_url |
chr string URL for NOAA Center for Operational Oceanographic Products and Services (CO-OPS) API. Defaults to the CO-OPS API for data retrieval: https://api.tidesandcurrents.noaa.gov/api/prod/datagetter. |
beg_int |
int integer of beginning date in YYYYMMDD format. Defaults to
|
end_int |
int integer of ending date in YYYYMMDD format. Defaults to
|
product |
chr string of product type. For options, see Data Products | CO-OPS API.
Defaults to |
datum |
chr string of datum. Defaults to |
time_zone |
Time zone. Defaults to |
units |
chr string of units. Defaults to |
Given the default arguments in (and especially product = "monthly_mean"
), this function returns a data frame from reading
path_csv
(updated if download_latest = TRUE
or newly written if
path_csv
does not exist) having the following fields:
station_id
: integer column from input argument df_stations
station_name
: character column from input argument df_stations
date
: first of the month given by year
and month
from API output
year
: year of the data
month
: month of the data
mhhw
: Mean Higher-High Water
mhw
: Mean High Water
msl
: Mean Sea Level
mtl
: Mean Tide Level
mlw
: Mean Low Water
mllw
: Mean Lower-Low Water
dtl
: Mean Diurnal Tide Level
gt
: Great Diurnal Range
mn
: Mean Range of Tide
dhq
: Mean Diurnal High Water Inequality
dlq
: Mean Diurnal Low Water Inequality
hwi
: Greenwich High Water Interval (in Hours)
lwi
: Greenwich Low Water Interval (in Hours)
highest
: Highest Tide
lowest
: Lowest Tide
inferred
: A flag that when set to 1 indicates that the water level value has been inferred
For more details on these output data columns, see About Tidal Datums | NOAA Tides & Currents.
read_importsealevels(tempfile("sealevels", fileext=".csv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.