C+ C NAME: C read_frame(infile,mode,ic,id,jd,frame) C PURPOSE: C To read a frame of SMEI data and convert the unsigned short integers to floating C CATEGORY: C SMEI Data processing C CALLING SEQUENCE: C call read_frame(infile,mode,ic,id,jd,frame) C INPUTS: C infile character Input file name (currently 18 characters) C*** This will have to change... C mode integer 1 - "Engineering" frame records, no onboard binning C 2 - "Hi-res" frame records, binned 2 x 2 pixels C 4 - "Normal Data" frame records, binned 4 x 4 pixels C ic integer Camera 0,1,2,3 or 4 C id integer data frame max x-value (along rows) C jd integer data frame max y-value (down columns) C OUTPUTS: C frame(id,jd) real data frame C CALLS: C none C PROCEDURE: C Wind off header, read in one data frame, convert to short unsigned integer, float to real C Note: ***This procedure probably needs significant alteration for the SMEI data C coming to us on the weekly CD's.*** C In particular, the FITS header probably contains desirable information which will C want to be passed out through this subroutine's argument list. Also, the unsigned C short integer format of our *.nic files is probably not Hanscom's convention. C yoffset is the number of rows skipped by EGSE before starting its 256-row readout rectangle C MODIFICATION HISTORY: C Jan, 2003 A. Buffington (UCSD/CASS) C Feb, 2003 A. Smith (UCSD/CASS) C- subroutine read_frame_q(infile,mode,ic,id,jd,frame,q) integer*1 trail1(72),trail2(152) real*8 q(4) character*1 a3(3) integer*4 i,j,id,jd,itemp integer*2 idata(id,jd),head(3),k real*4 frame(id,jd),yoffset(5) character infile*63 !not compatable with TMO data data yoffset /0.,65.,59.,62.,55./ if(ic.gt.0)then if(mode.ne.1.and.mode.ne.2.and.mode.ne.4)then print *,' Bummer!!, bad mode = ',mode return endif open(10,file=infile,form='binary',readonly) read(10)head,((idata(i,j),i=1,id),j=1,jd),a3,trail1,q,trail2 close(10) c convert from short unsigned integer to real*4 do j=1,jd do i=1,id itemp=int4(idata(i,j)) if(itemp.lt.0)itemp=itemp+65536 frame(i,j)=float(itemp) c Now fix covered pixels if(mode.eq.1.and.(i.eq.21.or.i.eq.1264))frame(i,j)=0.0 if(mode.eq.2.and.(i.eq.11.or.i.eq.632))frame(i,j)=2.*frame(i,j) if(mode.eq.4.and.(i.eq.6.or.i.eq.316))frame(i,j)=1.333*frame(i,j) enddo enddo else open(10,file=infile,form='binary',readonly) read(10)head,((idata(i,j),i=1,1280),j=1,600) close(10) c convert from short unsigned integer to real*4 do j=1,600 do i=1,1280 itemp=int4(idata(i,j)) if(itemp.lt.0)itemp=itemp+65536 frame(i,j)=float(itemp) enddo enddo endif c return end