[PATCH] Convert deco info from JDiveLog to Subsurface

Miika Turkia miika.turkia at gmail.com
Wed Dec 19 09:43:07 PST 2012


On Mon, Dec 17, 2012 at 9:19 AM, Miika Turkia <miika.turkia at gmail.com> wrote:
> 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.

I finally spotted this one. It does not come from jdivelog2subsurface
conversion but it appears only on the XML file saved from Subsurface.

$ xsltproc xslt/jdivelog2subsurface.xslt dives/ostc.jlb | grep
'ndl.*stop' | wc -l
0

And next the same hit count when when opening the ostc.jlb in
subsurface and saving the log as ostc.sub:

$ grep 'ndl.*stop' dives/ostc.sub | wc -l
40

>>> 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.

I have been looking at the differences on the xslt conversion and
subsurface produced output quite a bit and the attached xslt is the
best I can currently come up with. A few additional eyes might spot
the bug.

Manually convert sample JDiveLog log to Subsurface format:
$ xsltproc xslt/jdivelog2subsurface.xslt dives/ostc.jlb

Inspect the original file in multi-line format instead of one liner:
$ xmllint --format dives/ostc.jlb

miika
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Include-decoinfo-on-JDiveLog-import.patch
Type: application/octet-stream
Size: 7701 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20121219/a1777313/attachment.obj>


More information about the subsurface mailing list