def test_pix2latlong(pix_size_single, origin_point, is_flipped,
num_chunks, chunk_position):
img = make_image(pix_size_single, origin_point, is_flipped,
num_chunks, chunk_position)
chunk_idx = img.chunk_idx
res_x = img._full_res[0]
res_y = img._full_res[1]
pix_size = (img.pixsize_x, img.pixsize_y)
origin = (img._start_lon, img._start_lat)
true_lons = np.arange(res_x) * pix_size[0] + origin[0]
all_lats = np.arange(res_y) * pix_size[1] + origin[1]
true_lats = np.array_split(all_lats, num_chunks)[chunk_idx]
true_d = np.array([[a, b] for a in true_lons for b in true_lats])
pix_x = np.arange(res_x)
pix_y = np.arange(img.resolution[1]) # chunk resolution
xy = np.array([[a, b] for a in pix_x for b in pix_y])
lonlats = img.pix2lonlat(xy)
assert np.all(lonlats == true_d)
评论列表
文章目录