iy = np.floor(sy * (ym - gmin[1]) / gsize[1]).astype('int')