MacDive Forums

Discussion and Support for MacDive
It is currently Sat Nov 25, 2017 3:34 pm

All times are UTC + 8 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: CSV -> SDM Converter
PostPosted: Thu May 12, 2011 4:31 pm 
Offline

Joined: Thu Apr 07, 2011 1:58 am
Posts: 19
Dive Computer: Suunto
Hello,

I need to import into macdive 150 dives.
For thoses, I got only some basic datas such as date/time, location, depth, duration, type of gas and ratio O2/N2, buddies, air/water temperature, weather

I can managed thoses dives datas with a perl script to generate csv or XML file.

I try first to generate an .UDCF file, but in this case I can not insert the div duration, depth and buddies in the file (there is no elements for this)

Also I didn't find any specification of the others files formats that macdive can import such as Divelog xml or Oceanic csv...

regards


Top
 Profile  
 
PostPosted: Thu May 12, 2011 4:33 pm 
Offline
Site Admin
User avatar

Joined: Sat Apr 12, 2008 8:33 am
Posts: 3496
Dive Computer: Shearwater Perdix AI
Suunto Dive Manager .SDE is probably the best format.

If you need an example to use as a template, email me and I will send you one.

_________________
http://www.mac-dive.com : support@mac-dive.com : @MacDiveApp


Top
 Profile  
 
PostPosted: Thu May 12, 2011 6:03 pm 
Offline

Joined: Thu Apr 07, 2011 1:58 am
Posts: 19
Dive Computer: Suunto
Thanks, it would be great


Top
 Profile  
 
PostPosted: Fri May 13, 2011 7:30 pm 
Offline

Joined: Thu Apr 07, 2011 1:58 am
Posts: 19
Dive Computer: Suunto
Hi again,

In the Suunto SDE xml file, when I have no value or data to put in a field, should I put "0" or nothing?


Top
 Profile  
 
PostPosted: Sat May 14, 2011 4:53 am 
Offline
Site Admin
User avatar

Joined: Sat Apr 12, 2008 8:33 am
Posts: 3496
Dive Computer: Shearwater Perdix AI
It should be fine to just leave it empty, though some things will be expected to be there. You'll see errors in the console if this is the case though.

_________________
http://www.mac-dive.com : support@mac-dive.com : @MacDiveApp


Top
 Profile  
 
PostPosted: Mon May 16, 2011 3:26 pm 
Offline

Joined: Thu Apr 07, 2011 1:58 am
Posts: 19
Dive Computer: Suunto
Hi,

Allright, it works great now.
Thanks much for your informations.


By the way, to do this i wrote a perl script which convert a CSV file to a SDE package (including ZIP compression).
Do you want I post it in the forum? Maybe it could help other people.


Top
 Profile  
 
PostPosted: Mon May 16, 2011 3:31 pm 
Offline
Site Admin
User avatar

Joined: Sat Apr 12, 2008 8:33 am
Posts: 3496
Dive Computer: Shearwater Perdix AI
Sure. I've written similar things myself, though they tend to be quite specific to a particular file format so I've never bothered to post them. And just quick hacks to get the job done.

But that would be useful - feel free to attach it. Let me know if you have any issues with the attachment settings and I'll sort it out.

_________________
http://www.mac-dive.com : support@mac-dive.com : @MacDiveApp


Top
 Profile  
 
PostPosted: Wed May 18, 2011 4:40 am 
Offline

Joined: Thu Apr 07, 2011 1:58 am
Posts: 19
Dive Computer: Suunto
Hi,

Please find below a perl script to convert a CSV (semi colon separated value) divelog into a Suunto dive log .sde file you can easily import to macdive
This is not a magic script but it could help most of people.

To perform the conversion you must launch the script you have to:
1) copy the perl script into the same directory of your csv divelog
2) open a terminal and go to this directory with the "cd" command
3) launch the following command :
perl csv_to_sde.pl -i dive_log.csv -o dive_log.sde
(put the file name you want for the .sde file)
4) the script will after ask for the column number of each kind of data (just press enter if none)


Concerning the CSV file you have to:
- encode the CSV file in UTF-8 (mandatory to process special char)
- have a field for the country
- have a field for the location
- have a field for the site
- the date should be in the format: dd/mm/yyyy or yyyy/mm/dd or dd-mm-yyyy or yyyy-mm-dd
- the time should be in the format: hh:mm or hh:mm:ss or hh:mm pm/am or a "h" could replace the ":"
- the dive duration should be in the format: hh:mm:ss or mm:ss or mm

If anybody need help for this script your can ask

[edit]: I just post a new version of the script, there was a bug in the previous one


Attachments:
csv_to_sde.pl.zip [3.93 KiB]
Downloaded 641 times


Last edited by mamax on Thu Jun 16, 2011 4:30 pm, edited 2 times in total.
Top
 Profile  
 
PostPosted: Wed May 18, 2011 5:12 am 
Offline
Site Admin
User avatar

Joined: Sat Apr 12, 2008 8:33 am
Posts: 3496
Dive Computer: Shearwater Perdix AI
Thanks very much for posting this - I'm sure it will be handy.

I'll sticky this thread for you.

_________________
http://www.mac-dive.com : support@mac-dive.com : @MacDiveApp


Top
 Profile  
 
 Post subject: Re: CSV -> SDM Converter
PostPosted: Wed May 18, 2011 6:37 am 
Offline

Joined: Wed Apr 27, 2011 12:55 pm
Posts: 29
Location: Kitchener, Ontario
Dive Computer: Suunto D9, Reefnet
Hmm, I don't think this will work for me. I've exported my missing dives from Sensus Manager in CSV, but it looks to still be in their format. Temps in degrees Kelvin, depth in Kilopascals... etc...

I think I'll just wait until the next revision of the program...

Or maybe I'll look into writing my own converter script..


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group