dap4/d4cdm/src/main/java/dap4/cdm/nc2/CDMArrayStructure.java
static StructureMembers
    computemembers(DapVariable var)
    {
        DapStructure ds = (DapStructure)var.getBaseType();
        StructureMembers sm
                = new StructureMembers(ds.getShortName());
        List<DapVariable> fields = ds.getFields();
        for(int i = 0; i < fields.size(); i++) {
            DapVariable field = fields.get(i);
            DapType dt = field.getBaseType();
            DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt);
            StructureMembers.Member m =
                    sm.addMember(
                            field.getShortName(), "", null,
                            cdmtype,
                            CDMUtil.computeEffectiveShape(field.getDimensions()));
            m.setDataParam(i); // So we can index into various lists
            // recurse if this field is itself a structure
            if(dt.getTypeSort().isStructType()) {
                StructureMembers subsm = computemembers(field);
                m.setStructureMembers(subsm);
            }
        }
        return sm;
    }
static StructureMembers
    computemembers(DapVariable var)
    {
        DapStructure ds = (DapStructure)var.getBaseType();
        StructureMembers sm
                = new StructureMembers(ds.getShortName());
        List<DapVariable> fields = ds.getFields();
        for(int i = 0; i < fields.size(); i++) {
            DapVariable field = fields.get(i);
            DapType dt = field.getBaseType();
            DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt);
            StructureMembers.Member m =
                    sm.addMember(
                            field.getShortName(), "", null,
                            cdmtype,
                            CDMUtil.computeEffectiveShape(field.getDimensions()));
            m.setDataParam(i); // So we can index into various lists
            // recurse if this field is itself a structure
            if(dt.getTypeSort().isStructType()) {
                StructureMembers subsm = computemembers(field);
                m.setStructureMembers(subsm);
            }
        }
        return sm;
    }
static StructureMembers computemembers ( DapVariable var ) { DapStructure ds = ( DapStructure ) var . getBaseType ( ) ; StructureMembers sm = new StructureMembers ( ds . getShortName ( ) ) ; List < DapVariable > fields = ds . getFields ( ) ; for ( int i = 0 ; i < fields . size ( ) ; i ++ ) { DapVariable field = fields . get ( i ) ; DapType dt = field . getBaseType ( ) ; DataType cdmtype = CDMTypeFcns . daptype2cdmtype ( dt ) ; StructureMembers . Member m = sm . addMember ( field . getShortName ( ) , "" , null , cdmtype , CDMUtil . computeEffectiveShape ( field . getDimensions ( ) ) ) ; m . setDataParam ( i ) ; // So we can index into various lists // recurse if this field is itself a structure if ( dt . getTypeSort ( ) . isStructType ( ) ) { StructureMembers subsm = computemembers ( field ) ; m . setStructureMembers ( subsm ) ; } } return sm ; }
Compute the StructureMembers object
from a DapStructure. May need to recurse
if a field is itself a Structure

@param var The DapVariable to use to construct
a StructureMembers object.
@return The StructureMembers object for the given DapStructure
Compute the StructureMembers object from a DapStructure . May need to recurse if a field is itself a Structure