我有两个光栅文件,一个分辨率为30米,一个分辨率为100米。我想获取30m分辨率光栅的每个像素的坐标,然后从100m分辨率光栅中提取每个坐标的值。最终目标是使用100米光栅的值制作30米分辨率的光栅
我正在使用Python,并且尝试使用rasterio模块,但我很难理解如何提取每个像素的lat/lon(或row/col)点
我的CRS是:WGS84,EPSG 4326
我的决议是:res:(0.00026949450000020.00026949459)
到目前为止,我的代码是:
import numpy as np
import skimage.transform as st
import rasterio
import pyproj
30m_file = rasterio.open(path_to_30m_file)
100m_file = rasterio.open(path_to_100m_file)
band1 = 30m_file.read(1)
print("band1:", band1)
#Access values based on georeferenced space
x, y = 30m_file.bounds.left + 0.003, 30m_file.bounds.top - 0.002
row, col = 30m_file.index(x, y)
print("row:", row)
print("col:", col)
print("example value:", band1[row, col])
#The logic would then follow:
# for every pixel lat/lon in 30m file
# open 100m file
# extract 100m value at those 30m pixel lat/lon
# keeping 30m resolution
但是访问坐标然后通过它们解析是阻止我的原因
目前没有回答
相关问题 更多 >
编程相关推荐