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] read ushort(*) vlen_t variable

Hello all,
I've the following netcdf file with a vlen_t type in one variable... When I
try to read with the following Java code I get the error that is showed
bellow. Anyone know when I can read a vlen_t variable?

types:

        ushort(*) vlen_t;

dimensions:
        acqtime = UNLIMITED ; 

variables:
        uint acqtime(acqtime) ;
                acqtime:long_name = "Acquisition time" ;
        (...)
        vlen_t levels(acqtime);
                levels:long_name = "Acquired values array" ;


data:
        acqtime = 1,2,3,4,5,6,7,8,9,10;
        levels={1,1,1,2,3,4,5,6,7,8},
                {2,2,2,3,4,5,6,7,8,9},
                {3,3,3,4,5,6,7,8,9,10},
                {4,4,4,5,6,7,8,9,10,11},
                {5,5,5,6,7,8,9,10,11,12},
                {6,6,6,7,8,9,10,11,12,13},
                {7,7,7,8,9,10,11,12,13,14},
                {8,8,8,9,10,11,12,13,14,15},
                {9,9,9,10,11,12,13,14,15,16},
                {10,10,10,11,12,13,14,15,16,17};
}


-------------------------------
           dataFile = NetcdfFile.open(filename, null);

           // Retrieve the variable named "data"
            Variable dataVar = dataFile.findVariable("levels");

            if (dataVar == null) {
                System.out.println("Cant find Variable data");
                return;
            }

            try {
                   Array data = dataVar.read();
               } catch (IOException ioe) {
                   System.out.println("trying to read " +  ioe);
               }
__________________________________
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
        at ucar.nc2.iosp.hdf5.Tiling.tile(Tiling.java:84)
        at ucar.nc2.iosp.hdf5.Tiling.order(Tiling.java:99)
        at ucar.nc2.iosp.hdf5.Tiling.compare(Tiling.java:113)
        at
ucar.nc2.iosp.hdf5.H5header$DataBTree$Node.first(H5header.java:4265)
        at
ucar.nc2.iosp.hdf5.H5header$DataBTree$DataChunkIterator2.<init>(H5header.java:4137)
        at
ucar.nc2.iosp.hdf5.H5header$DataBTree.getDataChunkIterator2(H5header.java:4118)
        at ucar.nc2.iosp.hdf5.H5tiledLayout.<init>(H5tiledLayout.java:90)
        at ucar.nc2.iosp.hdf5.H5iosp.readData(H5iosp.java:175)
        at ucar.nc2.iosp.hdf5.H5iosp.readData(H5iosp.java:121)
        at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:1759)
        at ucar.nc2.Variable.reallyRead(Variable.java:809)
        at ucar.nc2.Variable._read(Variable.java:781)
        at ucar.nc2.Variable.read(Variable.java:659)
        at ucar.nc2.Variable.getScalarData(Variable.java:759)
        at ucar.nc2.Variable.readScalarByte(Variable.java:675)
Java Result: 1
-- 
View this message in context: 
http://netcdf-java.1577316.n2.nabble.com/read-ushort-vlen-t-variable-tp5763328p5763328.html
Sent from the NetCDF-Java mailing list archive at Nabble.com.



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