opendap/src/main/java/ucar/nc2/dods/DODSNetcdfFile.java
private void addAttributes(Variable v, DodsV dodsV) {
    List<DODSAttribute> atts = dodsV.attributes;
    for (Attribute ncatt : atts) {
      v.addAttribute(ncatt);
    }

    // this is the case where its (probably) a Grid, and so _Coordinate.Axes has been assigned, but if
    // theres also a coordinates attribute, need to add that info
    Attribute axes = v.findAttribute(CF.COORDINATES);
    Attribute _axes = v.findAttribute(_Coordinate.Axes);
    if ((null != axes) && (null != _axes)) {
      v.addAttribute(combineAxesAttrs(axes, _axes));
    }
  }
private void addAttributes(Variable v, DodsV dodsV) {
    List<DODSAttribute> atts = dodsV.attributes;
    for (Attribute ncatt : atts) {
      v.addAttribute(ncatt);
    }

    // this is the case where its (probably) a Grid, and so _Coordinate.Axes has been assigned, but if
    // theres also a coordinates attribute, need to add that info
    Attribute axes = v.findAttribute(CF.COORDINATES);
    Attribute _axes = v.findAttribute(_Coordinate.Axes);
    if ((null != axes) && (null != _axes)) {
      v.addAttribute(combineAxesAttrs(axes, _axes));
    }
  }
/* private void addAttributes(String tableName, AttributeTable attTable) {

java.util.Enumeration attNames = attTable.getNames();
while (attNames.hasMoreElements()) {
String attName = (String) attNames.nextElement();
dods.dap.Attribute att = attTable.getAttribute(attName);
if (!att.isContainer()) {
DODSAttribute ncatt = new DODSAttribute( tableName +"." + attName, att);
addAttribute( null, ncatt);
if (debugAttributes) System.out.println(" addAttribute = "+tableName +"." + attName);
}
}

try {
look for nested ones
attNames = attTable.getNames();
while (attNames.hasMoreElements()) {
String attName = (String) attNames.nextElement();
dods.dap.Attribute att = attTable.getAttribute(attName);
if (att.isContainer()) {
addAttributes(tableName +"."+attName, att.getContainer());
}
}
} catch (Exception e) {} // WRONG
} catch (NoSuchAttributeException e) {}
}

an attTable name matches a Variable
private void addAttributes(Variable v, AttributeTable attTable) {
if (attTable == null) return;
if (debugAttributes) System.out.println(" addAttributes to "+v.getName());

java.util.Enumeration attNames = attTable.getNames();
while (attNames.hasMoreElements()) {
String attName = (String) attNames.nextElement();
dods.dap.Attribute att = attTable.getAttribute(attName);
if (att == null) continue;
if (!att.isContainer()) {
DODSAttribute ncatt = new DODSAttribute( attName, att);
v.addAttribute( ncatt);
} else if (v instanceof Structure) {
Structure s = (Structure) v;
Variable member = s.findVariable( att.getShortName());
if (member != null) {
addAttributes(member, att.getContainer());
} else {
if (debugAttributes) System.out.println("Cant find nested Variable "+ att.getShortName()+" in "+v.getName());
}
} else {
if (debugAttributes) System.out.println("Container attribute "+ att.getShortName()+" in non structure variables"+v.getName());
}
}
}