mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
45ed0ec757
commit
26779a9af5
2 changed files with 4 additions and 0 deletions
|
@ -1155,6 +1155,8 @@ static void fixup_water_salinity(struct dive *dive)
|
|||
|
||||
for_each_dc (dive, dc) {
|
||||
if (dc->salinity) {
|
||||
if (dc->salinity < 500)
|
||||
dc->salinity += FRESHWATER_SALINITY;
|
||||
sum += dc->salinity;
|
||||
nr++;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue