@@ -22,32 +22,43 @@ def usage():
22
22
"Tool to use identification step to compute tracking" )
23
23
parser .add_argument ('yaml_file' ,
24
24
help = 'Yaml file to configure py-eddy-tracker' )
25
- parser .add_argument ('--filename' ,
25
+ parser .add_argument ('--correspondance_in' ,
26
+ help = 'Filename to save correspondance' )
27
+ parser .add_argument ('--correspondance_out' ,
26
28
help = 'Filename to save correspondance' )
27
29
parser .add_argument ('--save_correspondance_and_stop' ,
28
30
action = 'store_true' ,
29
31
help = 'Stop tracking after correspondance computation,'
30
32
' merging can be done with EddyFinalTracking' )
33
+ parser .add_argument ('--blank_period' ,
34
+ type = int ,
35
+ default = 0 ,
36
+ help = 'Nb of detection which will not use at the end of the period' )
31
37
args = parser .parse_args ()
32
38
33
39
# Read yaml configuration file
34
40
with open (args .yaml_file , 'r' ) as stream :
35
41
config = yaml_load (stream )
36
- return config , args .save_correspondance_and_stop , args .filename
42
+ if not exists (args .correspondance_in ):
43
+ args .correspondance_in = None
44
+ return config , args .save_correspondance_and_stop , args .correspondance_in , args .correspondance_out , args .blank_period
37
45
38
46
39
47
if __name__ == '__main__' :
40
- CONFIG , SAVE_STOP , CORRESPONDANCES_OUT = usage ()
48
+ CONFIG , SAVE_STOP , CORRESPONDANCES_IN , CORRESPONDANCES_OUT , BLANK_PERIOD = usage ()
41
49
42
50
# Create output directory
43
51
SAVE_DIR = CONFIG ['PATHS' ].get ('SAVE_DIR' , None )
44
52
if SAVE_DIR is not None and not exists (SAVE_DIR ):
45
53
mkdir (SAVE_DIR )
46
54
55
+ YAML_CORRESPONDANCES_IN = CONFIG ['PATHS' ].get ('CORRESPONDANCES_IN' , None )
47
56
YAML_CORRESPONDANCES_OUT = CONFIG ['PATHS' ].get ('CORRESPONDANCES_OUT' , None )
48
- if CORRESPONDANCES_OUT is None and YAML_CORRESPONDANCES_OUT is not None :
57
+ if CORRESPONDANCES_IN is None :
58
+ CORRESPONDANCES_IN = YAML_CORRESPONDANCES_IN
59
+ if CORRESPONDANCES_OUT is None :
49
60
CORRESPONDANCES_OUT = YAML_CORRESPONDANCES_OUT
50
- else :
61
+ if YAML_CORRESPONDANCES_OUT is None and CORRESPONDANCES_OUT is None :
51
62
CORRESPONDANCES_OUT = 'Correspondances.nc'
52
63
53
64
if 'CLASS' in CONFIG :
@@ -68,14 +79,18 @@ if __name__ == '__main__':
68
79
FILENAMES += glob (PATTERN )
69
80
FILENAMES .sort ()
70
81
82
+ if BLANK_PERIOD > 0 :
83
+ FILENAMES = FILENAMES [:- BLANK_PERIOD ]
84
+ logging .info ('Last %d files will be pop' , BLANK_PERIOD )
85
+
71
86
START_TIME = dt .datetime .now ()
72
87
logging .info ('Start tracking on %d files' , len (FILENAMES ))
73
88
74
89
CORRESPONDANCES = Correspondances (
75
90
datasets = FILENAMES ,
76
91
virtual = NB_VIRTUAL_OBS_MAX_BY_SEGMENT ,
77
92
class_method = CLASS ,
78
- previous_correspondance = CONFIG [ 'PATHS' ]. get ( ' CORRESPONDANCES_IN' , None ) )
93
+ previous_correspondance = CORRESPONDANCES_IN )
79
94
80
95
DATE_START , DATE_STOP = CORRESPONDANCES .period
81
96
DICT_COMPLETION = dict (date_start = DATE_START , date_stop = DATE_STOP , date_prod = START_TIME )
0 commit comments