[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20050405: problem using UDUNITS with Fortran code


>Date: Wed, 6 Apr 2005 18:56:43 -0400 (EDT)
>From: Yuanchong Zhang <address@hidden>
>Organization: Columbia University/NASA GISS
>To: address@hidden (Steve Emmerson)
>Subject: Re: 20050405: problem using UDUNITS with Fortran code
> Keywords: 200504051922.j35JM9v2005883

The above message contained the following:

>       Since ncdump gives us the unit for any specific data file and
> in most cases, we don't need convert unit of the output values. How
> can I don't use UDUNITS at all (to avoid such unnecessary trouble)?

It is possible to write netCDF applications that do not use the UDUNITS
package -- especially if the application does not need to convert values
between units.

> From your web site, the only Fortran sample program (by Cathy Smith,
> in 1996) has to use UDUNITS, however. Do you have other Fortran sample
> that doesn't invoke UDUNITS?

Sorry, no.

> The unit conversion is really not an
> important issue since we know how to convert, but this UDUNITS package
> actually complicates reading NetCDF data for users. 
>       My machine is IBM AIX 4.3 RS6000, the default is 32-bit
> compilation. I still don't know how to change udunits.inc for our Fortran
> compiler (i.e., new declaration can be invoked by all Fortran main and
> subroutines) while I'm asking our system people to figure out how to
> make C-preprocessor to work properly. Is there any sample for changing
> this inc file for Fortran compiler to use only? Thanks a lot.  

The simplest solution for not #include-ing the file "udunits.inc" in
Fortran code is to simply not #include it.  You will then have to
explicitly declare the types of the UDUNITS routines that the code

Because your system is a 32-bit one, you should use an INTEGER to 
hold the pointer to the unit structure returned by the UTMAKE routine.

Steve Emmerson

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.