-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_metadata.py
99 lines (73 loc) · 2.79 KB
/
read_metadata.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import json
import re
from json import load
def read_satellite_step():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_step = metadata[satellite]["time_step"]
return satellite_step
def read_start_slot():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_step = metadata[satellite]["start_slot"]
return satellite_step
def read_epsilon_param():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
epsilon_param = metadata[satellite]["epsilon_param"]
return epsilon_param
def read_satellite_model_path():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_model_path = metadata[satellite]["model_path"]
return satellite_model_path
def read_satellite_pca_path():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_pca_path = metadata[satellite]["pca_path"]
return satellite_pca_path
def read_labels_dir(label_type):
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_labels_dir = metadata[satellite]["labels"][label_type.lower()]
return satellite_labels_dir
def read_satellite_resolution_path():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
satellite_resolution_path = metadata[satellite]["res_path"]
return satellite_resolution_path
def read_indexes_dir_and_pattern(type_chan):
metadata = json.load(open("metadata.json"))
satellite = metadata["satellite"]
pattern = metadata[satellite]["indexes"][type_chan]["pattern"]
dir = metadata[satellite]["indexes"][type_chan]["dir"]
return dir, pattern
def read_channels_names(type_chan):
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
channels = metadata[satellite]["channels_name"]
if type_chan == "infrared":
r = re.compile("IR")
elif type_chan == "visible":
r = re.compile("VIS")
return filter(r.match, channels)
def read_satellite_name():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
return satellite
def read_channels_dir_and_pattern():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
pattern = metadata[satellite]["channels"]["pattern"]
dir = metadata[satellite]["channels"]["dir"]
return dir, pattern
def read_mask_dir_and_pattern(mask_name):
metadata = load(open("metadata.json"))
pattern = metadata["masks"][mask_name]["pattern"]
dir = metadata["masks"][mask_name]["dir"]
return dir, pattern
def read_satellite_longitude():
metadata = load(open("metadata.json"))
satellite = metadata["satellite"]
longitude = metadata[satellite]["longitude"]
return longitude