[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20040510: Question on ucar.units package: getting scale factor
- Subject: 20040510: Question on ucar.units package: getting scale factor
- Date: Mon, 10 May 2004 12:46:46 -0600
Rashad,
>Date: Mon, 10 May 2004 14:04:34 -0400
>From: "El-Badrawi,Rashad" <address@hidden>
>Organization: UCHC
>To: "Steve Emmerson" <address@hidden>
>Subject: RE: 20040510: Question on ucar.units package: getting scale factor
The above message contained the following:
> Thanks a lot for your reply. Can you give me an example of what you
> suggested, because it seems a little abstract to me.
Here's an example:
utUnit unit = utScan("millimoles per meter^3);
double amountOfUnit = ...
utUnit stdUnit = utScan("micromoles per liter");
double scale, offset;
utConvert(unit, stdUnit, &scale, &offset);
printf("The concentration is %g micromoles per liter\n",
amountOfUnit*scale);
I've omitted any tests for errors or unit compatibility.
The idea is that, if you have a canonical unit (to which everything
should be related) then you can convert all values to that unit in order
to display them.
> Regards,
> Rashad
Regards,
Steve Emmerson