Issues with CSV Manual Import

164 views
Skip to first unread message

Adrien S.

unread,
Jan 5, 2019, 3:26:39 PM1/5/19
to Subsurface Divelog
Hi,
Following the loss of my divebooks this year, I have downloaded Subsurface to digitalize all my dives.

I am using Windows 10, with Subsurface 4.8.4.

I prepared an excel spreadsheet with all of my dive data, that I would like to transfer to Subsurface. The excel file was made by hand (by me).
I converted it to CSV and have solved most of my issues by tweaking the data here and there (dates, dive durations) to fit Subsurface.

However, I still have some problems :
  • Country : I can't find the "Country" column to add it to Subsurface from my file column.
  • Notes : Some of them disappear during the import, I don't know why. For example : the notes from dive 223 disappeared, while those from dive 222 are visible.
  • GPS coordinates : There is a button, but all the GPS coordinates I import are scrambled after the first two digits. I use this format for my coordinates :
    43°00"13.4"N 6°23"51.3"E
    What should I change please ?
You can find both the CSV file and the Excel file I am using attached.

Everything else I want works fine. Thanks to the developers for this awesome software ^^

Dives CSV File.csv
Dives Excel File.xlsx

Miika Turkia

unread,
Jan 6, 2019, 3:50:37 AM1/6/19
to Subsurface Divelog
Hello,

the CSV import has some limitations. It was written using XSLT and I have started to feel this to have been wrong decision. (XSLT made sense for most of the dive log imports as they were XML and XSLT is very powerful for such conversions.)

The notes field cannot contain new lines. If you want new lines within the notes, they must be marked with "\n" (without the quotes).

CSV import does not currently support country field. The import was written before some changes in the dive-site handling and hasn't been updated to include this information. We do support reverse geo-lookup, so if you have GPS coordinates, the country can be looked up from a web service, and is shown in Subsurface. If you currently want to include the country manually, that must be included in the location field, e.g. I used to use "Country / site" syntax before the GPS/location support evolved to give me the country information. I'll look into adding the country field for the import, but it might take some time.

The GPS coordinates should be given in decimal notation as stated in our user manual https://subsurface-divelog.org/documentation/subsurface-4-user-manual/#S_Appendix_D. BTW you do have an error in your GPS coordinate; 43°00"13.4"N 6°23"51.3"E, the first " should be '. But unfortunately this notation is still not supported in import.

Anyway, I wrote a shell one-liner to convert the GPS coordinates in your log to something we can import (after "fixing" the new lines in notes field manually). Works on Linux where GeoConvert is available.

awk -F';' '{ for (i=1; i<11; i++) printf "%s;", $i; system("echo " gensub(/([0-9]+°)([0-9\.]+)""([0-9\.]+)""/, "\\1\\2\x27\\3\x5c\x5c\x22", "g", $11) " | GeoConvert") }'  /tmp/Dives\ CSV\ Files.csv > /tmp/gps.csv

When imported to Subsurface, this resulted in the attached log file, with a quick look it seems to have the coordinates in more or less correct locations.

HTH
DivesWithGPS.ssrf

Adrien S.

unread,
Jan 6, 2019, 7:52:04 AM1/6/19
to Subsurface Divelog
Ok, no problem for the timing, can't complain when it's free :) It's already really nice !

Thanks for the appendix ! I didn't see it when I read the manual and found out all this by myself but it took me quite some time :p I stopped at the manual CSV import section and didn't reach the appendix.

I didn't understand everything about your corrections to my GPS data, but the file you gave me works perfectly and everything is in it ! So thank you very much :) I see you even fixed my notes.

Bye :)
Reply all
Reply to author
Forward
0 new messages