code: public static int[] coordinateToNearestRowCol( Window active, Coordinate coord ) {
  
          double easting = coord.x;
          double northing = coord.y;
          int[] rowcol = new int[2];
          if (easting > active.getEast() || easting < active.getWest() || northing > active.getNorth()
                  || northing < active.getSouth()) {
              return null;
          }
  
          double minx = active.getWest();
          double ewres = active.getWEResolution();
          for( int i = 0; i < active.getCols(); i++ ) {
              minx = minx + ewres;
              if (easting < minx) {
                  rowcol[1] = i;
                  break;
              }
          }
  
          double maxy = active.getNorth();
          double nsres = active.getNSResolution();
          for( int i = 0; i < active.getRows(); i++ ) {
              maxy = maxy - nsres;
              if (northing > maxy) {
                  rowcol[0] = i;
                  break;
              }
          }
  
          return rowcol;
      }
docs: <p>
  Return the row and column of the active region matrix for a give coordinate *
  </p>
  <p>
  NOTE: basically the inverse of
  {@link GrassLegacyUtilities#rowColToCenterCoordinates(Window, int, int)}
  </p>
  
  @param active the active region
  @param coord
  @return and int array containing row and col