def METHOD_NAME(self, y):
    # Return -1 if outside the tile system bounds
    if y < self.bbox.miny or y > self.bbox.maxy:
        return -1
    # If equal to the max y return the largest row
    if y == self.bbox.maxy:
        return self.nrows - 1
    else:
        return int((y - self.bbox.miny) / self.tilesize)