def _get_extents(self, proj, res, lon_arr, lat_arr):
p = Proj(proj)
res = float(res)
first_good = self._first_good_nav(lon_arr, lat_arr)
one_x, one_y = p(lon_arr[first_good], lat_arr[first_good])
left_x = one_x - res * first_good[1]
right_x = left_x + res * lon_arr.shape[1]
top_y = one_y + res * first_good[0]
bot_y = top_y - res * lon_arr.shape[0]
half_x = res / 2.
half_y = res / 2.
return (left_x - half_x,
bot_y - half_y,
right_x + half_x,
top_y + half_y)
评论列表
文章目录