cdm/src/main/java/ucar/nc2/Variable.java
public void resetShape() {
    // if (immutable) throw new IllegalStateException("Cant modify");  LOOK allow this for unlimited dimension updating
    this.shape = new int[dimensions.size()];
    for (int i = 0; i < dimensions.size(); i++) {
      Dimension dim = dimensions.get(i);
      shape[i] = dim.getLength();
      //shape[i] = Math.max(dim.getLength(), 0); // LOOK
      // if (dim.isUnlimited() && (i != 0)) // LOOK only true for Netcdf-3
      //   throw new IllegalArgumentException("Unlimited dimension must be outermost");
      if (dim.isVariableLength()) {
        //if (dimensions.size() != 1)
        //  throw new IllegalArgumentException("Unknown dimension can only be used in 1 dim array");
        //else
        isVariableLength = true;
      }
    }
    this.shapeAsSection = null; // recalc next time its asked for
  }
public void resetShape() {
    // if (immutable) throw new IllegalStateException("Cant modify");  LOOK allow this for unlimited dimension updating
    this.shape = new int[dimensions.size()];
    for (int i = 0; i < dimensions.size(); i++) {
      Dimension dim = dimensions.get(i);
      shape[i] = dim.getLength();
      //shape[i] = Math.max(dim.getLength(), 0); // LOOK
      // if (dim.isUnlimited() && (i != 0)) // LOOK only true for Netcdf-3
      //   throw new IllegalArgumentException("Unlimited dimension must be outermost");
      if (dim.isVariableLength()) {
        //if (dimensions.size() != 1)
        //  throw new IllegalArgumentException("Unknown dimension can only be used in 1 dim array");
        //else
        isVariableLength = true;
      }
    }
    this.shapeAsSection = null; // recalc next time its asked for
  }
public void resetShape ( ) { // if (immutable) throw new IllegalStateException("Cant modify");  LOOK allow this for unlimited dimension updating this . shape = new int [ dimensions . size ( ) ] ; for ( int i = 0 ; i < dimensions . size ( ) ; i ++ ) { Dimension dim = dimensions . get ( i ) ; shape [ i ] = dim . getLength ( ) ; //shape[i] = Math.max(dim.getLength(), 0); // LOOK // if (dim.isUnlimited() && (i != 0)) // LOOK only true for Netcdf-3 //   throw new IllegalArgumentException("Unlimited dimension must be outermost"); if ( dim . isVariableLength ( ) ) { //if (dimensions.size() != 1) //  throw new IllegalArgumentException("Unknown dimension can only be used in 1 dim array"); //else isVariableLength = true ; } } this . shapeAsSection = null ; // recalc next time its asked for }
Use when dimensions have changed, to recalculate the shape.
Use when dimensions have changed to recalculate the shape .