From b1c923cd5995b4826b75e9aaef83dbcff70d49f2 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 26 Feb 2016 15:16:36 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- dive.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dive.h') diff --git a/dive.h b/dive.h index ccb12e9be..cf9b19f82 100644 --- a/dive.h +++ b/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; -- cgit v1.2.3-70-g09d2