cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public Variable addVariable(Group g, String shortName, DataType dataType, String dimString) {
    Group parent = (g == null) ? ncfile.getRootGroup() : g;
    return addVariable(g, null, shortName, dataType, Dimension.makeDimensionsList(parent, dimString));
  }
public Variable addVariable(Group g, String shortName, DataType dataType, String dimString) {
    Group parent = (g == null) ? ncfile.getRootGroup() : g;
    return addVariable(g, null, shortName, dataType, Dimension.makeDimensionsList(parent, dimString));
  }
Add a variable to the file. Must be in define mode.

@param g         the group to add to. if null, use root group
@param shortName name of Variable, must be unique with the file.
@param dataType  type of underlying element
@param dimString names of Dimensions for the variable, blank separated.
Must already have been added. Use an empty string for a scalar variable.
@return the Variable that has been added