C+ C NAME: C smei_get_glare C PURPOSE: C Get glare map C CALLING SEQUENCE: subroutine smei_get_glare(icam, mode, glare_map, glare_factor, cx, cy, dx, dy) C INPUTS: C OUTPUTS: C icam integer camera (1,2,3) C mode integer mode (0,1,2) C glare_map real 318x64 (mode 2) frame representing the glare C glare_factor real 90x180 array of multipliers for the glare map C cx real C cy real C dx real C dy real C INCLUDE: include 'filparts.h' include 'dirspec.h' include 'smei_frm_layout.h' include 'ftspar.h' C CALLS: C iFilePath, iGetLun, iFreeLun C FTNOPN, FTGISZ, FTGPVE, FTCLOS, FTGKYE, say_fts C RESTRICTIONS: C glare_map MUST be a 318 x 64 array C glare_factor MUST be a 90 x 180 array C PROCEDURE: C The glare map represents the shape of the glare as present in C the SMEI frames as a mode 2 (318x64) array. C This glare map, multiplied by a constant, is subtracted from C each SMEI frame. The multiplier is a function of the location C of the Sun relative to the optical axis. C The glare_factor array represents this multiplier as a function C of two angles thetax and thetay. C MODIFICATION HISTORY: C DEC-2004, Paul Hick (UCSD/CASS) C DEC-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Now using WCS-compliant keywords. C- integer icam integer mode real glare_map (*) real glare_factor(*) real cx real cy real dx real dy character cSay*9 /'get_glare'/ character cSeverity /'E'/ character cStr *(FIL__LENGTH) character cFile*(FIL__LENGTH) logical anyf integer nAxes(2) integer Str2Str ! Read the glare map (318x64 array) i = 0 i = i+Str2Str('c' , cStr(i+1:)) i = i+Int2Str(icam, cStr(i+1:)) i = i+Str2Str('m' , cStr(i+1:)) i = i+Int2Str(mode, cStr(i+1:)) i = i+Str2Str('_glare_map.fts.gz', cStr(i+1:)) i = iFilePath(cEnvi(:iEnvi)//'SMEIDB',0,' ',cStr,cFile) iU = iGetLun(cFile) istat = 0 ! The open statement will crash the program if the glare ! map does not exist (currently only c2m2 and c3m1 maps exist, ! so mode 0 frames can't be processed yet with glare subtraction) call FTNOPN(iU, cFile, FTS__READONLY, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTGISZ(iU, 2, nAxes, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) anyf = .FALSE. call FTGPVE(iU, 1, 1, nAxes(1)*nAxes(2), 0.0, glare_map, anyf, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTCLOS(iU, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) iU = iFreeLun(iU) i = 0 i = i+Str2Str('is' , cStr(i+1:))+1 i = i+Int2Str(nAxes(1) , cStr(i+1:)) i = i+Str2Str(' x' , cStr(i+1:))+1 i = i+Int2Str(nAxes(2) , cStr(i+1:)) call Say(cSay,'I','#'//cFile,cStr) ! Read the glare multipliers (90 x 180 array) i = iFilePath(cEnvi(:iEnvi)//'SMEIDB',0,' ','glare_multiplier.fts.gz',cFile) iU = iGetLun(cFile) istat = 0 call FTNOPN(iU, cFile, FTS__READONLY, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTGISZ(iU, 2, nAxes, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTGKYE(iU, 'CRPIX1', cx, cStr, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTGKYE(iU, 'CRPIX2', cy, cStr, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTGKYE(iU, 'CDELT1', dx, cStr, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) dx = 1.0/dx call FTGKYE(iU, 'CDELT2', dy, cStr, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) dy = 1.0/dy anyf = .FALSE. call FTGPVE(iU, 1, 1, nAxes(1)*nAxes(2), 0.0, glare_factor, anyf, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) call FTCLOS(iU, istat) if (istat .ne. 0) call say_fts(cSay,cSeverity,istat) iU = iFreeLun(iU) !bad = BadR4Set(0.0) !call GridFill(6,nX,nY,clsff,bside,zmin,zmax) !bad = BadR4Set(bad) i = 0 i = i+Str2Str('is' , cStr(i+1:))+1 i = i+Int2Str(nAxes(1) , cStr(i+1:)) i = i+Str2Str(' x' , cStr(i+1:))+1 i = i+Int2Str(nAxes(2) , cStr(i+1:)) call Say(cSay,'I','#'//cFile,cStr) return end