-
Notifications
You must be signed in to change notification settings - Fork 0
/
force_workflow.py
executable file
·69 lines (49 loc) · 2.59 KB
/
force_workflow.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###### execute force dynamically ##########
### requirements: sudo apt-get install xterm
############################################
import subprocess
import time
import glob
from utils.utils import create_folder_structure, execute_cmd
from utils.force_class_utils import force_class
#########################
### define parameters ###
#########################
base_path = '/rvt_mount/' # Base Path where ./process/ folder structure should be created
project_name = "test" # Project Name defined for data storage
force_dir = "/force:/force" # Mount Point for Force-Datacube
local_dir = "/rvt_mount:/rvt_mount" # Mount Point for local Drive
hold = True # if True, cmd must be closed manually - recommended for debugging FORCE
aois = glob.glob(f"/rvt_mount/process/data/test/aoi_sbs_test.shp") # Define multiple or single AOI-Shapefile
###################################################################
### check / create folder structure and create process skeleton ###
###################################################################
#create_folder_structure(base_path)
#force_class(project_name, force_dir, local_dir, base_path, aois, hold)
##############################
### execute parameter file ###
##############################
params_path = "/rvt_mount/process/temp/test/FORCE/aoi_sbs_test.shp/tsa.prm"
execute_cmd(params_path, hold, local_dir, force_dir)
###########################
### MASK Do it yourself ###
###########################
###mask create
# cmd = f'sudo docker run -v {local_dir} -u "$(id -u):$(id -g)" davidfrantz/force ' \
# "force-cube -o /uge_mount/FORCE/new_struc/process/result/aoi_sam/mask " \
# "/uge_mount/FORCE/new_struc/data/aoi_sam/aoi.shp"
###mask mosaic
# cmd = f'sudo docker run -v {local_dir} -u "$(id -u):$(id -g)" davidfrantz/force ' \
# "force-mosaic /uge_mount/FORCE/mask/femophys/process/"
###########################
### Execute Script Do it yourself ###
###########################
#cmd = f'sudo docker run -v {local_dir} -v {force_dir} -u "$(id -u):$(id -g)" davidfrantz/force ' \
# "force-higher-level " \
# "/rvt_mount/process/temp/test/FORCE/aoi_sbs_test.shp/tsa.prm"
#startzeit = time.time()
#print("Prozess gestartet bei "+str(startzeit))
#subprocess.run(['xterm','-hold','-e', cmd])
#subprocess.run(['xterm','-e', cmd2])
#endzeit = time.time()
#print("Prozess cmd beendet nach "+str((endzeit-startzeit)/60)+" Minuten")