预处理高分四号影像

处理内容:辐射定标、物理量计算、几何校正、波段合成

辐射定标

两种方法:

1.直接辐射定标(参数为1)

2.用公式(双击图像查看辐射增益和偏移)但是只能针对一个波段

注意这里用辐射增益和偏移 得到表观辐亮度

附增益和偏移系数:https://blog.csdn.net/zhangxin4832/article/details/118334914

物理量计算

PMI计算表观反射率

E双击图像查看即lrradiance ,θ为xml文件里Satellitezenith,d参数点击查看

IRS处理计算亮温

几何校正

https://blog.csdn.net/weixin_43626557/article/details/103942202

波段重组

重采样:envi工具里resize data

波段合成

1、用代码

import numpy as np
from osgeo import gdal

def layerstaking(PMS, IRS, merge):
    try:
        # Read IRS data
        IRS_ds = gdal.Open(IRS)
        IRS_geotrans = IRS_ds.GetGeoTransform()
        IRS_cols = IRS_ds.RasterXSize
        IRS_rows = IRS_ds.RasterYSize
        IRS_array = IRS_ds.GetRasterBand(1).ReadAsArray()

        # Read PMS data
        PMS_ds = gdal.Open(PMS)
        PMS_geotrans = PMS_ds.GetGeoTransform()
        PMS_cols = PMS_ds.RasterXSize
        PMS_rows = PMS_ds.RasterYSize
        PMS_lefttop_x, PMS_lefttop_y = PMS_geotrans[0], PMS_geotrans[3]
        PMS_x_res, PMS_y_res = PMS_geotrans[1], PMS_geotrans[5]

        # Calculate the relative position of IRS in PMS
        x_offset = int((IRS_geotrans[0] - PMS_lefttop_x) / PMS_x_res)
        y_offset = int((IRS_geotrans[3] - PMS_lefttop_y) / PMS_y_res)

        # Create a new array for IRS to match the PMS dimensions
        new_IRS_band = np.full((PMS_rows, PMS_cols), -999, dtype=np.float32)

        # Place the IRS data into the corresponding position
        new_IRS_band[y_offset:y_offset+IRS_rows, x_offset:x_offset+IRS_cols] = IRS_array

        # Create a new dataset for output
        driver = gdal.GetDriverByName('GTiff')
        out_ds = driver.Create(merge, PMS_cols, PMS_rows, PMS_ds.RasterCount + 1, gdal.GDT_Float32)

        # Copy PMS bands to the new dataset
        for i in range(PMS_ds.RasterCount):
            out_band = out_ds.GetRasterBand(i + 1)
            out_band.WriteArray(PMS_ds.GetRasterBand(i + 1).ReadAsArray())

        # Add the new IRS band to the output dataset
        out_IRS_band = out_ds.GetRasterBand(PMS_ds.RasterCount + 1)
        out_IRS_band.WriteArray(new_IRS_band)

        # Set geotransform and projection
        out_ds.SetGeoTransform(PMS_ds.GetGeoTransform())
        out_ds.SetProjection(PMS_ds.GetProjection())

        print("Layer stacking completed successfully.")

    except Exception as e:
        print(f"An error occurred: {e}")

    finally:
        # Cleanup
        IRS_ds = None
        PMS_ds = None
        out_ds = None

# Example usage
PMS_path = "\\resample5.tif"
IRS_path = "\\IRS_T_rpcortho.tif"
output_path = "\\merged1.tif"
layerstaking(PMS_path, IRS_path, output_path)

2、build layer stack(需坐标系范围设置)

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值