cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public Group addGroup(Group parent, String name) {
    if (!defineMode) throw new UnsupportedOperationException("not in define mode");
    if (parent == null) return ncfile.getRootGroup();

    Group result = new Group(ncfile, parent, name);
    parent.addGroup(result);
    return result;
  }
public Group addGroup(Group parent, String name) {
    if (!defineMode) throw new UnsupportedOperationException("not in define mode");
    if (parent == null) return ncfile.getRootGroup();

    Group result = new Group(ncfile, parent, name);
    parent.addGroup(result);
    return result;
  }
Add a Group to the file. Must be in define mode.
If pass in null as the parent then the root group is returned and the name is ignored.
This is how you get the root group. Note this is different from other uses of parent group.

@param parent the parent of this group, if null then returns the root group.
@param name   the name of this group, unique within parent
@return the created group