Learn R Programming

gsw

gsw is an R package that provides a connection to software relating to TEOS, the Thermodynamic Equation Of Seawater (see http://www.teos-10.org). This connection involves R wrappers to C functions within the GSW-C library (https://github.com/TEOS-10/GSW-C, release v3.06-16-0, commit 657216dd4f5ea079b5f0e021a4163e2d26893371), along with a data file within the GSW-Matlab library (https://github.com/TEOS-10/GSW-Matlab/blob/master/Toolbox/library/gsw_data_v3_0.mat, commit 38c9635d6fd93e74c2648e4ee23cec49c1f58530).

The foundational algorithms upon which both GSW-C and GSW-R rest were devised by the Scientific Committee on Oceanic Research / International Association for the Physical Sciences of the Oceans, Working Group 127. These algorithms were recommended as a replacement for a previous system (called UNESCO-80) at the twenty-fifth assembly in the Intergovernmental Oceanographic Commission in 2009.

The gsw functions reproduce test values in the GSW-Matlab documentation to a tolerance of 1.5e-8, the default for numerical comparison in R working on a 64-bit machine. This offers some assurance that the coding process has not introduced errors.

The naming convention in gsw is patterned on the system described at http://www.teos-10.org/pubs/gsw/html/gsw_contents.html, as a way to reduce the effort users might face in switching to R.

Copy Link

Version

Install

install.packages('gsw')

Monthly Downloads

2,822

Version

1.2-0

License

GPL (>= 2) | file LICENSE

Maintainer

Last Published

August 19th, 2024

Functions in gsw (1.2-0)

gsw_adiabatic_lapse_rate_from_CT

Adiabatic Lapse Rate
argfix

Reshape list elements to match that of the first element
gsw_alpha_wrt_t_ice

Ice Thermal Expansion Coefficient with Respect to in-situ Temperature
gsw_CT_freezing

Conservative Temperature of Freezing Seawater
gsw_cp_t_exact

Isobaric heat capacity
gsw_CT_freezing_first_derivatives_poly

First Derivatives of Conservative Temperature for Freezing Water (Polynomial version)
gsw_Nsquared

Calculate Brunt Vaisala Frequency squared
gsw_alpha_on_beta

Thermal expansion coefficient over haline contraction coefficient
gsw_alpha

Thermal expansion coefficient with respect to Conservative Temperature
gsw_SA_freezing_from_t_poly

Compute Absolute Salinity at Freezing in-situ Temperature (Polynomial version)
gsw_enthalpy_second_derivatives

Second Derivatives of Enthalpy
gsw

R implementation of Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
gsw_SP_from_SR

Calculate Practical Salinity from Reference Salinity
gsw_kappa

Isentropic Compressibility of Seawater (75-term equation)
gsw_O2sol_SP_pt

Oxygen Solubility in Seawater (UNESCO variables)
gsw_Fdelta

Ratio of Absolute to Preformed Salinity, minus 1
gsw_melting_ice_equilibrium_SA_CT_ratio_poly

Calculate d(SA)/d(CT) for Ice Melting in near-freezing Seawater (Polynomial version)
gsw_Helmholtz_energy_ice

Helmholtz Energy of Ice
gsw_adiabatic_lapse_rate_ice

Adiabatic Lapse Rate of Ice
gsw_alpha_wrt_t_exact

Thermal expansion coefficient with respect to in-situ temperature
gsw_CT_from_entropy

Conservative Temperature from Entropy
gsw_SA_from_SP_Baltic

Convert from Practical Salinity to Absolute Salinity (Baltic)
gsw_CT_from_t

Convert from temperature to conservative temperature
gsw_deltaSA_from_SP

Absolute Salinity Anomaly from Practical Salinity
gsw_enthalpy_CT_exact

Seawater Specific Enthalpy in terms of Conservative Temperature
gsw_rho_first_derivatives_wrt_enthalpy

Density First Derivatives wrt enthalpy (75-term equation)
gsw_CT_from_enthalpy

Conservative Temperature from Enthalpy
gsw_pt0_from_t

Potential temperature referenced to the surface
gsw_cp_ice

Specific heat to ice
gsw_CT_first_derivatives_wrt_t_exact

Derivatives of Conservative Temperature with Respect to or at Constant in-situ Temperature
gsw_SA_from_SP

Convert from Practical Salinity to Absolute Salinity
gsw_CT_freezing_poly

Conservative Temperature Freezing Point (Polynomial version)
gsw_sigma0

Potential density anomaly referenced to 0 dbar
gsw_SP_from_Sstar

Practical Salinity from Preformed Salinity
gsw_melting_seaice_into_seawater

Calculate properties related to seaice melting in seawater
gsw_enthalpy_second_derivatives_CT_exact

Second Derivatives of Enthalpy (exact)
gsw_SA_freezing_from_CT_poly

Compute Absolute Salinity at Freezing Point (Polynomial version)
gsw_CT_from_pt

Conservative Temperature from Potential Temperature
gsw_dynamic_enthalpy

Dynamic enthalpy of seawater (75-term equation)
gsw_enthalpy

Specific enthalpy of seawater (75-term equation)
gsw_pot_enthalpy_ice_freezing

Potential Enthalpy of Ice at Freezing Point
gsw_pt_from_entropy

Potential Temperature from Entropy
gsw_entropy_from_pt

Specific Entropy ito Absolute Salinity and Potential Temperature
gsw_SA_from_rho

Compute Absolute Salinity from Density, etc
gsw_t_deriv_chem_potential_water_t_exact

Derivative of Chemical Potential of Water in Seawater wrt Temperature
gsw_CT_maxdensity

Conservative Temperature at Maximum Density
gsw_pressure_freezing_CT

Pressure at which Seawater Freezes
gsw_enthalpy_t_exact

Seawater Specific Enthalpy in terms of in-situ Temperature
gsw_SP_from_SA

Convert from Absolute Salinity to Practical Salinity
gsw_geo_strf_dyn_height

Geostrophic Dynamic Height Anomaly
gsw_rho_alpha_beta

In-situ density, thermal expansion coefficient and haline contraction coefficient (75-term equation)
gsw_CT_first_derivatives

First Derivatives of Conservative Temperature
gsw_entropy_from_t

Specific Entropy i.t.o. Absolute Salinity, Temperature, and Pressure
gsw_O2sol

Oxygen Solubility in Seawater (GSW variables)
gsw_melting_ice_into_seawater

Calculate properties related to ice melting in seawater
gsw_CT_second_derivatives

Second Derivatives of Conservative Temperature
gsw_C_from_SP

Electrical Conductivity from Practical Salinity
gsw_gibbs_ice

Gibbs Energy of Ice, and its Derivatives
gsw_geo_strf_dyn_height_1

Geostrophic Dynamic Height Anomaly (provisional version)
gsw_SP_salinometer

Practical Salinity from Salinometer Reading
gsw_p_from_z

Pressure from height (75-term equation)
gsw_kappa_const_t_ice

Isothermal Compressibility of Ice
gsw_IPV_vs_fNsquared_ratio

Ratio of vert. gradient of pot. density to vert grad of locally-referenced pot density
gsw_enthalpy_ice

Ice Specific Enthalpy
gsw_pt0_from_t_ice

Potential Temperature of Ice Referenced to the Surface
gsw_beta_const_t_exact

Haline contraction coefficient at constant in-situ temperature
gsw_pt_first_derivatives

First Derivatives of Potential Temperature
gsw_entropy_second_derivatives

Second Derivatives of Entropy
gsw_SR_from_SP

Calculate Reference Salinity from Practical Salinity
gsw_spiciness2

Seawater Spiciness at p=2000 dbar
gsw_geo_strf_dyn_height_pc

Geostrophic Dynamic Height Anomaly (Piecewise-Constant Profile)
gsw_t_from_CT

In situ temperature from Conservative Temperature
gsw_sigma3

Potential density anomaly referenced to 3000 dbar
gsw_pot_enthalpy_ice_freezing_first_derivatives

First Derivatives of Potential Enthalpy
gsw_cabbeling

Cabbeling coefficient
gsw_enthalpy_diff

Specific Enthalpy Difference with Pressure
gsw_SA_freezing_from_t

Compute Absolute Salinity at Freezing in-situ Temperature
gsw_Sstar_from_SA

Convert from Absolute Salinity to Preformed Salinity
gsw_CT_from_rho

Conservative Temperature from Density, Absolute Salinity and Pressure
gsw_rho_ice

In-situ density of ice
gsw_pt_from_t_ice

Potential Temperature of Ice from in-situ Temperature
gsw_frazil_properties

Properties of Frazil ice
gsw_melting_ice_equilibrium_SA_CT_ratio

Calculate d(SA)/d(CT) for Ice Melting in near-freezing Seawater
gsw_grav

Gravitational Acceleration
gsw_sigma1

Potential density anomaly referenced to 1000 dbar
gsw_melting_ice_SA_CT_ratio_poly

Calculate d(SA)/d(CT) for Ice Melting in Seawater (Polynomial version)
gsw_dilution_coefficient_t_exact

Dilution coefficient
gsw_pt_from_t

Potential Temperature from in-situ Temperature
gsw_sigma2

Potential density anomaly referenced to 2000 dbar
gsw_SA_from_Sstar

Absolute Salinity from Preformed Salinity
gsw_latentheat_melting

Latent Heat of Melting
gsw_SP_from_C

Convert from Electrical Conductivity to Practical Salinity
gsw_sound_speed_ice

Sound speed in ice
gsw_SP_from_SK

Calculate Practical Salinity from Knudsen Salinity
gsw_CT_freezing_first_derivatives

First Derivatives of Conservative Temperature for Freezing Water
gsw_frazil_ratios_adiabatic

Ratios of SA, CT and p changes when Frazil Ice Forms
gsw_Turner_Rsubrho

Turner Angle and Density Ratio
gsw_SA_freezing_from_CT

Compute Absolute Salinity at Freezing Conservative Temperature
gsw_SAAR

Absolute Salinity Anomaly Ratio
gsw_beta

Haline contraction coefficient at constant Conservative Temperature
gsw_kappa_ice

Isentropic Compressibility of Ice
gsw_sound_speed_t_exact

Sound Speed in Seawater
gsw_specvol_first_derivatives_wrt_enthalpy

First Derivatives of Specific Volume wrt Enthalpy
gsw_entropy_first_derivatives

First Derivatives of Entropy
gsw_Sstar_from_SP

Convert from Practical Salinity to Preformed Salinity
gsw_t_freezing

Freezing Temperature of Seawater
gsw_specvol_ice

Specific Volume of Ice
gsw_enthalpy_first_derivatives

First Derivatives of Enthalpy
gsw_internal_energy

Specific Internal Energy of Seawater (75-term equation)
gsw_kappa_t_exact

Isentropic compressibility of seawater (exact)
gsw_chem_potential_water_t_exact

Chemical Potential of Water in Seawater
gsw_ice_fraction_to_freeze_seawater

Ice Fraction to Cool Seawater to Freezing
gsw_pt_from_CT

Potential temperature from Conservative Temperature
gsw_sound_speed

Sound speed
gsw_frazil_ratios_adiabatic_poly

Ratios of SA, CT and p changes when Frazil Ice Forms (polynomial form)
gsw_pot_enthalpy_from_pt_ice_poly

Potential Enthalpy of Ice (Polynomial version)
gsw_t_from_pt0_ice

In situ Temperature from Potential Temperature at 0dbar
gsw_rho_t_exact

In-situ Density of Seawater
gsw_infunnel

Determine whether a point is inside the 'funnel' of acceptable values
gsw_specvol_t_exact

Specific Volume of Seawater
gsw_melting_ice_SA_CT_ratio

Calculate d(SA)/d(CT) for Ice Melting in Seawater
gsw_enthalpy_first_derivatives_CT_exact

First Derivatives of Enthalpy wrt CT
gsw_chem_potential_water_ice

Chemical Potential of Ice
gsw_pot_rho_t_exact

Potential density
gsw_pressure_coefficient_ice

Pressure Coefficient for Ice
gsw_rho

In-situ density
gsw_rho_second_derivatives_wrt_enthalpy

Second Derivatives of Density wrt Enthalpy
gsw_rho_second_derivatives

Second Derivatives of Density
gsw_specvol_first_derivatives

First Derivatives of Specific Volume
gsw_frazil_properties_potential_poly

Properties of Frazil ice i.t.o. potential enthalpy (polynomial version)
gsw_seaice_fraction_to_freeze_seawater

Sea ice Fraction to Cool Seawater to Freezing
gsw_sigma4

Potential density anomaly referenced to 4000 dbar
gsw_specvol_second_derivatives

Second Derivatives of Specific Volume
gsw_frazil_properties_potential

Properties of Frazil ice i.t.o. potential enthalpy
gsw_pot_enthalpy_from_pt_ice

Potential Enthalpy of Ice
gsw_entropy_ice

Entropy of ice
gsw_latentheat_evap_CT

Latent heat of evaporation
gsw_specvol_second_derivatives_wrt_enthalpy

Second Derivatives of Specific Volume wrt Enthalpy
gsw_t_freezing_first_derivatives_poly

Derivatives of Freezing Water Properties (Polynomial version)
gsw_pot_enthalpy_ice_freezing_poly

Potential Enthalpy of Ice at Freezing Point (Polynomial version)
gsw_pt_from_pot_enthalpy_ice_poly

Potential Temperature from Potential Enthalpy of Ice (Polynomial version)
gsw_internal_energy_ice

Specific Internal Energy of Ice (75-term equation)
gsw_spiciness1

Seawater Spiciness at p=1000 dbar
gsw_specvol

Specific Volume of Seawater
gsw_pot_enthalpy_ice_freezing_first_derivatives_poly

First Derivatives of Potential Enthalpy (Polynomial version)
gsw_t_freezing_first_derivatives

Derivatives of Freezing Water Properties
gsw_gibbs

Gibbs Energy of Seawater, and its Derivatives
gsw_spiciness0

Seawater Spiciness at p=0 dbar
gsw_latentheat_evap_t

Latent heat of evaporation
gsw_pt_second_derivatives

Second Derivatives of Potential Temperature
saar

Global SA lookup file
gsw_specvol_anom_standard

Specific volume anomaly [standard] (75-term equation)
gsw_pt_from_pot_enthalpy_ice

Potential Temperature from Potential Enthalpy of Ice
gsw_specvol_alpha_beta

Specific Volume, alpha, and beta
gsw_rho_first_derivatives

Density First Derivatives wrt SA, CT and p (75-term equation)
gsw_thermobaric

Thermobaric coefficient (75-term equation)
gsw_z_from_p

Height from Pressure