cdm/src/main/java/ucar/nc2/NetcdfFile.java
public Dimension addDimension(Group parent, Dimension d) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (parent == null) parent = rootGroup;
    parent.addDimension(d);
    return d;
  }
public Dimension addDimension(Group parent, Dimension d) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (parent == null) parent = rootGroup;
    parent.addDimension(d);
    return d;
  }
Add a shared Dimension to a Group.

@param parent add to this group. If group is null, use root group
@param d      add this Dimension
@return the dimension that was added