
; CNA_ZOFFCORR -- Perform zero-read subtraction for MULTI-ACCUM data
; groups. The science images are subtracted and the DQ arrays 
; are combined. The ERR, SAMP, and TIME arrays are unchanged.
; The exposure time for the group being corrected is reduced
; by an amount equal to the exposure time of the zero-read.

; Revision history:
; I. Barg 10-Jan-2000 Modified structure names (and tag names) to match 
;             "/iraf/stsdas/lib/hstio.h".

function cna_zoffcorr, nic, zoff, input

@calnica_common

  ; Arguments:
  ;	nic	 i: NICMOS info structure
  ;	zoff	 i: zero-read image
  ;	input	io: image to be zero-subtracted


  ; Subtract science arrays.
  input.sci.data.data = input.sci.data.data - $
				 zoff.sci.data.data

  ; Combine (i.e. logical "OR") data quality arrays.
  input.dq.data.data = input.dq.data.data or $
			       zoff.dq.data.data

  ; Subtract the exposure time of the zero-read image
  ; from the exposure time of the science image being processed.
  ztime = 0.0
  ztime = sxpar(zoff.sci.hdr,'SAMPTIME')
  nic.exptime(nic.group-1) = $
                          nic.exptime(nic.group-1) - ztime

  ; Subtract the time arrays from one another.
  input.intg.data.data = input.intg.data.data - $
                                   zoff.intg.data.data


  ; Successful return.
  return, 0

end

