[PATCH] DL7 import: ignore non-numeric pressure

Miika Turkia miika.turkia at gmail.com
Thu Nov 3 08:36:57 PDT 2016


If pressure field is empty, we do not want to have field separator as
pressure value. This would flood the console with parsing error
messages.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/csv2xml.xslt | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 4a0c4db..da41bb1 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -412,14 +412,16 @@
                 <xsl:with-param name="line" select="$line"/>
               </xsl:call-template>
             </xsl:variable>
-            <xsl:choose>
-              <xsl:when test="$units = 0">
-                <xsl:value-of select="$pressure"/>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:value-of select="concat(format-number(($pressure div 14.5037738007), '#'), ' bar')"/>
-              </xsl:otherwise>
-            </xsl:choose>
+            <xsl:if test="$pressure >= 0">
+              <xsl:choose>
+                <xsl:when test="$units = 0">
+                  <xsl:value-of select="$pressure"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="concat(format-number(($pressure div 14.5037738007), '#'), ' bar')"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:if>
           </xsl:attribute>
         </xsl:if>
       </sample>
-- 
2.5.0



More information about the subsurface mailing list