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.
Terry, > Subject: UDUNITS conversion software > To: address@hidden > From: Terry Jarrett <address@hidden> > Keywords: 199508071916.AA20783 In the above message you wrote: > We'd like to use UDUNITS noninteractively. We have a > program in which the user enters a value and specifies > the units. We want to convert these user entries to a > system standard set of units by calling your conversion > library. Can we bypass the UDUNITS.C file by including > a calling routine in our code so that the conversion > occurs transparently to the user? A program can use the UDUNITS library to convert between units. This is exactly what the udunits(1) utility does. Whether or not a program is interactive is irrelevant to using the UDUNITS library. See the installed manual page, udunits(3), for information on using the library and the udunits(1) utility (which comes with the distribution) for a example on using the library. For what you want to do, the following sequence of calls will, in general, be made: utInit(path) utScan(spec, &unit) utPrint(&unit, buf) utTerm() -------- Steve Emmerson <address@hidden>