Importing Dive Data from a CSV file

Miika Turkia miika.turkia at gmail.com
Fri Sep 23 22:19:01 PDT 2016


On Fri, Sep 23, 2016 at 9:28 PM, Anton Lundin <glance at acc.umu.se> wrote:
> On 22 September, 2016 - Nick wrote:
>
>> Hi, I have some old dive data in an Excel spreadsheet that I want to import
>> into SubSurface, but am having some problems with some of the data. I have a
>> number of dives that are longer than 60 minutes, and these are held in the
>> CSV file in HH:MM:SS format. One dive for example is 1:09:00 (69 minutes)
>> but when importing the duration is showing as 1m09s.
>>
>>
>>
>> How can I import these correctly?
>>
>
> You can rewrite your time to be on the format MM:SS , ie 69:09. That
> a working workaround.
>
>
> There is a bug in the csv import code. As far as i can read the bug is
> at xslt/csv2xml.xslt:99

This parser is used when there is a dive profile included. The XSLT
used when there is one line per dive is manualcsv2xml.xslt.

> <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
>
> To me that looks very much like "Take minutes and seconds, and don't
> care about anything else. Also substring in xslt is 1-indexed, so we
> throw away something in the beginning. Sense this makes none.

This field is for start time, not duration and there is an additional
1 before the true time as otherwise time might be interpreted as
octal. And that must be skipped :D

> Miika: Am i just reading it wrong or how is this ment to work?

Yep, you are reading wrong field. In this case, duration is passed
as-is to Subsurface to be parsed. I just sent a patch to change the
duration from h:m:s format to m:s format, so it will be parsed
properly.

miika


More information about the subsurface mailing list