-
Notifications
You must be signed in to change notification settings - Fork 0
/
lut_hygeos.py
46 lines (36 loc) · 1.15 KB
/
lut_hygeos.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
#!/usr/bin/env python
# encoding: utf-8
"""
Reader for HYGEOS LUT
"""
from pyhdf.SD import SD
import numpy as np
class LUT(object):
'''
Read HYGEOS LUT
'''
def __init__(self, adffile):
hdf = SD(adffile)
# Read mu angles
sds = hdf.select('dim_mu')
self.muv = sds.get()[::-1] # put in ascending order for mu
self.mus = np.copy(self.muv)
# Read raa
sds = hdf.select('dim_phi')
self.raa = sds.get()
# Read tau_ray
sds = hdf.select('dim_tauray')
self.tau = sds.get()
# Read wind
sds = hdf.select('dim_wind')
self.wind = sds.get()
# Read Rmolgli
sds = hdf.select('Rmolgli')
rho = sds.get() # (mu, raa, mu, tau, wind)
#self.rho_molgli = np.flip(rho,(0,1,2)) # put in ascending order for mu and HYGEOS convention for raa
self.rho_molgli = np.flip(rho, (0, 2))
# Read Rmol
sds = hdf.select('Rmol')
rho = sds.get() # (mu, raa, mu, tau)
#self.rho_mol = np.flip(rho,(0,1,2)) # put in ascending order for mu and HYGEOS convention for raa
self.rho_mol = np.flip(rho, (0, 2))