[PATCH] Convert deco info from JDiveLog to Subsurface

Miika Turkia miika.turkia at gmail.com
Sun Dec 16 23:19:52 PST 2012


On Mon, Dec 17, 2012 at 3:59 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
> Linus Torvalds <torvalds at linux-foundation.org> writes:
>
>> On Sun, Dec 16, 2012 at 1:18 PM, Linus Torvalds
>> <torvalds at linux-foundation.org> wrote:
>>>
>>> Looking a bit closer, subsurface actually _parses_ the data
>>> incorrectly - loading the file and then re-saving it causes bogus
>>> data. Dirk?
>>
>> Oh, nope, that's not it.
>>
>> It's the xml translation after all.
>>
>> Miika's xslt file doesn't translate the insane time format, so we end
>> up with stuff like
>>
>>   ndl="170.0 min"
>>
>> and then subsurface parses that as "170 seconds", because it expects
>> the minute format to be "170:00".
>
> Yep.
>
>> But that's not all. The reason the ceiling doesn't show up for some
>> dives seems to be another (unrelated) xslt translation error. The
>> first sample of the last dive in Jan's list ends up looking like this
>> (after changing the time parsing with a quick hack):
>>
>>   <sample time='0:00 min' depth='0.0 m' ndl='240:00 min'
>> stoptime='7:00 min' stopdepth='3.0 m' />
>>
>> ie the first sample has both a 4 hour NDL time, but then it *also* has
>> a 3m ceiling with a 7-minute stop.
>>
>> The actual jdivelog file has something like this:
>>
>>   ...
>>   <T>450.0</T>
>>   <D>72.91</D>
>>   <TEMPERATURE>281.45</TEMPERATURE>
>>   <DECOINFO tfs="1.0">3.0</DECOINFO>
>>   <ALARM>DECO</ALARM>
>>    ...
>>
>> without any NDL information at all. It *looks* like that NDL
>> information came from the previous dive. So the xslt seems to bleed
>> info from in between one dive to another.
>
> That's not good.
>
> Miika, I held back on applying your patch and am hoping for an updated
> one that fixes these two issues...

Still something wrong, but I just can't spot the error. I do not see
the error Linus pointed out nor do I see any reason why the ceiling is
not drawn on some of the dives.

There is a weird NDL zero between stop markings but that comes from
the JDiveLog, there indeed is such a decoinfo tag in there.
    <sample time="6:40 min" depth="53.2 m" stoptime="1:00 min"
stopdepth="6.0 m"/>
    <sample time="7:20 min" depth="62.94 m" ndl="0:00 min"/>
    <sample time="8:00 min" temp="07.3 C" depth="72.26 m"
stoptime="1:00 min" stopdepth="3.0 m"/>

And filtering out the ndl 0 values is no cure for anything. On the contrary.

BTW someone has discovered time travel
  <dive number="220" date="2012-12-28" time="10:29" duration="155:27 min">

miika
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Convert-deco-info-from-JDiveLog-to-Subsurface.patch
Type: application/octet-stream
Size: 7155 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20121217/bd8f1dd7/attachment.obj>


More information about the subsurface mailing list