# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/data_mgr/fits_to_archive.py 3277 2020-06-26 13:45:06Z depa $

"""Script executed by mergeHeaders C++ ICE method
finish FITS header by adding CHECKSUM and DATASUM and
move it to position on filesystem synched with LBTO
archive"""

from astropy.io import fits
from util import shinsLogger
import sys

try:
    with fits.open(filenameSHINS, mode="update") as hdulOrig:
        hdulOrig[0].header.add_checksum()
        hdulOrig.flush()
        # move file to position on filesystem synched with LBTO archive
        # ...
        status = 0
except IOError as e:
    print ("ERROR")
    status = 1
    raise e
