With the source code distributed via GitHub, you can directly integrate ACOLITE in your Python scripts. For example if you have cloned ACOLITE into ~/git/acolite:
# add acolite clone to Python path and import acolite
import sys, os
user_home = os.path.expanduser("~")
sys.path.append(user_home+'/git/acolite')
import acolite as ac
# scenes to process
bundles = ['/path/to/scene1', '/path/to/scene2']
# alternatively use glob
# import glob
# bundles = glob.glob('/path/to/scene*')
# output directory
odir = '/path/to/output/directory'
# optional 4 element limit list [S, W, N, E]
limit = None
# optional file with processing settings
# if set to None defaults will be used
settings_file = None
# run through bundles
for bundle in bundles:
# import settings
settings = ac.acolite.acolite_settings(settings_file)
# set settings provided above
settings['limit'] = limit
settings['inputfile'] = bundle
settings['output'] = odir
# other settings can also be provided here, e.g.
# settings['s2_target_res'] = 60
# settings['dsf_path_reflectance'] = 'fixed'
# settings['l2w_parameters'] = ['t_nechad', 't_dogliotti']
# process the current bundle
ac.acolite.acolite_run(settings=settings)
# add acolite clone to Python path and import acolite
import sys, os
user_home = os.path.expanduser("~")
sys.path.append(user_home+'/git/acolite')
import acolite as ac
# add EARTHDATA_u and EARTHDATA_p
os.environ['EARTHDATA_u'] = ''
os.environ['EARTHDATA_p'] = ''
# scenes to process
bundles = ['/path/to/scene1', '/path/to/scene2']
# alternatively use glob
# import glob
# bundles = glob.glob('/path/to/scene*')
# output directory
odir = '/path/to/output/directory'
# optional 4 element limit list [S, W, N, E]
limit = None
# optional file with processing settings
# if set to None defaults will be used
settings_file = None
# run through bundles
for bundle in bundles:
# import settings
settings = ac.acolite.settings.parse(settings_file)
# set settings provided above
settings['limit'] = limit
settings['inputfile'] = bundle
settings['output'] = odir
# other settings can also be provided here, e.g.
# settings['s2_target_res'] = 60
# settings['dsf_aot_estimate'] = 'fixed'
# settings['l2w_parameters'] = ['t_nechad', 't_dogliotti']
# process the current bundle
ac.acolite.acolite_run(settings=settings)
A simpler and perhaps more robust way to run from Python is to pass a dictionary of settings to acolite_run. The missing settings will be set to the global or sensor defaults.
# add acolite clone to Python path and import acolite
import sys, os
user_home = os.path.expanduser("~")
sys.path.append(user_home+'/git/acolite')
import acolite as ac
# create empty dict and set some settings
settings = {}
settings['limit'] = 4 element limit ROI [S, W, N, E]
settings['inputfile'] = path to bundle
settings['output'] = path to output directory
# run processing
ac.acolite.acolite_run(settings=settings)