summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-04-30 17:48:08 -0600
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-30 16:55:39 -0700
commitc21883c4190c83dd6feb8b033ca653e2e55e91fa (patch)
treea7809912787ef6adb6eb802e8fd25a0a7568e694
parent3f25f841271e5e563df92f81d26fc2d29d31f4da (diff)
downloadsubsurface-c21883c4190c83dd6feb8b033ca653e2e55e91fa.tar.gz
Select only "meaningful" samples for divelogs.de export
The logic to select samples from EON Steel for divelogs.de export is the following: - Ignore sample at time zero, as that is surface, and the second "odd" sample contains information we are interested in - Grab the second sample, first sample with pressure and temperature readings - Grab the third sample - "grand parent" is 0, thus our first interval sample - Grab the samples when the predecessor (or grand parent) is at least 10 seconds away This logic seems to produce reasonable results when exporting EON Steel logs to divelogs.de. Naturally there might be corner cases, that are not taken into account, but this basic logic seems reasonable in normal cases. (Unfortunately analysis is done based on a single dive.) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--xslt/divelogs-export.xslt47
1 files changed, 42 insertions, 5 deletions
diff --git a/xslt/divelogs-export.xslt b/xslt/divelogs-export.xslt
index f231060c0..f912febed 100644
--- a/xslt/divelogs-export.xslt
+++ b/xslt/divelogs-export.xslt
@@ -290,11 +290,48 @@
<!-- <name select="{concat(@time, ' - ', preceding-sibling::sample[1]/@time)}"/>-->
</xsl:when>
<xsl:otherwise>
- <SAMPLE>
- <DEPTH>
- <xsl:value-of select="substring-before(./@depth, ' ')"/>
- </DEPTH>
- </SAMPLE>
+ <xsl:choose>
+ <!-- Suunto EON Steel special case -->
+ <xsl:when test="$special = 1">
+ <xsl:variable name="cur">
+ <xsl:call-template name="time2sec">
+ <xsl:with-param name="time">
+ <xsl:value-of select="@time"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="prev">
+ <xsl:call-template name="time2sec">
+ <xsl:with-param name="time">
+ <xsl:value-of select="preceding-sibling::sample[1]/@time"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="prevprev">
+ <xsl:call-template name="time2sec">
+ <xsl:with-param name="time">
+ <xsl:value-of select="preceding-sibling::sample[2]/@time"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$cur - $prev &gt;= 10 or $prev = 0 or $prevprev = 0">
+ <SAMPLE>
+ <DEPTH>
+ <xsl:value-of select="substring-before(./@depth, ' ')"/>
+ </DEPTH>
+ </SAMPLE>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <SAMPLE>
+ <DEPTH>
+ <xsl:value-of select="substring-before(./@depth, ' ')"/>
+ </DEPTH>
+ </SAMPLE>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>