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.
> >From: address@hidden (Mary Haley) > >Subject: question about compiling netCDF on Crays > >Organization: NCAR/SCD > >Keywords: 199712291733.KAA18810 netCDF 3.3.1 Cray Hi Mary, > In your INSTALL notes for building netcdf 3.3.1 on ouray, you mention > the following: > > In the following, the "-i64" and "-dp" options are necessary in > order to make FORTRAN INTEGER and DOUBLE PRECISION datatypes > equivalent to C "int" and "double", respectively. > > Is this required or just recommended? The reason I ask is because a > user on ouray was trying to write some Fortran double precision > variables to a netCDF file, but it's not getting the correct results > presumably because the options above cause double precision to behave > like C doubles, which would make them 8 bytes and not 16 bytes. Is > this correct? NetCDF only supports external representations for IEEE single-precision (4 bytes) and IEEE double precision (8 bytes) floating-point numbers. There is no straightforward way to store a 16-byte floating-point number in a netCDF file, since there is no external data type corresponding to a floating-point type with that much precision. It would be possible to store such a number using type punning as an array of 4 4-byte integers, for example, but this would require writing a layer on top of netCDF to make it practical, and no other applications for dealing with netCDF data would understand this convention. We used the "-dp" option on SCD's recommendation, since someone up there told us that's the way the majority of Fortran programs were compiled, and that no one used the 128-bit double precision types because their arithmetic was very slow, implemented in software rather than hardware. > Should I tell the user he can't write double precision variables from > Fortran, or could I actually recompile the netCDF library on ouray > without these options and give him the new library for his own use? You can write double precision variables from Fortran using the netCDF-3 interfaces, but their values will only be stored as IEEE 64-bit floats, so precision will be lost from Cray's 128-bit floats. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu