cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public Dimension addDimension(Group g, String dimName, int length) {
    return addDimension(g, dimName, length, false, false);
  }
public Dimension addDimension(Group g, String dimName, int length) {
    return addDimension(g, dimName, length, false, false);
  }
Add a shared Dimension to the file. Must be in define mode.

@param dimName name of dimension
@param length  size of dimension.
@return the created dimension