protected void builddimrefs ( DapVariable dapvar , List < Dimension > cdmdims ) throws DapException { if ( cdmdims == null || cdmdims . size ( ) == 0 ) return ; // It is unfortunately the case that the dimensions // associated with the variable are not // necessarily the same object as those dimensions // as declared, so we need to use a non-trivial // matching algorithm. for ( Dimension cdmdim : cdmdims ) { DapDimension dapdim = null ; if ( cdmdim . isShared ( ) ) { Dimension declareddim = finddimdecl ( cdmdim ) ; if ( declareddim == null ) throw new DapException ( "Unprocessed cdm dimension: " + cdmdim ) ; dapdim = ( DapDimension ) this . nodemap . get ( declareddim ) ; assert dapdim != null ; } else if ( cdmdim . isVariableLength ( ) ) { // ignore continue ; } else { //anonymous dapdim = builddim ( cdmdim ) ; } assert ( dapdim != null ) : "Internal error" ; dapvar . addDimension ( dapdim ) ; } }
Assign dimensions to a variable