[netcdf-java] changing variable shape with NcML

I'm using relatively new version 4 NetCDF Java code.
I have an HDF5 file with a 1D array of data, but I secretly know that it represents a 2D array. I was hoping that I could simply get away with defining a 2D shape for the variable in NcML:

<dimension name="time" length="149016" isUnlimited="true" />
<dimension name="vector_dimension" length="2" />
<variable name = "B" orgName="ExtendibleArray" shape="time vector_dimension" type="double">

I was getting away with it till I tried to subset the Variable with read(int[] origin, int[] shape). When it got to VariableDS._read(Section section), the code delegated to the 1D "orgVar" with the 2D section which made it sad:

ucar.ma2.InvalidRangeException: Number of ranges in section (2) must be = 1
        at ucar.ma2.Section.fill(Section.java:143)
        at ucar.nc2.Variable.read(Variable.java:776)
        at ucar.nc2.dataset.VariableDS._read(VariableDS.java:496)
        at ucar.nc2.Variable.read(Variable.java:776)
        at ucar.nc2.Variable.read(Variable.java:722)

Was I just being overly optimistic in trying to change the shape/rank this way? Any suggestions on how to get this as a 2D array via the NcML Reader?

Thanks,
Doug



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