visad/src/main/java/ucar/nc2/iosp/grid/GridServiceProvider.java
@Override
  public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
    long start = System.currentTimeMillis();

    Array dataArray = Array.factory(DataType.FLOAT, section.getShape());
    GridVariable pv = (GridVariable) v2.getSPobject();

    // Canonical ordering is ens, time, level, lat, lon
    int rangeIdx = 0;
    Range ensRange = pv.hasEnsemble() ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range timeRange = (section.getRank() > 2) ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range levRange = pv.hasVert() ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range yRange = section.getRange(rangeIdx++);
    Range xRange = section.getRange(rangeIdx);

    IndexIterator ii = dataArray.getIndexIterator();

    for (int ensIdx : ensRange) {
      for (int timeIdx : timeRange) {
        for (int levelIdx : levRange) {
          readXY(v2, ensIdx, timeIdx, levelIdx, yRange, xRange, ii);
        }
      }
    }

    if (debugTiming) {
      long took = System.currentTimeMillis() - start;
      System.out.println("  read data took=" + took + " msec ");
    }

    return dataArray;
  }
@Override
  public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
    long start = System.currentTimeMillis();

    Array dataArray = Array.factory(DataType.FLOAT, section.getShape());
    GridVariable pv = (GridVariable) v2.getSPobject();

    // Canonical ordering is ens, time, level, lat, lon
    int rangeIdx = 0;
    Range ensRange = pv.hasEnsemble() ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range timeRange = (section.getRank() > 2) ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range levRange = pv.hasVert() ? section.getRange(rangeIdx++) : new Range( 0, 0 );
    Range yRange = section.getRange(rangeIdx++);
    Range xRange = section.getRange(rangeIdx);

    IndexIterator ii = dataArray.getIndexIterator();

    for (int ensIdx : ensRange) {
      for (int timeIdx : timeRange) {
        for (int levelIdx : levRange) {
          readXY(v2, ensIdx, timeIdx, levelIdx, yRange, xRange, ii);
        }
      }
    }

    if (debugTiming) {
      long took = System.currentTimeMillis() - start;
      System.out.println("  read data took=" + took + " msec ");
    }

    return dataArray;
  }
@ Override public Array readData ( Variable v2 , Section section ) throws IOException , InvalidRangeException { long start = System . currentTimeMillis ( ) ; Array dataArray = Array . factory ( DataType . FLOAT , section . getShape ( ) ) ; GridVariable pv = ( GridVariable ) v2 . getSPobject ( ) ; // Canonical ordering is ens, time, level, lat, lon int rangeIdx = 0 ; Range ensRange = pv . hasEnsemble ( ) ? section . getRange ( rangeIdx ++ ) : new Range ( 0 , 0 ) ; Range timeRange = ( section . getRank ( ) > 2 ) ? section . getRange ( rangeIdx ++ ) : new Range ( 0 , 0 ) ; Range levRange = pv . hasVert ( ) ? section . getRange ( rangeIdx ++ ) : new Range ( 0 , 0 ) ; Range yRange = section . getRange ( rangeIdx ++ ) ; Range xRange = section . getRange ( rangeIdx ) ; IndexIterator ii = dataArray . getIndexIterator ( ) ; for ( int ensIdx : ensRange ) { for ( int timeIdx : timeRange ) { for ( int levelIdx : levRange ) { readXY ( v2 , ensIdx , timeIdx , levelIdx , yRange , xRange , ii ) ; } } } if ( debugTiming ) { long took = System . currentTimeMillis ( ) - start ; System . out . println ( "  read data took=" + took + " msec " ) ; } return dataArray ; }
Read the data for the variable

@param v2      Variable to read
@param section section infomation
@return Array of data
@throws IOException           problem reading from file
@throws InvalidRangeException invalid Range
Read the data for the variable