ui/src/main/java/ucar/nc2/ui/gis/SpatialGrid.java
public void setGrid( Rectangle2D bbox, double width, double height) {
    offsetX = bbox.getX();
    offsetY = bbox.getY();

      // number of grid cells
    countX = Math.min( nx, (int) (bbox.getWidth() / (scaleOverlap * width)));
    countY = Math.min( ny, (int) (bbox.getHeight() / (scaleOverlap * height)));

    gridWidth = bbox.getWidth() / countX;
    gridHeight = bbox.getHeight() / countY;

    if (debug)
      System.out.println("SpatialGrid size "+ gridWidth+" "+ gridHeight+" = "+countX+" by "+countY+
        " scaleOverlap= "+ scaleOverlap);
  }
public void setGrid( Rectangle2D bbox, double width, double height) {
    offsetX = bbox.getX();
    offsetY = bbox.getY();

      // number of grid cells
    countX = Math.min( nx, (int) (bbox.getWidth() / (scaleOverlap * width)));
    countY = Math.min( ny, (int) (bbox.getHeight() / (scaleOverlap * height)));

    gridWidth = bbox.getWidth() / countX;
    gridHeight = bbox.getHeight() / countY;

    if (debug)
      System.out.println("SpatialGrid size "+ gridWidth+" "+ gridHeight+" = "+countX+" by "+countY+
        " scaleOverlap= "+ scaleOverlap);
  }
Set the grid scale.
@param bbox bounding box: we are only interested in points inside of this
@param width : divide the bounding box into cells of this width.
@param height : divide the bounding box into cells of this height.
maximum number of grid cells is nx x ny