Skip to content

TEOS-10/GSW-Python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gswc

This is the start of an experimental Python implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10) in which the core functionality is obtained by wrapping the functions from the C implementation (GSW-C).

Warning: this is in an early development stage. If it proceeds, the repo will probably be renamed and moved.

Warning: this is presently for Python 3 only.

Warning: the only official TEOS-10 implementations are provided as zipfiles at <http://www.teos-10.org/software.htm>.

The strategy used here is to use an auto-generated C extension module to wrap the C functions as numpy ufuncs, and then use an autogenerated Python module to add docstrings and handle masked arrays. 158 scalar C functions with only double-precision arguments and return values are wrapped.

It is expected that some small fraction of the functions implemented in C will be re-implemented here directly in Python, (3 have been done so far) and that, over time, more of the functions present in GSW-Matlab will also be re-implemented here in Python, or added to the C and wrapped. In doing so, we would like to maintain aspects of the approach used so far: factor out common chunks of documentation, or and/or pull directly from GSW-Matlab, with automated customization as needed. In other words, minimize repetition at the base level of the source code, so that whenever something can be improved or needs to be updated, it can be done in one place, and will then be propagated automatically as needed by the code generation tools.

If this development is successful, it will probably replace python-gsw as the primary Python implementation of GSW.

Although the repository is "gswc", the package name is now "gsw".

The package can be installed using pip install .. It is not necessary to run the code generators; their output is included in the repo.

The tests module does not yet support automated testing via py.test, but manually running check_functions.py, which translates function calls and tests from its Matlab counterpart, results in 145 passes and 0 failures.

About

Python implementation of TEOS-10 GSW based on ufunc wrappers of GSW-C

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors