subroutine omgprep open output file read the OSW window parameters, binning factors from header call CAL_GetBoresightMat call OAL_GetAttitude (with time of reference frame) find OM boresight direction undistort image rotate by the angle corresponding to the grism filter write out to a fits file. close OSWSL close output file end subroutine omgprep