Home » Linux Magazine » A Brief Introduction to XTide

A Brief Introduction to XTide

David Flater

Issue #32, December 1996

This article introduces a program that produces output in text mode, graphics and Java. Besides all that, XTide is both useful and fun.

XTide is free software for predicting tides. If you live on the water, then you’re already convinced that it’s the coolest program ever written. But if you’re stuck inland, like 99% of the human population, you may still find it to be an interesting and possibly educational toy. In fact, I originally wrote it to ease the pain of long hours in a land-locked, windowless office.

XTide can provide tide predictions in a wide variety of graphic and text formats. It can also act as an on-screen tide clock, showing the current time and water level at the location of your choice.

It was developed entirely under Linux, but all flavors of Unix are supported. Ports to Macintosh, DOS, MS-Windows and OS/2 also exist, supported by their respective maintainers.

Since XTide’s release in Summer 1995, web sites offering tide predictions have appeared everywhere. It is probably a safe bet that the majority of XTide users have used it only through a web page. Dean Pentcheff’s page (http://tbone.biol.sc.edu/tide/) is an example, offering tide predictions for many locations world-wide. However, if you look around, you will find that many coastal cities have their own XTide pages offering local tide information. [One example of this is our own page for Pacific Beach, Washington at http://www.a42.com/grays/PB/. —Pub]

XTide is released under the GNU Public License and comes with no warranty. It is an excellent tool for visualizing tide predictions, but don’t ever depend on it for navigation or use it where an error could be dangerous. XTide’s predictions are only as good as its database of tide information, and that was built up almost entirely by scavenging the Net. Always verify the output against predictions published by NOAA or a similar agency before taking any risks.

Installing XTide

The primary site for the XTide source distribution is universe.digex.net/~dave/files/. Only HTTP access is permitted (no anonymous FTP). However, that web page contains full instructions for downloading via HTTP and even provides a program, http_get, to make it easier.

You will need to get at least two files: an XTide source distribution and a harmonics file. The harmonics file is the database of tide information that XTide uses to predict the tides. The default harmonics file, harmonics, contains data for many U.S. and British Columbia locations, as well as a fair number of assorted locations world-wide. There is another harmonics file, harmonics.canadian, which contains data for over 1,000 Canadian locations.

Generally, there will be two source distributions available: a stable version and a development version. The development version will have “dev” in the file name. XTide follows an open development process, much like the Linux kernel, with every new feature immediately available to those brave enough to run it.

While XTide installation is not fully automatic, there is nothing especially difficult about it. The following is taken from the XTide README, simplified by the assumption that we have a typical Linux system:

  • Copy the harmonics file to the place that you have decided to put it (e.g., /etc/harmonics), gunzip it, and chmod 644.
  • Edit the #defines in config.h to specify the location and name of the harmonics file and the default location for which to show tides. The location you specify must be in the harmonics file. NOTE: The environment variables LOCATION and HFILE override the values specified in config.h, so you might just want to set these in /etc/profile instead.
  • xmkmf; make depend; make.
  • Copy the xtide executable into /usr/X11R6/bin.
  • Copy xtide.man to /usr/man/man1/xtide.1 and chmod 644.
  • Copy xtide.xpm into /usr/include/X11/pixmaps (mode 644) and change your window manager config file to use that icon for windows whose names start with “XTide”. The syntax to do this in fvwm (system.fvwmrc) is:
    Style "XTide*"     Icon xtide.xpm
    

Running XTide

XTide is controlled almost entirely by command line switches. Pull-down menus and other user-interface niceties may be added in future versions; thus far it’s been a challenge just keeping up with the more urgent feature requests.

XTide has way too many command line switches. Everyone seems to want different things from a tide program, and I have attempted to keep everyone happy. As a result, the default modes are very simple and boring, and you need to supply the switches to turn on any fancy features you may want. The XTide README can help with this; you can also type xtide -help to get a listing of the switches.

The default mode for XTide is tide clock, with no fancy options enabled. To get it to look like the picture, you need at least the following switches:

-now    Show current time in tide clock.
  -hinc Label the tide height tick marks with
        default increment.
  -tinc Label the time tick marks with default
         increment.
  -hairy        "Hairy" tide clock mode,
        showing slice of tide graph.

In order to get a different location and/or the time zone for that location, you will need these:

-list   List all supported locations.
  -location     Specify the location for which to predict tides
  -loctz        Use their time zone, not mine.

<f“Courier”>-location random<f$> will cause XTide to choose a location at random.

If you are not interested in keeping a tide clock on your desktop, the next most interesting mode will probably be graph mode. For that, you will need these switches:

-graph  Specify graph mode.
-gstart Specify the starting time for graphs and
        listings.

The format for the time stamps given to -gstart is YYYY:MM:DD:HH:MM. For example, half past midnight, June 1, 1995, is 1995:06:01:00:30.

By generating tide graphs for various locations, you will quickly get a feel for the different kinds of tides different places have. Many people are surprised to find out that not all places have two high tides and two low tides each day. Some places, like Bayou Rigaud, Louisiana, have only one high and one low tide per day; other places, like Brunswick, Maine, can have four of each! The latter are known as quarter-diurnal tides; the former (diurnal tides) are also interesting in that they will sometimes flatline, showing almost no tidal activity for 24 hours or more.

XTide supports many other modes, including simple ASCII text listings of tides, tide calendars, PPM and GIF output, and even Java-based tide graphs. It also has many options of special interest to folks on the water, such as to apply offsets for secondary tide locations, or to find the times at which the water goes above or below a specific tide level. Most of these options are explained in greater detail in the XTide README.

Learning More

An illustrated version of the XTide README can be accessed at universe.digex.net/~dave/xtide/. It contains examples of almost every kind of output that XTide can generate and includes full instructions and a FAQ.

You can learn a lot about tides and tide prediction by reading the National Ocean Service’s Tide and Current Glossary. An old version is preserved at universe.digex.net/~dave/xtide/tidegloss.html for the purpose of providing definitions for the technical terms used in the XTide README. The latest version, currently accessible at www-ceob.nos.noaa.gov/tidegloss.html, has been separated into many smaller web pages for easier browsing.

The canonical reference for tide prediction is the Manual of Harmonic Analysis and Prediction of Tides, Special Publication No. 98, Revised (1940) Edition, United States Government Printing Office, 1941. However, much of the traditional lore on tide prediction is not digestible unless you like swimming through pages of equations. Probably the easiest introduction to the subject for programmers is to read the source for the Java applets provided in the XTide distribution. These were written to be as small and simple as possible, and you can easily see where the tides are generated.

Although tide prediction is almost a definition of the term niche market, XTide has attracted an amazing number of users, and I hope that it will continue to serve their needs for years to come.

David Flater (dave@universe.digex.net) is a Computer Scientist (actual job title) living in the vicinity of Washington, D.C. He escaped grad school two years ago with a Ph.D. in Computer Science and is still trying to regain his sense of humor. All things considered, he’d rather be John Carmack.

x

Check Also

Finding Linux Software

Erik Troan Issue #24, April 1996 There is a treasure trove of software for Linux ...