cdm/src/main/java/ucar/nc2/dt/grid/GridCoordinate2D.java
public boolean findCoordElementForce(double wantLat, double wantLon, int[] rectIndex) {
    findBounds();
    if (wantLat < latMinMax.min) return false;
    if (wantLat > latMinMax.max) return false;
    if (wantLon < lonMinMax.min) return false;
    if (wantLon > lonMinMax.max) return false;

    boolean saveDebug = debug;
    debug = false;
    for (int row=0; row<nrows; row++) {
      for (int col=0; col<ncols; col++) {

        rectIndex[0] = row;
        rectIndex[1] = col;

        if (contains(wantLat, wantLon, rectIndex)) {
          debug = saveDebug;
          return true;
        }
      }
    }
    //debug = saveDebug;
    return false;
  }
public boolean findCoordElementForce(double wantLat, double wantLon, int[] rectIndex) {
    findBounds();
    if (wantLat < latMinMax.min) return false;
    if (wantLat > latMinMax.max) return false;
    if (wantLon < lonMinMax.min) return false;
    if (wantLon > lonMinMax.max) return false;

    boolean saveDebug = debug;
    debug = false;
    for (int row=0; row<nrows; row++) {
      for (int col=0; col<ncols; col++) {

        rectIndex[0] = row;
        rectIndex[1] = col;

        if (contains(wantLat, wantLon, rectIndex)) {
          debug = saveDebug;
          return true;
        }
      }
    }
    //debug = saveDebug;
    return false;
  }
public boolean findCoordElementForce ( double wantLat , double wantLon , int [ ] rectIndex ) { findBounds ( ) ; if ( wantLat < latMinMax . min ) return false ; if ( wantLat > latMinMax . max ) return false ; if ( wantLon < lonMinMax . min ) return false ; if ( wantLon > lonMinMax . max ) return false ; boolean saveDebug = debug ; debug = false ; for ( int row = 0 ; row < nrows ; row ++ ) { for ( int col = 0 ; col < ncols ; col ++ ) { rectIndex [ 0 ] = row ; rectIndex [ 1 ] = col ; if ( contains ( wantLat , wantLon , rectIndex ) ) { debug = saveDebug ; return true ; } } } //debug = saveDebug;
 return false ; }
brute force
brute force