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)