cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public EnumTypedef addTypedef(Group g, EnumTypedef td) {
    if (!defineMode) throw new UnsupportedOperationException("not in define mode");
    if (!version.isExtendedModel())
      throw new IllegalArgumentException("Enum type only supported in extended model, this version is="+version);
    g.addEnumeration(td);
    return td;
  }
public EnumTypedef addTypedef(Group g, EnumTypedef td) {
    if (!defineMode) throw new UnsupportedOperationException("not in define mode");
    if (!version.isExtendedModel())
      throw new IllegalArgumentException("Enum type only supported in extended model, this version is="+version);
    g.addEnumeration(td);
    return td;
  }
Add a EnumTypedef to the file. Must be in define mode.

@param g  the group to add to. if null, use root group
@param td the EnumTypedef.
@return the created attribute