grib/src/main/java/ucar/nc2/grib/collection/GribDataReader.java
private void read(DataReceiverIF dataReceiver) throws IOException {
    Collections.sort(records);

    int currFile = -1;
    RandomAccessFile rafData = null;
    try {
      for (DataRecord dr : records) {
        if (Grib.debugIndexOnly || Grib.debugGbxIndexOnly) {
          GribIosp.debugIndexOnlyCount++;
          currentDataRecord = dr.record;
          currentDataRafFilename = gribCollection.getDataRafFilename(dr.record.fileno);
          if (Grib.debugIndexOnlyShow) dr.show(gribCollection);
          dataReceiver.setDataToZero();
          continue;
        }

        if (dr.record.fileno != currFile) {
          if (rafData != null) rafData.close();
          rafData = gribCollection.getDataRaf(dr.record.fileno);
          currFile = dr.record.fileno;
        }

        if (dr.record.pos == GribCollectionMutable.MISSING_RECORD) continue;

        if (GribDataReader.validator != null && dr.validation != null && rafData != null) {
          GribDataReader.validator.validate(gribCollection.cust, rafData, dr.record.pos + dr.record.drsOffset, dr.validation);

        } else if (show && rafData != null) { // for validation
          show( dr.validation);
          show(rafData, dr.record.pos + dr.record.drsOffset);
        }

        float[] data = readData(rafData, dr);
        GdsHorizCoordSys hcs = vindex.group.getGdsHorizCoordSys();
        dataReceiver.addData(data, dr.resultIndex, hcs.nx);
      }

    } finally {
      if (rafData != null) rafData.close();  // make sure its closed even on exception
    }
  }
private void read(DataReceiverIF dataReceiver) throws IOException {
    Collections.sort(records);

    int currFile = -1;
    RandomAccessFile rafData = null;
    try {
      for (DataRecord dr : records) {
        if (Grib.debugIndexOnly || Grib.debugGbxIndexOnly) {
          GribIosp.debugIndexOnlyCount++;
          currentDataRecord = dr.record;
          currentDataRafFilename = gribCollection.getDataRafFilename(dr.record.fileno);
          if (Grib.debugIndexOnlyShow) dr.show(gribCollection);
          dataReceiver.setDataToZero();
          continue;
        }

        if (dr.record.fileno != currFile) {
          if (rafData != null) rafData.close();
          rafData = gribCollection.getDataRaf(dr.record.fileno);
          currFile = dr.record.fileno;
        }

        if (dr.record.pos == GribCollectionMutable.MISSING_RECORD) continue;

        if (GribDataReader.validator != null && dr.validation != null && rafData != null) {
          GribDataReader.validator.validate(gribCollection.cust, rafData, dr.record.pos + dr.record.drsOffset, dr.validation);

        } else if (show && rafData != null) { // for validation
          show( dr.validation);
          show(rafData, dr.record.pos + dr.record.drsOffset);
        }

        float[] data = readData(rafData, dr);
        GdsHorizCoordSys hcs = vindex.group.getGdsHorizCoordSys();
        dataReceiver.addData(data, dr.resultIndex, hcs.nx);
      }

    } finally {
      if (rafData != null) rafData.close();  // make sure its closed even on exception
    }
  }
private void read ( DataReceiverIF dataReceiver ) throws IOException { Collections . sort ( records ) ; int currFile = - 1 ; RandomAccessFile rafData = null ; try { for ( DataRecord dr : records ) { if ( Grib . debugIndexOnly || Grib . debugGbxIndexOnly ) { GribIosp . debugIndexOnlyCount ++ ; currentDataRecord = dr . record ; currentDataRafFilename = gribCollection . getDataRafFilename ( dr . record . fileno ) ; if ( Grib . debugIndexOnlyShow ) dr . show ( gribCollection ) ; dataReceiver . setDataToZero ( ) ; continue ; } if ( dr . record . fileno != currFile ) { if ( rafData != null ) rafData . close ( ) ; rafData = gribCollection . getDataRaf ( dr . record . fileno ) ; currFile = dr . record . fileno ; } if ( dr . record . pos == GribCollectionMutable . MISSING_RECORD ) continue ; if ( GribDataReader . validator != null && dr . validation != null && rafData != null ) { GribDataReader . validator . validate ( gribCollection . cust , rafData , dr . record . pos + dr . record . drsOffset , dr . validation ) ; } else if ( show && rafData != null ) { // for validation show ( dr . validation ) ; show ( rafData , dr . record . pos + dr . record . drsOffset ) ; } float [ ] data = readData ( rafData , dr ) ; GdsHorizCoordSys hcs = vindex . group . getGdsHorizCoordSys ( ) ; dataReceiver . addData ( data , dr . resultIndex , hcs . nx ) ; } } finally { if ( rafData != null ) rafData . close ( ) ; // make sure its closed even on exception } }
Read all of the data records that have been added.
The full (x,y) record is read, the reciever will subset the (x, y) as needed.
@param dataReceiver send data here.
Read all of the data records that have been added . The full ( x y ) record is read the reciever will subset the ( x y ) as needed .