Commit 907f8b6546c9c13e1fc80e24ec4d07b0c06387e1

Authored by Louis Baetens
1 parent c6620c11
Exists in master

BUG the log directory was not created automatically

PCC/all_run_pcc.py
... ... @@ -10,15 +10,20 @@ import glob
10 10 import argparse
11 11 import time
12 12  
  13 +for to_check in ['tmp', 'log']:
  14 + if not os.path.exists(to_check):
  15 + os.makedirs(to_check)
  16 + print(to_check + ' created')
  17 +
  18 +import logging
  19 +logging.basicConfig(filename='log/pcc_run.log',level=logging.ERROR, format='%(asctime)s %(message)s')
  20 +
13 21 import masks_conversion
14 22 import find_chain_directory_paths
15 23 import comparison
16 24 import metrics_grapher
17 25 import png_converter
18 26  
19   -import logging
20   -logging.basicConfig(filename='log/pcc_run.log',level=logging.ERROR, format='%(asctime)s %(message)s')
21   -
22 27  
23 28 def create_directories(comparison_parameters):
24 29 '''
... ...
PCC/find_chain_directory_paths.py
... ... @@ -155,6 +155,15 @@ def get_mask_path(location, date_string, processing_chain='maja', mask_type='clo
155 155  
156 156  
157 157 def main():
  158 + location = 'Alta_Floresta_Brazil'
  159 + date_string = '20180714'
  160 + check_existing_date(location, date_string, processing_chain='maja', display = True)
  161 + get_mask_path(location, date_string, processing_chain='maja', mask_type='cloud', display = True)
  162 +
  163 + return
  164 +
  165 +
  166 +
158 167 location = 'Gobabeb'
159 168 date_string = '20170909'
160 169 check_existing_date(location, date_string, processing_chain='maja', display = True)
... ...
PCC/parameters_files/comparison_parameters.json
... ... @@ -12,7 +12,7 @@
12 12 },
13 13 "erosion_radius_meters": "480",
14 14 "labeled_img_name": "labeled_img_regular.tif",
15   - "main_dir": "/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD/RailroadValley_11SPC_20170501",
  15 + "main_dir": "/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD/Alta_Floresta_Brazil_21LWK_20180714",
16 16 "resolution": "60"
17 17 },
18 18 "processing": {
... ... @@ -70,10 +70,10 @@
70 70 }
71 71 },
72 72 "user_choices": {
73   - "current_date": "20170501",
74   - "location": "RailroadValley",
75   - "main_dir": "/mnt/data/home/baetensl/clouds_detection_git/Data_PCC_HOT017/RailroadValley_11SPC_20170501",
76   - "raw_img": "RailroadValley_bands.tif",
77   - "tile": "11SPC"
  73 + "current_date": "20180714",
  74 + "location": "Alta_Floresta_Brazil",
  75 + "main_dir": "/mnt/data/home/baetensl/clouds_detection_git/Data_PCC_HOT017/Alta_Floresta_Brazil_21LWK_20180714",
  76 + "raw_img": "Alta_Floresta_Brazil_bands.tif",
  77 + "tile": "21LWK"
78 78 }
79 79 }
80 80 \ No newline at end of file
... ...
PCC/statistics_synthesis.py
... ... @@ -70,7 +70,7 @@ def make_table_metrics(paths_configuration, comparison_parameters, locations, al
70 70 Make tables with the results of the chains on each scene
71 71 '''
72 72  
73   - csv_path = '/mnt/data/home/baetensl/clouds_detection_git/Various_data/all_28_sites_sorted.csv'
  73 + csv_path = '/mnt/data/home/baetensl/clouds_detection_git/Various_data/all_scenes.csv'
74 74  
75 75 all_scenes_names = []
76 76  
... ... @@ -395,13 +395,13 @@ def plot_all_metrics(paths_configuration, comparison_parameters, locations, alcd
395 395  
396 396 n = 3
397 397 print('Worst accuracies :')
398   - for data in [data_maja, data_sen2cor, data_fmask]:
399   - worst_accuracies_indexes = np.array([d[0] for d in data]).argsort()[:n]
400   - worst_accuracies = [data[idx][0] for idx in worst_accuracies_indexes]
401   - if len(worst_accuracies_indexes) > 0:
402   - print(worst_accuracies_indexes)
403   - print(worst_accuracies)
404   - print([op.basename(maja_stats[idx]) for idx in worst_accuracies_indexes])
  398 + #~ for data in [data_maja, data_sen2cor, data_fmask]:
  399 + #~ worst_accuracies_indexes = np.array([d[0] for d in data]).argsort()[:n]
  400 + #~ worst_accuracies = [data[idx][0] for idx in worst_accuracies_indexes]
  401 + #~ if len(worst_accuracies_indexes) > 0:
  402 + #~ print(worst_accuracies_indexes)
  403 + #~ print(worst_accuracies)
  404 + #~ print([op.basename(maja_stats[idx]) for idx in worst_accuracies_indexes])
405 405  
406 406 if cas_alcd == None:
407 407 out_fig = op.join('tmp_report', 'cas1_stats_synthesis_{}_{}.png'.format(plot_type, grouping))
... ... @@ -419,7 +419,8 @@ def main():
419 419 paths_configuration = json.load(open(op.join('..', 'paths_configuration.json')))
420 420 comparison_parameters = json.load(open(op.join('parameters_files','comparison_parameters.json')))
421 421  
422   - locations = ['Arles', 'Gobabeb', 'Ispra', 'Marrakech', 'Mongu', 'Orleans', 'Pretoria', 'RailroadValley']
  422 + locations = ['Arles', 'Gobabeb', 'Ispra', 'Marrakech', 'Mongu', 'Orleans', 'Pretoria', 'RailroadValley',
  423 + 'Munich', 'Alta_Floresta_Brazil']
423 424 excluded = []
424 425  
425 426  
... ... @@ -437,14 +438,16 @@ def main():
437 438 elif cas_alcd == 3:
438 439 alcd_algo = 'alcd_initial'
439 440 maja_erode = True
  441 +
  442 + #~ grouping = 'by_stats'
  443 + #~ plot_all_metrics(paths_configuration, comparison_parameters, locations, alcd_algo,
  444 + #~ grouping, plot_type = 'boxplot', excluded = excluded, maja_erode = maja_erode,
  445 + #~ cas_alcd = cas_alcd)
440 446  
441 447 file_suffix = 'HOT17'
442 448 make_table_metrics(paths_configuration, comparison_parameters, locations, alcd_algo, excluded = excluded, maja_erode = maja_erode, cas_alcd = cas_alcd, file_suffix = file_suffix)
443 449  
444   - grouping = 'by_stats'
445   - plot_all_metrics(paths_configuration, comparison_parameters, locations, alcd_algo,
446   - grouping, plot_type = 'boxplot', excluded = excluded, maja_erode = maja_erode,
447   - cas_alcd = cas_alcd)
  450 +
448 451  
449 452  
450 453 if __name__ == '__main__':
... ...