public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
    // Vgroup vgroup = (Vgroup) v2.getSPobject();
    // Range scanRange = section.getRange(0);
    // Range radialRange = section.getRange(1);
    // Range gateRange = section.getRange(2);

    Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape());
    IndexIterator ii = data.getIndexIterator();

    List<List<Ray>> groups;
    String shortName = v2.getShortName();
    if (shortName.startsWith("Reflectivity")) groups = volScan.getReflectivityGroups();
    else if (shortName.startsWith("Velocity")) groups = volScan.getVelocityGroups();
    else if (shortName.startsWith("TotalPower")) groups = volScan.getTotalPowerGroups();
    else if (shortName.startsWith("Width")) groups = volScan.getWidthGroups();
    else if (shortName.startsWith("DiffReflectivity"))
      groups = volScan.getDifferentialReflectivityGroups();
    else throw new IllegalStateException("Illegal variable name = " + shortName);

    if (section.getRank() == 2) {
      Range radialRange = section.getRange(0);
      Range gateRange = section.getRange(1);
      List<Ray> lli = groups.get(0);
      readOneScan(lli, radialRange, gateRange, ii);
    } else {
      Range scanRange = section.getRange(0);
      Range radialRange = section.getRange(1);
      Range gateRange = section.getRange(2);
      for (int i = scanRange.first(); i <= scanRange.last(); i += scanRange.stride()) {
        readOneScan(groups.get(i), radialRange, gateRange, ii);
      }
    }
    return data;
  }
Пример #2
0
  // 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);
  }
 /**
  * Read data from a top level Variable and return a memory resident Array.
  *
  * @param v2 Variable. It may have FLOAT/INTEGER data type.
  * @param section wanted section of data of Variable. The section list is a list of ucar.ma2.Range
  *     which define the requested data subset.
  * @return Array of data which will be read from Variable through this call.
  */
 public Array readData1(ucar.nc2.Variable v2, Section section)
     throws IOException, InvalidRangeException {
   // doData(raf, ncfile, varList);
   int[] sh = section.getShape();
   Array temp = Array.factory(v2.getDataType(), sh);
   long pos0 = 0;
   // Suppose that the data has LayoutRegular
   LayoutRegular index = new LayoutRegular(pos0, v2.getElementSize(), v2.getShape(), section);
   if (v2.getShortName().startsWith("time") | v2.getShortName().startsWith("numGates")) {
     temp = readIntData(index, v2);
   } else {
     temp = readFloatData(index, v2);
   }
   return temp;
 }
Пример #4
0
  public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
    Vgroup vgroup = (Vgroup) v2.getSPobject();

    Range scanRange = section.getRange(0);
    Range radialRange = section.getRange(1);
    Range gateRange = section.getRange(2);

    Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape());
    IndexIterator ii = data.getIndexIterator();

    for (int i = scanRange.first(); i <= scanRange.last(); i += scanRange.stride()) {
      Cinrad2Record[] mapScan = vgroup.map[i];
      readOneScan(mapScan, radialRange, gateRange, vgroup.datatype, ii);
    }

    return data;
  }