[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Russ Rew: Re: 961120: question about netCDF data files
- Subject: Russ Rew: Re: 961120: question about netCDF data files
- Date: Wed, 20 Nov 1996 10:28:41 -0700
Oops, forgot to CC: support-netcdf ...
------- Forwarded Message
Date: Wed, 20 Nov 1996 10:27:54 -0700
From: Russ Rew <address@hidden>
To: address@hidden (Mary Haley)
Subject: Re: 961120: question about netCDF data files
>To: address@hidden
>From: address@hidden (Mary Haley)
>Subject: question about netCDF data files
>Organization: .
>Keywords: 199611201626.AA17127
Hi Mary,
> I wrote to you a few weeks ago asking about building a double precision
> version of netCDF. By double precision, I'm talking about from the
> Fortran end, using the "-r8" option with the Fortran compiler.
>
> Since netCDF is written in C, this doesn't really mean much, but I'm
> wondering if I should be trying to convert the C code to double
> precision, to satisfy the Fortran users who will be linking with
> netCDF and using 8 byte reals. I hesitate to do this because I
> don't know the netCDF code at all, and feel like I would be hacking
> away blindly.
>
> I guess my question is if I buy myself anything by converting the
> netCDF C code to double precision?
No, the netCDF C code already handles single-precision floats (32-bit)
and double-precision floats (64-bit) as separate types, and this
distinction is also preserved in the FORTRAN interface. The netCDF
library is an I/O library; it does no arithmetic on data values, so it's
not really meaningful to "convert it to double precision". Fortran
users can read and write 8-byte reals with the netCDF library by using
NCDOUBLE netCDF variables.
> A second question I have is how netCDF data files are different
> between the Cray and 32-bit workstations? If I write a netCDF file on
> the Cray, where floats are 8 bytes, how does it work that I'm able to
> routines?
There is no difference between netCDF data written on the Cray
and the same data written on a 32-bit workstation. NetCDF variables
are declared with an "external type", which for floating-point values
may be either single-precision (NCFLOAT, 32 bits) or double-precision
(NCDOUBLE, 64 bits). If you write a 64-bit float on the Cray into an
NCFLOAT netCDF variable, you lose precision. The exact same thing
occurs on a 32-bit workstation, if you choose to write 64-bit
double-precision floats into a 32-bit representation.
In other words, the user has control over whether all the precision is
preserved or not by how they define their netCDF variables, independent
of what platform they are on. The library handles all the details of
conversion.
> Sorry if these are newbie questions. I just want to make sure I
> understand all this before I make a decision on how to build the
> netCDF libraries for users who will be working with 8 byte floats.
That's OK. NetCDF has already been used on 64-bit platforms such as the
Cray, DEC Alpha, and SGI IRIX64 for some time, so we know the design
works.
- --Russ
------- End of Forwarded Message