@@ -22,32 +22,43 @@ def usage():
2222        "Tool to use identification step to compute tracking" )
2323    parser .add_argument ('yaml_file' ,
2424                        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' ,
2628                        help = 'Filename to save correspondance' )
2729    parser .add_argument ('--save_correspondance_and_stop' ,
2830                        action = 'store_true' ,
2931                        help = 'Stop tracking after correspondance computation,' 
3032                             ' 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' )
3137    args  =  parser .parse_args ()
3238
3339    # Read yaml configuration file 
3440    with  open (args .yaml_file , 'r' ) as  stream :
3541        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 
3745
3846
3947if  __name__  ==  '__main__' :
40-     CONFIG , SAVE_STOP , CORRESPONDANCES_OUT  =  usage ()
48+     CONFIG , SAVE_STOP , CORRESPONDANCES_IN ,  CORRESPONDANCES_OUT ,  BLANK_PERIOD  =  usage ()
4149
4250    # Create output directory 
4351    SAVE_DIR  =  CONFIG ['PATHS' ].get ('SAVE_DIR' , None )
4452    if  SAVE_DIR  is  not None  and  not  exists (SAVE_DIR ):
4553        mkdir (SAVE_DIR )
4654
55+     YAML_CORRESPONDANCES_IN  =  CONFIG ['PATHS' ].get ('CORRESPONDANCES_IN' , None )
4756    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 :
4960        CORRESPONDANCES_OUT  =  YAML_CORRESPONDANCES_OUT 
50-     else :
61+     if   YAML_CORRESPONDANCES_OUT   is   None   and   CORRESPONDANCES_OUT   is   None :
5162        CORRESPONDANCES_OUT  =  'Correspondances.nc' 
5263
5364    if  'CLASS'  in  CONFIG :
@@ -68,14 +79,18 @@ if __name__ == '__main__':
6879        FILENAMES  +=  glob (PATTERN )
6980    FILENAMES .sort ()
7081
82+     if  BLANK_PERIOD  >  0 :
83+         FILENAMES  =  FILENAMES [:- BLANK_PERIOD ]
84+         logging .info ('Last %d files will be pop' , BLANK_PERIOD )
85+ 
7186    START_TIME  =  dt .datetime .now ()
7287    logging .info ('Start tracking on %d files' , len (FILENAMES ))
7388
7489    CORRESPONDANCES  =  Correspondances (
7590        datasets = FILENAMES ,
7691        virtual = NB_VIRTUAL_OBS_MAX_BY_SEGMENT ,
7792        class_method = CLASS ,
78-         previous_correspondance = CONFIG [ 'PATHS' ]. get ( ' CORRESPONDANCES_IN' ,  None ) )
93+         previous_correspondance = CORRESPONDANCES_IN )
7994
8095    DATE_START , DATE_STOP  =  CORRESPONDANCES .period 
8196    DICT_COMPLETION  =  dict (date_start = DATE_START , date_stop = DATE_STOP , date_prod = START_TIME )
0 commit comments