30
30
Scroll down to line ~640 to get started
31
31
===============================================================================
32
32
"""
33
-
33
+ import sys
34
34
import 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 , \
36
36
datestr2datetime , gaussian_resolution , \
37
37
get_cax , collection_loop , track_eddies , \
38
38
anim_figure
@@ -75,7 +75,7 @@ def read_nc(self, varfile, varname, indices="[:]"):
75
75
varname : variable ('temp', 'mask_rho', etc) to read
76
76
indices : string of index ranges, eg. '[0,:,0]'
77
77
'''
78
- with netcdf . Dataset (varfile ) as nc :
78
+ with Dataset (varfile ) as nc :
79
79
try :
80
80
var = eval ('' .join (("nc.variables[varname]" , indices )))
81
81
except Exception :
@@ -90,7 +90,7 @@ def read_nc_att(self, varfile, varname, att):
90
90
varname : variable ('temp', 'mask_rho', etc) to read
91
91
att : string of attribute, eg. 'valid_range'
92
92
'''
93
- with netcdf . Dataset (varfile ) as nc :
93
+ with Dataset (varfile ) as nc :
94
94
return eval ('' .join (("nc.variables[varname]." , att )))
95
95
96
96
@@ -488,13 +488,13 @@ def __init__(self, AVISO_FILE, LONMIN, LONMAX, LATMIN, LATMAX,
488
488
self .fillval = self .read_nc_att (AVISO_FILE ,
489
489
'Grid_0001' , '_FillValue' )
490
490
491
- if np . logical_and ( LONMIN < 0 , LONMAX <= 0 ) :
491
+ if LONMIN < 0 and LONMAX <= 0 :
492
492
self ._lon -= 360.
493
493
self ._lon , self ._lat = np .meshgrid (self ._lon , self ._lat )
494
494
self ._angle = np .zeros_like (self ._lon )
495
495
# To be used for handling a longitude range that
496
496
# crosses 0 degree meridian
497
- if np . logical_and ( LONMIN < 0 , LONMAX >= 0 ) :
497
+ if LONMIN < 0 and LONMAX >= 0 :
498
498
self .ZERO_CROSSING = True
499
499
500
500
self .set_initial_indices (LONMIN , LONMAX , LATMIN , LATMAX )
@@ -720,8 +720,12 @@ def pcol_2dxy(self, x, y):
720
720
721
721
if __name__ == '__main__' :
722
722
723
+
724
+
725
+ YAML_FILE = sys .argv [1 ]
726
+ print "\n Launching with yaml file: %s" % YAML_FILE
723
727
# Choose a yaml configuration file
724
- YAML_FILE = 'eddy_tracker_configuration.yaml'
728
+ # YAML_FILE = 'eddy_tracker_configuration.yaml'
725
729
#YAML_FILE = 'BlackSea.yaml'
726
730
727
731
#--------------------------------------------------------------------------
@@ -765,7 +769,7 @@ def pcol_2dxy(self, x, y):
765
769
MAX_SLA = config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_SLA' ]['MAX_SLA' ]
766
770
INTERVAL = config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_SLA' ]['INTERVAL' ]
767
771
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 )
769
773
elif 'Q' in DIAGNOSTIC_TYPE :
770
774
MAX_Q = config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_Q' ]['MAX_Q' ]
771
775
NUM_LEVS = config ['CONTOUR_PARAMETER' ]['CONTOUR_PARAMETER_Q' ]['NUM_LEVS' ]
@@ -812,6 +816,8 @@ def pcol_2dxy(self, x, y):
812
816
813
817
SEPARATION_METHOD = config ['SEPARATION_METHOD' ]
814
818
819
+ MAX_LOCAL_EXTREMA = config ['MAX_LOCAL_EXTREMA' ]
820
+
815
821
TRACK_EXTRA_VARIABLES = config ['TRACK_EXTRA_VARIABLES' ]
816
822
817
823
VERBOSE = config ['VERBOSE' ]
@@ -897,8 +903,9 @@ def pcol_2dxy(self, x, y):
897
903
898
904
A_eddy .SMOOTHING = SMOOTHING
899
905
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
902
909
903
910
A_eddy .M = sla_grd .M
904
911
C_eddy .M = sla_grd .M
@@ -991,7 +998,7 @@ def pcol_2dxy(self, x, y):
991
998
992
999
for AVISO_FILE in AVISO_FILES :
993
1000
994
- with netcdf . Dataset (AVISO_FILE ) as nc :
1001
+ with Dataset (AVISO_FILE ) as nc :
995
1002
996
1003
try :
997
1004
thedate = nc .OriginalName
@@ -1007,8 +1014,7 @@ def pcol_2dxy(self, x, y):
1007
1014
1008
1015
rtime = thedate
1009
1016
1010
- if np .logical_and (thedate >= thestartdate ,
1011
- thedate <= theenddate ):
1017
+ if thedate >= thestartdate and thedate <= theenddate :
1012
1018
active = True
1013
1019
else :
1014
1020
active = False
@@ -1257,6 +1263,7 @@ def pcol_2dxy(self, x, y):
1257
1263
1258
1264
#print 'figure saving'
1259
1265
#tt = time.time()
1266
+
1260
1267
anim_figure (A_eddy , C_eddy , Mx , My , pMx , pMy , plt .cm .RdBu_r , rtime , DIAGNOSTIC_TYPE ,
1261
1268
SAVE_DIR , 'SLA ' + tit , animax , animax_cbar )
1262
1269
#print 'figure saving done in %s seconds\n' %(time.time() - tt)
0 commit comments