C+ C NAME: C orbit_binner C PURPOSE: C This program will take composite images of orbits and re-bin them C CATEGORY: C SMEI data analysis C OUTPUTS: C A grid file that represents the re-binned orbits C PROCEDURE: C Read in the orbits to be used, re-bin them C MODIFICATION HISTORY: C July 2003, Aaron Smith (UCSD/CASS) C- PROGRAM orbit_binner implicit none integer*4 i, j, k, s, hour, date, numorb, ic, mode, testi, testj integer*4 eqorbit(1200,1200) /1440000*0/ integer*4 plorbit(1600,1600) /2560000*0/ integer*4 eqorbitbin(600,600) /360000*0/ integer*4 eqorbitbincnt(600,600) /360000*0/ integer*4 plorbitbin(400,400) /160000*0/ integer*4 plorbitbincnt(400,400) /160000*0/ character eqinfile*27, plinfile*25 character dum, eqoutfile*24, ploutfile*22 ic=2 mode=4 numorb = 10 do k=1,numorb if(k.eq.1) then date=0529 hour=03 elseif(k.eq.2) then date=0529 hour=04 elseif(k.eq.3) then date=0529 hour=06 elseif(k.eq.4) then date=0529 hour=08 elseif(k.eq.5) then date=0529 hour=09 elseif(k.eq.6) then date=0529 hour=11 elseif(k.eq.7) then date=0529 hour=13 elseif(k.eq.8) then date=0529 hour=14 elseif(k.eq.9) then date=0529 hour=16 elseif(k.eq.10) then date=0529 hour=18 elseif(k.eq.11) then date=0529 hour=19 elseif(k.eq.12) then date=0529 hour=21 endif do s=1,5 print*, s,' Beginning Orbit Binning Process...' if(s.eq.1)then write (eqinfile,'(A7,I4.4,A1,I2.2,A13)') 'Orbits/',date,'_',hour,'_EqPlot_1.grd' write (eqoutfile,'(I4.4,A1,I2.2,A17)') date,'_',hour,'_EqPlot_1_bin.grd' elseif(s.eq.2)then write (eqinfile,'(A7,I4.4,A1,I2.2,A13)') 'Orbits/',date,'_',hour,'_EqPlot_2.grd' write (eqoutfile,'(I4.4,A1,I2.2,A17)') date,'_',hour,'_EqPlot_2_bin.grd' elseif(s.eq.3)then write (eqinfile,'(A7,I4.4,A1,I2.2,A13)') 'Orbits/',date,'_',hour,'_EqPlot_3.grd' write (eqoutfile,'(I4.4,A1,I2.2,A17)') date,'_',hour,'_EqPlot_3_bin.grd' elseif(s.eq.4)then write (plinfile,'(A7,I4.4,A1,I2.2,A11)') 'Orbits/',date,'_',hour,'_spolar.grd' write (ploutfile,'(I4.4,A1,I2.2,A15)') date,'_',hour,'_spolar_bin.grd' else write (plinfile,'(A7,I4.4,A1,I2.2,A11)') 'Orbits/',date,'_',hour,'_npolar.grd' write (ploutfile,'(I4.4,A1,I2.2,A15)') date,'_',hour,'_npolar_bin.grd' endif do i=1,600 do j=1,600 eqorbitbin(i,j)=0 eqorbitbincnt(i,j)=0 if(i.le.400.and.j.le.400) then plorbitbin(i,j)=0 plorbitbincnt(i,j)=0 endif enddo enddo if(s.lt.4)then !!do eq plots !! read in headers and orbit image arrays open(12,file=eqinfile,form='formatted',readonly) read(12,120)dum read(12,120)dum read(12,120)dum read(12,120)dum read(12,120)dum 120 format(a20) read(12,12)((eqorbit(i,j),i=1,1200),j=1,1200) 12 format(20i6) close(12) !! re-bin orbit do testi=2,1200,2 do testj=2,1200,2 do i=testi-1,testi do j=testj-1,testj if(eqorbit(i,j).gt.0) then eqorbitbin(testi/2,testj/2)=eqorbitbin(testi/2,testj/2)+eqorbit(i,j) eqorbitbincnt(testi/2,testj/2)=eqorbitbincnt(testi/2,testj/2)+1 endif enddo enddo enddo enddo do i=1,600 do j=1,600 if(eqorbitbin(i,j).ne.0) eqorbitbin(i,j)=eqorbitbin(i,j)/eqorbitbincnt(i,j) enddo enddo else !!do polar plots !! read in headers and orbit image arrays open(17,file=plinfile,form='formatted',readonly) read(17,122)dum read(17,122)dum read(17,122)dum read(17,122)dum read(17,122)dum 122 format(a20) read(17,17)((plorbit(i,j),i=1,1600),j=1,1600) 17 format(20i6) close(17) !! re-bin orbit do testi=4,1600,4 do testj=4,1600,4 do i=testi-3,testi do j=testj-3,testj if(plorbit(i,j).gt.0) then plorbitbin(testi/4,testj/4)=plorbitbin(testi/4,testj/4)+plorbit(i,j) plorbitbincnt(testi/4,testj/4)=plorbitbincnt(testi/4,testj/4)+1 endif enddo enddo enddo enddo do i=1,400 do j=1,400 if(plorbitbin(i,j).ne.0) plorbitbin(i,j)=plorbitbin(i,j)/plorbitbincnt(i,j) enddo enddo endif if(s.lt.4)then !!Write image(orbit re-binned) to file open (14,file = eqoutfile, form = 'formatted') if(s.eq.1)then write(14,14) 14 format('DSAA'/'600 600'/'0 120'/'-60 60'/'0 1400') elseif(s.eq.2)then write(14,15) 15 format('DSAA'/'600 600'/'120 240'/'-60 60'/'0 1400') else write(14,16) 16 format('DSAA'/'600 600'/'240 360'/'-60 60'/'0 1400') endif do j=1,600 write(14,'(20i6)')(eqorbitbin(i,j),i=1,600) enddo close(14) else !!Write image(orbit re-binning) to file open (19,file = ploutfile, form = 'formatted') write(19,19) 19 format('DSAA'/'400 400'/'-40 40'/'-40 40'/'0 1400') do j=1,400 write(19,'(20i6)')(plorbitbin(i,j),i=1,400) enddo close(19) endif enddo !!end s loop to include all 5 maps of the sky enddo !!end k loop to include many orbits print*, 'Fortran out!!!' end