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

[netCDF #GMP-676686]: Potential bug in ncdump v4.3.3.1



> Full Name: Jim Enright
> Package Version: 4.3.3.1
> Operating System: CentOS 6.5

Hi Jim,

Thanks for reporting this bug. I've reproduced it here and will have it fixed 
soon.
It's great that you identified a version in which it worked and a later version 
that
has the bug, which makes it easy to find the exact git commit that introduced
the bug, using "git bisect".

--Russ

> We have come across a potential bug in the ncdump utility from version 
> 4.3.3.1 of NetCDF when inspecting the output of an application we are working 
> with.
> 
> When one views this file using the full annotations for Fortran indices (the 
> "-f f" option) there seems to be an off-by-1 error on the indexing. This 
> causes some issue with the labelling of the last element in each dimension.
> I have reproduced this with the file created by the "simple_xy_wr.f90" 
> example from the NetCDF-Fortran source tarball as shown below.
> 
> $ ncdump -f f simple_xy.nc
> data =
> 0,   // data(1,1)
> 1,   // data(2,1)
> 2,   // data(3,1)
> 3,   // data(4,1)
> 4,   // data(5,1)
> 5,   // data(6,1)
> 6,   // data(7,1)
> 7,   // data(8,1)
> 8,   // data(9,1)
> 9,   // data(10,1)
> 10,   // data(11,1)
> 11,  // data(1,1) <== INCORRECT - should be data(12,1)
> 12,   // data(1,2)
> ...
> ...
> 21,   // data(10,2)
> 22,   // data(11,2)
> 23,  // data(1,2) <== INCORRECT - should be data(12,2)
> 24,   // data(1,3)
> 
> For an older version ncdump, from version NetCDF version 4.1.1, the correct 
> behaviour is seen:
> $ ncdump -f f simple_xy.nc
> data =
> 0,   // data(1,1)
> 1,   // data(2,1)
> 2,   // data(3,1)
> 3,   // data(4,1)
> 4,   // data(5,1)
> 5,   // data(6,1)
> 6,   // data(7,1)
> 7,   // data(8,1)
> 8,   // data(9,1)
> 9,   // data(10,1)
> 10,   // data(11,1)
> 11,  // data(12,1) <== CORRECT
> 12,   // data(1,2)
> ...
> ...
> 21,   // data(10,2)
> 22,   // data(11,2)
> 23,  // data(12,2) <== CORRECT
> 24,   // data(1,3)
> 
> The same behaviour is seen when using C indices for a NetCDF file created by 
> C code.
> 
> Can you provide any advice on this please?
> 
> Thanks for your help,
> Jim
> 
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: GMP-676686
Department: Support netCDF
Priority: Normal
Status: Closed