cdm/src/main/java/ucar/nc2/NetcdfFile.java
public Attribute addAttribute(Group parent, String name, String value) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (value == null) return null;
    if (parent == null) parent = rootGroup;
    Attribute att = new Attribute(name, value);
    parent.addAttribute(att);
    return att;
  }
public Attribute addAttribute(Group parent, String name, String value) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (value == null) return null;
    if (parent == null) parent = rootGroup;
    Attribute att = new Attribute(name, value);
    parent.addAttribute(att);
    return att;
  }
Add optional String attribute to a group.

@param parent add to this group. If group is null, use root group
@param name attribute name, may not be null
@param value attribute value, may be null, in which case, do not addd
@return the attribute that was added