-
Notifications
You must be signed in to change notification settings - Fork 0
/
GLACIER_FRONT_EXTRACTION.py
48 lines (44 loc) · 2.11 KB
/
GLACIER_FRONT_EXTRACTION.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
42
43
44
45
46
47
48
#!/usr/bin/python -u
#
# Purpose: Glacier calving front extraction from optical landsat-8 and 9 imagery
# Author: Erik Loebel
# Last change: 2023-02-02
#
#
# ------------------------------------------
import sys
import subprocess
glacier = str(sys.argv[1])
if glacier == 'custom':
print(" - custom glacier: loading lon, lat coordinates", flush=True)
lon=str(sys.argv[2])
lat=str(sys.argv[3])
### pre processing for all scenes in folder /input ###
print('+++ INITIALIZING PRE-PROCESSING +++', flush=True)
if glacier == 'zachariae_isstrom':
print(" - glacier is zachariae_isstrom ---> 2 seperate (and overlapping) ANN predictions neccessary", flush=True)
subprocess.call(["scripts/pre-processing.sct", 'zachariae_isstrom_north'])
subprocess.call(["scripts/pre-processing.sct", 'zachariae_isstrom_south'])
elif glacier == 'nioghalvfjerdsbrae':
print(" - glacier is nioghalvfjerdsbrae ---> 3 seperate (and overlapping) ANN predictions neccessary", flush=True)
subprocess.call(["scripts/pre-processing.sct", 'nioghalvfjerdsbrae_a'])
subprocess.call(["scripts/pre-processing.sct", 'nioghalvfjerdsbrae_b'])
subprocess.call(["scripts/pre-processing.sct", 'nioghalvfjerdsbrae_c'])
elif glacier == 'humboldt':
print(" - glacier is humboldt ---> 7 seperate (and overlapping) ANN predictions neccessary", flush=True)
subprocess.call(["scripts/pre-processing.sct", 'humboldt_a'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_c'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_e'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_g'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_i'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_k'])
subprocess.call(["scripts/pre-processing.sct", 'humboldt_m'])
else:
if glacier == 'custom':
subprocess.call(["scripts/pre-processing.sct", glacier,lon,lat])
else:
subprocess.call(["scripts/pre-processing.sct", glacier])
print(" - pre processing finished", flush=True)
### Predicting calving front from pre processed data ###
print('+++ INITIALIZING ANN PROCESSING +++', flush=True)
subprocess.call(['python', 'scripts/predict_calving_front.py'])