On Tue, Nov 3, 2015 at 5:53 AM, Dirk Hohndel <[email protected]> wrote:
> On Mon, Nov 02, 2015 at 06:14:16PM -0800, Linus Torvalds wrote:
>> On Mon, Nov 2, 2015 at 6:03 PM, Linus Torvalds
>> <[email protected]> wrote:
>> >
>> > So something like the attached might be the right thing.  Not tested.
>>
>> Tested and seems to work.
>>
>> It looks like none of the dives actually have more than one cylinder,
>> but being UDDF, we know that the developers are insane (it's basically
>> a requirement to touch UDDF), and we have beauties like liks:
>>
>>     <mix id="gas_33">
>>       <name>33</name>
>>       <o2>0.21</o2>
>>       <n2>0.79</n2>
>>       <maximumpo2>1.4</maximumpo2>
>>     </mix>
>>
>> which is obviously just air, and all the *other* gases are the same
>> thing too (so gas_2 .. gas_289 are all air).
>
> Gas Two Hundred Eighty Nine ???

The XSLT grabs all the gases for all the dives, so we end up with
quite a few cylinders in total.

> But no, it's not ALL of them air. There are beauties like this hidden in
> there as well:
>
>     <mix id="gas_87">
>       <name>87</name>
>       <o2>0.34</o2>
>       <n2>0.659999967</n2>
>       <maximumpo2>1.6</maximumpo2>
>     </mix>
>
> Which is a rather useful way of defining EAN34 I guess.

It looks like there are a couple of ways used to define cylinders in
different sources of UDDF files. And when I added support for Xdeep,
we ended up with the massive amount of cylinders for something else...

>> Christ. I didn't look at what actually triggered the "lots of gases
>> for a single dive" though. There's only so long I can stand staring at
>> UDDF.
>>
>> Let me re-iterate my undying love for UDDF one more time.
>
> A shared feeling. Having talked to Nick about the amazing beauty that is
> the DAN format I understand that there is another circle of hell beyond
> where UDDF itself can take us...
>
>> Looking (carefully - wouldn't want to go blind) at the UDDF, I see things 
>> like
>>
>>           <waypoint>
>>             <depth>0</depth>
>>             <divetime>0</divetime>
>>             <switchmix ref="gas_25" />
>>             <temperature>296.05</temperature>
>>           </waypoint>
>>
>> but there seems to be only one per dive (the divetime is always zero).
>> So I'm not quite sure what makes us overflow the cylinder thing. The
>> xslt translation from uddf to the native subsurface format may be
>> doing something odd.
>
> Always a possibility. But this sounds like it's just picking the starting
> gas. Using grep (much safer than actually opening the file in an editor)
> it appears that not a single dive has an actual gas switch in it. So we
> should never have run out of cylinders.
>
> So yes, I think there's a bug in our uddf parsing. Miika?

Patch attached. I just didn't send it out yesterday, as there was
still something wrong with importing directly to Subsurface. (I
probably run out of memory.) But if the cylinder index is already
fixed, I suppose this issue should be pretty much covered when
attached patch is included.

>> So I think that xml parsing patch is worth applying regardless, but I
>> also get the feeling that there might be something else going on in
>> addition to this.

I would not be surprised, if there was still something more lurking around...

miika
From 6fe8ee082be16a191b914e3bebfc767f4ccc905d Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Mon, 2 Nov 2015 18:35:39 +0200
Subject: [PATCH] Grab all gas mixes only when no tank data is given

Grabbing all gas mixes was added for Xdeep default cylinders, and it is
not required for other data sources that have tankdata info in the UDDF
file.

See #958

Signed-off-by: Miika Turkia <[email protected]>
---
 xslt/uddf.xslt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xslt/uddf.xslt b/xslt/uddf.xslt
index e15c27e..d37bf67 100644
--- a/xslt/uddf.xslt
+++ b/xslt/uddf.xslt
@@ -60,6 +60,9 @@
   </xsl:template>
 
   <xsl:template match="dive|u:dive|u1:dive">
+    <xsl:variable name="tankdata">
+      <xsl:value-of select="count(//tankdata|//u:tankdata|//u1:tankdata)"/>
+    </xsl:variable>
     <dive>
       <!-- Count the amount of temeprature samples during the dive -->
       <xsl:variable name="temperatureSamples">
@@ -278,7 +281,7 @@
         </xsl:for-each>
       </xsl:if>
 
-      <xsl:if test="/uddf/gasdefinitions != ''">
+      <xsl:if test="/uddf/gasdefinitions != '' and $tankdata = 0">
         <xsl:for-each select="/uddf/gasdefinitions/mix">
           <cylinder description="unknown">
             <xsl:attribute name="o2">
-- 
2.1.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to