legacy/src/main/java/ucar/nc2/NetcdfFileWriteable.java
public Dimension addDimension(String dimName, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength) {
    if (!defineMode)
      throw new UnsupportedOperationException("not in define mode");
    if (!N3iosp.isValidNetcdfObjectName(dimName))
      throw new IllegalArgumentException("illegal netCDF-3 dimension name "+dimName);

    Dimension dim = new Dimension(dimName, length, isShared, isUnlimited, isVariableLength);
    super.addDimension(null, dim);
    return dim;
  }
public Dimension addDimension(String dimName, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength) {
    if (!defineMode)
      throw new UnsupportedOperationException("not in define mode");
    if (!N3iosp.isValidNetcdfObjectName(dimName))
      throw new IllegalArgumentException("illegal netCDF-3 dimension name "+dimName);

    Dimension dim = new Dimension(dimName, length, isShared, isUnlimited, isVariableLength);
    super.addDimension(null, dim);
    return dim;
  }
Add a Dimension to the file. Must be in define mode.

@param dimName          name of dimension
@param length           size of dimension.
@param isShared         if dimension is shared
@param isUnlimited      if dimension is unlimited
@param isVariableLength if dimension is variable length
@return the created dimension