Functions for utilization in the ION Parameter Function framework
Reference Information: add link
#Prerequisites
This assumes basic development environment setup (git, directory structure). Please follow the "New Developers Tutorial" for basic steps.
Install the following if not yet present:
Install git 1.7.7: Download the Mac or Linux installer and run it
OS Packages and package management: For Mac, use homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
- python 2.7
Install python, hdf5 and netcdf with Homebrew
brew install python
You can even reinstall git using brew to clean up your /usr/local directory Be sure to read the pyon README for platform specific guidance to installing dependent libraries and packages. Linux: Note that many installs have much older versions installed by default. You will need to upgrade couchdb to at least 1.1.0.
##libgswteos Dependency
A very important component is the libgswteos-10 library. Installation is quite straightforward on Mac OSX and a little more hairy on Linux.
On OSX
The libgswteos dependency is brew installable:
brew tap lukecampbell/homebrew-libgswteos
brew install libgswteos-10
brew test -v libgswteos-10
On Linux
The dependencies for building/installing the library are: autoconf, automake, & libtool
-
Obtain the tarball from: https://github.com/lukecampbell/gsw-teos/tarball/v3.0r4
- sha1: 6ae190b7da78d6aff7859e7d1a3bb027ce6cc5f3
-
Build Procedure
bash ./autogen.sh ./configure --prefix=/usr/local/libgswteos-10 make sudo make install
-
Linking Procedure:
sudo ln -s /usr/local/libgswteos-10/lib/libgswteos-10.la /usr/local/lib/ sudo ln -s /usr/local/libgswteos-10/lib/libgswteos-10.so.3 /usr/local/lib/ sudo ln -s /usr/local/libgswteos-10/lib/libgswteos-10.so.3.0.0 /usr/local/lib/ sudo ln -s /usr/local/libgswteos-10/lib/libgswteos-10.so /usr/local/lib/ sudo ln -s /usr/local/libgswteos-10/include/gswteos-10.h /usr/local/include/
-
Ensure that the global
C_INCLUDE_PATH
andLD_LIBRARY_PATH
includes /usr/local/lib in all profiles otherwise python won't run correctly:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include
Python packages and environment management:
Install pip
easy_install pip
Install virtualenv and virtualenvwrapper modules for your python 2.7 installation Note: This may require Mac's XCode (use XCode 3.3 free version
easy_install --upgrade virtualenv
easy_install --upgrade virtualenvwrapper
Setup a virtualenv to run ion-functions (use any name you like):
mkvirtualenv --python=python2.7 ion_functions
workon ion_functions
pip install numpy==1.6.2
#Source
To obtain the ion-functions project, begin by forking the GitHub repository. Next, clone your fork of the repository to your local machine (replace your_name with the name of your github account:
git clone git@github.com:your_name/ion-functions.git
cd ion-functions
#Installation Ensure you are in a virtualenv prior to running the steps below
From the ion-functions directory, run the following commands:
python bootstrap.py -v 1.7
bin/buildout
Once those steps complete, you should be able to run the unit tests
#Running unit tests (via nose)
From the coverage-model directory, run the following command:
bin/nosetests -v
This will run all tests in the ion-functions repository. The -v flag denotes verbose output (the name of each test prints as it runs). For more nose options, refer to the nose documentation
From the ion-functions directory, run the following command:
make
This will compile the C-extension unit tests. To run the tests:
extensions/test
You should see something of the like:
test_spike_simple... ok
test_spike_l simple... ok
test_spike_long... ok
#Libraries Currently Included
- Numpy – array manipulation
- import numpy as np
- Numexpr – relatively trivial "one line" expressions
- import numexpr
- vals = umexpr.evaluate('sin(x)**10 – y', local_dict={'x': x_vals, 'y': y_vals})
- import numexpr
- Gibbs Seawater equations – from TEOS-10 (Contact Luke Campbell if you notice something's missing)
- from pygsw import vectors as gsw
- vals = gsw.sp_from_sa(input_1, …)
- from pygsw import vectors as gsw
- GeoMag python library