Learn R Programming

HelpersMG (version 4.2)

tide.info: Annual tide calendar for one particular location

Description

The script extracts tide information from: http://tides.mobilegeographics.com/ into a data.frame. The presence of XLM package is required for this function.

Usage

tide.info(
  file = NULL,
  year = as.POSIXlt(Sys.time())$year + 1900,
  location = 0,
  latitude = NA,
  longitude = NA,
  tz = ""
)

Arguments

file

An html file from the site http://tides.mobilegeographics.com/

year

Year to get the calendar

location

Code based on http://tides.mobilegeographics.com/

latitude

The latitude of the tide information

longitude

The longitude of the tide information

tz

Timezone

Value

Return a data.frame with tide calendar: Level is the tide level, Tide is the High or Low Tide information and Date.Time is the date/time in POSIXlt format.

Details

tide.info gets the annual tide calendar for one particular location.

See Also

Other Periodic patterns of indices: index.periodic(), minmax.periodic(), moon.info(), sun.info()

Examples

Run this code
# NOT RUN {
library("HelpersMG")
lat <- 5.74
long <- -54
Awala2004 <- tide.info(year=2004, longitude=long, latitude=lat, tz="America/Cayenne")
with(Awala2004, plot(Date.Time, Level, bty="n", las=1, type="l", 
xlab=paste("Year", as.POSIXlt(Date.Time[1])$year+1900), 
ylab="Tide level in m"))
latitude <- 45.3667
longitude <- -64.3833
NovaScotia <- tide.info(year=2018, longitude=longitude, 
                       latitude=latitude, tz="America/Halifax" )
with(NovaScotia, plot(Date.Time, Level, bty="n", las=1, type="l", xaxt="n", 
   xlab=paste("January", as.POSIXlt(Date.Time[1])$year+1900), 
   xlim=as.numeric(as.POSIXlt(as.Date(c("2018-01-01", "2018-01-31")))), 
   ylab="Tide level in m"))
axis(1, at=as.numeric(as.POSIXlt(seq(from=as.Date("2018-01-01"), 
                                     to=as.Date("2018-01-31"), by="1 day"))), 
labels=1:31)
segments(x0=as.numeric(as.POSIXlt(as.Date("2018-01-01"))), 
x1=as.numeric(as.POSIXlt(as.Date("2018-01-31"))), y0=0, y1=0, lty=2)
# }

Run the code above in your browser using DataLab