cdm/src/main/java/ucar/nc2/NetcdfFile.java
public boolean removeVariable(Group g, String varName) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (g == null) g = rootGroup;
    return g.removeVariable(varName);
  }
public boolean removeVariable(Group g, String varName) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (g == null) g = rootGroup;
    return g.removeVariable(varName);
  }
Remove a Variable from the given group by name.

@param g       remove from this group. If group is null, use root group
@param varName name of variable to remove.
@return true is variable found and removed