private Array readDataFromPartition(PartitionCollectionImmutable.VariableIndexPartitioned vindexP, SectionIterable section) throws IOException {
    """
	/*
	Iterates using SectionIterable.next(int[] index).
	The work of translating that down into partition heirarchy and finally to a GC is all in VariableIndexPartitioned.getDataRecord(int[] index)
	want.getShape() indicates the result Array shape.
    """

    int rank = section.getRank();
    SectionIterable sectionWanted = section.subSection(0, rank - 2); // all but x, y
    SectionIterable.SectionIterator iterWanted = sectionWanted.getIterator();  // iterator over wanted indices in vindexP
    int[] indexWanted = new int[rank - 2];                              // place to put the iterator result
    int[] useIndex = indexWanted;

    // collect all the records that need to be read
    int resultPos = 0;
    while (iterWanted.hasNext()) {
      iterWanted.next(indexWanted);   // returns the vindexP index in indexWanted array

      // for MRUTP, must munge the index here (not in vindexP.getDataRecord, because its recursive
      if (vindexP.getType() == GribCollectionImmutable.Type.MRUTP) {
        // find the partition from getRuntimeIdxFromMrutpTimeIndex
        CoordinateTime2D time2D = (CoordinateTime2D) vindexP.getCoordinateTime();
        assert time2D != null;
        int[] timeIndices = time2D.getTimeIndicesFromMrutp(indexWanted[0]);

        int[] indexReallyWanted = new int[indexWanted.length+1];
        indexReallyWanted[0] = timeIndices[0];
        indexReallyWanted[1] = timeIndices[1];
        System.arraycopy(indexWanted, 1, indexReallyWanted, 2, indexWanted.length-1);
        useIndex = indexReallyWanted;
      }

      PartitionCollectionImmutable.DataRecord record = vindexP.getDataRecord(useIndex);
      if (record == null) {
        if (Grib.debugRead) logger.debug("readDataFromPartition missing data%n");
        resultPos++; // can just skip, since result is prefilled with NaNs
        continue;
      }
      record.resultIndex = resultPos;
      records.add(record);
      resultPos++;
    }

    // sort by file and position, then read
    DataReceiverIF dataReceiver = new DataReceiver(section.getShape(), section.getRange(rank-2), section.getRange(rank-1) );
    readPartitioned(dataReceiver);

    return dataReceiver.getArray();
  }
private Array readDataFromPartition(PartitionCollectionImmutable.VariableIndexPartitioned vindexP, SectionIterable section) throws IOException {

    int rank = section.getRank();
    SectionIterable sectionWanted = section.subSection(0, rank - 2); // all but x, y
    SectionIterable.SectionIterator iterWanted = sectionWanted.getIterator();  // iterator over wanted indices in vindexP
    int[] indexWanted = new int[rank - 2];                              // place to put the iterator result
    int[] useIndex = indexWanted;

    // collect all the records that need to be read
    int resultPos = 0;
    while (iterWanted.hasNext()) {
      iterWanted.next(indexWanted);   // returns the vindexP index in indexWanted array

      // for MRUTP, must munge the index here (not in vindexP.getDataRecord, because its recursive
      if (vindexP.getType() == GribCollectionImmutable.Type.MRUTP) {
        // find the partition from getRuntimeIdxFromMrutpTimeIndex
        CoordinateTime2D time2D = (CoordinateTime2D) vindexP.getCoordinateTime();
        assert time2D != null;
        int[] timeIndices = time2D.getTimeIndicesFromMrutp(indexWanted[0]);

        int[] indexReallyWanted = new int[indexWanted.length+1];
        indexReallyWanted[0] = timeIndices[0];
        indexReallyWanted[1] = timeIndices[1];
        System.arraycopy(indexWanted, 1, indexReallyWanted, 2, indexWanted.length-1);
        useIndex = indexReallyWanted;
      }

      PartitionCollectionImmutable.DataRecord record = vindexP.getDataRecord(useIndex);
      if (record == null) {
        if (Grib.debugRead) logger.debug("readDataFromPartition missing data%n");
        resultPos++; // can just skip, since result is prefilled with NaNs
        continue;
      }
      record.resultIndex = resultPos;
      records.add(record);
      resultPos++;
    }

    // sort by file and position, then read
    DataReceiverIF dataReceiver = new DataReceiver(section.getShape(), section.getRange(rank-2), section.getRange(rank-1) );
    readPartitioned(dataReceiver);

    return dataReceiver.getArray();
  }
private Array readDataFromPartition ( PartitionCollectionImmutable . VariableIndexPartitioned vindexP , SectionIterable section ) throws IOException { int rank = section . getRank ( ) ; SectionIterable sectionWanted = section . subSection ( 0 , rank - 2 ) ; // all but x, y SectionIterable . SectionIterator iterWanted = sectionWanted . getIterator ( ) ; // iterator over wanted indices in vindexP int [ ] indexWanted = new int [ rank - 2 ] ; // place to put the iterator result int [ ] useIndex = indexWanted ; // collect all the records that need to be read int resultPos = 0 ; while ( iterWanted . hasNext ( ) ) { iterWanted . next ( indexWanted ) ; // returns the vindexP index in indexWanted array // for MRUTP, must munge the index here (not in vindexP.getDataRecord, because its recursive if ( vindexP . getType ( ) == GribCollectionImmutable . Type . MRUTP ) { // find the partition from getRuntimeIdxFromMrutpTimeIndex CoordinateTime2D time2D = ( CoordinateTime2D ) vindexP . getCoordinateTime ( ) ; assert time2D != null ; int [ ] timeIndices = time2D . getTimeIndicesFromMrutp ( indexWanted [ 0 ] ) ; int [ ] indexReallyWanted = new int [ indexWanted . length + 1 ] ; indexReallyWanted [ 0 ] = timeIndices [ 0 ] ; indexReallyWanted [ 1 ] = timeIndices [ 1 ] ; System . arraycopy ( indexWanted , 1 , indexReallyWanted , 2 , indexWanted . length - 1 ) ; useIndex = indexReallyWanted ; } PartitionCollectionImmutable . DataRecord record = vindexP . getDataRecord ( useIndex ) ; if ( record == null ) { if ( Grib . debugRead ) logger . debug ( "readDataFromPartition missing data%n" ) ; resultPos ++ ; // can just skip, since result is prefilled with NaNs continue ; } record . resultIndex = resultPos ; records . add ( record ) ; resultPos ++ ; } // sort by file and position, then read DataReceiverIF dataReceiver = new DataReceiver ( section . getShape ( ) , section . getRange ( rank - 2 ) , section . getRange ( rank - 1 ) ) ; readPartitioned ( dataReceiver ) ; return dataReceiver . getArray ( ) ; }
/*
Iterates using SectionIterable.next(int[] index).
The work of translating that down into partition heirarchy and finally to a GC is all in VariableIndexPartitioned.getDataRecord(int[] index)
want.getShape() indicates the result Array shape.
/ * Iterates using SectionIterable . next ( int [] index ) . The work of translating that down into partition heirarchy and finally to a GC is all in VariableIndexPartitioned . getDataRecord ( int [] index ) want . getShape () indicates the result Array shape .