NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdf-java] ArrayIndexOutOfBoundsException reading from NcML/OPeNDAP dataset

Hi all,

I'm getting a strange problem when reading data from a certain
dataset.  The NcML is attached (it's from Rich Signell at USGS) and it
essentially aggregates a few OPeNDAP endpoints.  The CDL for the
variable in question looks OK:

short water_temp(time=32, depth=34, lat=561, lon=401);
     :_CoordinateAxes = "time depth lat lon ";
     :long_name = "Water Temperature";
     :units = "degC";
     :NAVO_code = 15; // int
     :_FillValue = -30000s; // short
     :missing_value = -30000s; // short
     :scale_factor = 0.0010f; // float
     :add_offset = 20.0f; // float

(generated using ToolsUI-4.0).  I can read the metadata from this
variable without a problem.  However, when I try to read actual data I
get a problem at the line:

GridDatatype subset = grid.makeSubset(null, null, tRange, zRange,
yRange, xRange);

"grid" is a GridDatatype object representing the un-subsetted
water_temp variable, whose shape is [32, 34, 561, 401] as expected.
The values of the various Ranges at this point are:
  tRange: 31:31
  zRange: 0:0
  yRange: 1:559
  zRange: 1:399

These all look fine, and are within the range of the various axis
lengths.  However I get the following exception:

java.lang.ArrayIndexOutOfBoundsException: 1
        at 
ucar.nc2.dataset.CoordinateAxis1D.readValues(CoordinateAxis1D.java:636)
        at ucar.nc2.dataset.CoordinateAxis1D.doRead(CoordinateAxis1D.java:569)
        at 
ucar.nc2.dataset.CoordinateAxis1D.getCoordName(CoordinateAxis1D.java:116)
        at ucar.nc2.dt.grid.GridCoordSys.makeTimes(GridCoordSys.java:1290)
        at ucar.nc2.dt.grid.GridCoordSys.<init>(GridCoordSys.java:463)
        at ucar.nc2.dt.grid.GeoGrid.subset(GeoGrid.java:750)
        at ucar.nc2.dt.grid.GeoGrid.makeSubset(GeoGrid.java:757)

 I am using a very recent download of the netcdf-4.0.jar from the web.
 Can anyone help?  Is this a problem in my code or is it a bug in
nj4.0?

Thanks in advance,
Jon

-- 
Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower@xxxxxxxxxxxxx
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm

Attachment: ncom_agg6.ncml
Description: Binary data

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