[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NetCDF portability and floating point translations
- Subject: Re: NetCDF portability and floating point translations
- Date: Wed, 07 Dec 1994 13:07:16 -0700
> Organization: LLNL
> Keywords: 199412071927.AA27451
Hi Doug,
> I am re-designing a plotfile database for several finite element codes and
> have been examining NetCDF, HDF, and a local product, PDB, to provide the
> foundation for our new database. A specific requirement we have is to
> write a file with 32-bit floats from the Cray, where the native wordsize
> is of course 64 bits. HDF performs this 64-to-32 conversion
> automatically, as does PDB if I specify a 32-bit file format. I have not
> been able to discover how, or even if, NetCDF will do this.
NetCDF also does it automatically, as part of the conversion from the native
64-bit floating-point representation to the IEEE 32-bit floating-point used
by the underlying XDR library. When you write an array of floating-point
values to a netCDF file (with a call to ncvarput(), for example), each
floating-point value is converted to 32-bit IEEE floating-point just before
it is written to disk.
Similarly when values are read in from a netCDF file, they are converted
from XDR format (IEEE floating-point) to native representation "on the fly"
as the values are read.
> As I read the
> documentation, the in-memory data buffer on reads and writes is expected
> accommodate the word-size of the NetCDF file variable, which would seem to
> rule out an on-the-fly conversion of word sizes.
No, the in-memory data buffer needs to be the right size for the data in its
native representation (in this case 64-bit Cray floats). If the
documentation implies otherwise, I'd like to fix it. If you can remember
where the documentation needs correcting, please let me know.
--
Russ Rew UCAR Unidata Program
address@hidden P.O. Box 3000
http://www.unidata.ucar.edu/ Boulder, CO 80307-3000