Skip to content

Oceanographic calculations

MATLAB Scripts

Matlab scripts for oceanographic calculations

 

Shell-scripts I have written:

  • aou – Calculate the apparent oxygen utilization from the measured oxygen concentration, T and S.
  • densatp – Calculate the density of seawater at a given S, T and P-hydrostatic (dbar).
  • density – Calculate the density of seawater for a given S and T at 1 atm total pressure.
  • n2sat – Calculate nitrogen saturation as a function of S and T according to Weiss (1970).
  • n2satv2 – Calculate nitrogen saturation as a function of T and S according to Hamme & Emerson (2004).
  • o2sat – Calculate oxygen saturation as a function of S and T.
  • o2satv2a – Calculate oxygen saturation (ml O2/L) as a function of T and S according to Garcia & Gordon (1992).
  • o2satv2b – Calculate oxygen saturation (umol O2/kg) as a function of S and T according to Garcia & Gordon (1992).
  • pH_total –  Calculate pH of the total scale, plus all of the CO2 system parameters from S, T, P, phosphate, silicate, alkalinity, and total CO2.
  • salinity – Calculate the salinity (pss) of seawater from conductivity (S/m), T and P.
  • sbec2sal – Calculate the salinity (pss) of seawater from conductivity (mS/cm), T and P.
  • vapprs – Calculate the vapor pressure of water as a function of (S,T,P) according to Weiss and Price (1980).
  • Vsnd_stp1 – Calculate the speed of sound in seawater using the van ‘t Hoff equation with coefficients fitted to a data matrix calculated using the UNESCO 1995 speed of sound equation for seawater as determined by Wong and Zhu (1995).
  • Vsnd_stp2 – Calculate the speed of sound in seawater using the van ‘t Hoff equation with coefficients fitted to a data matrix calculated using the TEOS-10 complete EoS for seawater.
  • Vsnd_un95 – Calculate the speed of sound in seawater using the UNESCO 1995 sound speed equation for seawater as determined by Wong and Zhu (1995).

 

Shell-scripts that I have collected and modified/optimized for use on a PC (see note below):

  • Adiabat – Computes the adiabatic temperature gradient.
  • Depth – Computes depth given the pressure at some latitude.
  • Potentmp – Computes potential temperature from in-situ measurements. Requires adiabat.
  • Pressure – Computes pressure given the depth at some latitude.
  • Sndspd – Computes the speed of sound in seawater using any one of 5 (user selectable) formulations.

Note: These files were originally part of the oceanography toolbox [v1.4] compiled by R. Pawlowicz @ WHOI. I have renamed and modified these files for use with the Windows version of MATLAB®. These files will also work well in a UNIX environment.