HTTPS SSH

INFORMATION ON CONVERSION

Alvin Depth to Fofonoff Depth Converter is a tool for converting in either direction between these two depth measurements. Both depths were calculated from pressure in decibars and decimal degrees latitude using the Fofonoff Equation, but Alvin Depth assumes 30 degrees latitude all of the time. If converting from Alvin to Fofonoff, the Alvin Depth (meters) and 30 degrees latitude are first run through the inverted Fofonoff Equation to find pressure in dbars. This pressure measurement is then put back into the equation, but this time with the correct latitude where the measurement was taken. The output is Fofonoff Depth in meters.

For more background information on Alvin Depth and the Fofonoff Equation, visit these websites:

https://www.whoi.edu/page.do?pid=11355

http://unesdoc.unesco.org/images/0005/000598/059832eb.pdf

INSTALLATION

Uses Python 2.7 Python Requirements: - Numpy - Pandas - PyQt4

PACKAGING

Packaging this program into self-contained executables is a little tricky, but can be done using the pyinstaller package as of 10/23/2015. These steps will need to be done with every OS that you want to build an executable for.

Linux:

  1. Set up a new virtual environment for packaging.
  2. Copy the existing PyQt4 and sip packages from the host system into the new virtual environment lib/python2.7/site-packages directory. These cannot be installed by pip.
  3. Upgrade pip and setuptools: pip install -U pip setuptools
  4. Install numpy: pip install numpy
  5. Download pytz and python-dateutil sources direct from pypi
  6. Unzip sources and modify setup.py for each package: change zip_safe to False
  7. Install each package with: python setup.py install
  8. Install pandas: pip install pandas
  9. Clone the development version of pyinstaller: `git clone https://github.com/pyinstaller/pyinstaller'
  10. Install pyinstaller
  11. Test packaging using the 'onedir' option: pyinstaller -D -w fofonoff_app.py
  12. Try running it: cd dist/fofonoff_app && ./fofonoff_app
  13. If it works, delete dist directory and use the 'onefile' option: pyinstaller -F -w fofonoff_app.py

Windows: 0. Use a python distribution such as pythonxy that includes numpy, pandas, and PyQt4

to save yourselve from lots of headaches
  1. Set up a new virtual environment for packaging.
  2. Copy the existing PyQt4 and sip packages from the host system into the new virtual environment Lib/python2.7/site-packages directory. These cannot be installed by pip.
  3. Upgrade pip and setuptools: pip install -U pip setuptools
  4. Copy over the pre-built numpy package to Lib/python2.7/site-packages
  5. Download pytz and python-dateutil sources direct from pypi
  6. Unzip sources and modify setup.py for each package: change zip_safe to False
  7. Install each package with: python setup.py install
  8. Copy over the pre-built pandas package ot Lib/python2.7/site-packages
  9. Clone the development version of pyinstaller: `git clone https://github.com/pyinstaller/pyinstaller'
  10. Install pyinstaller
  11. Test packaging using the 'onedir' option: pyinstaller -D -w fofonoff_app.py
  12. Try running the 'fofonoff_app.exe' program in dist/fofonoff_app
  13. If it works, delete dist directory and use the 'onefile' option: pyinstaller -F -w fofonoff_app.py

USING THE PROGRAM

  1. Select the direction of conversion by clicking either the "Alvin to Fofonoff" button or the "Fofonoff to Alvin" button.
  2. Select whether to do a single conversion or to convert multiple depths in a .csv file.
  3. If doing single conversion, simply enter Depth in meters (either Alvin or Fofonoff depending on your selection in Step 1) and latitude in decimal degrees. If you enter a depth that is too large, you will see an error message when you click "Convert". Latitude can be positive or negative.
  4. If converting a whole .csv file:
    • Enter the path of the input file in the "Input File (.csv)" box, or browse for your file.
    • In the "Input File Settings" area, you must enter information telling the program what to convert in your input file. The "Column # of Depth Values" is the field in which your desired depth to be converted is located (default is 1, meaning the first column in a .csv file). Similarly, you must enter the "Column # of Latitude (decimal degrees) Values", so that the program knows where to find latitude (default is column number 2). The "Delimiter" is usually one character long. Some commonly used delimiters include space, tab, and commas. If your .csv file has a row with headers, then the "Row Number Where Data Begin" may be row number 2 (being the second row from the top of the file).
    • Browse or type an output file directory and name. If you browse for the directory, the text box will show the directory you selected. You must enter a file name with ".csv" at the end or else an error message will occur when you try to convert.
    • In the "Output File Settings" area, you get to choose what your output file will look like. Select how many decimals to round to (4 is the maximum, offering accuracy to the millimeter with one "guessing place"). Note that the option "Output data (single column) in the "Contents of New File" setting excludes all of the data in your input file and merely outputs the new depth. This does NOT delete your input data as long as your output file is a new file. An overwrite warning will pop up if data loss may occur. The other option in the "Contents of New File" setting keeps the input data and appends a new column with the output depth.
    • It is recommended that before you do any conversion, you click the "Preview Output File" button to see the top few rows of data in your new file. This is especially useful if you are converting large files that will take a long time to convert. The preview feature lets you be sure your output settings are what you want them to be.
    • Finally, once everything looks good, go ahead and "Write Output File". The conversion progress is displayed below. Please allow a little bit of time for the progress bar and label to update if you are converting large files. If either the input or output settings do not work, the status label will indicate any possible issues. Relevant overwrite pop-up messages will appear to avoid unintentional data loss.
    • Your file will appear in the directory you specified once the conversion is complete!