本期记录只上干活,废话不多说,主要是后面与HEG配合使用,实现一系列研究与反演操作。
python环境:Python 3.5.2 +Pycharm
模块包:pyhdf
安装方法(命令行输入):
pip install pyhdf
from pyhdf.SD import SD
HDF_FILR_URL = "E:\Persona_project\Py-Program\RS\modis\MOD021KM.A2018092.0300.061.2018092134259.hdf"
file = SD(HDF_FILR_URL)
info=file.info()#数据集个数
print(info)
ds_dict=file.datasets()#所有数据集名称
for idx, sds in enumerate(ds_dict.keys()):
print(idx, sds)
# -*- coding:utf-8 -*-
# author:
from pyhdf.SD import SD
HDF_FILR_URL = "E:\Persona_project\Py-Program\RS\modis\MOD021KM.A2018092.0300.061.2018092134259.hdf"
file = SD(HDF_FILR_URL)
EV_1KM_Emissive = file.select('EV_1KM_RefSB').get()
print(EV_1KM_Emissive.shape)
# -*- coding:utf-8 -*-
# author:
from pyhdf.SD import SD
HDF_FILR_URL = "E:\Persona_project\Py-Program\RS\modis\MOD021KM.A2018092.0300.061.2018092134259.hdf"
file = SD(HDF_FILR_URL)
EV_1KM_Emissive = file.select('EV_1KM_RefSB')
attributes = EV_1KM_Emissive.attributes()#获取属性
radiance_scales = attributes['radiance_scales']#辐亮度缩放尺度
radiance_offsets = attributes['radiance_offsets']##辐亮度偏移值
reflectance_scales = attributes['reflectance_scales']#反射率缩放尺度
reflectance_offsets = attributes['reflectance_scales']#反射率偏移值
print(radiance_scales)
print(radiance_offsets)
print(reflectance_scales)
print(reflectance_offsets)