@@ -400,9 +400,24 @@ def calc_gui_stats(data):
400
400
401
401
402
402
def _get_obsids_to_update (check_missing = False , table_file = None , start = None , stop = None ):
403
+ # Use the end of AOPCADMD data or a supplied stop time.
404
+ _ , aopcadmd_end_time = fetch .get_time_range ("AOPCADMD" )
405
+ stop = stop if stop is not None else aopcadmd_end_time
406
+
407
+ # There's some duplication below in how stop time is applied, but in both
408
+ # cases the the kadi obsids are filtered on the stop time of the obsid as less than or equal to
409
+ # the stop time defined above (the supplied stop time or the end of cxc archive
410
+ # AOPCADMD data). The kadi obsid events may be complete past the end of
411
+ # the AOPCADMD data, especially if kadi events are updated using MAUDE data.
412
+ #
413
+ # Note that the obsid event interval is the full interval of constant obsid.
414
+ # Obsid commanding is normally in the maneuver between observations.
415
+ # And note that the normal stop kwarg is inclusive and includes intervals that intersect with
416
+ # that stop time.
417
+
403
418
if check_missing :
404
419
last_tstart = start if start is not None else "2007:271:12:00:00"
405
- kadi_obsids = events .obsids .filter (start = last_tstart )
420
+ kadi_obsids = events .obsids .filter (start = last_tstart , stop__lte = stop )
406
421
with tables .open_file (table_file , "r" ) as h5 :
407
422
tbl_data = h5 .root .data [:]
408
423
# get all obsids that aren't already in tbl
@@ -416,7 +431,7 @@ def _get_obsids_to_update(check_missing=False, table_file=None, start=None, stop
416
431
]
417
432
except Exception :
418
433
last_tstart = start if start is not None else "2002:012:12:00:00"
419
- kadi_obsids = events .obsids .filter (start = last_tstart , stop = stop )
434
+ kadi_obsids = events .obsids .filter (start = last_tstart , stop__lte = stop )
420
435
# Skip the first obsid (as we already have it in the table)
421
436
obsids = [o .obsid for o in kadi_obsids ][1 :]
422
437
return obsids
0 commit comments