mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Fix MacDive import to convert Imperial temperature
MacDive import needs to convert temperatures to Celcius. However, it seems that MacDive reports no reading as 32F (and probably 0C when using Metric). There is no way of knowing whether we have no reading or the temperature is actually zero, so we use the given temperature currently as 0C is a valid temperature... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4b0d7ac72f
commit
ecdb4cd522
1 changed files with 36 additions and 5 deletions
|
@ -208,22 +208,34 @@
|
|||
<temperature>
|
||||
<xsl:if test="tempAir != ''">
|
||||
<xsl:attribute name="air">
|
||||
<xsl:value-of select="concat(tempAir, ' C')"/>
|
||||
<xsl:call-template name="tempConvert">
|
||||
<xsl:with-param name="temp" select="tempAir"/>
|
||||
<xsl:with-param name="units" select="$units"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="tempLow != ''">
|
||||
<xsl:attribute name="water">
|
||||
<xsl:value-of select="concat(tempLow, ' C')"/>
|
||||
<xsl:call-template name="tempConvert">
|
||||
<xsl:with-param name="temp" select="tempLow"/>
|
||||
<xsl:with-param name="units" select="$units"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="tempair != ''">
|
||||
<xsl:attribute name="air">
|
||||
<xsl:value-of select="concat(tempair, ' C')"/>
|
||||
<xsl:call-template name="tempConvert">
|
||||
<xsl:with-param name="temp" select="tempair"/>
|
||||
<xsl:with-param name="units" select="$units"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="templow != ''">
|
||||
<xsl:attribute name="water">
|
||||
<xsl:value-of select="concat(templow, ' C')"/>
|
||||
<xsl:call-template name="tempConvert">
|
||||
<xsl:with-param name="temp" select="temlow"/>
|
||||
<xsl:with-param name="units" select="$units"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</temperature>
|
||||
|
@ -288,7 +300,10 @@
|
|||
</xsl:if>
|
||||
<xsl:if test="temperature != ''">
|
||||
<xsl:attribute name="temp">
|
||||
<xsl:value-of select="concat(temperature, ' C')"/>
|
||||
<xsl:call-template name="tempConvert">
|
||||
<xsl:with-param name="temp" select="temperature"/>
|
||||
<xsl:with-param name="units" select="$units"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</sample>
|
||||
|
@ -378,6 +393,22 @@
|
|||
</xsl:template>
|
||||
<!-- end convert pressure -->
|
||||
|
||||
<!-- convert temperature to C -->
|
||||
<xsl:template name="tempConvert">
|
||||
<xsl:param name="temp"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($temp, ' C')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert temperature -->
|
||||
|
||||
<!-- convert time in seconds to minutes:seconds -->
|
||||
<xsl:template name="timeConvert">
|
||||
<xsl:param name="timeSec"/>
|
||||
|
|
Loading…
Reference in a new issue