-
Notifications
You must be signed in to change notification settings - Fork 0
/
MOD03.py
42 lines (34 loc) · 1.08 KB
/
MOD03.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 06:33:43 2023
@author: hg
"""
import numpy as np
from pyhdf.SD import SD
class MOD03 :
sdfile = ''
latlon = None ;
geobands=[]
minmax =[] ;
def __init__(self, fname):
self.sdfile = SD(fname)
print(fname)
#print (self.sdfile.info())
datasets_dic = self.sdfile.datasets()
# for idx, sds in enumerate(datasets_dic.keys()) :
# print(idx,sds)
self.geobands=np.array([self.sdfile.select('Latitude'),self.sdfile.select('Longitude'),self.sdfile.select('SensorZenith')])
print(self.geobands.shape)
self.load_minmax()
def load_minmax (self):
min =0
max =0
self.minmax.clear()
for i in range (3):
min=np.min(self.geobands[i])
max=np.max(self.geobands[i])
self.minmax.append((min,max))
print ('Raw MODIS File : ')
print ('Latitude range ', self.minmax[0])
print ('Longitude range ', self.minmax[1])