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
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-ast
- id: debug-statements
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
exclude: >
(?x)^(
.*\.c
)$
args:
- --ignore-words-list=nin,preformed,wih,
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ prune *.egg-info
global-exclude *.so

exclude *.yml
exclude *.yaml
exclude *.enc
exclude .gitignore
exclude .isort.cfg
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ C99 complex data type used in original GSW-C.

To test, after installation, run "pytest" from the source directory.

### Note for xarray users
## 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.

## 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.
50 changes: 25 additions & 25 deletions gsw/_wrapped_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ def enthalpy_first_derivatives(SA, CT, p):
(1) h_SA, the derivative with respect to Absolute Salinity at
constant CT and p, and
(2) h_CT, derivative with respect to CT at constant SA and p.
Note that h_P is specific volume (1/rho) it can be caclulated by calling
Note that h_P is specific volume (1/rho) it can be calculated by calling
gsw_specvol(SA,CT,p).

Parameters
Expand Down Expand Up @@ -993,7 +993,7 @@ def enthalpy_first_derivatives_CT_exact(SA, CT, p):
(1) h_SA, the derivative with respect to Absolute Salinity at
constant CT and p, and
(2) h_CT, derivative with respect to CT at constant SA and p.
Note that h_P is specific volume, v, it can be calulated by calling
Note that h_P is specific volume, v, it can be calculated by calling
gsw_specvol_CT_exact(SA,CT,p).

Parameters
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def frazil_properties(SA_bulk, h_bulk, p):
"""
Calculates the mass fraction of ice (mass of ice divided by mass of ice
plus seawater), w_Ih_final, which results from given values of the bulk
Absolute Salinity, SA_bulk, bulk enthalpy, h_bulk, occuring at pressure
Absolute Salinity, SA_bulk, bulk enthalpy, h_bulk, occurring at pressure
p. The final values of Absolute Salinity, SA_final, and Conservative
Temperature, CT_final, of the interstitial seawater phase are also
returned. This code assumes that there is no dissolved air in the
Expand All @@ -1344,7 +1344,7 @@ def frazil_properties(SA_bulk, h_bulk, p):
Absolute Salinity of the seawater in the final state,
whether or not any ice is present.
CT_final : array-like, deg C
Conservative Temperature of the seawater in the the final
Conservative Temperature of the seawater in the final
state, whether or not any ice is present.
w_Ih_final : array-like, unitless
mass fraction of ice in the final seawater-ice mixture.
Expand All @@ -1364,11 +1364,11 @@ def frazil_properties_potential(SA_bulk, h_pot_bulk, p):
Calculates the mass fraction of ice (mass of ice divided by mass of ice
plus seawater), w_Ih_eq, which results from given values of the bulk
Absolute Salinity, SA_bulk, bulk potential enthalpy, h_pot_bulk,
occuring at pressure p. The final equilibrium values of Absolute
occurring at pressure p. The final equilibrium values of Absolute
Salinity, SA_eq, and Conservative Temperature, CT_eq, of the
interstitial seawater phase are also returned. This code assumes that
there is no dissolved air in the seawater (that is, saturation_fraction
is assumed to be zero thoughout the code).
is assumed to be zero throughout the code).

Parameters
----------
Expand All @@ -1385,7 +1385,7 @@ def frazil_properties_potential(SA_bulk, h_pot_bulk, p):
Absolute Salinity of the seawater in the final state,
whether or not any ice is present.
CT_final : array-like, deg C
Conservative Temperature of the seawater in the the final
Conservative Temperature of the seawater in the final
state, whether or not any ice is present.
w_Ih_final : array-like, unitless
mass fraction of ice in the final seawater-ice mixture.
Expand All @@ -1405,11 +1405,11 @@ def frazil_properties_potential_poly(SA_bulk, h_pot_bulk, p):
Calculates the mass fraction of ice (mass of ice divided by mass of ice
plus seawater), w_Ih_eq, which results from given values of the bulk
Absolute Salinity, SA_bulk, bulk potential enthalpy, h_pot_bulk,
occuring at pressure p. The final equilibrium values of Absolute
occurring at pressure p. The final equilibrium values of Absolute
Salinity, SA_eq, and Conservative Temperature, CT_eq, of the
interstitial seawater phase are also returned. This code assumes that
there is no dissolved air in the seawater (that is, saturation_fraction
is assumed to be zero thoughout the code).
is assumed to be zero throughout the code).

Parameters
----------
Expand All @@ -1426,7 +1426,7 @@ def frazil_properties_potential_poly(SA_bulk, h_pot_bulk, p):
Absolute Salinity of the seawater in the final state,
whether or not any ice is present.
CT_final : array-like, deg C
Conservative Temperature of the seawater in the the final
Conservative Temperature of the seawater in the final
state, whether or not any ice is present.
w_Ih_final : array-like, unitless
mass fraction of ice in the final seawater-ice mixture.
Expand Down Expand Up @@ -1509,8 +1509,8 @@ def frazil_ratios_adiabatic_poly(SA, p, w_Ih):
@match_args_return
def gibbs_ice_part_t(t, p):
"""
part of the the first temperature derivative of Gibbs energy of ice
that is the outout is gibbs_ice(1,0,t,p) + S0
part of the first temperature derivative of Gibbs energy of ice
that is the output is gibbs_ice(1,0,t,p) + S0

Parameters
----------
Expand All @@ -1531,8 +1531,8 @@ def gibbs_ice_part_t(t, p):
@match_args_return
def gibbs_ice_pt0(pt0):
"""
part of the the first temperature derivative of Gibbs energy of ice
that is the outout is "gibbs_ice(1,0,pt0,0) + s0"
part of the first temperature derivative of Gibbs energy of ice
that is the output is "gibbs_ice(1,0,pt0,0) + s0"

Parameters
----------
Expand Down Expand Up @@ -1983,7 +1983,7 @@ def melting_ice_into_seawater(SA, CT, p, w_Ih, t_Ih):
Absolute Salinity of the seawater in the final state,
whether or not any ice is present.
CT_final : array-like, deg C
Conservative Temperature of the seawater in the the final
Conservative Temperature of the seawater in the final
state, whether or not any ice is present.
w_Ih_final : array-like, unitless
mass fraction of ice in the final seawater-ice mixture.
Expand Down Expand Up @@ -2149,10 +2149,10 @@ def melting_seaice_into_seawater(SA, CT, p, w_seaice, SA_seaice, t_seaice):
-------
SA_final : array-like, g/kg
Absolute Salinity of the mixture of the melted sea ice
(or ice) and the orignal seawater
(or ice) and the original seawater
CT_final : array-like, deg C
Conservative Temperature of the mixture of the melted
sea ice (or ice) and the orignal seawater
sea ice (or ice) and the original seawater


"""
Expand Down Expand Up @@ -2633,7 +2633,7 @@ def pt_from_CT(SA, CT):
Calculates potential temperature (with a reference sea pressure of
zero dbar) from Conservative Temperature. This function uses 1.5
iterations through a modified Newton-Raphson (N-R) iterative solution
proceedure, starting from a rational-function-based initial condition
procedure, starting from a rational-function-based initial condition
for both pt and dCT_dpt.

Parameters
Expand Down Expand Up @@ -2842,7 +2842,7 @@ def rho(SA, CT, p):
@match_args_return
def rho_alpha_beta(SA, CT, p):
"""
Calculates in-situ density, the appropiate thermal expansion coefficient
Calculates in-situ density, the appropriate thermal expansion coefficient
and the appropriate saline contraction coefficient of seawater from
Absolute Salinity and Conservative Temperature. This function uses the
computationally-efficient expression for specific volume in terms of
Expand Down Expand Up @@ -2944,7 +2944,7 @@ def rho_ice(t, p):
"""
Calculates in-situ density of ice from in-situ temperature and pressure.
Note that the output, rho_ice, is density, not density anomaly; that
is, 1000 kg/m^3 is not subracted from it.
is, 1000 kg/m^3 is not subtracted from it.

Parameters
----------
Expand Down Expand Up @@ -3050,7 +3050,7 @@ def rho_t_exact(SA, t, p):
"""
Calculates in-situ density of seawater from Absolute Salinity and
in-situ temperature. Note that the output, rho, is density,
not density anomaly; that is, 1000 kg/m^3 is not subracted from it.
not density anomaly; that is, 1000 kg/m^3 is not subtracted from it.

Parameters
----------
Expand Down Expand Up @@ -3773,7 +3773,7 @@ def specvol(SA, CT, p):
@match_args_return
def specvol_alpha_beta(SA, CT, p):
"""
Calculates specific volume, the appropiate thermal expansion coefficient
Calculates specific volume, the appropriate thermal expansion coefficient
and the appropriate saline contraction coefficient of seawater from
Absolute Salinity and Conservative Temperature. This function uses the
computationally-efficient expression for specific volume in terms of
Expand Down Expand Up @@ -3809,9 +3809,9 @@ def specvol_anom_standard(SA, CT, p):
Calculates specific volume anomaly from Absolute Salinity, Conservative
Temperature and pressure. It uses the computationally-efficient
expression for specific volume as a function of SA, CT and p (Roquet
et al., 2015). The reference value to which the anomally is calculated
et al., 2015). The reference value to which the anomaly is calculated
has an Absolute Salinity of SSO and Conservative Temperature equal to
0 degress C.
0 degrees C.

Parameters
----------
Expand Down Expand Up @@ -4264,7 +4264,7 @@ def t_freezing_first_derivatives(SA, p, saturation_fraction):
@match_args_return
def t_freezing_first_derivatives_poly(SA, p, saturation_fraction):
"""
Calculates the frist derivatives of the in-situ temperature at which
Calculates the first derivatives of the in-situ temperature at which
seawater freezes with respect to Absolute Salinity SA and pressure P (in
Pa). These expressions come from differentiating the expression that
defines the freezing temperature, namely the equality between the
Expand Down
2 changes: 1 addition & 1 deletion gsw/tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_xarray_with_coords():
CT_chunk = CT.chunk(chunks={'y':1,'t':1})
lat_chunk = lat.chunk(chunks={'y':1})

# Dimensions and cordinates match:
# Dimensions and coordinates match:
expected = gsw.sigma0(SA_vals, CT_vals)
xarray = gsw.sigma0(SA, CT)
chunked = gsw.sigma0(SA_chunk, CT_chunk)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read(*parts):


class build_ext(_build_ext):
# Extention builder from pandas without the cython stuff
# Extension builder from pandas without the cython stuff
def build_extensions(self):
numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')

Expand Down