cdm/src/main/java/ucar/ma2/ArrayStructure.java
public Array extractMemberArray(StructureMembers.Member m) throws IOException {
    if (m.getDataArray() != null)
      return m.getDataArray();
    DataType dataType = m.getDataType();

    /* special handling for sequences
    if (dataType == DataType.SEQUENCE) {
      List<StructureData> sdataList = new ArrayList<StructureData>();
      for (int recno=0; recno<getSize(); recno++) {
        ArraySequence2 seq = getArraySequence(recno, m);
        StructureDataIterator iter = seq.getStructureDataIterator();
        while (iter.hasNext())
          sdataList.add( iter.next());
      }
      ArraySequence2 seq = getArraySequence(0, m);
      int size = sdataList.size();
      StructureData[] sdataArray = sdataList.toArray( new StructureData[size]);
      return new ArrayStructureW( seq.getStructureMembers(), new int[] {size}, sdataArray);
   } */

    // combine the shapes
    int[] mshape = m.getShape();
    int rrank = rank + mshape.length;
    int[] rshape = new int[rrank];
    System.arraycopy(getShape(), 0, rshape, 0, rank);
    System.arraycopy(mshape, 0, rshape, rank, mshape.length);

    // create an empty array to hold the result
    Array result;
    if (dataType == DataType.STRUCTURE) {
      StructureMembers membersw = new StructureMembers(m.getStructureMembers()); // no data arrays get propagated
      result = new ArrayStructureW(membersw, rshape);

    } else if (dataType == DataType.OPAQUE) {
      result = Array.factory(DataType.OPAQUE, rshape);

    } else {
      result = Array.factory(dataType, rshape);
    }

    IndexIterator resultIter = result.getIndexIterator();
    if (dataType == DataType.DOUBLE) {
      for (int recno = 0; recno < getSize(); recno++)
        copyDoubles(recno, m, resultIter);

    } else if (dataType == DataType.FLOAT) {
      for (int recno = 0; recno < getSize(); recno++)
        copyFloats(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == byte.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyBytes(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == short.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyShorts(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == int.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyInts(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == long.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyLongs(recno, m, resultIter);

    } else if (dataType == DataType.CHAR) {
      for (int recno = 0; recno < getSize(); recno++)
        copyChars(recno, m, resultIter);

    } else if ((dataType == DataType.STRING) || (dataType == DataType.OPAQUE)) {
      for (int recno = 0; recno < getSize(); recno++)
        copyObjects(recno, m, resultIter);

    } else if (dataType == DataType.STRUCTURE) {
      for (int recno = 0; recno < getSize(); recno++)
        copyStructures(recno, m, resultIter);

    } else if (dataType == DataType.SEQUENCE) {
      for (int recno = 0; recno < getSize(); recno++)
        copySequences(recno, m, resultIter);

    }

    return result;
  }
public Array extractMemberArray(StructureMembers.Member m) throws IOException {
    if (m.getDataArray() != null)
      return m.getDataArray();
    DataType dataType = m.getDataType();

    /* special handling for sequences
    if (dataType == DataType.SEQUENCE) {
      List<StructureData> sdataList = new ArrayList<StructureData>();
      for (int recno=0; recno<getSize(); recno++) {
        ArraySequence2 seq = getArraySequence(recno, m);
        StructureDataIterator iter = seq.getStructureDataIterator();
        while (iter.hasNext())
          sdataList.add( iter.next());
      }
      ArraySequence2 seq = getArraySequence(0, m);
      int size = sdataList.size();
      StructureData[] sdataArray = sdataList.toArray( new StructureData[size]);
      return new ArrayStructureW( seq.getStructureMembers(), new int[] {size}, sdataArray);
   } */

    // combine the shapes
    int[] mshape = m.getShape();
    int rrank = rank + mshape.length;
    int[] rshape = new int[rrank];
    System.arraycopy(getShape(), 0, rshape, 0, rank);
    System.arraycopy(mshape, 0, rshape, rank, mshape.length);

    // create an empty array to hold the result
    Array result;
    if (dataType == DataType.STRUCTURE) {
      StructureMembers membersw = new StructureMembers(m.getStructureMembers()); // no data arrays get propagated
      result = new ArrayStructureW(membersw, rshape);

    } else if (dataType == DataType.OPAQUE) {
      result = Array.factory(DataType.OPAQUE, rshape);

    } else {
      result = Array.factory(dataType, rshape);
    }

    IndexIterator resultIter = result.getIndexIterator();
    if (dataType == DataType.DOUBLE) {
      for (int recno = 0; recno < getSize(); recno++)
        copyDoubles(recno, m, resultIter);

    } else if (dataType == DataType.FLOAT) {
      for (int recno = 0; recno < getSize(); recno++)
        copyFloats(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == byte.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyBytes(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == short.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyShorts(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == int.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyInts(recno, m, resultIter);

    } else if (dataType.getPrimitiveClassType() == long.class) {
      for (int recno = 0; recno < getSize(); recno++)
        copyLongs(recno, m, resultIter);

    } else if (dataType == DataType.CHAR) {
      for (int recno = 0; recno < getSize(); recno++)
        copyChars(recno, m, resultIter);

    } else if ((dataType == DataType.STRING) || (dataType == DataType.OPAQUE)) {
      for (int recno = 0; recno < getSize(); recno++)
        copyObjects(recno, m, resultIter);

    } else if (dataType == DataType.STRUCTURE) {
      for (int recno = 0; recno < getSize(); recno++)
        copyStructures(recno, m, resultIter);

    } else if (dataType == DataType.SEQUENCE) {
      for (int recno = 0; recno < getSize(); recno++)
        copySequences(recno, m, resultIter);

    }

    return result;
  }
public Array extractMemberArray ( StructureMembers . Member m ) throws IOException { if ( m . getDataArray ( ) != null ) return m . getDataArray ( ) ; DataType dataType = m . getDataType ( ) ; /* special handling for sequences
    if (dataType == DataType.SEQUENCE) {
      List<StructureData> sdataList = new ArrayList<StructureData>();
      for (int recno=0; recno<getSize(); recno++) {
        ArraySequence2 seq = getArraySequence(recno, m);
        StructureDataIterator iter = seq.getStructureDataIterator();
        while (iter.hasNext())
          sdataList.add( iter.next());
      }
      ArraySequence2 seq = getArraySequence(0, m);
      int size = sdataList.size();
      StructureData[] sdataArray = sdataList.toArray( new StructureData[size]);
      return new ArrayStructureW( seq.getStructureMembers(), new int[] {size}, sdataArray);
   } */ // combine the shapes
 int [ ] mshape = m . getShape ( ) ; int rrank = rank + mshape . length ; int [ ] rshape = new int [ rrank ] ; System . arraycopy ( getShape ( ) , 0 , rshape , 0 , rank ) ; System . arraycopy ( mshape , 0 , rshape , rank , mshape . length ) ; // create an empty array to hold the result
 Array result ; if ( dataType == DataType . STRUCTURE ) { StructureMembers membersw = new StructureMembers ( m . getStructureMembers ( ) ) ; // no data arrays get propagated
 result = new ArrayStructureW ( membersw , rshape ) ; } else if ( dataType == DataType . OPAQUE ) { result = Array . factory ( DataType . OPAQUE , rshape ) ; } else { result = Array . factory ( dataType , rshape ) ; } IndexIterator resultIter = result . getIndexIterator ( ) ; if ( dataType == DataType . DOUBLE ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyDoubles ( recno , m , resultIter ) ; } else if ( dataType == DataType . FLOAT ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyFloats ( recno , m , resultIter ) ; } else if ( dataType . getPrimitiveClassType ( ) == byte . class ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyBytes ( recno , m , resultIter ) ; } else if ( dataType . getPrimitiveClassType ( ) == short . class ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyShorts ( recno , m , resultIter ) ; } else if ( dataType . getPrimitiveClassType ( ) == int . class ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyInts ( recno , m , resultIter ) ; } else if ( dataType . getPrimitiveClassType ( ) == long . class ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyLongs ( recno , m , resultIter ) ; } else if ( dataType == DataType . CHAR ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyChars ( recno , m , resultIter ) ; } else if ( ( dataType == DataType . STRING ) || ( dataType == DataType . OPAQUE ) ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyObjects ( recno , m , resultIter ) ; } else if ( dataType == DataType . STRUCTURE ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copyStructures ( recno , m , resultIter ) ; } else if ( dataType == DataType . SEQUENCE ) { for ( int recno = 0 ; recno < getSize ( ) ; recno ++ ) copySequences ( recno , m , resultIter ) ; } return result ; }
Extract data for one member, over all structures.

@param m get data from this StructureMembers.Member.
@return Array values.
@throws java.io.IOException on read error (only happens for Sequences, otherwise data is already read)
Extract data for one member over all structures .