desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
36 stars 24 forks source link

resolve symlinks when storing $DESI_SPECTRO_DARK paths #2381

Open sbailey opened 1 month ago

sbailey commented 1 month ago

the spectro pipeline records the filepaths of the dark files used to process an exposure in DEPNAMnn/DEPVERnn keywords, e.g.

[login20 daily] fitsheader preproc/20241005/00256520/preproc-b7-00256520.fits.gz | grep DEP | grep -i dark
DEPNAM03= 'CCD_CALIB_DARK'                                                      
DEPVER03= '/global/cfs/cdirs/desi/spectro/desi_spectro_dark/latest/dark_frames&'CONTINUE  '/dark-sm8-b7-20240831.fits.gz'                                       

However, desi_spectro_dark/latest is a symlink which currently points to v2405 but will change in the future, making this provenance ambiguous.

To do: if a filename starts with the value of $DESI_SPECTRO_CALIB, and that value is a symlink, replace it with the full true path.

This would probably be worth a helper function to work out all the symlink checking and file resolution logic so that we can re-use it with other cases that might have symlinks (I don't know what those are yet, but let's not bury this in some preproc code).