dap4/d4cdm/src/main/java/dap4/cdm/nc2/DataToCDM.java
protected CDMArrayStructure
    createStructure(DataCursor data)
            throws DapException
    {
        CDMArrayStructure arraystruct = new CDMArrayStructure(this.cdmroot, data);
        DapVariable var = (DapVariable) data.getTemplate();
        DapStructure struct = (DapStructure) var.getBaseType();
        int nmembers = struct.getFields().size();
        List<DapDimension> dimset = var.getDimensions();
        Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset));
        while(odom.hasNext()) {
            Index index = odom.next();
            long offset = index.index();
            DataCursor[] cursors = (DataCursor[]) data.read(index);
            DataCursor ithelement = cursors[0];
            for(int f = 0; f < nmembers; f++) {
                DataCursor dc = (DataCursor) ithelement.readField(f);
                Array afield = createVar(dc);
                arraystruct.add(offset, f, afield);
            }
        }
        return arraystruct;
    }
protected CDMArrayStructure
    createStructure(DataCursor data)
            throws DapException
    {
        CDMArrayStructure arraystruct = new CDMArrayStructure(this.cdmroot, data);
        DapVariable var = (DapVariable) data.getTemplate();
        DapStructure struct = (DapStructure) var.getBaseType();
        int nmembers = struct.getFields().size();
        List<DapDimension> dimset = var.getDimensions();
        Odometer odom = Odometer.factory(DapUtil.dimsetToSlices(dimset));
        while(odom.hasNext()) {
            Index index = odom.next();
            long offset = index.index();
            DataCursor[] cursors = (DataCursor[]) data.read(index);
            DataCursor ithelement = cursors[0];
            for(int f = 0; f < nmembers; f++) {
                DataCursor dc = (DataCursor) ithelement.readField(f);
                Array afield = createVar(dc);
                arraystruct.add(offset, f, afield);
            }
        }
        return arraystruct;
    }
protected CDMArrayStructure createStructure ( DataCursor data ) throws DapException { CDMArrayStructure arraystruct = new CDMArrayStructure ( this . cdmroot , data ) ; DapVariable var = ( DapVariable ) data . getTemplate ( ) ; DapStructure struct = ( DapStructure ) var . getBaseType ( ) ; int nmembers = struct . getFields ( ) . size ( ) ; List < DapDimension > dimset = var . getDimensions ( ) ; Odometer odom = Odometer . factory ( DapUtil . dimsetToSlices ( dimset ) ) ; while ( odom . hasNext ( ) ) { Index index = odom . next ( ) ; long offset = index . index ( ) ; DataCursor [ ] cursors = ( DataCursor [ ] ) data . read ( index ) ; DataCursor ithelement = cursors [ 0 ] ; for ( int f = 0 ; f < nmembers ; f ++ ) { DataCursor dc = ( DataCursor ) ithelement . readField ( f ) ; Array afield = createVar ( dc ) ; arraystruct . add ( offset , f , afield ) ; } } return arraystruct ; }
Create an array of structures. WARNING: the underlying CDM code
(esp. NetcdfDataset) apparently does not support nested
structure arrays; so this code may throw an exception.

@return A CDMArrayStructure for the databuffer for this struct.
@throws DapException
Create an array of structures . WARNING : the underlying CDM code ( esp . NetcdfDataset ) apparently does not support nested structure arrays ; so this code may throw an exception .