; NAME : convft4 ; PURPOSE : ; convert flare telescope T4 data into MAGPACK2's standard format ; CATEGORY : ; solar magnetic field computation package (MAGPACK2) ; CALLING SEQUENCE : ; convft4, h,img,s,v, mparam,rdata, nxnew=nxnew ; INPUTS : ; h(0,1,2,3) = nkrheader ; img,s,v = intensity, Doppler signal, Stokes V-parameter ; for calibrated data, s,v arrays actually store vl,bl ; OPTIONAL INPUT PARAMETERS : ; none ; KEYWORD PARAMETERS : ; nxnew = new nx (number of pixels in the x-direction) ; possible values are 512, 256, 128, 64, ,,,. ; if not specified, the old nx value in the file header is used ; OUTPUTS : ; creates arrays mparam and rdata ; mparam = magpack2 parameters ; rdata = i,s,v or i,vl,bl ; COMMON BLOCKS : none ; SIDE EFFECTS : none ; RESTRICTIONS : none ; PROCEDURE : ; ; MODIFICATION HISTORY : ; T.Sakurai, 1993 ; ;------------------------------------------------------------------------ ; pro convft4, h,img,s,v, mparam,rdata, nxnew=nxnew ; mparam = defmp() pix0 = 0.66 ; standard pixel size pix1 = pix0*(512/h(0).nx) ; arc sec. for 1 pixel if ( strmid(h(0).dx,0,1) eq ' ' ) then begin ; dx is blank pixx = pix1 pixy = pix1 endif else begin pixx = float(h(0).dx) pixy = float(h(0).dy) endelse if keyword_set(nxnew) then nbin=( h(0).nx/nxnew > 1 ) else nbin=1 timeint,h,time1,time2,date1,date2 time1 = strmid(time1,0,8) time2 = strmid(time2,0,8) sunparam, h(0).time_sys, date1,time1, rsp, pdeg, b0deg, cl0deg, doy if h(1).correct gt 100 then $ ; in this case s=d and v=bl kindm = 1101L $ ; intensity, velocity, and bl else $ kindm = -4404L ; waveband No.4 = 6337A nbytem =h(0).nbyt nframe =4 nx0 =h(0).nx ny0 =h(0).ny dx0 = pixx * 0.07 dy0 = pixy * 0.07 xs0 =h(0).g_x*0.07 - 0.5*nx0*dx0 ys0 =h(0).g_y*0.07 - 0.5*ny0*dy0 nx = nx0/nbin ny = ny0/nbin dx = dx0 * nbin dy = dy0 * nbin xs = xs0 + 0.5* dx0 * (nbin-1) ys = ys0 + 0.5* dy0 * (nbin-1) ypos =0.0 mesh =0 rsp = 0.07 * rsp xxtod = [ xs + 0.5*dx*(nx-1), ys + 0.5*dy*(ny-1), 0.0 ] zt2 = rsp*rsp - xxtod(0)^2 - xxtod(1)^2 if zt2 ge 0.0 then xxtod(2) = sqrt(zt2) else xxtod(2) = -rsp pi = 3.141592 mparam.kindm =kindm mparam.nbytem =nbytem mparam.nframe =nframe mparam.nx =nx mparam.ny =ny mparam.xs =xs mparam.ys =ys mparam.dx =dx mparam.dy =dy mparam.ypos =ypos mparam.mesh =mesh mparam.rsp =rsp mparam.prad =pi*pdeg/180.0 mparam.b0rad =pi*b0deg/180.0 mparam.cl0rad =pi*cl0deg/180.0 mparam.xxtod=xxtod mparam.inst='MTK/FT4 ' mparam.tsys= string( h(0).time_sys, format='(a6)') mparam.dateo = date1 mparam.stime= time1 mparam.etime= time2 mparam.mfile = string( h(0).obs_id, format='(a8)') ftag='' spawn, "date '+%y/%m/%d%T'",ftag mparam.ftag= ftag(0) mparam.inst = string( h(0).observatory, h(0).telescope, format='(a4,a4)') mparam.title = string( h(0).obs_id, format='(a80)') rdata = fltarr(nx,ny,8) rbuf = fltarr(nx,ny) mparam.status.i = 0 rbuf = rebin( float(img), nx, ny ) rbuf = rbuf/max(rbuf) rdata(*,*,0) = rotate(rbuf,7) ; reverse y-direction factp=0.00005 if kindm lt 0 then begin mparam.status.s = 1 rbuf = factp*rebin( float(s), nx, ny) rdata(*,*,1) = rotate(rbuf,7) mparam.status.v = 2 rbuf = factp*rebin( float(v), nx, ny) rdata(*,*,2) = rotate(rbuf,7) endif else begin factb=0.1 ; unit of bl is 0.1 gauss factv=1.0 ; unit of vl is m/sec mparam.status.bl = 1 rbuf = factb*rebin( float(v), nx, ny) rdata(*,*,1) = rotate(rbuf,7) mparam.status.vl = 2 rbuf = factv*rebin( float(s), nx, ny) rdata(*,*,2) = rotate(rbuf,7) endelse print,'(proc.convft4) nbin,nx,ny,kindm=',nbin,nx,ny,kindm return end