I think these were the two main changes. It makes getting all 30 bursts from a file go from 420 ms to 65 ms:
In [1]: import s1reader
In [2]: import burst_db.historical_bursts.parse_bursts
In [3]: file = 'S1A_IW_SLC__1SDV_20200102T111719_20200102T111747_030620_038227_9FE9.SAFE'
In [4]: o = 'S1A_OPER_AUX_POEORB_OPOD_20210316T184157_V20200101T225942_20200103T005942.EOF'
In [10]: %time [s1reader.load_bursts(file, o, idx) for idx in [1,2,3]]
CPU times: user 387 ms, sys: 32.5 ms, total: 419 ms
Wall time: 424 ms
In [8]: %time bursts = burst_db.historical_bursts.parse_bursts.bursts_from_safe_dir(file, o)
CPU times: user 18.3 ms, sys: 3.61 ms, total: 22 ms
Wall time: 65.3 ms
Seems worth making the small refactor at some point
With a few small adjustments and adding
@functools.cache
on theET.parse
call for the precise orbit, we can speed up loading the bursts by a bunch.See (parsing the precise orbit file, which happens once per subswath) https://github.com/opera-adt/burst_db/blob/main/src/burst_db/historical_bursts/parse_bursts.py#L363-L364 and here (for the iteration of the element list to get just the UTC times and Zs) https://github.com/opera-adt/burst_db/blob/main/src/burst_db/historical_bursts/parse_bursts.py#L449-L459
I think these were the two main changes. It makes getting all 30 bursts from a file go from 420 ms to 65 ms:
Seems worth making the small refactor at some point