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

[netCDFJava #OZO-122681]: changing variable shape with NcML



Hi Doug:

I though about but never implemented that feature in NcML. Ill give it some 
more thought to see how easy it would be. You could maybe do it yourself by 
doing:

  Array orgData = orgVar.read();
  Array newData = orgData.reshape( myShape);
  return newData.section( mySection);

note all data is always read in. assuming you have enough memory, you could 
cache the data with 

  orgVar.setCache( orgData);

so subsequent reads would get it.


> I've hit a roadblock and haven't had any luck on the mail list. Is NcML
> designed to be able to change the rank of an original dataset?
> 
> ---
> 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
> 
> 


Ticket Details
===================
Ticket ID: OZO-122681
Department: Support netCDF Java
Priority: Normal
Status: Closed