Importing dives extracted from Petrel 3

24 views
Skip to first unread message

Ivan Karlović

unread,
Aug 19, 2026, 5:45:54 PM (13 days ago) Aug 19
to subsurfac...@googlegroups.com
Hello!

I've recently had the misfortune of my Petrel 3 failing on me. Long story short, it managed to log and capture the dives I've been to, but I couldn't download them due to the nature of the failure (one of the buttons stopped working). I've sent it to be repaired and the kind folks at NarkedAt90 have managed to extract and send a database file with the dives in it (15 dives I've already imported and 8 new dives I want to import). I figured it couldn't be that hard to just parse it, reformat it to subsurface format and push it to git directly.

I've tried using the python pnf package and it can open the provided db file and parse it correctly. Once I got a good look, I noticed that reformatting it to subsufrace format wouldn't be that straightforward. I could certainly do it, but there are some fields and ids that subsuface calculates from the data in some way (which I could find out by digging through the source code and verifying against the existing dives). I've then tried importing the dives using the import log option in desktop subsurface and providing the db file, but that does nothing, doesn't even leave an application log or error entry. I've then extracted two relevant tables into csvs and tried importing that, and while it can get some general data, it can't read the sample data of the dive profile. When importing from the dive computer, I couldn't just give the db instead of the Petrel 3 connection, so that was a dead end as well.

My question is what would be the easiest way for me to import those dives into subsurface? I can always go digging around the source code to see how it's done and then either modifying the application to accept my db file (or more likely modifying the SQLite database into a format that subsurface would expect) or I could try writing an application that would read the db and generate the Divecomputer and Dive-### that I could then push to git myself.

But I'd very much like to avoid overengineering a solution just for the 8 dives. Other than going through the source code, do you have any advice?

Michael Keller

unread,
Aug 20, 2026, 9:13:18 PM (12 days ago) Aug 20
to subsurfac...@googlegroups.com
Hi Ivan.
Shearwater's DB format is really a kind of a container format - while
the overall table format stays the same, the content format of the
'data_bytes_...' columns is dependent on what is set in 'format'. Some
of it ('sw-clouddb') is a legacy proprietary format (which is what the
Subsurface importer supports), but newer formats are essentially
identical to what is transferred by the dive computer when downloading
dives, either in the older Predator format or in the newer Petrel
format. Another format is UDDF. Data in the 'data_bytes_...' columns is
gzip stream compressed, with the first four bytes encoding the length -
this part is already implemented in the Subsurface importer.

So all in all I think all of the parts needed to import this are
available in Subsurface, the importer for the container formats, and
decoders for Predator or Petrel in libdivecomputer, plus the UDDF
importer - all one needs to do is to hook them up in the right way. If
you are keen to work on this, an implementing this inside Subsurface
will be a good way to make it accessible to other users.


Ngā mihi

  Michael Keller

Reply all
Reply to author
Forward
0 new messages