This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
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