Visual Basic for oceanographic calculations

Please note: These files are in text format. To use with Excel® you will need to change the filename extension from txt to bas. Then they can be loaded as modules in the Visual Basic Editor. Use the ALT-F11 key to start the Visual Basic Editor followed by CTRL-M to import the file into the worksheet.

VB-scripts adapted from the MATLAB® scripts that I have written:

Function Name Text Filename Calculation
AOU AOU.txt AOU from observed O2 conc vs the expected O2 conc from Weiss (1970)
DENSATP STP2Dens.txt Calculate the in situ density of seawater as a function of S, T & P (Millero & Poisson, 1981)
DENSITY SwDensity.txt Calculate the density of seawater as a function of S & T at Pabs = 1 atm (Millero & Poisson, 1981)
N2SAT N2sat_v1.txt N2 saturation as a function of S, & T from Weiss (1970)
N2SAT_V2 N2sat_v2.txt N2 saturation as a function of S, & T from Hamme & Emerson (2004)
O2SAT_V2A O2sat_v2a.txt O2 saturation as a function of S, & T according to Garcia & Gordon (1992) in units of ml O2/L of seawater
O2SAT_V2B O2sat_v2b.txt O2 saturation as a function of S, & T according to Garcia & Gordon (1992) in units of umol O2/kg of seawater
SAL Cond2Sal.txt Calculate Salinity (pss-78) of seawater from Conductivity (S/m), T & P (UNESCO, 1983)
SBE SbeC2Sal.txt Calculate Salinity (pss-78) of seawater from Conductivity (mS/cm), T & P (UNESCO, 1983)
VapPress VapPress.txt Calculate the fugacity coefficient of CO2 in seawater (Weiss & Price, 1980)

VB-scripts adapted from the MATLAB® scripts that I have collected and modified/optimized for use on a PC:  (see note #1 below)

Function Name Text Filename Calculation
ADIABAT Adiabat.txt Computes the adiabatic temperature gradient.
DEPTH PLat2Dep.txt Depth given the pressure at some latitude.
POTENTMP Potentmp.txt Potential temperature from in-situ measurements. Requires adiabat.
PRESS DLat2Prs.txt Pressure given the depth at some latitude.
Sndspd Sndspd.txt Velocity of sound in seawater according to Mackenzie (1981).
SW_svel SW_svel.txt Velocity of sound in seawater according to UNESCO (1983).

VB-scripts for CO2 systems: (see note #2 below)

Function Name Text Filename Calculation
CO2Ast_T CO2Ast_total.txt Calculate CO2(aq) + H2CO3 as a function of S, T, P, TP, TSi, TAlk & TCO2.
CO3_T CO3_total.txt Calculate CO3= as a function of S, T, P, TP, TSi, TAlk & TCO2.
fCO2_T fCO2_total.txt Calculate fCO2 as a function of S, T, P, TP, TSi, TAlk & TCO2.
HCO3_T HCO3_total.txt Calculate HCO3– as a function of S, T, P, TP, TSi, TAlk & TCO2.
pH_nbs2sws pH_nbs2sws.txt Convert pH on the NBS scale to pH on the Seawater scale
pH_nbs2total pH_nbs2total.txt Convert pH on the NBS scale to pH on the Total scale
pH_T pH_total.txt Calculate pH on the Total scale as a function of S, T, P, TP, TSi, TAlk & TCO2.
pH_total2nbs pH_total2nbs.txt Convert pH on the Total scale to pH on the NBS scale
pH_nbs2sws pH_nbs2sws.txt Convert pH on the Total scale to pH on the Seawater scale
phi_CO2 phi_CO2.txt Calculate the fugacity coefficient of CO2 in seawater according to Kortzinger (1999)

Notes:

  1. These algorithms were originally part of the oceanography toolbox [v1.4] compiled by R. Pawlowicz @ WHOI.
  2. This code was adapted from the work of others: CO2SYS.exe was originally written by Ernie Lewis and Doug Wallace. It was converted to Matlab by Richard E. Zeebe & Dieter A. Wolf-Gladrow. Parts were then extracted and modified by Rachel M. Dunk. I am indebted to all of them for their initial development of this code.

Products

Data repository
Data policy
What is happening in Monterey Bay today?
Central and Northern California Ocean Observing System
Chemical data
Ocean float data
Slough data
Mooring ISUS measurements
M1 ISUS CTD Data Display
Southern Ocean Data
Mooring data
M1 Mooring Summary Data
M1 ADCP (CeNCOOS)
M1 Asimet
M1 Download Info
M1 EMeter
M1 Fluorometer (CeNCOOS)
M1 GPS Location
Molecular and genomics data
ESP Web Portal
Seafloor mapping
Upper ocean data
Spatial Temporal Oceanographic Query System (STOQS) Data
Tide prediction
Image gallery
Video library
Seminars
Previous seminars
David Packard Distinguished Lecturers
Research software
Video Annotation and Reference System
System Overview
Knowledgebase
Installation
Annotation Interface
Video Tape User Guide
Video File User Guide
Installation
Annotation Glossary
Query Interface
Basic User Guide
Advanced User Guide
Results
Installation
Query Glossary
FAQ
VARS Publications
Oceanographic Decision Support System
MB-System seafloor mapping software
MB-System Documentation
MB-System Announcements
MB-System Announcements (Archive)
How to Download and Install MB-System
MB-System Discussion Lists
MB-System FAQ
Matlab scripts: Linear regressions
Introduction to Model I and Model II linear regressions
A brief history of Model II regression analysis
Index of downloadable files
Summary of modifications
Regression rules of thumb
Results for Model I and Model II regressions
Graphs of the Model I and Model II regressions
Which regression: Model I or Model II?
Matlab scripts: Oceanographic calculations
Matlab scripts: Sound velocity
Visual Basic for Excel: Oceanographic calculations
Educational resources
MBARI Summer Internship Program
Education and Research: Testing Hypotheses (EARTH)
EARTH workshops
2016—New Brunswick, NJ
2015—Newport, Oregon
2016 Satellite workshop—Pensacola, FL
2016 Satellite workshop—Beaufort, NC
EARTH resources
EARTH lesson plans
Lesson plans—published
Lesson plans—development
Lesson drafts—2015
Lesson drafts—2016 Pensacola
Center for Microbial Oceanography: Research and Education (C-MORE) Science Kits
Publications
Sample archive