diff options
author | Robert C. Helling <helling@atdotde.de> | 2016-02-26 15:16:36 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-28 15:39:52 +0100 |
commit | 26779a9af5beb10a4e0dd50a418450cab5960137 (patch) | |
tree | cb259038e2ef8f90069c2d9a4644d82b8511e8fa /subsurface-core/dive.h | |
parent | 45ed0ec757e0fd51b9dda01b76c7f2dad9cb82ac (diff) | |
download | subsurface-26779a9af5beb10a4e0dd50a418450cab5960137.tar.gz |
If salinity is not density, add density of fresh water
There was a reported case of an import of a dive that gave a salinity of
35g/l. This is an actual salinity (an amount of salt in the water) but
for subsurface the salinity is actually the density of the water. So for
too small values of the salinity add the density of fresh water.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/dive.h')
-rw-r--r-- | subsurface-core/dive.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/subsurface-core/dive.h b/subsurface-core/dive.h index 0f5c43451..f8970b237 100644 --- a/subsurface-core/dive.h +++ b/subsurface-core/dive.h @@ -409,6 +409,8 @@ static inline int calculate_depth_to_mbar(int depth, pressure_t surface_pressure mbar = SURFACE_PRESSURE; if (!salinity) salinity = SEAWATER_SALINITY; + if (salinity < 500) + salinity += FRESHWATER_SALINITY; specific_weight = salinity / 10000.0 * 0.981; mbar += rint(depth / 10.0 * specific_weight); return mbar; |