Using numpy overlay data layer - Layer Stacking binding GDAL functions implemented in ENVI

0 configuration and environment

  • System: win7 × 64
  • python: 3.6.4 ×64
  • Package: numpy, GDAL (see installation method GDAL installation )

Loading data and split 1

Reading raster data using GDAL (remote sensing data .tif):

image = gdal.Open(tifpath) # 读取整个遥感影像,多行多列多层
band = image.GetRasterBand(n)  # 得到第n层的数据
band_array = band.ReadAsArray(0,0,lie,hang)  # 转化为数组形式

Layer 2 overlay data

nir, red, blue vegetation standard false color composite, can be visually vegetation growing state, for which we need to read and superposition of three layers:

layer3 = np.array((nir, red, blue))  # nir是第一层, red是第二层,blue是第三层
run.tif_write(out_path, layer3, p, g)  # 输出即可

run.tif_write is the package I wrote it myself output of remote sensing images, please refer to the specific use of GDAL

Guess you like

Origin blog.csdn.net/qq_40260867/article/details/95171100