opendap/src/main/java/opendap/dap/DGrid.java
public boolean projectionYieldsGrid(boolean constrained) {

        if(!constrained) return true;
        
        // For each dimension in the Array part, check the corresponding Map
        // vector to make sure it is present in the projected Grid. If for each
        // projected dimension in the Array component, there is a matching Map
        // vector, then the Grid is valid.
        boolean valid = true;

        // Don't bother checking if the Array component is not included.
        if (!((SDArray) arrayVar).isProject())
            return false;

        int nadims = arrayVar.numDimensions();
        int nmaps =  getVarCount()-1;
        //Enumeration aDims = arrayVar.getDimensions();
        //Enumeration e = mapVars.elements();
        //while (valid && e.hasMoreElements() && aDims.hasMoreElements()) {

        if(nadims != nmaps)
            valid = false;
        else for(int d=0;d<nadims;d++) {
            try {

            DArrayDimension thisDim = arrayVar.getDimension(d); //(DArrayDimension) aDims.nextElement();
            SDArray mapArray = (SDArray)getVar(d+1); //e.nextElement();
            DArrayDimension mapDim = mapArray.getFirstDimension();

            if (thisDim.getSize() > 0) {
                // LogStream.out.println("Dimension Contains Data.");

                if (mapArray.isProject()) { // This map vector better be projected!
                    // LogStream.out.println("Map Vector Projected, checking projection image...");

                    // Check the matching Map vector; the Map projection must equal
                    // the Array dimension projection

                    // wrong: valid at this point might have been false: valid = true;
                    valid = valid && mapDim.getStart() == thisDim.getStart();
                    valid = valid && mapDim.getStop() == thisDim.getStop();
                    valid = valid && mapDim.getStride() == thisDim.getStride();
                } else {
                    // LogStream.out.println("Map Vector not Projected.");
                    valid = false;
                }

            } else {
                // LogStream.out.println("Dimension empty. Verifying corresponding Map vector not projected...");
                // Corresponding Map vector must be excluded from the
                // projection or it's not a grid.
                valid = !mapArray.isProject();
            }

            }  catch(Exception e) {
                Util.check(e);
                valid=false;
                break;
            }


        }

        //if (e.hasMoreElements() != aDims.hasMoreElements()) valid = false;

        return valid;
    }
public boolean projectionYieldsGrid(boolean constrained) {

        if(!constrained) return true;
        
        // For each dimension in the Array part, check the corresponding Map
        // vector to make sure it is present in the projected Grid. If for each
        // projected dimension in the Array component, there is a matching Map
        // vector, then the Grid is valid.
        boolean valid = true;

        // Don't bother checking if the Array component is not included.
        if (!((SDArray) arrayVar).isProject())
            return false;

        int nadims = arrayVar.numDimensions();
        int nmaps =  getVarCount()-1;
        //Enumeration aDims = arrayVar.getDimensions();
        //Enumeration e = mapVars.elements();
        //while (valid && e.hasMoreElements() && aDims.hasMoreElements()) {

        if(nadims != nmaps)
            valid = false;
        else for(int d=0;d<nadims;d++) {
            try {

            DArrayDimension thisDim = arrayVar.getDimension(d); //(DArrayDimension) aDims.nextElement();
            SDArray mapArray = (SDArray)getVar(d+1); //e.nextElement();
            DArrayDimension mapDim = mapArray.getFirstDimension();

            if (thisDim.getSize() > 0) {
                // LogStream.out.println("Dimension Contains Data.");

                if (mapArray.isProject()) { // This map vector better be projected!
                    // LogStream.out.println("Map Vector Projected, checking projection image...");

                    // Check the matching Map vector; the Map projection must equal
                    // the Array dimension projection

                    // wrong: valid at this point might have been false: valid = true;
                    valid = valid && mapDim.getStart() == thisDim.getStart();
                    valid = valid && mapDim.getStop() == thisDim.getStop();
                    valid = valid && mapDim.getStride() == thisDim.getStride();
                } else {
                    // LogStream.out.println("Map Vector not Projected.");
                    valid = false;
                }

            } else {
                // LogStream.out.println("Dimension empty. Verifying corresponding Map vector not projected...");
                // Corresponding Map vector must be excluded from the
                // projection or it's not a grid.
                valid = !mapArray.isProject();
            }

            }  catch(Exception e) {
                Util.check(e);
                valid=false;
                break;
            }


        }

        //if (e.hasMoreElements() != aDims.hasMoreElements()) valid = false;

        return valid;
    }
public boolean projectionYieldsGrid ( boolean constrained ) { if ( ! constrained ) return true ; // For each dimension in the Array part, check the corresponding Map
 // vector to make sure it is present in the projected Grid. If for each
 // projected dimension in the Array component, there is a matching Map
 // vector, then the Grid is valid.
 boolean valid = true ; // Don't bother checking if the Array component is not included.
 if ( ! ( ( SDArray ) arrayVar ) . isProject ( ) ) return false ; int nadims = arrayVar . numDimensions ( ) ; int nmaps = getVarCount ( ) - 1 ; //Enumeration aDims = arrayVar.getDimensions();
 //Enumeration e = mapVars.elements();
 //while (valid && e.hasMoreElements() && aDims.hasMoreElements()) {
 if ( nadims != nmaps ) valid = false ; else for ( int d = 0 ; d < nadims ; d ++ ) { try { DArrayDimension thisDim = arrayVar . getDimension ( d ) ; //(DArrayDimension) aDims.nextElement();
 SDArray mapArray = ( SDArray ) getVar ( d + 1 ) ; //e.nextElement();
 DArrayDimension mapDim = mapArray . getFirstDimension ( ) ; if ( thisDim . getSize ( ) > 0 ) { // LogStream.out.println("Dimension Contains Data.");
 if ( mapArray . isProject ( ) ) { // This map vector better be projected!
 // LogStream.out.println("Map Vector Projected, checking projection image...");
 // Check the matching Map vector; the Map projection must equal
 // the Array dimension projection
 // wrong: valid at this point might have been false: valid = true;
 valid = valid && mapDim . getStart ( ) == thisDim . getStart ( ) ; valid = valid && mapDim . getStop ( ) == thisDim . getStop ( ) ; valid = valid && mapDim . getStride ( ) == thisDim . getStride ( ) ; } else { // LogStream.out.println("Map Vector not Projected.");
 valid = false ; } } else { // LogStream.out.println("Dimension empty. Verifying corresponding Map vector not projected...");
 // Corresponding Map vector must be excluded from the
 // projection or it's not a grid.
 valid = ! mapArray . isProject ( ) ; } } catch ( Exception e ) { Util . check ( e ) ; valid = false ; break ; } } //if (e.hasMoreElements() != aDims.hasMoreElements()) valid = false;
 return valid ; }
When projected (using whatever the current constraint provides in the way
of a projection) am I still a Grid?

@return True if projected grid is still a grid. False otherwise.
When projected ( using whatever the current constraint provides in the way of a projection ) am I still a Grid?