cdm/src/main/java/ucar/nc2/Variable.java
public void setDimensions(List<Dimension> dims) {
    if (immutable) throw new IllegalStateException("Cant modify");
    this.dimensions = (dims == null) ? new ArrayList<>() : new ArrayList<>(dims);
    resetShape();
  }
public void setDimensions(List<Dimension> dims) {
    if (immutable) throw new IllegalStateException("Cant modify");
    this.dimensions = (dims == null) ? new ArrayList<>() : new ArrayList<>(dims);
    resetShape();
  }
Set the shape with a list of Dimensions. The Dimensions may be shared or not.
Dimensions are in order, slowest varying first. Send a null for a scalar.
Technically you can use Dimensions from any group; pragmatically you should only use
Dimensions contained in the Variable's parent groups.

@param dims list of type ucar.nc2.Dimension