Dive data

Started by Alan Clifford, June 02, 2015, 06:45:59 AM

Previous topic - Next topic

Alan Clifford

Hi Phil and others.

As I've recently acquired a cable for my dive computer, I want to plug the depth data into my dive photos.  The photos usually have good enough but not totally accurate gps data in them as I leave a tracker aboard the boat.

The Suunto software can export a variety of files.  Exiftool doesn't like the .xml file, exiftool told me the .sde was a zip file and, after unzipping, exiftool was happy with it.  The one I think I'd like to use is the .sml file, mainly because it isn't all one one line like the .sde file.  Probably a Mac thing though.  They both seem to be xml files of some sort.   It can also create a pdf and a dandl7

I'd like to extract the start time from the header and then each of the depths and elapses from the .sml file.  Perhaps put them in a .csv file as times and depths but not sure yet.  Then I'll need to interpolate against the time in the photograph, which I can do myself if necessary once I've extracted the dive data.

Can exiftool do any of this?


Sml Device Log Samples Sample Time: 760
Sml Device Log Samples Sample Depth: 15.8496
Sml Device Log Samples Sample Time: 780
Sml Device Log Samples Sample Events Alarm Type: Ascent Speed
Sml Device Log Samples Sample Events Alarm Active: true
Sml Device Log Samples Sample Time: 780
Sml Device Log Samples Sample Depth: 13.4112
Sml Device Log Samples Sample Time: 800
Sml Device Log Samples Sample Depth: 12.8016




                        <Sample>
                                <Time>760</Time>
                                <Depth>15.8496</Depth>
                        </Sample>
                        <Sample>
                                <Time>780</Time>
                                <Events>
                                        <Alarm>
                                                <Type>Ascent Speed</Type>
                                                <Active>true</Active>
                                        </Alarm>
                                </Events>
                        </Sample>
                        <Sample>
                                <Time>780</Time>
                                <Depth>13.4112</Depth>
                        </Sample>
                        <Sample>
                                <Time>800</Time>
                                <Depth>12.8016</Depth>
                        </Sample>









Phil Harvey

Hi Alan,

So this device only records depth vs. time?  I don't even know where you would put that in the metadata.

ExifTool isn't going to offer much help in reading these dive logs.  If they contained GPS information I could add it to my supported GPS log file format, but without even having a standard place to put the depth information I don't think it makes sense to do this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

To explain better, I'd use the depth to replace the existing altitude (exif and xmp) in the diving photos (see below).  The existing data is from the boat so the latitude and longitude are more or less OK.  The existing altitude reflects, I guess, errors in gps accuracy that become apparent in the altitude data at sea level.  So the first thing I am looking at is the extraction of the time/depth pairs from the log files. I was wandering if exiftool could help me parse and extract from the dive log files rather than me having to do it!

This is an example of what I have in a photo:
[Composite]     GPS Altitude                    : 2.1 m Below Sea Level
[Composite]     GPS Date/Time                   : 2015:03:04 16:09:35Z
[Composite]     GPS Latitude                    : 13 deg 4' 19.67" N
[Composite]     GPS Latitude Ref                : North
[Composite]     GPS Longitude                   : 59 deg 36' 9.78" W
[Composite]     GPS Longitude Ref               : West
[Composite]     GPS Position                    : 13 deg 4' 19.67" N, 59 deg 36' 9.78" W

Phil Harvey

Hi Alan,

Oh right.  Use it for a negative altitude.  That makes sense.  If I had a better memory, I would have recalled that I recommended just this.

But ExifTool won't help you at the moment.   The mechanism is in place, but since there is no lat/lon in this file it may require some special-casing to add support for this, as well as having to recognize this new format.  I would consider this, but I have been very busy lately and wouldn't be able to get to it for a while.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

Don't put this on your to-do list just for me.  But your link was very helpful - the depth I've got is the depth below the surface, not the depth below sea level.  And given my gps tracker thought the boat was underwater in my example, I'm beginning to think that I might need to average out that error in the gps over the duration of the dive to give myself a better water surface altitude.

I need to think about this some more.

Alan Clifford

Having looked around the web, there doesn't seem to be any place for storing depth data in photos.  So I'm thinking about user defined tags.  This all may change by tomorrow!

UW Depth                        : -31.9
UW Altitude Surface             : -2.11363636363636
UW Altitude                     : -34.0136363636364


As I've got two devices and I like stuff to be repeatable, I'm thinking this way:
- import from the gps as I do now but also put the altitude into uwaltitudesurface.
- if uwdepth exists, calculate uwaltitude and also update the gps altitude
- import from the dive computer to uwdepth
- if uwaltitudesurface exists, calculate uwaltitude and also update the gps altitude

It would really be good if the depth were in the photos and I could extract it to annotate the photos on my website.
Also what is quite nice is that FastPhotoTagger that I have been using will display the user tags and also write to them if the .ExifTool_config file with the tags exists.

I need to better understand the user tags but this is what I have so far

# exiftool -config example.config ...

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::exif' => {
        # date and time with timezone in xmp:datetimeoriginal
        # depth in metres below the surface
            # UWDepth => { Writable => 'rational', Groups => { 2 => 'Location' } },
            # 0 = Above Surface, 1 = Below Surface
            # UWDepthRef  => { Writable => 'integer', Groups => { 2 => 'Location' } },
        # Or use a floating point with minus being below the surface
            # UWDepth2 => { Writable => 'rational', Groups => { 2 => 'Location' } },
        UWDepth => { Writable => 'real', Groups => { 2 => 'Location' } },
        UWAltitudeSurface => { Writable => 'real', Groups => { 2 => 'Location' } },
        UWAltitude => { Writable => 'real', Groups => { 2 => 'Location' } },
    },
);



Phil Harvey

Hi Alan,

Looks good, but you should go with a user-defined namespace instead of borrowing the XMP-exif namespace.

Then you are free to do what you want, and using signed reals instead of the archaic EXIF rational with a reference direction makes sense.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

I'll follow your advice on the namespace.

Something is puzzling me.  I basically copied the new tag stuff from your example config file.  I was expecting -G2 to show "location" for my tags but they show "image"

exiftool f200_3209_wb.med.jpg -a -G2 -xmp:datetimeoriginal -xmp:gps* -xmp:uw* -s
[Time]          DateTimeOriginal                : 2015:03:04 12:09:35-04:00
[Location]      GPSAltitude                     : 2.11363636363636 m
[Location]      GPSAltitudeRef                  : Below Sea Level
[Location]      GPSLatitude                     : 13 deg 4' 19.67" N
[Location]      GPSLongitude                    : 59 deg 36' 9.78" W
[Time]          GPSDateTime                     : 2015:03:04 16:09:35
[Image]         UWAltitude                      : -34.0136363636364
[Image]         UWAltitudeSurface               : -2.11363636363636
[Image]         UWDepth                         : -31.9


Phil Harvey

Hi Alan,

Add "Groups => { 2 => 'Location' }," to your tag definitions to have them show up in the Location group.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).