Monday, April 09, 2012

Getting XTIDE Up on Joyent SmartMachine (Solaris 11)

This is my note on getting the XTide (learn more) up on the Joyent SmartMachine on which I am running various personal web projects. My XTide was previously hosted on a shared Linux machine (i.e., no root access) before but the provider upgraded the Linux and then it broke. Since I now have an Intel Solaris 11 virtual machine of "my own," I have decided to transition to this server (as I find time, of course.) Installing and configuring XTide on a shared machine was a real hassle as they did not have X11 installed and they won't install it for me, but now with the virtual machine in which I have the "root" things are becoming much easier, in addition there are a lot of pre-built installs that's available (still require the root access.) {Why Joyent SmartMachine and Solaris? Don't ask. But I am extremely satisfied with it. }

Perhaps you may have the same problem and here is how I got around the issues.

Note that I am only interested in running this as a command line to compute the tide and graphics in the area I surf using a cron job. So if you have an X-Windows issue, this article won't help much.


Getting It Installed

Getting it installed is fairly simple.
  • The page http://www.flaterco.com/xtide/files.html tells that on Solaris you go to Blastware.COM, but almost all of the mirror sites it points to are broken. Instead, if you go to http://www.opencsw.org/packages/xtide/ it is still avilable. The maintenance of this stopped around 2.10 (in 2008) but for my purposes, it is OK. Someday, when I have more time, I may volunteer to contribute to Opencsw to maintain this. Not now...
  • It comes with required libraries, and also the original harmonics and wvs files it was built with in /opt/csw/share/xtide 
  • If you don't know what I am talking about but you have the root access to the machine, just follow the instructions on the OpenCSW web site, install the pkgutil installer first as a root (if you don't have) and then install the xtide with it. You would be all set in a matter of 5-10 minutes. And if you still don't know what I am talking about, then it is best to ask your IT admin buddy to get that done as it can affect other OpenCSW packages other people may be using on your machine. 
Getting it to Run
  • "Out of the box" by typing in {tide -l "princeton"} it did not run. In fact it threw an exception about saying  the following:

    XTide Fatal Error:  BAD_OR_AMBIGUOUS_COMMAND_LINE

    but do not dismay yet...!
  • Here is what I have done to get it going!
The "tide" command on /opt/csw/bin/tide is a shell script which, in turn, will run tide.bin after "tide" sets various environment variables. There appears to be an issue with the WVS_DIR environment variable and if only have the HFILE_PATH it works (in other words comment out WVS_DIR definition in the tide script), and it will output the tide. The graphics output also worked.

To test if anything works, you can first only EXPORT the HFILE_PATH in your shell then run /opt/csw/bin/tide.bin directly like this.

HFILE_PATH="/opt/csw/share/xtide/harmonics.tcd"
export HFILE_PATH
/opt/csw/bin/tide.bin -l "princeton"

The Harmonics Database Location Names Have Changed

In my old script I had -l "half moon bay." This time it did not work as the program could not find the station name. So be sure that you look at the Location List (http://www.flaterco.com/xtide/locations.html)  that matches your Harmonic file you've downloaded.

Hope this helps in your situation.





No comments: