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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ updates:
github-actions:
patterns:
- '*'
cooldown:
default-days: 7
6 changes: 6 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Documentation

# no permissions by default
permissions: {}

on:
pull_request:
push:
Expand All @@ -12,12 +15,15 @@ on:
jobs:
build-docs:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Full Tests

# no permissions by default
permissions: {}

on:
pull_request:
push:
Expand All @@ -10,20 +13,23 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
os: [ubuntu-latest]
python-version: [ "3.10", "3.11", "3.12", "3.13" , "3.14" ]
os: [ ubuntu-latest ]
fail-fast: false

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Micromamba Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt octave --channel conda-forge
python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge

- name: Install seawater
shell: bash -l {0}
Expand All @@ -33,4 +39,4 @@ jobs:
- name: Full Tests
shell: bash -l {0}
run: |
python -m pytest -rxs --doctest-modules --pyargs seawater
python -m pytest -rxs -m "not octave" --doctest-modules --pyargs seawater
42 changes: 42 additions & 0 deletions .github/workflows/tests_octave.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Full Tests

# no permissions by default
permissions: {}

on:
pull_request:
push:
branches: [main]

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.10" ]
os: [ ubuntu-latest ]
fail-fast: false

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Micromamba Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} octave=6 --file requirements.txt --file requirements-dev.txt --channel conda-forge

- name: Install seawater
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall

- name: Full Tests
shell: bash -l {0}
run: |
python -m pytest -rxs -m "octave" --doctest-modules --pyargs seawater
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: seawater/tests/seawater_v3_3/

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-ast
Expand All @@ -16,12 +16,12 @@ repos:
files: requirements-dev.txt

- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
rev: v0.4.6
hooks:
- id: blackdoc

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
exclude: >
Expand All @@ -32,23 +32,28 @@ repos:
- --ignore-words-list=pres,delt,arry

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
rev: v4.0.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.6
rev: v0.14.14
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format


- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.1.3
rev: v2.11.1
hooks:
- id: pyproject-fmt

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.22.0
hooks:
- id: zizmor

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ license = { file = "LICENSE.txt" }
maintainers = [
{ name = "Filipe Fernandes", email = "ocefpaf+seawater@gmail.com" },
]
requires-python = ">=3.8"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dynamic = [
"dependencies",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy<2
numpy>=2
scipy
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ line-length = 90
lint.select = ["ALL"]

lint.ignore = [
"COM812", # missing-trailing-comma
"ANN001", # Missing type annotation for function argument
"ANN002", # Missing type annotation for `*arys`
"ANN101", # Missing type annotation for `self` in method
Expand Down
26 changes: 13 additions & 13 deletions seawater/eos80.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"alpha",
"aonb",
"beta",
"cp",
"dens",
"dens0",
"dpth",
"g",
"salt",
"fp",
"svel",
"pres",
"dens0",
"dens",
"g",
"pden",
"cp",
"pres",
"ptmp",
"salt",
"svel",
"temp",
]

Expand Down Expand Up @@ -133,7 +133,7 @@ def alpha(s, t, p, *, pt=False):
>>> import seawater as sw
>>> s, t, p = 40, 10, 4000
>>> sw.alpha(s, t, p, pt=True)
0.00025061316481624323
np.float64(0.00025061316481624323)

References
----------
Expand Down Expand Up @@ -170,7 +170,7 @@ def aonb(s, t, p, *, pt=False):
>>> import seawater as sw
>>> s, t, p = 40, 10, 4000
>>> sw.aonb(s, t, p, pt=True)
0.347650567047807
np.float64(0.347650567047807)

References
----------
Expand Down Expand Up @@ -241,7 +241,7 @@ def beta(s, t, p, *, pt=False):
>>> import seawater as sw
>>> s, t, p = 40, 10, 4000
>>> sw.beta(s, t, p, pt=True)
0.0007208766174161893
np.float64(0.0007208766174161893)

References
----------
Expand Down Expand Up @@ -612,7 +612,7 @@ def g(lat, z=0):
--------
>>> import seawater as sw
>>> sw.g(45, z=0)
9.8061898752054
np.float64(9.8061898752054)

References
----------
Expand Down Expand Up @@ -705,7 +705,7 @@ def pres(depth, lat):
>>> import seawater as sw
>>> depth, lat = 7321.45, 30
>>> sw.pres(depth, lat)
7500.006513011802
np.float64(7500.006513011802)

References
----------
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def temp(s, pt, p, pr=0):
>>> import seawater as sw
>>> s, t, p = 35, 15, 100
>>> sw.temp(s, sw.ptmp(s, t, p), p)
15.0
np.float64(15.0)

References
----------
Expand Down
4 changes: 2 additions & 2 deletions seawater/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def f(lat):
--------
>>> import seawater as sw
>>> sw.f(45)
0.00010312445296824608
np.float64(0.00010312445296824608)

References
----------
Expand Down Expand Up @@ -316,7 +316,7 @@ def swvel(length, depth):
--------
>>> import seawater as sw
>>> sw.swvel(10, 100)
3.949327084834294
np.float64(3.949327084834294)

"""
length, depth = list(map(np.asanyarray, (length, depth)))
Expand Down
2 changes: 1 addition & 1 deletion seawater/geostrophic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

__all__ = [
"bfrq",
"svan",
"gpan",
"gvel",
"svan",
]


Expand Down
14 changes: 7 additions & 7 deletions seawater/library.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import numpy as np

__all__ = [
"T68conv",
"T90conv",
"cndr",
"salds",
"salrp",
"salrt",
"seck",
"sals",
"seck",
"smow",
"T68conv",
"T90conv",
]


Expand Down Expand Up @@ -66,7 +66,7 @@ def cndr(s, t, p):
s, t = list(map(np.ravel, (s, t)))
# Do a Newton-Raphson iteration for inverse interpolation of Rt from s.
Rx = []
for S, T in zip(s, t):
for S, T in zip(s, t, strict=True):
Rx_loop = np.sqrt(S / 35.0) # first guess at Rx = sqrt(Rt).
SInc = sals(Rx_loop * Rx_loop, T) # S Increment (guess) from Rx.
iloop = 0
Expand Down Expand Up @@ -437,7 +437,7 @@ def T68conv(T90):
--------
>>> import seawater as sw
>>> T68conv(19.995201151723585)
20.0
np.float64(20.0)

References
----------
Expand Down Expand Up @@ -483,9 +483,9 @@ def T90conv(t, t_type="T68"):
Examples
--------
>>> T90conv(20.004799999999999)
20.0
np.float64(20.0)
>>> T90conv(20.0, t_type="T48")
19.98816284091818
np.float64(19.98816284091818)

References
----------
Expand Down
Loading