-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
66 lines (52 loc) · 1.38 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 29 13:33:59 2023
@author: hg
"""
import pathlib
import numpy as np
import os, sys
import matplotlib.pyplot as plt
from MOD021 import *
from MOD03 import *
from L1B_Resamp import *
# infile = sys.argv[1]
# file = SD(infile)
# (a,b) = file.info()
# datasets_dic = file.datasets()
# for idx, sds in enumerate(datasets_dic.keys()):
# print(idx, sds)
# band_1k = file.select('EV_1KM_Emissive')
# # b11 is 32, b2 is 22
# atts=band_1k.attributes()
# scales = atts['radiance_scales']
# offs = atts['radiance_offsets']
# print(scales)
# b22 = band_1k[2,:,:]
# print(b22.shape)
# band22 = (b22+offs[2]) * scales[2]
# print(np.max(band22))
fpairs=[]
indir = '/Users/hg/workdir/data/'
# get pairs of MOD21 MOD03 files
lfiles=os.listdir(indir)
for f in lfiles :
if 'MOD021KM' in f :
indx = f.find('A2014')
srch_string = f[indx:indx+13]
print ('searching for : ', srch_string)
for f03 in lfiles :
if 'MOD03' in f03 and srch_string in f03 :
fpairs.append((indir+f,indir+f03))
for p in fpairs:
print(p)
#print (p[0])
m = MOD021 (p[0].strip())
ll = MOD03 (p[1].strip())
l1br = L1B_Resamp()
l1br.set_arrays(m,ll)
l1br.resamps()
#plt.imshow(m.thermalarr[2,:,:],cmap='gray')
plt.imshow(l1br.outarr,cmap='gray')
plt.show()