cdm/src/main/java/ucar/nc2/Variable.java
public void resetDimensions() {
    if (immutable) throw new IllegalStateException("Cant modify");
    ArrayList<Dimension> newDimensions = new ArrayList<>();

    for (Dimension dim : dimensions) {
      if (dim.isShared()) {
        Dimension newD = getParentGroup().findDimension(dim.getShortName());
        if (newD == null)
          throw new IllegalArgumentException("Variable " + getFullName() + " resetDimensions  FAILED, dim doesnt exist in parent group=" + dim);
        newDimensions.add(newD);
      } else {
        newDimensions.add(dim);
      }
    }
    this.dimensions = newDimensions;
    resetShape();
  }
public void resetDimensions() {
    if (immutable) throw new IllegalStateException("Cant modify");
    ArrayList<Dimension> newDimensions = new ArrayList<>();

    for (Dimension dim : dimensions) {
      if (dim.isShared()) {
        Dimension newD = getParentGroup().findDimension(dim.getShortName());
        if (newD == null)
          throw new IllegalArgumentException("Variable " + getFullName() + " resetDimensions  FAILED, dim doesnt exist in parent group=" + dim);
        newDimensions.add(newD);
      } else {
        newDimensions.add(dim);
      }
    }
    this.dimensions = newDimensions;
    resetShape();
  }
public void resetDimensions ( ) { if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; ArrayList < Dimension > newDimensions = new ArrayList <> ( ) ; for ( Dimension dim : dimensions ) { if ( dim . isShared ( ) ) { Dimension newD = getParentGroup ( ) . findDimension ( dim . getShortName ( ) ) ; if ( newD == null ) throw new IllegalArgumentException ( "Variable " + getFullName ( ) + " resetDimensions  FAILED, dim doesnt exist in parent group=" + dim ) ; newDimensions . add ( newD ) ; } else { newDimensions . add ( dim ) ; } } this . dimensions = newDimensions ; resetShape ( ) ; }
Reset the dimension array. Anonymous dimensions are left alone.
Shared dimensions are searched for recursively in the parent groups.
Reset the dimension array . Anonymous dimensions are left alone . Shared dimensions are searched for recursively in the parent groups .