Is this a bug in the NetCDF library?

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

Content-Type: text/plain

Hi,
I have recently started using the ucar java class library and have come
across what I think might be a bug.  I hope this list is the correct one for
questions of this type and has some users or developers of this package who
can help me.

I am using version 2.2 of the Java library and during testing had a problem
with the ucar.nc2.Variable class.  In the following method:

        Array read(int [] origin, int [] shape)

The following line calculates the last index in the required range.  I think
it is doing this incorrectly when the statring point (first) is anything
other than the first element (0).  The routine then crashes a line or two
later:

        int last = (shape==null) ? getShape()[i] : first + shape[i] - 1;

I had to change the line to:

        int last = (shape==null) ? getShape()[i] : shape[i] - 1;

This seems to make more sense since it appears that the 'last' variable
should contain the index of the last element in the array, rather than a
count of the number of elements to be read, which is what the original line
of code would suggest it is trying to do (even then I think the code would
need some attention).  On the other hand this seems like a piece of bread
and butter code which is constantly used, so I am worried that I am doing
else wrong.

Has anyone come across this problem?  Is there a NetCDF developer who can
help me?

Thanks
Brian


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