Log Units?

Dirk Hohndel dirk at hohndel.org
Sun Apr 28 13:09:33 PDT 2013


On Apr 28, 2013, at 12:55 PM, Mark Kampe wrote:

> One of the many things I love about this program is an ASCII (xml)
> format that makes it easy to peruse, filter and fix things.  In
> sanity checking and preening entries imported from an SDL I could
> not help but notice that all the units were SI (which I normally
> favor, but they were awkward when checking reported weights).
> IMHO the more human-readable the data is, the more value people
> will find ways to get out of it.

Agreed.

> I'm happy to do this, but I'm new to the list and wanted to make
> sure I wasn't suggesting something dumb or redundant, so I wanted
> to put out the suggestion first and find out what the protocol is.
> 
> Having spent a full ten minutes looking at the code, it looks to
> me like save-xml unconditionally saves in SI units, and parse-xml
> chooses its units based on the type of import being done.  But,
> given that save-xml always appends the unit to the number, it
> would seem reasonable to:
> 
>  1) implement an option in parse-xml that allows suffix-
>     specified units to override the default (and probably
>     accompany this with a bunch of new range sanity checks
>     on the internal-units value)

Well, if the unit is explicitly given then you shouldn't really need a lot of range 
sanity checks. Yes, water temperatures above 80C or below -10C are 
somewhat unlikely, but if that's what's in the file and the unit is explicitly given, 
I don't see why we should refuse the insanity...
> 
>  2) change save-xml to output the preferred units
> 	(w/appropriate suffix)

No - the SI units are there for a reason. They make sense to the vast majority
of the planet (outside such forward thinking countries like Liberia, Birma and…
I keep forgetting the third one in the triumvirate of brilliance that's imperial
measurements), they allow us to avoid rounding errors (as they are the units
that we use internally). And most importantly they are well defined. A "pound"
and a "gallon" are actually different amounts, depending where in the world
you are. A kg and a liter are the same everywhere.

If you really want to have imperial units in your XML files I suggest a tiny
perl script that does the conversion after things are stored. I don't object 
to the ability to parse the data when reading it in, but I categorically object
to saving in imperial units just because the user chose to view things in those
units.

I know that other dive logs have taken a different stance on that issue
but Subsurface will not.

>  3) verify correctness by
>     a) import a large (SI) log
>     b) change the preferred units to imperial and export it
>     c) grep to confirm no bar, meters, liters, etc
>     d) visually sanity check  the exported log for a few
> 	depths, temperatures, pressures, sac rates
>     e) restart program and import the (now) imperial log
>     f) change preferred units to SI, and export it
>     g) diff to confirm it is identical to the original
>        (and manual examination of any round-off errors).

And that's why we are not going to do this. There will be rounding errors.
And that's just not what I want users to experience. I've seen too many
data files that have 11.9999lbs or other such silliness in them.

>   4) maybe add an auto-fudge option to correct imperial weights
>      (e.g. if chosen unit is lbs and value is within .05lb of
>  	    an even lb).  This seems wrong on an ongoing basis,
> 	    but might be exactly the right thing to do on initial
> 	    log importation).

That doesn't only seem wrong. It IS wrong.

/D




More information about the subsurface mailing list