Goby v2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
goby
util
seawater
depth.h
1
// Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2
// GobySoft, LLC (2013-)
3
// Massachusetts Institute of Technology (2007-2014)
4
// Community contributors (see AUTHORS file)
5
//
6
//
7
// This file is part of the Goby Underwater Autonomy Project Libraries
8
// ("The Goby Libraries").
9
//
10
// The Goby Libraries are free software: you can redistribute them and/or modify
11
// them under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 2.1 of the License, or
13
// (at your option) any later version.
14
//
15
// The Goby Libraries are distributed in the hope that they will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with Goby. If not, see <http://www.gnu.org/licenses/>.
22
23
// modified for C++ by s. petillo spetillo@mit.edu
24
// ocean engineering graduate student - mit / whoi joint program
25
// massachusetts institute of technology (mit)
26
// laboratory for autonomous marine sensing systems (lamss)
27
28
#ifndef DEPTHH
29
#define DEPTHH
30
31
#include <cmath>
32
33
// Calculates Depth given the Pressure at some Latitude.
34
// Taken directly from MATLAB OceansToolbox depth.m
35
36
inline
double
pressure2depth(
double
P,
double
LAT)
37
{
38
// function DEPTH=depth(P,LAT);
39
/*
40
DEPTH Computes depth given the pressure at some latitude
41
D=DEPTH(P,LAT) gives the depth D (m) for a pressure P (dbars)
42
at some latitude LAT (degrees).
43
44
This probably works best in mid-latiude oceans, if anywhere!
45
46
Ref: Saunders, Fofonoff, Deep Sea Res., 23 (1976), 109-111
47
48
49
Notes: RP (WHOI) 2/Dec/91
50
I copied this directly from the UNESCO algorithms
51
52
CHECKVALUE: DEPTH = 9712.653 M FOR P=10000 DECIBARS, LATITUDE=30 DEG
53
ABOVE FOR STANDARD OCEAN: T=0 DEG. CELSUIS ; S=35 (IPSS-78)
54
*/
55
56
using namespace
std
;
// for math functions
57
58
double
X = sin(LAT / 57.29578);
59
X = X * X;
60
// GR= GRAVITY VARIATION WITH LATITUDE: ANON (1970) BULLETIN GEODESIQUE
61
double
GR = 9.780318 * (1.0 + (5.2788E-3 + 2.36E-5 * X) * X) + 1.092E-6 * P;
62
double
DEPTH = (((-1.82E-15 * P + 2.279E-10) * P - 2.2512E-5) * P + 9.72659) * P;
63
DEPTH = DEPTH / GR;
64
65
return
DEPTH;
66
}
67
68
#endif
std
STL namespace.
Generated by
1.8.11