簡體   English   中英

Rasterio.merge 刪除圖像

[英]Rasterio.merge removing images

我正在嘗試合並 landsat 8 波段。 我的數據集有幾個 B3 波段靠在一起

import rasterio 
from rasterio.plot import show
from rasterio.merge import merge
from rasterio.warp import reproject

import os 
from matplotlib import pyplot


files_to_merge = []
for file in os.listdir():
    if file.endswith(".TIF") and ("GM" not in file):
        files_to_merge.append(rasterio.open(file))

test, out_trans = merge(files_to_merge)
show(test)

當我在上面的代碼之上時,我得到:

合並圖像

要合並的文件列表具有以下對象:


 <open DatasetReader name='LE07_L1TP_017015_20210503_20210529_02_T1_B3.TIF' mode='r'>,
 <open DatasetReader name='LC08_L1TP_016015_20210504_20210517_02_T1_B3.TIF' mode='r'>,
 <open DatasetReader name='LE07_L1TP_017016_20210503_20210529_02_T1_B3.TIF' mode='r'>,
 <open DatasetReader name='LC08_L1TP_016014_20210504_20210517_02_T1_B3.TIF' mode='r'>,
 <open DatasetReader name='LE07_L1TP_017014_20210503_20210529_02_T1_B3.TIF' mode='r'>,

我有點困惑為什么其他光柵圖像沒有出現在合並圖像中。 當我刪除第一個樂隊時,我可以重新運行合並命令:

test, out_trans = merge([files_to_merge[1],files_to_merge[2], files_to_merge[3], files_to_merge[4]])
show(test,cmap='terrain')

合並圖像 2

這似乎更好,但也不正確。 我有點困惑發生了什么 - 如何正確合並所有圖像? 任何幫助都得到了認可,我是 rasterio 的新手。

萬一有人遇到過這個問題,有很多事情是錯的

  • 這不是您合並 landsat 7 和 8 圖像的方式。 如果你做了最少量的研究(我沒有),你應該訪問這個網站: https ://www.usgs.gov/faqs/what-are-band-designations-landsat-satellites?qt-news_science_products = 0#qt-news_science_products

基本上 Landsat 7 B1 與 Landsat 8 B1 不同,您想將 Landsat 7 B1 與 Landsat 8 B2 合並。

  • Landsat 8 傳感器與 Landsat 7 的比例不同。重新調整 Landsat 8 以使其在 0 到 255 之間

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM