Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
37 changes: 37 additions & 0 deletions gsw/geostrophy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .conversions import z_from_p

__all__ = ['geo_strf_dyn_height',
'geo_strf_steric_height',
'distance',
'f',
'geostrophic_velocity',
Expand Down Expand Up @@ -105,6 +106,42 @@ def geo_strf_dyn_height(SA, CT, p, p_ref=0, axis=0, max_dp=1.0,
return dh


@match_args_return
def geo_strf_steric_height(SA, CT, p, p_ref=0, axis=0, max_dp=1.0, interp_method="pchip"):
"""
Steric height anomaly as a function of pressure.

Parameters
----------
SA : array-like
Absolute Salinity, g/kg
CT : array-like
Conservative Temperature (ITS-90), degrees C
p : array-like
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
p_ref : float or array-like, optional
Reference pressure, dbar
axis : int, optional, default is 0
The index of the pressure dimension in SA and CT.
max_dp : float
If any pressure interval in the input p exceeds max_dp, the dynamic
height will be calculated after interpolating to a grid with this
spacing.
interp_method : string {'mrst', 'pchip', 'linear'}
Interpolation algorithm.

Returns
-------
steric_height : array
Dynamic height anomaly divided by the acceleration of gravity.

"""
return (
geo_strf_dyn_height(SA, CT, p, p_ref, axis=axis, max_dp=max_dp, interp_method=interp_method)
/ 9.7963
)


def unwrap(lon, centered=True, copy=True):
"""
Unwrap a sequence of longitudes or headings in degrees.
Expand Down
Binary file added gsw/tests/geo_strf_steric_height.npy
Binary file not shown.
1 change: 1 addition & 0 deletions gsw/tests/test_check_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# Substitute new check values for the pchip interpolation version.
cv.geo_strf_dyn_height = np.load(os.path.join(root_path,'geo_strf_dyn_height.npy'))
cv.geo_strf_steric_height = np.load(os.path.join(root_path,'geo_strf_steric_height.npy'))
cv.geo_strf_velocity = np.load(os.path.join(root_path,'geo_strf_velocity.npy'))

cf = Bunch()
Expand Down
1 change: 1 addition & 0 deletions gsw/tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

# Substitute new check values for the pchip interpolation version.
cv.geo_strf_dyn_height = np.load(os.path.join(root_path,'geo_strf_dyn_height.npy'))
cv.geo_strf_steric_height = np.load(os.path.join(root_path,'geo_strf_steric_height.npy'))
cv.geo_strf_velocity = np.load(os.path.join(root_path,'geo_strf_velocity.npy'))

for name in ['SA_chck_cast', 't_chck_cast', 'p_chck_cast']:
Expand Down
6 changes: 6 additions & 0 deletions gsw/tests/write_geo_npyfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
cv.pr)
np.save('geo_strf_dyn_height.npy', dyn_height)

steric_height = gsw.geo_strf_steric_height(cv.SA_chck_cast,
cv.CT_chck_cast,
cv.p_chck_cast,
cv.pr)
np.save('geo_strf_steric_height.npy', steric_height)

lon = cv.long_chck_cast
lat = cv.lat_chck_cast
p = cv.p_chck_cast
Expand Down
Loading