@@ -108,7 +108,7 @@ def merge_correspondance(self, other):
108
108
i = where (other .datasets == array (self .datasets [- 1 ]))[0 ]
109
109
if len (i ) != 1 :
110
110
raise Exception ('More than one intersection' )
111
-
111
+
112
112
# Merge
113
113
# Create a hash table
114
114
translate = empty (other .current_id , dtype = 'u4' )
@@ -194,7 +194,7 @@ def store_correspondance(self, i_previous, i_current, nb_real_obs):
194
194
def append (self , * args , ** kwargs ):
195
195
self .nb_link_max = max (self .nb_link_max , len (args [0 ]))
196
196
super (Correspondances , self ).append (* args , ** kwargs )
197
-
197
+
198
198
def id_generator (self , nb_id ):
199
199
"""Generation id and incrementation
200
200
"""
@@ -221,7 +221,7 @@ def recense_dead_id_to_extend(self):
221
221
list_previous_virtual_id .index (i ) for i in virtual_dead_id ]
222
222
# Virtual obs which can be prolongate
223
223
alive_virtual_obs = self .virtual_obs ['segment_size'
224
- ][i_virtual_dead_id ] < self .nb_virtual
224
+ ][i_virtual_dead_id ] < self .nb_virtual
225
225
nb_virtual_extend = alive_virtual_obs .sum ()
226
226
logging .debug ('%d virtual obs will be prolongate on the '
227
227
'next step' , nb_virtual_extend )
@@ -230,7 +230,7 @@ def recense_dead_id_to_extend(self):
230
230
self .previous_virtual_obs = self .virtual_obs
231
231
# Creation of an virtual step for dead one
232
232
self .virtual_obs = VirtualEddiesObservations (
233
- size = nb_dead + nb_virtual_extend ,
233
+ size = nb_dead + nb_virtual_extend ,
234
234
track_extra_variables = self .previous_obs .track_extra_variables ,
235
235
track_array_variables = self .previous_obs .track_array_variables ,
236
236
array_variables = self .previous_obs .array_variables )
@@ -255,27 +255,27 @@ def recense_dead_id_to_extend(self):
255
255
self .virtual_obs ['dlon' ][:nb_dead ] = obs_b ['lon' ] - obs_a ['lon' ]
256
256
self .virtual_obs ['dlat' ][:nb_dead ] = obs_b ['lat' ] - obs_a ['lat' ]
257
257
self .virtual_obs ['lon' ][:nb_dead
258
- ] = obs_b ['lon' ] + self .virtual_obs ['dlon' ][:nb_dead ]
258
+ ] = obs_b ['lon' ] + self .virtual_obs ['dlon' ][:nb_dead ]
259
259
self .virtual_obs ['lat' ][:nb_dead
260
- ] = obs_b ['lat' ] + self .virtual_obs ['dlat' ][:nb_dead ]
260
+ ] = obs_b ['lat' ] + self .virtual_obs ['dlat' ][:nb_dead ]
261
261
# Id which are extended
262
262
self .virtual_obs ['track' ][:nb_dead ] = dead_id
263
263
# Add previous virtual
264
264
if nb_virtual_extend > 0 :
265
265
obs_to_extend = self .previous_virtual_obs .obs [i_virtual_dead_id
266
- ][alive_virtual_obs ]
266
+ ][alive_virtual_obs ]
267
267
for key in obs_b .dtype .fields .keys ():
268
268
if key in ['lon' , 'lat' , 'time' , 'track' , 'segment_size' ,
269
269
'dlon' , 'dlat' ] or 'contour_' in key :
270
270
continue
271
271
self .virtual_obs [key ][nb_dead :] = obs_to_extend [key ]
272
272
self .virtual_obs ['lon' ][nb_dead :
273
- ] = obs_to_extend ['lon' ] + obs_to_extend ['dlon' ]
273
+ ] = obs_to_extend ['lon' ] + obs_to_extend ['dlon' ]
274
274
self .virtual_obs ['lat' ][nb_dead :
275
- ] = obs_to_extend ['lat' ] + obs_to_extend ['dlat' ]
275
+ ] = obs_to_extend ['lat' ] + obs_to_extend ['dlat' ]
276
276
self .virtual_obs ['track' ][nb_dead :] = obs_to_extend ['track' ]
277
277
self .virtual_obs ['segment_size' ][nb_dead :
278
- ] = obs_to_extend ['segment_size' ]
278
+ ] = obs_to_extend ['segment_size' ]
279
279
# Count
280
280
self .virtual_obs ['segment_size' ][:] += 1
281
281
@@ -318,7 +318,7 @@ def save(self, filename):
318
318
# Create dimensions
319
319
logging .debug ('Create Dimensions "Nlink" : %d' , self .nb_link_max )
320
320
h_nc .createDimension ('Nlink' , self .nb_link_max )
321
-
321
+
322
322
logging .debug ('Create Dimensions "Nstep" : %d' , nb_step )
323
323
h_nc .createDimension ('Nstep' , nb_step )
324
324
var_file_in = h_nc .createVariable (
@@ -333,16 +333,16 @@ def save(self, filename):
333
333
334
334
var_nb_link = h_nc .createVariable (
335
335
zlib = True , complevel = 1 ,
336
- varname = 'nb_link' , datatype = 'u2' , dimensions = ( 'Nstep' ) )
337
-
336
+ varname = 'nb_link' , datatype = 'u2' , dimensions = 'Nstep' )
337
+
338
338
for name , dtype in self .correspondance_dtype :
339
339
if dtype is bool_ :
340
340
dtype = 'byte'
341
341
h_nc .createVariable (zlib = True ,
342
342
complevel = 1 ,
343
343
varname = name ,
344
344
datatype = dtype ,
345
- dimensions = ('Nstep' ,'Nlink' ))
345
+ dimensions = ('Nstep' , 'Nlink' ))
346
346
347
347
for i , correspondance in enumerate (self ):
348
348
nb_elt = correspondance .shape [0 ]
@@ -389,8 +389,8 @@ def prepare_merging(self):
389
389
# correspondance
390
390
self .nb_obs_by_tracks [
391
391
correspondance ['id' ][correspondance ['virtual' ]]
392
- ] += correspondance ['virtual_length' ][
393
- correspondance ['virtual' ]]
392
+ ] += correspondance ['virtual_length' ][
393
+ correspondance ['virtual' ]]
394
394
395
395
# Compute index of each tracks
396
396
self .i_current_by_tracks = \
@@ -414,7 +414,7 @@ def merge(self, until=-1):
414
414
track_extra_variables = self .current_obs .track_extra_variables ,
415
415
track_array_variables = self .current_obs .track_array_variables ,
416
416
array_variables = self .current_obs .array_variables ,
417
- )
417
+ )
418
418
419
419
# Calculate the index in each tracks, we compute in u4 and translate
420
420
# in u2 (which are limited to 65535)
@@ -433,7 +433,7 @@ def merge(self, until=-1):
433
433
434
434
# To know if the track start
435
435
first_obs_save_in_tracks = zeros (self .i_current_by_tracks .shape ,
436
- dtype = bool_ )
436
+ dtype = bool_ )
437
437
438
438
for i , file_name in enumerate (self .datasets [1 :]):
439
439
if until != - 1 and i >= until :
@@ -455,7 +455,7 @@ def merge(self, until=-1):
455
455
for field in fields :
456
456
var = field [0 ]
457
457
eddies [var ][index_final [m_first_obs ]
458
- ] = self .previous_obs [var ][index_in ]
458
+ ] = self .previous_obs [var ][index_in ]
459
459
# Increment
460
460
self .i_current_by_tracks [i_id [m_first_obs ]] += 1
461
461
# Active this flag, we have only one first by tracks
@@ -469,7 +469,7 @@ def merge(self, until=-1):
469
469
if m_virtual .any ():
470
470
# Incrementing index
471
471
self .i_current_by_tracks [i_id [m_virtual ]
472
- ] += self [i ]['virtual_length' ][m_virtual ]
472
+ ] += self [i ]['virtual_length' ][m_virtual ]
473
473
# Get new index
474
474
index_final = self .i_current_by_tracks [i_id ]
475
475
@@ -480,7 +480,7 @@ def merge(self, until=-1):
480
480
for field in fields :
481
481
var = field [0 ]
482
482
eddies [var ][index_final
483
- ] = self .current_obs [var ][index_current ]
483
+ ] = self .current_obs [var ][index_current ]
484
484
485
485
# Add increment for each index used
486
486
self .i_current_by_tracks [i_id ] += 1
0 commit comments