From 6a4a741a3911ba84d694afab5c9c11dbbc6a449d Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 14:34:37 -0300 Subject: [PATCH 1/6] update readme --- README.md | 92 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index eb36cfa..9ed0e23 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,69 @@ -# gsw Python package +# GSW-Python -![https://travis-ci.org/TEOS-10/GSW-Python](https://travis-ci.org/TEOS-10/GSW-Python.svg?branch=master) ![https://conda.anaconda.org/conda-forge](https://anaconda.org/conda-forge/gsw/badges/installer/conda.svg) [![DOI](https://zenodo.org/badge/86503067.svg)](https://zenodo.org/badge/latestdoi/86503067) +[![Tests](https://github.com/TEOS-10/GSW-Python/actions/workflows/tests.yml/badge.svg)](https://github.com/TEOS-10/GSW-Python/actions/workflows/tests.yml) +[![Wheels](https://github.com/TEOS-10/GSW-Python/actions/workflows/cibuildwheel.yml/badge.svg)](https://github.com/TEOS-10/GSW-Python/actions/workflows/cibuildwheel.yml) +[![DOI](https://zenodo.org/badge/86503067.svg)](https://zenodo.org/badge/latestdoi/86503067) -This Python implementation of the Thermodynamic Equation of -Seawater 2010 (TEOS-10) is based primarily on numpy ufunc wrappers of -the GSW-C implementation. We expect it to replace the original -[python-gsw](https://github.com/TEOS-10/python-gsw) -pure-python implementation after a brief overlap period. -The primary reasons for this change are that by building on the -C implementation we reduce code duplication and we gain an immediate -update to the 75-term equation. Additional benefits include a -major increase in speed, a reduction in memory usage, and the -inclusion of more functions. The penalty is that a C (or MSVC C++ for -Windows) compiler is required to build the package from source. +This Python implementation of the Thermodynamic Equation of Seawater 2010 (TEOS-10) is based primarily on numpy ufunc wrappers of the GSW-C implementation. +This replaces the original [python-gsw](https://github.com/TEOS-10/python-gsw) pure-python implementation after a brief overlap period. +The primary reasons for this change are that by building on the C implementation we reduce code duplication and we gain an immediate update to the 75-term equation. +Additional benefits include a major increase in speed, +a reduction in memory usage, +and the inclusion of more functions. +The penalty is that a C (or MSVC C++ for Windows) compiler is required to build the package from source. -**Warning: this is for Python >=3.5 only.** +**Warning: this is for Python >=3.6 only.** Documentation is provided at https://teos-10.github.io/GSW-Python/. For the core functionality, we use an auto-generated C extension -module to wrap the C functions as numpy -[ufuncs](https://docs.scipy.org/doc/numpy/reference/ufuncs.html), -and then use an -autogenerated Python module to add docstrings and handle masked -arrays. 165 scalar C functions with only double-precision -arguments and return values are wrapped as ufuncs, and 158 of -these are exposed in the ``gsw`` namespace with an additional -wrapper in Python. - -A hand-written wrapper is used for one C function, and others -are re-implemented directly in Python instead of being wrapped. -Additional functions present in GSW-Matlab but not in GSW-C may -be re-implemented in Python, but there is no expectation that -all such functions will be provided. - -The package can be installed from a clone of the repo using -``pip install .``. It is neither necessary nor recommended -to run the code generators, and no instructions are provided -for them; their output is -included in the repo. You will need a suitable compiler: gcc or -clang for unix-like systems, or the MSVC compiler set used for Python -itself on Windows. For Windows, some of the source code has been -modified to C++ because the MSVC C compiler does not support the +module to wrap the C functions as numpy [ufuncs](https://docs.scipy.org/doc/numpy/reference/ufuncs.html), +and then use an autogenerated Python module to add docstrings and handle masked arrays. +165 scalar C functions with only double-precision arguments and return values are wrapped as ufuncs, +and 158 of these are exposed in the ``gsw`` namespace with an additional wrapper in Python. + +A hand-written wrapper is used for one C function, and others are re-implemented directly in Python instead of being wrapped. +Additional functions present in GSW-Matlab but not in GSW-C may be re-implemented in Python, +but there is no expectation that all such functions will be provided. + +## Installation + +Pip users can install the pre-built wheels with: + +```shell +pip install gsw +``` + +conda users will find binaries on conda-forge, + +```shell +conda install gsw --channel conda-forge +``` + +The development version of the package can be installed from a clone of the repo using + +```shell +pip install . +``` + +It is neither necessary nor recommended to run the code generators, +and no instructions are provided for them; +their output is included in the repo. +You will need a suitable compiler: +gcc or clang for unix-like systems, +or the MSVC compiler set used for Python itself on Windows. +For Windows, some of the source code has been modified to C++ because the MSVC C compiler does not support the C99 complex data type used in original GSW-C. To test, after installation, run "pytest" from the source directory. ## Note for xarray users -A wrapper around gsw called [gsw-xarray](https://github.com/DocOtak/gsw-xarray) -exists for xarray. It adds CF compliant attributes when possible, units, and name. +A wrapper around gsw called [gsw-xarray](https://github.com/DocOtak/gsw-xarray) exists for xarray. +It adds CF compliant attributes when possible, units, and name. ## Note for on generating the docstrings + The autogenerated docstrings are checked with codespell in the CIs. -when autogenerating them the we need to run `pre-commit run --all-files` and fix the documentation issues found. +when autogenerating them the we need to run ``pre-commit run --all-files`` and fix the documentation issues found. From be66ff0d0fee8dd0bc9e2d5d6a46c2e6e1d61140 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 15:08:25 -0300 Subject: [PATCH 2/6] sync docs and readme --- README.md | 2 +- docs/index.rst | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9ed0e23..a73868b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This Python implementation of the Thermodynamic Equation of Seawater 2010 (TEOS-10) is based primarily on numpy ufunc wrappers of the GSW-C implementation. -This replaces the original [python-gsw](https://github.com/TEOS-10/python-gsw) pure-python implementation after a brief overlap period. +This library replaces the original [python-gsw](https://github.com/TEOS-10/python-gsw) pure-python implementation.. The primary reasons for this change are that by building on the C implementation we reduce code duplication and we gain an immediate update to the 75-term equation. Additional benefits include a major increase in speed, a reduction in memory usage, diff --git a/docs/index.rst b/docs/index.rst index 9cedc0c..2edddda 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,17 +1,11 @@ -.. gsw documentation master file, created by - sphinx-quickstart on Mon Mar 13 15:27:45 2017. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - GSW-Python ========== This Python implementation of the Thermodynamic Equation of Seawater 2010 (`TEOS-10 `__) is based primarily on numpy ufunc wrappers of the `GSW-C `__ implementation. -We expect it to replace the original -`python-gsw `__ -pure-python implementation after a brief overlap period. +This library replaces the original +`python-gsw `__ pure-python implementation. The primary reasons for this change are that by building on the C implementation we reduce code duplication and we gain an immediate update to the 75-term equation. Additional benefits include a From a3493076880c51d9fd636d5ada2ae45f2841a95c Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 15:08:36 -0300 Subject: [PATCH 3/6] update pre-commit --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b867213..c1f6ac1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.3.0 hooks: - id: check-ast - id: debug-statements - id: check-added-large-files - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.2.1 hooks: - id: codespell exclude: > From 32f6b6d4c736227af3e88417699b2bef6d088083 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 15:08:42 -0300 Subject: [PATCH 4/6] fix typo --- gsw/_wrapped_ufuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsw/_wrapped_ufuncs.py b/gsw/_wrapped_ufuncs.py index 376f9ab..01c22c1 100644 --- a/gsw/_wrapped_ufuncs.py +++ b/gsw/_wrapped_ufuncs.py @@ -213,7 +213,7 @@ def C_from_SP(SP, t, p): """ Calculates conductivity, C, from (SP,t,p) using PSS-78 in the range 2 < SP < 42. If the input Practical Salinity is less than 2 then a - modified form of the Hill et al. (1986) fomula is used for Practical + modified form of the Hill et al. (1986) formula is used for Practical Salinity. The modification of the Hill et al. (1986) expression is to ensure that it is exactly consistent with PSS-78 at SP = 2. From 9cea560b8241b2ad812a891e6e9a0b7a43571de7 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 15:19:41 -0300 Subject: [PATCH 5/6] review actions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a73868b..470ae23 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ a reduction in memory usage, and the inclusion of more functions. The penalty is that a C (or MSVC C++ for Windows) compiler is required to build the package from source. -**Warning: this is for Python >=3.6 only.** +**Warning: this is for Python >=3.8 only.** Documentation is provided at https://teos-10.github.io/GSW-Python/. @@ -63,7 +63,7 @@ To test, after installation, run "pytest" from the source directory. A wrapper around gsw called [gsw-xarray](https://github.com/DocOtak/gsw-xarray) exists for xarray. It adds CF compliant attributes when possible, units, and name. -## Note for on generating the docstrings +## Note on generating the docstrings The autogenerated docstrings are checked with codespell in the CIs. -when autogenerating them the we need to run ``pre-commit run --all-files`` and fix the documentation issues found. +when autogenerating them we need to run ``pre-commit run --all-files`` and fix the documentation issues found. From 33a51d6530890a662811de3df1b1d5085b8167f1 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 13 Sep 2022 15:19:55 -0300 Subject: [PATCH 6/6] fix min supported Python --- setup.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 19fc7d4..7ce214b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,8 +15,10 @@ classifiers = License :: OSI Approved :: BSD License Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: Scientific/Engineering @@ -24,7 +26,7 @@ classifiers = zip_safe = False install_requires = numpy -python_requires = >=3.6 +python_requires = >=3.8 packages = find: include_package_data = True