cdm/src/main/java/ucar/nc2/ft2/coverage/adapter/GeoGridCoordinate2D.java
private boolean box9(double wantLat, double wantLon, int[] rectIndex) {
    int row = rectIndex[0];
    int minrow = Math.max(row-1, 0);
    int maxrow = Math.min(row+1, nrows);

    int col = rectIndex[1];
    int mincol= Math.max(col-1, 0);
    int maxcol = Math.min(col+1, ncols);

    if (debug) System.out.printf("%n   box9:");
    for (int i=minrow; i<=maxrow; i++)
      for (int j=mincol; j<=maxcol; j++) {
        rectIndex[0] = i;
        rectIndex[1] = j;
        if (contains(wantLat, wantLon,  rectIndex)) return true;
      }

    return false;
  }
private boolean box9(double wantLat, double wantLon, int[] rectIndex) {
    int row = rectIndex[0];
    int minrow = Math.max(row-1, 0);
    int maxrow = Math.min(row+1, nrows);

    int col = rectIndex[1];
    int mincol= Math.max(col-1, 0);
    int maxcol = Math.min(col+1, ncols);

    if (debug) System.out.printf("%n   box9:");
    for (int i=minrow; i<=maxrow; i++)
      for (int j=mincol; j<=maxcol; j++) {
        rectIndex[0] = i;
        rectIndex[1] = j;
        if (contains(wantLat, wantLon,  rectIndex)) return true;
      }

    return false;
  }
private boolean box9 ( double wantLat , double wantLon , int [ ] rectIndex ) { int row = rectIndex [ 0 ] ; int minrow = Math . max ( row - 1 , 0 ) ; int maxrow = Math . min ( row + 1 , nrows ) ; int col = rectIndex [ 1 ] ; int mincol = Math . max ( col - 1 , 0 ) ; int maxcol = Math . min ( col + 1 , ncols ) ; if ( debug ) System . out . printf ( "%n   box9:" ) ; for ( int i = minrow ; i <= maxrow ; i ++ ) for ( int j = mincol ; j <= maxcol ; j ++ ) { rectIndex [ 0 ] = i ; rectIndex [ 1 ] = j ; if ( contains ( wantLat , wantLon , rectIndex ) ) return true ; } return false ; }
we think its got to be in one of the 9 boxes around rectIndex
we think its got to be in one of the 9 boxes around rectIndex