-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_ESTARFM.py
41 lines (30 loc) · 1.08 KB
/
run_ESTARFM.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
"""
Description : Runs ESTARFM to perform MODIS-Landsat surface reflectance fusion
Usage: run_ESTARFM.py --root=<input_patches_directory>
Options:
--root=<input_patches_directory> Input patches directory
"""
import os
import subprocess
from docopt import docopt
import logging
from progress.bar import Bar
def main(args):
root = args['--root']
patch_directories = [os.path.join(root, x) for x in os.listdir(root)]
bar = Bar("Patch directory", max=len(patch_directories))
for patch_directory in patch_directories:
params_directory = os.path.join(patch_directory, 'params')
params_paths = [os.path.join(params_directory, x) for x in os.listdir(params_directory)]
for param_path in params_paths:
cmd = f'src/cuESTARFM/Codes/cuESTARFM {param_path}'
subprocess.check_output(cmd, shell=True)
bar.next()
if __name__ == "__main__":
# Read input args
args = docopt(__doc__)
# Setup logging
logging.basicConfig(level=logging.INFO)
logging.info(f'arguments: {args}')
# Run generation
main(args)