30 #ifndef GOBY_UTIL_SEAWATER_DEPTH_H
31 #define GOBY_UTIL_SEAWATER_DEPTH_H
35 #include <boost/units/quantity.hpp>
36 #include <boost/units/systems/angle/degrees.hpp>
37 #include <boost/units/systems/si.hpp>
54 template <
typename PressureUnit = decltype(boost::units::si::deci*
bar),
55 typename LatitudeUnit = boost::units::degree::plane_angle>
56 boost::units::quantity<boost::units::si::length>
57 depth(boost::units::quantity<PressureUnit>
pressure, boost::units::quantity<LatitudeUnit> latitude)
61 double P = quantity<decltype(si::deci * bar)>(
pressure).value();
62 double LAT = quantity<degree::plane_angle>(latitude).value();
64 double X = std::sin(
LAT / 57.29578);
67 double GR = 9.780318 * (1.0 + (5.2788E-3 + 2.36E-5 * X) * X) + 1.092E-6 * P;
68 double DEPTH = (((-1.82E-15 * P + 2.279E-10) * P - 2.2512E-5) * P + 9.72659) * P;
71 return DEPTH * si::meters;