Re: Unit conversion database (was: multiple paramters in aggregate function)

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Unit conversion database (was: multiple paramters in aggregate function)
Date: 2009-08-20 12:06:19
Message-ID: h6je7r$9b9$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-08-19, Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> wrote:
> On 19 Aug 2009, at 19:20, Karsten Hilbert wrote:
>
>> Alban,
>>
>> I think having an installable schema for units of measure with
>> definitions and functions would be a great addition to PostgreSQL.
>
> Karsten,
>
> Thanks for the praise and the links.
>
>> I for one know we would use it in GNUmed (wiki.gnumed.de).
>>
>> A few points:
>>
>> Would these guys be of use as a source for reference data ?
>>
>> http://unitsofmeasure.org/
>
> That looks certainly interesting, especially the fact that they
> provide a source of units and conversions in an XML format. Although
> their conversion formulas don't look all that easy to parse.
>
> I've run into a few of the problems they mention already; for example
> the slight differences between imperial and US units of measurement
> with the same names and abbreviations...
>
>> You may want to think about whether there's use in combining
>> units with tagged types:
>>
>> http://svana.org/kleptog/pgsql/taggedtypes.html
>
> Yes, I've been thinking the same thing. I had it bookmarked already
> for the very purpose of checking it out and see how I could use tagged
> types with units.
>
>> There's also a Debian package which comes with a text format
>> units database:
>>
>> http://packages.debian.org/source/sid/units
>>
>> The original source for that:
>>
>> This package was put together by me, James Troup <james(at)nocrew(dot)org>,
>> from the GNU sources, which I obtained from
>> sunsite.doc.ic.ac.uk:/pub/gnu/units-1.54.tar.gz.
>
> I don't consider that tool very reliable[1]. A number of their
> concepts are probably usable though. I have it's source in my source
> tree (FreeBSD), so ample opportunity to peek.

the licence is GPL2 though so that may restrict it's use in some
contexts.

> [1] It doesn't correctly convert °C to °F or vv, that was one of the
> first things I tried.

what is "vv"
for °C to °F RTFM:

units 'tempC(37)' 'tempF'

it handles units (and arbitrary derived units) that are linked by a ratio
It does that very well.

units "mi water/kWh" "mm hg/btu"

Offset units like centigrade and farenheit pose a problem in many
contexts.

if the temperature just dropped 9 °F what's that in °C ?

yet the answer can be coerced from units.

units 'tempF(0)-tempF(9)+tempC(0)' 'tempC'

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2009-08-20 12:22:24 Re: multiple paramters in aggregate function
Previous Message Jorge Daine Quiambao 2009-08-20 12:03:15 Re: ERROR: could not access file "$libdir/xxid": No such file or directory