Allow LibRadtran to use prescribed sun-sensor geom
Sometimes, we want to pass solar zenith angle directly rather than
calculate it from the time of day. This provides a temporary, hacky
solution: If a file called `prescribed_geom` exists in the LUT
directory, use that instead of the LibRadtran-generated geometry file.
@@ -226,7 +226,13 @@ class LibRadTranRT(TabularRT):
transup = np.zeros(self.wl.shape)
# Get solar zenith, translate to irradiance at zenith = 0
- with open(self.lut_dir+'/LUT_'+fn+'.zen', 'r') as fin:
+ # HACK: If a file called `prescribed_geom` exists in the LUT directory,
+ # use that instead of the LibRadtran calculated zenith angle. This is
+ # not the most elegant or efficient solution, but it seems to work.
+ zenfile = self.lut_dir + "/prescribed_geom"
+ if not os.path.exists(zenfile):
+ zenfile = self.lut_dir+'/LUT_'+fn+'.zen', 'r'
+ with open(zenfile, 'r') as fin:
output = fin.read().split()
solzen, solaz = [float(q) for q in output[1:]]
