[netcdfgroup] Bug in nf90_put_att for long integers

Hello,

I think I found 1 (possibly 2) bugs.
When using nf90_put_att to create a fillvalue for a long integer (8 byte) in a 
netcdf4/hdf5 file, I get error message -36 NetCDF: Invalid argument.

As it turns out, the nf90 interface is not capable of writing any long 
integer. I could remedy this by using the Fortran 77 interface for this 
particular case. I believe the culprit is lines 211 and  in 
f90/netcdf_attributes.f90 (in netcdf 4.2.0, that is):
    nf90_put_att_EightByteInt = nf_put_att_int(ncid, varid, name, nf90_int, 
size(values), int(values))
should be
      nf90_put_att_EightByteInt = nf_put_att_int(ncid, varid, name, 
nf90_int64, size(values), int(values))

A similar conversion issue seems to be happening in the get_att functions 
(with defaultInteger being a normal int, not a long one)

The second issue is that the fortran 77 interface could only handle 4byte 
integers: Everything outside of the 4byte boundaries was converted into value 
1.  My guess is that the fortran interface converted the value to 4 bytes, and 
that the C backend made it a long again thanks to the passing of the typeid.

Am I correct here?

Thanks,
Thijs Heus
-- 
Dr. Thijs Heus
Hans Ertel Centre for Clouds and Convection
Max Planck Institute for Meteorology

Bundesstr. 53
D-20146 Hamburg, Germany
 
Office nr.  Z 426
Phone      +49 40 41173 242
Fax          +49 40 41173 298



  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: