{"id":27855,"library":"gsw","title":"Gibbs Seawater (GSW)","description":"GSW is a Python implementation of the Thermodynamic Equation of Seawater (TEOS-10) for oceanographic computations. Current version 3.6.21, requires Python >=3.11. It provides over 200 functions for oceanographic variables, including density, salinity, sound speed, potential temperature, etc. Release cadence is sporadic, following updates to the TEOS-10 algorithms.","status":"active","version":"3.6.21","language":"python","source_language":"en","source_url":"https://github.com/TEOS-10/GSW-python","tags":["oceanography","seawater","teos-10","gibbs"],"install":[{"cmd":"pip install gsw","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"All array operations depend on numpy arrays","package":"numpy","optional":false}],"imports":[{"note":"There is no common wrong import; just import gsw and use gsw.<function>()","wrong":"","symbol":"gsw","correct":"import gsw"}],"quickstart":{"code":"import numpy as np\nimport gsw\n\n# Example: compute absolute salinity from practical salinity\nSP = np.array([35.0, 35.5, 36.0])\np = np.array([0, 10, 100])  # pressure in dbar\nlon = np.array([-150, -150, -150])\nlat = np.array([30, 30, 30])\n\nSA = gsw.SA_from_SP(SP, p, lon, lat)\nprint(SA)\n\n# Example: conservative temperature from potential temperature (0 dbar reference)\nCT = gsw.CT_from_pt(SA, 15.0)\nprint(CT)","lang":"python","description":"Compute absolute salinity and conservative temperature from practical salinity and pressure."},"warnings":[{"fix":"Convert inputs to numpy arrays (e.g., np.array([...])).","message":"GSW functions expect numpy arrays; passing plain Python lists may raise errors in some operations.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Python to 3.11+ or install gsw==2.x with pip install 'gsw<3'.","message":"gsw 3.0+ dropped support for Python <3.11. If you are on an older Python version, pin to gsw<3.0.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Check the documentation for the exact function name; the old names are still available but may be removed in future.","message":"Some older function names (e.g., gsw.rho, gsw.alpha) have been renamed to use TEOS-10 standard names (e.g., gsw.rho_t_exact, gsw.alpha_wrt_CT_exact).","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Convert Pa to dbar by dividing by 10000.","message":"Pressure must be in dbar (decibars), not in Pa. Many newcomers mistakenly pass pressure in Pa.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'pip install gsw' in the correct environment.","cause":"gsw not installed or Python environment not activated.","error":"ImportError: No module named gsw"},{"fix":"Ensure all inputs are numeric numpy arrays: e.g., SP = np.array([34, 35], dtype=float).","cause":"Inputs are not numpy arrays or have incompatible dtypes (e.g., strings).","error":"TypeError: ufunc '...' not supported for the input types"},{"fix":"Check data; pressure must be >=0 dbar. For surface pressure use 0.","cause":"Negative pressure values are not physically meaningful for ocean depths.","error":"ValueError: Invalid input: pressure must be non-negative"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}