run_snow_detector.py 1.03 KB
Newer Older
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
import sys
import json
from s2snow import snow_detector

VERSION="0.1"

def show_help():
    """Show help of the s2snow script"""
    print "This script is used to compute snow mask using OTB applications on Spot/LandSat/Sentinel-2 products from theia platform"
    print "Usage: s2snow.py param.json"
    print "s2snow.py version to show version"
    print "s2snow.py help to show help"

def show_version():
    print VERSION

#----------------- MAIN ---------------------------------------------------

def main(argv):
    """ main script of snow extraction procedure"""

    json_file=argv[1]

    #load json_file from json files
    with open(json_file) as json_data_file:
      data = json.load(json_data_file)
      
    sd = snow_detector.snow_detector(data)
      
    sd.detect_snow(2)
      
if __name__ == "__main__":
    if len(sys.argv) != 2 :
        show_help()
    else:
        if sys.argv[1] == "version":
            show_version()
        elif sys.argv[1] == "help":
            show_help()
        else:
            main(sys.argv)