I think that there is a bug in the handling of AOD vs visibility values.
Here you always set AOD to a float value. As a consequence this branch is always executed, effectively ignoring visibility.
Unless I am mistaken, something like this should fix it (not tested):
def get_aod_value(aod, mon):
""" Set AOD to a default value if it has not been specified. """
if aod:
aod = float(aod)
if aod < 0:
raise ValueError("AOD can't be negative: <%f>" % aod)
else:
# sane defaults
if 4 < mon < 10:
aod = float(0.222) # summer
else:
aod = float(0.111) # winter
return aod
class Parameters:
"""6S Parameters (file) for i.atcorr"""
def __init__(self, geo,
mon, day, gmt,
lon, lat,
atm, aer, vis, aod, xps, xpp, bnd):
# (snip)
# If visibility is defined, then ignore AOD values.
if vis:
self.vis = float(vis)
self.aod = None
else:
self.aod = get_aod_value(aod, mon)
self.vis = -1 if self.aod == 0 else 0 # According to i.atcorr if aod is 0, then vis must be -1
g.message(debug=0, message="Visibility: %r; AOD %r" % (self.vis, self.aod))
Do take note that this sets the AOD default values inside Parameters instead of i.landsat.atcorr.py.
Great & Thanks for bringing this back alive! Along with the above, we can verify the "-r" related issue (as discussed offline) and ensure the script works as expected!
I think that there is a bug in the handling of AOD vs visibility values.
Here you always set AOD to a float value. As a consequence this branch is always executed, effectively ignoring visibility.
Unless I am mistaken, something like this should fix it (not tested):
Do take note that this sets the AOD default values inside
Parameters
instead ofi.landsat.atcorr.py
.