functions and code for working with tidal data in R