Tide prediction from model grids
  • Fortran 99%
  • Makefile 0.5%
  • Shell 0.5%
Find a file
2025-10-02 17:55:48 -04:00
example_drivers example1 now uses GOT5.5. Update code comments. 2025-10-02 17:33:27 -04:00
support1 tweak fixname routine 2025-10-02 17:41:02 -04:00
support2 Use standardised Fortran 2003 (except for .f files) 2025-09-23 14:15:07 +02:00
.gitignore add example_drivers/Makefile 2025-09-23 12:38:31 +02:00
LICENSE minor 2025-10-02 17:55:48 -04:00
perth.f90 Update comments 2025-10-02 17:50:07 -04:00
perth_lp.f90 Update comments 2025-10-02 17:50:07 -04:00
README.md Update readme. 2025-10-02 17:47:23 -04:00

perth5 (and perth5lp)

perth5 is a fortran(2003) module designed to compute ocean tide height predictions for a desired time and location, using as input a set of two-dimensional (finite difference) grids of constituent amplitudes and phases. The package is designed to handle all common global tide models in various formats (ascii, netcdf, and the native binary from the Oregon State model), as well as any number of constituents. On option it can use tidal inference for any missing (diurnal or semidiurnal) waves, using either linear or Fourier-series interpolation/extrapolation of tidal admittances. The input grids must store one constituent in each input file, which is currently the most common approach.

A second module, perth5lp, is used to handle long-period tides. This is a separate routine because it is not uncommon for models of long-period tides to be developed as a separate project, and to reside on grids that are inconsistent with those used for short-period tides. Subroutine perth5lp can also perform inference, if needed. Note that subroutine perth5 can also handle long-period tides if they reside in the given input files, but it will not perform inference in the long-period band.

The primary application envisioned for this software is to process satellite altimeter data. However,...

As an example of using a sledgehammer to fasten a pin, perth5 can also compute tide predictions from a simple ascii list of tidal constants, e.g., those from a single tide gauge. (Of course, there are simpler packages, without all the grid and netcdf overhead, that can do this, but since the infrastructure was already built, it seemed worth adding the capability.) To do this, one input file is used; the first record gives a single integer N, for the total number of constituents, followed by N records giving constituent name, amplitude, and phase lag. See the example program and its input file (consisting of NOAA's harmonic constants for Anchorage, with many compound constituents).

Nonetheless, the package is primarily meant for space geodesy and oceanography users. The package should certainly NOT be used for coastal navigation or in any other applications that risk life or property. Moreover, the accuracy of the predictions depends on the accuracy of the input model grids; lousy models give lousy predictions.

Usage

The user is responsible for writing any necessary driver routines that call the main perth5 (and/or perth5lp) subroutine. Five small example drivers are given in the relevant directory. The calling sequence to perth5 is as follows:

call perth5( dlat, dlon, time, tide, isdata )

where

  • dlat, dlon is latitude and longitude in degrees for the desired loation.
  • time is desired UT time, in decimal Modified Julian Date.
  • tide is the returned tidal height, in the same units as the input amplitudes.
  • isdata is a returned logical denoting whether tide data exist at the desired location.

Before the perth5 subroutine is called, an initialization subroutine must be called. The main input to it is a list of input file names, for the input constituent grids. The routine has some optional arguments, although the defaults should be taken for most purposes. One option can turn off inference if desired (its "on" by default); same for nodal corrections. A "verbose" option defaults to 0 for no printed output; it can be reset to 1, 2, or 3 for more and more printing, which is often useful to see.

The routine makes a valiant attempt to recognize constituent names that reside inside the input grids, or in their file names; contact me if it fails.

The software can handle well over a hundred compound tides (i.e., it can recognize their Darwinian names and can compute nodal modulations if appropriate). Of course, there is no limit to the number of possible compound tides. I suspect any missing ones are small and ignorable; if not, contact me and I will add them.

Note on (long-period) inference

Inference in the long-period band requires Mf and Mm constituents be provided, and optionally the 18.6-year node tide. If the node tide is missing, it will be computed as an equilibrium tide by using a simple analytical expression. In retrospect, this might have been a bad idea, because the software needs to figure out what amplitude units to use (consistent with whatever had been input for the other constituents), and this can go wrong, although the program will halt if it cannot determine the units for the analytical model. Moreover, the analytical expression is for the equilibrium ocean tide. If the computations are being done for (say) the load tide, then the result will be incorrect. It is always safest to input your own node tide grid, equilibrium or otherwise. (Its Darwin name is: "Node" or "Omega0".) Otherwise, one could always turn inference off for (say) long-period load tides; the error would be quite acceptable.

Other codes

The CNES FES tide models come with their own prediction software, written mostly in C, although by design perth5 can handle those models. If you don't like Fortran or C, try Tyler Sutterley's python package, pyTMD, at https://github.com/tsutterley/pyTMD

perth5 is a complete rewrite of an older package, perth or perth3, used for the GOT4 and earlier ocean models. The new code is far more flexible, powerful, and useful. I have noticed perth3 code appearing here and there in other packages, but perth5 is (mostly) completely new, including the code for inference and nodal corrections.

Version History

Following is a history of releases on codeberg, newest to oldest.

perth5 v1.16, perth5lp v1.21 (30 June 2024)

  • Import to codeberg.

perth5 v1.19, perth5lp v1.24 (2 Oct 2025)

  • Better standardize Fortran-2003 type statements.
  • Other minor code improvements, new Makefile for examples.