python EASE 2.0网格行列号与经纬度之间转换

1.经纬度转行列号

复制代码
from ease_lonlat import EASE2GRID, SUPPORTED_GRIDS

# define new grid by yourself
grid = EASE2GRID(name='EASE2_T3125m', epsg=6933, x_min=-17367530.45, y_max=6756820.20, res=3128.16, n_cols=11104, n_rows=4320)

# or using parameters taken from NSIDC and kept in SUPPORTED_GRIDS
# grid = EASE2GRID(name='EASE2_G1km', **SUPPORTED_GRIDS['EASE2_G1km'])

# convert longitude and latitude to row and col indicespoint_lon = -105.647
point_lat = 40.31176

col, row = grid.lonlat2rc(lon=point_lon, lat=point_lat)
复制代码

2.行列号转经纬度

复制代码
from ease_lonlat import EASE2GRID, SUPPORTED_GRIDS

# define new grid by yourself
grid = EASE2GRID(name='EASE2_T3125m', epsg=6933, x_min=-17367530.45, y_max=6756820.20, res=3128.16, n_cols=11104, n_rows=4320)

# or using parameters taken from NSIDC and kept in SUPPORTED_GRIDS
# grid = EASE2GRID(name='EASE2_G1km', **SUPPORTED_GRIDS['EASE2_G1km'])

# convert row and col to longtitude and latitude 
col = 2293
row = 645

# get lon, lat of the center of the pixel
pixel_center_lon, pixel_center_lat = grid.rc2lonlat(col=col, row=row)
复制代码

 

posted @   揪你小辫子  阅读(1107)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示