用Python中的光栅重建GEOTIFF以降低分辨率

2024-04-20 04:57:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图采取一个0.05 X 0.05度光栅在.tif格式和重磨它到0.25 X 0.25度(一个因素5)。我正在使用rasterio来处理下面的代码

with rio.open("/Volumes/TAMU_HD/CAPEstudy/PFI_NoFringe1.tif") as dataset:
    data = dataset.read(
        out_shape=(dataset.height / 5., dataset.width / 5., dataset.count),
        resampling=Resampling.bilinear

但我得到了一个错误:

TypeError                                 Traceback (most recent call last)
<ipython-input-16-c44a7a5e1041> in <module>
      2     data = dataset.read(
      3         out_shape=(dataset.height / 5., dataset.width / 5., dataset.count),
----> 4         resampling=Resampling.bilinear
      5     )

rasterio/_io.pyx in rasterio._io.DatasetReaderBase.read()

TypeError: 'float' object cannot be interpreted as an integer

有没有关于在rasterio中重新投标的建议,或者是否有其他软件包的建议可以更容易地做到这一点?提前谢谢。你知道吗


Tags: readdataascountoutwidthdatasetheight