@@ -142,12 +142,12 @@ def period(self):
142
142
date_stop = datetime (1950 , 1 , 1 ) + timedelta (int (self .class_method .load_from_netcdf (self .datasets [- 1 ]).obs ['time' ][0 ]))
143
143
return date_start , date_stop
144
144
145
- def swap_dataset (self , dataset ):
145
+ def swap_dataset (self , dataset , raw_data = False ):
146
146
""" Swap to next dataset
147
147
"""
148
148
self .previous2_obs = self .previous_obs
149
149
self .previous_obs = self .current_obs
150
- self .current_obs = self .class_method .load_from_netcdf (dataset )
150
+ self .current_obs = self .class_method .load_from_netcdf (dataset , raw_data = raw_data )
151
151
152
152
def merge_correspondance (self , other ):
153
153
# Verify compliance of file
@@ -515,7 +515,7 @@ def shorter_than(self, size_max):
515
515
self [i ]['id' ] = translate [self [i ]['id' ]]
516
516
logging .debug ('Select shorter than %d done' , size_max )
517
517
518
- def merge (self , until = - 1 ):
518
+ def merge (self , until = - 1 , raw_data = True ):
519
519
"""Merge all the correspondance in one array with all fields
520
520
"""
521
521
# Start loading identification again to save in the finals tracks
@@ -529,7 +529,7 @@ def merge(self, until=-1):
529
529
size = self .nb_obs ,
530
530
track_extra_variables = self .current_obs .track_extra_variables ,
531
531
track_array_variables = self .current_obs .track_array_variables ,
532
- array_variables = self .current_obs .array_variables )
532
+ array_variables = self .current_obs .array_variables , raw_data = raw_data )
533
533
534
534
# All the value put at nan, necessary only for all end of track
535
535
eddies ['cost_association' ][:] = default_fillvals ['f4' ]
@@ -554,7 +554,7 @@ def merge(self, until=-1):
554
554
break
555
555
logging .debug ('Merge data from %s' , file_name )
556
556
# Load current file (we begin with second one)
557
- self .swap_dataset (file_name )
557
+ self .swap_dataset (file_name , raw_data = raw_data )
558
558
# We select the list of id which are involve in the correspondance
559
559
i_id = self [i ]['id' ]
560
560
# Index where we will write in the final object
@@ -603,20 +603,21 @@ def merge(self, until=-1):
603
603
self .previous_obs = self .current_obs
604
604
return eddies
605
605
606
- def get_unused_data (self ):
606
+ def get_unused_data (self , raw_data = False ):
607
607
"""
608
608
Add in track object all the observations which aren't selected
609
609
Returns: Unused Eddies
610
610
611
611
"""
612
612
self .reset_dataset_cache ()
613
- self .swap_dataset (self .datasets [0 ])
613
+ self .swap_dataset (self .datasets [0 ], raw_data = raw_data )
614
614
615
615
nb_dataset = len (self .datasets )
616
616
# Get the number of obs unused
617
617
nb_obs = 0
618
618
list_mask = list ()
619
619
has_virtual = 'virtual' in self [0 ].dtype .names
620
+ logging .debug ('Count unused data ...' )
620
621
for i , filename in enumerate (self .datasets ):
621
622
last_dataset = i == (nb_dataset - 1 )
622
623
if has_virtual and not last_dataset :
@@ -637,15 +638,16 @@ def get_unused_data(self):
637
638
m [eddies_used ] = False
638
639
list_mask .append (m )
639
640
nb_obs += m .sum ()
640
-
641
+ logging . debug ( 'Count unused data OK' )
641
642
eddies = EddiesObservations (
642
643
size = nb_obs ,
643
644
track_extra_variables = self .current_obs .track_extra_variables ,
644
645
track_array_variables = self .current_obs .track_array_variables ,
645
- array_variables = self .current_obs .array_variables )
646
+ array_variables = self .current_obs .array_variables , raw_data = raw_data )
646
647
j = 0
647
648
for i , dataset in enumerate (self .datasets ):
648
- current_obs = self .class_method .load_from_netcdf (dataset )
649
+ logging .debug ('Loaf file : (%d) %s' , i , dataset )
650
+ current_obs = self .class_method .load_from_netcdf (dataset , raw_data = raw_data )
649
651
if i == 0 :
650
652
eddies .sign_type = current_obs .sign_type
651
653
unused_obs = current_obs .observations [list_mask [i ]]
0 commit comments