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

Re: 19981026: netCDF on T3D/E



Al,

>Date: Thu, 05 Nov 1998 11:09:13 -0500
>From: Al Bourgeois <address@hidden>
>Organization: Lockheed Martin
>To: address@hidden
>Subject: Re: 19981026: netCDF on T3D/E
>Keywords: 199811051609.JAA13971

In the above message, you wrote:

> With your help last week, I was able to successfully install netcdf-3.4
> on our T3D. However, my application code is not reading FORTRAN REALs
> correctly from file. The FORTRAN code I am using is calling NCVGT to
> read a hypercube of values from a netCDF variable which is defined in
> the file as "float DENSA_J(TSTEP, LAY, ROW, COL) ;".
> 
> With totalview I can see that in the C routine c_ncvgt, the case
> NC_FLOAT is performed. NF_REAL_IS_C_DOUBLE is set, and the routine
> nc_get_vara_double is called. This seems correct for the T3D, since
> FORTRAN REALs are REAL*8 which are C doubles. However, the file values
> are read incorrectly. E.g., 
> 
>                            netcdf-3.4              actual file values
>                            ----------              ------------------
> DENSA_J(1,1,1)             6.02284383774           8566.27832031
> DENSA_J(2,1,1)             3.05176072288e-05       8691.35351563
> DENSA_J(3,1,1)             6.03928279877           8835.61523438
> DENSA_J(4,1,1)             3.05176072288e-05       9037.1484375
> DENSA_J(5,1,1)             6.06250667572           9216.11523438
> 
> It seems that the float values in the file are being interpreted as
> doubles? Prior to using v3.4, I was using an older modified (hacked?)
> version of netcdf, which correctly reads in the floats from file into
> FORTRAN REAL arrays. The modification is to intercept the call to ncvgt
> and cast the doubles as floats. Then ncvgt is called with a float
> buffer, and the returned floats are converted back to doubles. I was
> expecting the v3.4 code to do something similar to this, but instead it
> reads the floats into a buffer which is declared double. Is something
> backwards here? Perhaps I failed to set something correctly in the
> configure step?

"make test" tests exactly this situation: reading NC_FLOAT-s into
Fortran REAL-s -- and does so extremely thoroughly.  Because the
netCDF library passed the "make test", we would be very surprised
if your problem was due to a bug in the netCDF library.  It would
seem more likely that your user code isn't executing in the same
environment as the "make test".

T3D-s are always front-ended by something else (usually CRAY hardware).
Is is possible that your user code is executing on a different machine
than the one on which the netCDF library was built?

--------
Steve Emmerson   <http://www.unidata.ucar.edu>