# A quick processor to add a proper unit to the upstream FITSes

from gavo import api
from gavo.utils import pyfits


class HeaderFixer(api.FileProcessor):
# We need to manipulate multiple extensions, so the normal header processor
# doesn't really help
	def process(self, srcName):
		hdus = pyfits.open(srcName, mode='update')
		hdus[0].header.set("CUNIT1", "Angstrom")
		hdus[0].header.set("CTYPE1", "WAVELENGTH")
		hdus.flush()



if __name__=="__main__":
	api.procmain(HeaderFixer, "cdfspect/q", "import")
