Sound Speed

Sound speed module within the kadlu package

class kadlu.sound.sound_speed.SoundSpeed(ocean=None, ssp=None, num_depths=50, rel_err=0.001)[source]

Bases: object

Class for handling computation and interpolation of sound speed.

The sound speed can be specified via the argument ssp (sound speed profile) or computed from the ocean variables (temperature, salinity).

ssp can be either a single value, in which case the sound speed is the same everywhere, or a tuple (c,z) where c is an array of sound speed values and z is an array of depths.

The interp and interp_xyz method may be used to obtain the interpolated sound speed at any set of coordinates.

Args:
ocean: instance of kadlu.geospatial.ocean.Ocean

Ocean variables

ssp: float or tuple

Sound speed profile. May be specified either as a float, in which case the sound speed is the same everywhere, or as a tuple (c,z) where c is an array of sound speeds and z is an array of depth values.

num_depths: int

Number of depth values for the interpolation grid. The default value is 50.

rel_err: float

Maximum deviation of the interpolation, expressed as a ratio of the range of sound-speed values. The default value is 0.001.

interp(lat, lon, z, grid=False)[source]

Interpolate sound speed in spherical coordinates (lat-lon).

lat,lot,z can be floats or arrays.

If grid is set to False, the interpolation will be evaluated at the coordinates (lat_i, lon_i, z_i), where lat=(lat_1,…,lat_N), lon=(lon_1,…,lon_N) and z=(z_,…,z_K). Note that in this case, lat and lon must have the same length.

If grid is set to True, the interpolation will be evaluated at all combinations (lat_i, lon_j, z_k), where lat=(lat_1,…,lat_N), lon=(lon_1,…,lon_M) and z=(z_1,…,z_K). Note that in this case, the lengths of lat and lon do not have to be the same.

Args:
lat: float or array

Latitude of the positions(s) where the bathymetry is to be evaluated

lon: float or array

Longitude of the positions(s) where the bathymetry is to be evaluated

z: float or array

Depth of the positions(s) where the interpolation is to be evaluated

grid: bool

Specify how to combine elements of lat,lon,z.

Returns:
: numpy.array

Interpolated sound speed values

interp_xy(x, y, z, grid=False)[source]

Interpolate sound speed in planar (x-y) geometry.

x,y,z can be floats or arrays.

If grid is set to False, the interpolation will be evaluated at the positions (x_i, y_i, z_i), where x=(x_1,…,x_N), y=(y_1,…,y_N), and z=(z_1,…,z_N). Note that in this case, x,y,z must have the same length.

If grid is set to True, the interpolation will be evaluated at all combinations (x_i, y_j, z_k), where x=(x_1,…,x_N), y=(y_1,…,y_M), and z=(z_1,…,z_K). Note that in this case, the lengths of x,y,z do not have to be the same.

Args:
x: float or array

x-coordinates

y: float or array

y-coordinates

z: float or array

depth(s)

grid: bool

Specify how to combine elements of x,y,z.

Returns:
: numpy.array

Interpolated sound speed values

kadlu.sound.sound_speed.sound_speed_teos10(lats, lons, z, t, SP)[source]

Compute sound speed from temperature, salinity, and depth for a given latitude and longitude using the Thermodynamic Equation of Seawater 2010.

https://teos-10.github.io/GSW-Python/

Args:
lats: numpy array

Latitudes (-90 to 90 degrees)

lons: numpy array

Longitudes (-180 to 180 degrees)

z: numpy array

Depths (meters)

t: numpy array

In-situ temperature (Celsius)

SP: numpy array

Practical Salinity (psu)

Returns:
c: numpy array

Sound speed (m/s)