1
+ # -*- coding: utf-8 -*-
2
+ # %run make_eddy_track_CLS.py
3
+
4
+ """
5
+ ===============================================================================
6
+ This file is part of py-eddy-tracker.
7
+
8
+ py-eddy-tracker is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ py-eddy-tracker is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ Copyright (c) 2014 by Evan Mason
22
+
23
+ ===============================================================================
24
+
25
+ make_eddy_track_CLS.py
26
+
27
+ Version 1.4.2
28
+
29
+
30
+ ===============================================================================
31
+ """
32
+ import glob as glob
33
+ #import pickle
34
+ import cPickle as pickle
35
+ #import dill
36
+ import numpy as np
37
+ from make_eddy_track_AVISO import track_eddies , AvisoGrid
38
+
39
+
40
+
41
+
42
+ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43
+
44
+ if __name__ == '__main__' :
45
+
46
+ DATA_DIR = '/data/OCE_ETU/MSA/emason/Global_DT10/'
47
+
48
+ A_PKL_FILES = 'A_eddy_????????.pkl'
49
+ C_PKL_FILES = 'C_eddy_????????.pkl'
50
+
51
+ A_PKL_FILES = sorted (glob .glob (DATA_DIR + A_PKL_FILES ))
52
+ C_PKL_FILES = sorted (glob .glob (DATA_DIR + C_PKL_FILES ))
53
+
54
+
55
+ for PKL_FILES in (A_PKL_FILES , C_PKL_FILES ):
56
+
57
+ for active , PKL_FILE in enumerate (PKL_FILES ):
58
+
59
+ print PKL_FILE
60
+
61
+ # Unpickle
62
+ with open (PKL_FILE , 'rb' ) as the_pickle :
63
+ eddy = pickle .load (the_pickle )
64
+ print '--- loaded %s' % PKL_FILE
65
+
66
+ print 'eddy.index' , eddy .index
67
+ eddy .savedir = DATA_DIR + eddy .savedir .rpartition ('/' )[- 1 ]
68
+
69
+ eddy .TRACK_DURATION_MIN = 10
70
+
71
+
72
+
73
+
74
+ if active :
75
+
76
+ first_record = False
77
+
78
+ eddy .new_list = False
79
+ eddy .tracklist = tracklist .tolist ()
80
+
81
+ eddy .index = index
82
+
83
+ eddy .old_lon = old_lon
84
+ eddy .old_lat = old_lat
85
+ eddy .old_amp = old_amp
86
+ eddy .old_uavg = old_uavg
87
+ eddy .old_radii_s = old_radii_s
88
+ eddy .old_radii_e = old_radii_e
89
+ eddy .old_teke = old_teke
90
+ #eddy.old_temp = old_temp
91
+ #eddy.old_salt = old_salt
92
+
93
+ eddy = track_eddies (eddy , first_record )
94
+ tracklist = np .copy (eddy .tracklist )
95
+
96
+ else :
97
+
98
+ first_record = True
99
+
100
+ eddy .create_netcdf (DATA_DIR , eddy .savedir )
101
+ eddy .set_old_variables ()
102
+
103
+ eddy = track_eddies (eddy , first_record )
104
+ tracklist = np .copy (eddy .tracklist )
105
+
106
+ index = eddy .index
107
+
108
+ print 'eddy.index' , eddy .index
109
+ print len (eddy .tracklist )
110
+
111
+
112
+ if not first_record :
113
+ print eddy .new_time_tmp [0 ]
114
+ eddy .write2netcdf (eddy .new_time_tmp [0 ])
115
+
116
+ old_lon = eddy .old_lon
117
+ old_lat = eddy .old_lat
118
+ old_amp = eddy .old_amp
119
+ old_uavg = eddy .old_uavg
120
+ old_radii_s = eddy .old_radii_s
121
+ old_radii_e = eddy .old_radii_e
122
+ old_teke = eddy .old_teke
123
+ #old_temp = eddy.old_temp
124
+ #old_salt = eddy.old_salt
125
+
126
+
127
+ #eddy.reset_holding_variables()
128
+
129
+
130
+
131
+
0 commit comments