File Name Translator Script

The File Name Translator Shell Script is deprecated and no longer maintained as the original filename is available directly via search results. See the Original Filename search results column description.


Download KOAID File Name Translator Shell Script

The names of data files as ingested into the Keck Observatory Archive (KOA) have been standardized into unique identifiers known as "KOAIDs" in the form AA.YYYYMMDD.#####.fits, where AA is the two-letter code for the instrument, YYYYMMDD is the UT date of observation, and ##### is the five-digit index number representing the number of seconds after UT midnight.

For observers with logs referring to the telescope-assigned filenames or other researchers with data reduction tools that expect file names in the orginal directory structure, it is desirable to translate the KOA filenames back to the original observatory filenames. We provide a UNIX shell script, koa_translator, for this purpose.

Usage:

koa_translator [directory] [-test]

The script looks through the specified directory (or the current directory if there is no argument) and all subdirectories for file names in the KOAID format described above. Files ending in ".fits" or ".fits.gz" will also be processed as these files are assumed to be from KOA.

The "-test" argument creates a file (translate.csh) that can be executed to perform the translation. Without this argument, the script will be created, run, and then deleted.

For each file found, the translator will look through the file's FITS header and reconstruct the original file name (including a parent directory derived from the UT date, and possibly appropriate subdirectories) and write to a file ("translate.csh") the appropriate shell commands to rename the KOA file to the original file name.

Other files with the same KOAID in their file names will also be renamed for consistency.

This is meant to reconstruct the original directory and file name structure as was used at the time of observation. The reconstruction will not always be perfect. Observers may have used nonstandard directory structure, or KOA might have recorded multiple versions of the same original file name. The latter might occur, for example, if observers recorded some files then deleted them and reset the file number to write new files into the same file names.

Note that if there are duplicate original filenames, the program will use the original filename for the first version it finds, then create second (and subsequent, if necessary) versions with ".v2", ".v3", etc. added to the filename. THIS DOES NOT GUARANTEE THAT FILES ALL USING ".v2", FOR EXAMPLE, ARE REALLY FROM THE SAME DATASET. You may have to do some checking to determine which files belong in which dataset.

KOAID Filenames Telescope-assigned Filenames
 
DEIMOS/raw/sci/DE.20110502.06737.fits DEIMOS/2011may02/raw/d0502_0001.fits
DEIMOS/raw/sci/DF.20130109.07231.fits DEIMOS/2013jan09/raw/fcs0109_0026.fits
DEIMOS/raw/cal/DE.20130108.83718.fits DEIMOS/2013jan09/raw/d0109_0004.fits.gz
 
ESI/raw/sci/ES.20130304.57410.fits ESI/2013mar04/raw/esi0057.fits
ESI/raw/cal/ES.20020607.10355.fits ESI/2002jun07/raw/esi0022.fits
 
HIRES/raw/sci/HI.20040824.19484.fits.gz HIRES/2004aug24/raw/hires2354.fits.gz
HIRES/raw/sci/HI.20040824.08919_CCD1_HDU01.jpg HIRES/2004aug24/raw/hires2309.fits_CCD1_HDU01.jpg
HIRES/raw/cal/HI.20010824.05854.fits.gz HIRES/2001aug24/raw/hires0091.fits.gz
HIRES/extracted/tbl/ccd2/trace/HI.20040824.19484_2_trace.dat.gz HIRES/2004aug24/extracted/hires2354_2_trace.dat.gz
 
LRIS/raw/sci/LR.20070717.21693.fits.gz LRIS/2007jul17/raw/lblue0304.fits.gz
LRIS/raw/sci/LB.20070717.12497.fits.gz LRIS/2007jul17/raw/lred0258.fits.gz
LRIS/raw/cal/LR.20120814.77711.fits.gz LRIS/2012aug14/raw/r120811_0007.fits.gz
 
KCWI/raw/sci/KB.20170918.21047.fits.gz KCWI/2017sep18/raw/kb170918_00053.fits.gz
KCWI/raw/cal/KB.20170918.04384.fits KCWI/2017sep18/raw/kb170918_00001.fits.gz
KCWI/raw/cal/KF.20170918.04513.fits KCWI/2017sep18/raw/kf170918_000001.fits.gz
 
LWS/raw/sci/LW.19990301.31206.fits.gz LWS/1999mar01/raw/08572_0047.fits.gz
LWS/raw/cal/LW.19990830.11842.fits.gz LWS/1999aug30/raw/lws0002.fits.gz
LWS/reduced/LW.19990301.31206_reduced.fits.gz LWS/1999mar01/reduced/08572_0047_reduced.fits.gz
 
MOSFIRE/raw/sci/MF.20120424.83500.fits MOSFIRE/2012apr24/raw/m120424_0131.fits
MOSFIRE/raw/cal/MF.20120630.01253.fits.gz MOSFIRE/2012jun30/raw/m120630_0001.fits.gz
 
NIRC/raw/sci/N1.20050126.38268.fits NIRC/2005jan26/raw/s10263.fits
NIRC/raw/cal/N1.20021018.20430.fits.gz NIRC/2002oct18/raw/s00025.fits.gz
 
NIRC2/raw/sci/N2.20120303.19088.fits NIRC2/2012mar03/raw/n0096.fits
NIRC2/raw/cal/N2.20080909.04479.fits.gz NIRC2/2008sep09/raw/n0001.fits.gz
NIRC2/calibrated/N2.20120303.19088_drp.fits.gz NIRC2/2012mar03/calibrated/n0096_drp.fits.gz
 
NIRSPEC/raw/sci/scam/NC.20120525.78917.fits.gz NIRSPEC/2012may25/raw/scam/may25i0012.fits.gz
NIRSPEC/raw/sci/spec/NS.20120526.03748.fits.gz NIRSPEC/2012may26/raw/spec/may26i0042.fits.gz
NIRSPEC/raw/cal/NS.20060507.32113.fits.gz NIRSPEC/2006may07/raw/spec/may07s0058.fits.gz
 
OSIRIS/raw/sci/OS.20050925.55312.fits.gz OSIRIS/2005sep25/raw/s050925_a026002.fits.gz
OSIRIS/raw/sci/OI.20050925.49731.fits.gz OSIRIS/2005sep25/raw/i050925_a019028.fits.gz
OSIRIS/raw/cal/OS.20061005.70399.fits.gz OSIRIS/2006oct05/raw/s061005_c001000.fits.gz
OSIRIS/reduced_cubes/OS.20050925.55312.lev1.fits.gz OSIRIS/2005sep25/reduced_cubes/s050925_a026002.lev1.fits.gz