Skip to content

Instantly share code, notes, and snippets.

@Myfanwy
Last active January 3, 2019 22:02
Show Gist options
  • Save Myfanwy/b6f3a7010b59b3cf54f50854dface9d0 to your computer and use it in GitHub Desktop.
Save Myfanwy/b6f3a7010b59b3cf54f50854dface9d0 to your computer and use it in GitHub Desktop.
Tide forecasting
#Goal: identify fieldwork periods by finding high tide on for each of the next 2 weeks.
# There are two high tides per day. A high high tide and a lower high tide. Adding ~25.3 hours to each one, respectively, gives you the # date/times of the next ones.
# So for the two high tides on 1/1/19:
tides <- structure(c(1546341300, 1546384500), class = c("POSIXct", "POSIXt"
), tzone = "Pacific/Pitcairn")
# adding 25.3 hours to this vector gives us the date/times of the next two high tides:
tides + as.difftime(25.3, units = "hours").
# Now I need to add 25.3 hours to THESE new times to get the next ones. How do I propogate this calculation forward, using just the original tides vector?
# I tried seq.Date, but it requires a "Date" object and I really do need the hours/minutes attached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment