from pyhdf.SD import SD, SDC
import pprint
HDF_FILR_URL = "E:\MyDownloads\MOD021KM.A2012156.0115.006.2014225090534.hdf"
file = SD(HDF_FILR_URL)
print(file.info())
datasets_dic = file.datasets()
for idx,sds in enumerate(datasets_dic.keys()):
print(idx,sds)
sds_obj = file.select('cloud_top_temperature_1km') # select sds
data = sds_obj.get() # get sds data
print data
输出cloud_top_temperature_1km数据
pprint.pprint(sds_obj.attributes())
输出数据性质
{'_FillValue': 65535,
'band_names': '20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36',
'long_name': 'Earth View 1KM Emissive Bands Scaled Integers',
'radiance_offsets': [2730.58349609375,
2730.58349609375,
2730.58349609375,
2730.58349609375,
1077.44482421875,
1560.3333740234375,
2730.583251953125,
2317.48828125,
2730.58349609375,
1560.333251953125,
1577.3397216796875,
1658.2213134765625,
2501.297607421875,
2501.297607421875,
2501.2978515625,
2501.2978515625],
'radiance_scales': [6.262398528633639e-05,
0.0031495101284235716,
6.921597378095612e-05,
7.910397835075855e-05,
3.155614103889093e-05,
5.639820665237494e-05,
0.00011755729792639613,
0.0001924497337313369,
0.000532486941665411,
0.0004063234373461455,
0.0008400219958275557,
0.000729697581846267,
0.00026226387126371264,
0.00020069582387804985,
0.0001767082721926272,
0.0001183385684271343],
'radiance_units': 'Watts/m^2/micrometer/steradian',
'units': 'none',
'valid_range': [0, 32767]}