Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy docs preview to GitHub Pages

on:
push:
branches:
- documentation
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install dependencies
run: pip install numpy scipy gsw ppigrf numexpr mkdocs-material mkdocstrings[python]

- name: Add package to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV

- name: Set fork site_url
run: |
sed -i "s|site_url:.*|site_url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/|" mkdocs.yml

- name: Deploy
run: mkdocs gh-deploy --force
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy docs to GitHub Pages

on:
push:
branches:
- master
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install dependencies
run: pip install numpy scipy gsw ppigrf numexpr mkdocs-material mkdocstrings[python]

- name: Add package to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV

- name: Deploy
run: mkdocs gh-deploy --force
39 changes: 21 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
*pyc
*.swp
bin
eggs
develop-eggs
ion_functions.egg-info
parts
.installed.cfg
ion_functions/data/tmp/
build
*.egg
*.o
*.c
!extensions/*.c
extensions/test
*.so
notebooks/
.idea
*pyc
*.swp
bin
eggs
develop-eggs
ion_functions.egg-info
parts
.installed.cfg
ion_functions/data/tmp/
build
*.egg
*.o
*.c
!extensions/*.c
extensions/test
*.so
notebooks/
.idea

.claude
CLAUDE.md
159 changes: 24 additions & 135 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,146 +1,35 @@
ION Functions
==============
# ion-functions

Functions for utilization in the ION Parameter Function framework
Python library of oceanographic data processing functions for the
[Ocean Observatories Initiative (OOI)](https://oceanobservatories.org/).

Reference Information: *add link*
ion-functions transforms raw instrument data (L0) into calibrated scientific
data products at L1 and L2 levels, covering CTD, ADCP, velocity, dissolved
oxygen, CO2, fluorometry, pH, pressure, meteorology, and more.

**Documentation:** https://oceanobservatories.github.io/ion-functions/

#Prerequisites
## Installation

This assumes basic development environment setup (git, directory structure). Please follow the
"New Developers Tutorial" for basic steps.
```bash
conda env create -f conda_env.yml
conda activate ion
python setup.py develop
```

## Running tests

**Install the following if not yet present:**
```bash
pytest
```

**Install** git 1.7.7:
*Download the Mac or Linux installer and run it*
## Running C-extension tests

*OS Packages and package management:*
For Mac, use homebrew
```bash
make
extensions/test
```

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
## License

* 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**

1. Obtain the tarball from: https://github.com/lukecampbell/gsw-teos/tarball/v3.0r4
* sha1: 6ae190b7da78d6aff7859e7d1a3bb027ce6cc5f3

1. Build Procedure

bash ./autogen.sh
./configure --prefix=/usr/local/libgswteos-10
make
sudo make install

1. 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/

1. Ensure that the global `C_INCLUDE_PATH` and `LD_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
pip install -r requirements.txt

#Source

To obtain the ion-functions project, begin by [forking the GitHub repository](https://github.com/ooici/ion-functions/). 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](https://nose.readthedocs.org/en/latest/))

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](https://nose.readthedocs.org/en/latest/man.html)

# Running C-Extension Unit Tests

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](http://www.scipy.org/Tentative_NumPy_Tutorial) – array manipulation
* import numpy as np
* [Numexpr](https://code.google.com/p/numexpr/) – relatively trivial "one line" expressions
* import numexpr
* vals = umexpr.evaluate('sin(x)**10 – y', local\_dict={'x': x\_vals, 'y': y\_vals})
* [Gibbs Seawater equations – from TEOS-10](https://pypi.python.org/pypi/pygsw) _(Contact Luke Campbell if you notice something's missing)_
* from pygsw import vectors as gsw
* vals = gsw.sp_from_sa(input_1, …)
* [GeoMag python library](https://pypi.python.org/pypi/geomag/)
See [LICENSE.txt](LICENSE.txt).
26 changes: 12 additions & 14 deletions conda_env.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: ion
channels:
- defaults
- ooi
- conda-forge
- conda-forge
- defaults
dependencies:
- cython=0.25.2
- ipython=5.3.0
- matplotlib
- nose=1.3.7
- numexpr=2.6.2
- numpy=1.16
- python=2.7
- scipy=1.2.1
- geomag=0.9.2015
- pygsw=0.0.11
prefix: ion
- python>=3.13
- cython
- numpy>=2.4
- scipy>=1.17
- matplotlib>=3.10
- gsw>=3.6
- ppigrf>=2.0
- mkdocstrings
- mkdocstrings-python
- mkdocs-material
Loading