// do not call directly
  @Override
  public Array reallyRead(Variable client, Section section, CancelTask cancelTask)
      throws IOException, InvalidRangeException {
    // see if its really a full read
    if ((null == section) || section.computeSize() == getSize())
      return reallyRead(client, cancelTask);

    if (orgVar == null) return getMissingDataArray(section.getShape());

    return orgVar.read(section);
  }
  // section of regular Variable
  @Override
  protected Array _read(Section section) throws IOException, InvalidRangeException {
    // really a full read
    if ((null == section) || section.computeSize() == getSize()) return _read();

    Array result;
    if (hasCachedData()) result = super._read(section);
    else result = proxyReader.reallyRead(this, section, null);

    if (needScaleOffsetMissing) return convertScaleOffsetMissing(result);
    else if (needEnumConversion) return convertEnums(result);
    else return result;
  }
Beispiel #3
0
 long computeArraySize(SDArray da) throws Exception {
   assert (da.getContainerVar() instanceof DPrimitive);
   BaseType base = da.getPrimitiveVector().getTemplate();
   DataType dtype = DODSNetcdfFile.convertToNCType(base);
   int elemSize = dtype.getSize();
   int n = da.numDimensions();
   List<Range> ranges = new ArrayList<Range>(n);
   long size = 0;
   for (int i = 0; i < n; i++) {
     ranges.add(new Range(da.getStart(i), da.getStop(i), da.getStride(i)));
     Section s = new Section(ranges);
     size += s.computeSize() * elemSize;
   }
   return size;
 }