3030Scroll down to line ~640 to get started 
3131=============================================================================== 
3232""" 
33- 
33+ import   sys 
3434import  glob  as  glob 
35- from  py_eddy_tracker_classes  import  plt , np , dt , netcdf , ndimage , time , \
35+ from  py_eddy_tracker_classes  import  plt , np , dt , Dataset , ndimage , time , \
3636                                    datestr2datetime , gaussian_resolution , \
3737                                    get_cax , collection_loop , track_eddies , \
3838                                    anim_figure 
@@ -75,7 +75,7 @@ def read_nc(self, varfile, varname, indices="[:]"):
7575          varname : variable ('temp', 'mask_rho', etc) to read 
7676          indices : string of index ranges, eg. '[0,:,0]' 
7777        ''' 
78-         with  netcdf . Dataset (varfile ) as  nc :
78+         with  Dataset (varfile ) as  nc :
7979            try :
8080                var  =  eval ('' .join (("nc.variables[varname]" , indices )))
8181            except  Exception :
@@ -90,7 +90,7 @@ def read_nc_att(self, varfile, varname, att):
9090          varname : variable ('temp', 'mask_rho', etc) to read 
9191          att : string of attribute, eg. 'valid_range' 
9292        ''' 
93-         with  netcdf . Dataset (varfile ) as  nc :
93+         with  Dataset (varfile ) as  nc :
9494            return  eval ('' .join (("nc.variables[varname]." , att )))
9595
9696
@@ -488,13 +488,13 @@ def __init__(self, AVISO_FILE, LONMIN, LONMAX, LATMIN, LATMAX,
488488            self .fillval  =  self .read_nc_att (AVISO_FILE ,
489489                                           'Grid_0001' , '_FillValue' )
490490
491-         if  np . logical_and ( LONMIN  <  0 ,  LONMAX  <= 0 ) :
491+         if  LONMIN  <  0   and   LONMAX  <= 0 :
492492            self ._lon  -=  360. 
493493        self ._lon , self ._lat  =  np .meshgrid (self ._lon , self ._lat )
494494        self ._angle  =  np .zeros_like (self ._lon )
495495        # To be used for handling a longitude range that 
496496        # crosses 0 degree meridian 
497-         if  np . logical_and ( LONMIN  <  0 ,  LONMAX  >=  0 ) :
497+         if  LONMIN  <  0   and   LONMAX  >=  0 :
498498            self .ZERO_CROSSING  =  True 
499499
500500        self .set_initial_indices (LONMIN , LONMAX , LATMIN , LATMAX )
@@ -720,8 +720,12 @@ def pcol_2dxy(self, x, y):
720720
721721if  __name__  ==  '__main__' :
722722
723+     
724+     
725+     YAML_FILE  =  sys .argv [1 ]
726+     print  "\n Launching with yaml file: %s"  %  YAML_FILE 
723727    # Choose a yaml configuration file 
724-     YAML_FILE  =  'eddy_tracker_configuration.yaml' 
728+     # YAML_FILE = 'eddy_tracker_configuration.yaml'
725729    #YAML_FILE = 'BlackSea.yaml' 
726730
727731   #-------------------------------------------------------------------------- 
@@ -765,7 +769,7 @@ def pcol_2dxy(self, x, y):
765769        MAX_SLA  =  config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_SLA' ]['MAX_SLA' ]
766770        INTERVAL  =  config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_SLA' ]['INTERVAL' ]
767771        CONTOUR_PARAMETER  =  np .arange (- MAX_SLA , MAX_SLA  +  INTERVAL , INTERVAL )
768-         SHAPE_ERROR  =  55.  *  np .ones (CONTOUR_PARAMETER .size )
772+         SHAPE_ERROR  =  config [ 'SHAPE_ERROR' ]  *  np .ones (CONTOUR_PARAMETER .size )
769773    elif  'Q'  in  DIAGNOSTIC_TYPE :
770774        MAX_Q  =  config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_Q' ]['MAX_Q' ]
771775        NUM_LEVS  =  config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_Q' ]['NUM_LEVS' ]
@@ -812,6 +816,8 @@ def pcol_2dxy(self, x, y):
812816
813817    SEPARATION_METHOD  =  config ['SEPARATION_METHOD' ]
814818
819+     MAX_LOCAL_EXTREMA  =  config ['MAX_LOCAL_EXTREMA' ]
820+     
815821    TRACK_EXTRA_VARIABLES  =  config ['TRACK_EXTRA_VARIABLES' ]
816822
817823    VERBOSE  =  config ['VERBOSE' ]
@@ -897,8 +903,9 @@ def pcol_2dxy(self, x, y):
897903
898904    A_eddy .SMOOTHING  =  SMOOTHING 
899905    C_eddy .SMOOTHING  =  SMOOTHING 
900-     #A_eddy.smooth_fac = smooth_fac 
901-     #C_eddy.smooth_fac = smooth_fac 
906+     
907+     A_eddy .MAX_LOCAL_EXTREMA  =  MAX_LOCAL_EXTREMA 
908+     C_eddy .MAX_LOCAL_EXTREMA  =  MAX_LOCAL_EXTREMA 
902909
903910    A_eddy .M  =  sla_grd .M 
904911    C_eddy .M  =  sla_grd .M 
@@ -991,7 +998,7 @@ def pcol_2dxy(self, x, y):
991998
992999    for  AVISO_FILE  in  AVISO_FILES :
9931000
994-         with  netcdf . Dataset (AVISO_FILE ) as  nc :
1001+         with  Dataset (AVISO_FILE ) as  nc :
9951002
9961003            try :
9971004                thedate  =  nc .OriginalName 
@@ -1007,8 +1014,7 @@ def pcol_2dxy(self, x, y):
10071014
10081015        rtime  =  thedate 
10091016
1010-         if  np .logical_and (thedate  >=  thestartdate ,
1011-                           thedate  <=  theenddate ):
1017+         if  thedate  >=  thestartdate  and  thedate  <=  theenddate :
10121018            active  =  True 
10131019        else :
10141020            active  =  False 
@@ -1257,6 +1263,7 @@ def pcol_2dxy(self, x, y):
12571263
12581264                    #print 'figure saving' 
12591265                    #tt = time.time() 
1266+                     
12601267                    anim_figure (A_eddy , C_eddy , Mx , My , pMx , pMy , plt .cm .RdBu_r , rtime , DIAGNOSTIC_TYPE , 
12611268                                SAVE_DIR , 'SLA '  +  tit , animax , animax_cbar )
12621269                    #print 'figure saving done in %s seconds\n' %(time.time() - tt) 
0 commit comments