我有卫星图像文件。加载到dask数组中。我想得到感兴趣的纬度和经度的像素值(最接近)
卫星图像在GEOS投影中。我有经度和纬度信息作为2D numpy数组
我已将其加载到dask数据数组中
from satpy import Scene
import matplotlib as plt
import os
cwd = os.getcwd()
fn = os.path.join(cwd, 'EUMETSAT_data/1Jan21/MSG1-SEVI-MSG15-0100-NA-20210101185741.815000000Z-20210101185757-1479430.nat')
files = [fn]
scn = Scene(filenames=files, reader='seviri_l1b_native')
scn.load(["VIS006"])
da = scn['VIS006']
我在satpy的帮助下从area属性读取lon lats:
lon, lat = scn['VIS006'].attrs['area'].get_lonlats()
print(lon.shape)
print(lat.shape)
(1179, 808)
(1179, 808)
我得到了一个2d numpy数组,每个数组的经度和纬度都是坐标,但我不能使用它们进行切片或选择
获取最近的lat-long像素信息的最佳实践/方法是什么? 如何将数据投影到lat-long坐标上,然后用于索引以获得像素值
最后,我想得到感兴趣的lat long的像素值(最近的)
提前感谢
@serge ballesta-谢谢你的指导
回答我自己的问题
将纬度和经度(platecaree投影)投影到GEOS投影CRS上。找到x和y。使用此x和y以及xarray的最近选择方法从dask数组中获取像素值
您正在使用的
AreaDefinition
对象(.attrs['area']
)有几种方法可以获取不同的坐标信息请注意,行和列是翻转的。
get_xy_from_lonlat
方法应该适用于数组或标量如果您感兴趣的话,还有其他方法可以获得每个像素的X/Y坐标
您可以通过以下方式找到位置:
相关问题 更多 >
编程相关推荐