@@ -298,6 +298,7 @@ def __init__(self, outdir):
298298 self ._last_sat_num = - 1
299299 self ._last_is_hr = 0
300300 self ._last_fnum = - 1
301+ self ._fids = {}
301302
302303 def generate_fid (self , sat_num = None ):
303304 if not (self .current_fid and self .merge_mode ):
@@ -306,11 +307,17 @@ def generate_fid(self, sat_num=None):
306307 hr = self ._last_is_hr and '_hr' or ''
307308 fnum = (self ._last_fnum > - 1 ) and ('_N' + str (self ._last_fnum )) or ''
308309 self .current_fid = f'{ pfx .upper ()} { hr } { fnum } _{ now .strftime ("%Y-%m-%d_%H-%M-%S,%f" )} '
310+ if fnum and self .merge_mode :
311+ self ._fids [self ._last_fnum ] = self .current_fid
309312 return self .current_fid
310313
311314 def force_new (self , * args , ** kwargs ):
312315 return super ().force_new (* args , ** kwargs )
313316
317+ def clear (self ):
318+ self ._fids .clear ()
319+ super ().clear ()
320+
314321 def push_data (self , data , is_v2 = 0 , raw_data = b'' , ** kw ):
315322 if int (data .sat_num ) not in sat_names :
316323 self ._miss_cnt += 1
@@ -422,12 +429,16 @@ def _push_data2(self, data):
422429 force = 1
423430 if data .fnum != self ._last_fnum :
424431 self ._last_fnum = data .fnum
425- force = 1
432+ fid = self ._fids .get (self ._last_fnum )
433+ if fid :
434+ self .current_fid = fid
435+ else :
436+ force = 1
426437
427438 if force :
428439 img = self .force_new (sat_num = sat_num )
429440 else :
430- img = self .get_image (has_soi , sat_num = sat_num )
441+ img = self .get_image (0 , sat_num = sat_num )
431442
432443 with img .lock :
433444 if has_soi :
0 commit comments