desihub / desitarget

DESI Targeting
BSD 3-Clause "New" or "Revised" License
18 stars 23 forks source link

Find and remove MTL-processed tiles that don't overlap future tiles #768

Closed geordie666 closed 2 years ago

geordie666 commented 2 years ago

This PR introduces functionality to:

The process operates per-program (i.e. it needs to be run once for BRIGHT and once for DARK).

Example commands:

purge_mtl DARK --isodate 2021-09-24T19:36:28+00:00 --mtldir /global/cscratch1/sd/adamyers/fakesurveyops/mtl 
purge_mtl BRIGHT --isodate 2021-09-24T19:36:28+00:00 --mtldir /global/cscratch1/sd/adamyers/fakesurveyops/mtl

Where --isodate specifies that the code should only consider tiles after a specific date and --mtldir uses a different directory to the standard $MTL_DIR environment variable. You'd need to add --purge to these commands to actually remove entries from files (but be really careful if you try that!). Without --purge the code just prints the list of non-overlapping tiles.

I've created an example run of purge_mtl (for both DARK and BRIGHT) in /global/cscratch1/sd/adamyers/fakesurveyops/mtl. The top line results were:

DARK

1163 targets were removed from the ledgers in /global/cscratch1/sd/adamyers/fakesurveyops/mtl/main/secondary/dark 32141 targets were removed from the ledgers in /global/cscratch1/sd/adamyers/fakesurveyops/mtl/main/dark 8 tiles were removed from the MTL tile file at /global/cscratch1/sd/adamyers/fakesurveyops/mtl/scnd-mtl-done-tiles.ecsv 8 tiles were removed from the MTL tile file at /global/cscratch1/sd/adamyers/fakesurveyops/mtl/mtl-done-tiles.ecsv

BRIGHT

2500 targets were removed from the ledgers in /global/cscratch1/sd/adamyers/fakesurveyops/mtl/main/secondary/bright 227982 targets were removed from the ledgers in /global/cscratch1/sd/adamyers/fakesurveyops/mtl/main/bright 56 tiles were removed from the MTL tile file at /global/cscratch1/sd/adamyers/fakesurveyops/mtl/scnd-mtl-done-tiles.ecsv 56 tiles were removed from the MTL tile file at /global/cscratch1/sd/adamyers/fakesurveyops/mtl/mtl-done-tiles.ecsv

geordie666 commented 2 years ago

This has been open or a while, now. I'll merge it once tests pass and then actually update MTL to remove the removable tiles.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.5%) to 57.299% when pulling 712caee9425d54645edf25dc778e8e21b2b51942 on ADM-purge-MTL into cba082b3b73bc0dfc0e8a790d50a8d5151ba1753 on master.