C+ C NAME: C program ashi_img_comb2 C PURPOSE: C To read the ASHI image grd files, rotate, stretch and combine them together C CALLING SEQUENCE: C ./ashi_img_comb C INPUTS: C N integer number of distance determinations = 4 C distx(N,I) real X distance in pixels from the axis C disty(N,I) real Y distance in pixels from the axis C offset1 real offset for determination 1 C offset2 real offset for determination 2 C offset3 real offset for determination 3 C offset4 real offset for determination 4 C C FUNCTIONS/SUBROUTINES: C read_grd_image C C MODIFICATION HISTORY: C November 2022, Bernard Jackson (UCSD) C- program ashi_img_comb2 parameter(NOBS = 4591) ! Potential Number of valid images parameter(NTOT = 35) ! Potential number of stellar values parameter(NXY = 2048) ! Maximum number of x or y values in each grd image parameter(ihead = 5) ! # of lines in the GRD file header real st (NOBS), ! Sidereal time for each measurement & rotrmm (NOBS), ! mean rotation from Matthew's center & rotrmb (NOBS), ! mean rotation from Bernie's center & xp (NOBS), ! mean X location of the pole in the original images & yp (NOBS), ! mean Y location of the pole in the original images & centxp (NOBS), ! Pole X mean center on unrotated image from Polaris & centyp (NOBS), ! Pole Y mean center on unrotated image from Polaris & centx (NOBS), ! Matthew's or Bernie's mean X center & centy (NOBS), ! Matthew's or Bernie's mean Y center & PDIST (NOBS) ! mean distance to the pole that needs to be calculated real RA (NTOT), ! Star RA (degrees) & DEC (NTOT), ! Star Dec (degrees) & amagsv(NTOT) ! Stellar V mag value character cfilei*52 /'./ASHI_grd_files/ASHI_Flight_Grds/ASHI_img_00000.grd'/ ! Location and name of an output file if there is one character cfileo*35 ! Location and name of the output file if there is one character cimghead(ihead)*9 ! Grd file 5 line header character cfile*21 /'Star_Bright_500_3.txt'/ character cfilrm*29 /'pr_t_lat_lon_2rot_delt_rm.txt'/ ! ST and Rotations from Matthew's and Bernie's center with sidereal time character cfilrb*26 /'pr_star_pole_cen_xy_rm.txt'/ ! Polaris location, pole location, and centroid of Bernie's center real aimagexy (NXY,NXY), ! Original image read in in floating point & aimagexyr(NXY,NXY), ! Rotated image in floating point & aimagexyn(NXY,NXY), ! image pixel hit number in floating point & aimagexyo(NXY,NXY), ! image pixel amplitudes removed & aimage (NXY,NXY,NOBS) ! images to combine integer imagexy(NXY,NXY) ! Original image read in in fixed point distcx = 1126.5 ! center of the image in X as determined by Matthew distcy = 1000.5 ! center of the image in Y as determined by Matthew dmax = 900.0 ! Distance from center beyond which image is zero C irotm = 0 irotm = 1 ! Read in ST and the rotation to get the pole to a vertical position print*, 'In program ashi_im_comb' if(irotm.eq.1) call read_rot_rm_matc(cfilrm,NOBS,st,rotrmm) ! Read in the sidereal time and mean rotation from Matthew's center irotb = 1 ! Read in the unrotated mean pole position if(irotb.eq.1) call read_cen_rm_bvjc(cfilrb,NOBS,centxp,centyp,centx,centy) ! Read in the mean rotation of the pole and Bernie's cent irotm = 1 if(irotm.eq.1) then ! overwrite mean centx and centy with Matthew's centers do I=1,NOBS centx(I) = distcx centy(I) = distcy end do end if if(irotb.eq.1) then ! determine the mean distance from Matthew's center to the pole position. do I=1,NOBS PDIST(I) = sqrt((centxp(I)-distcx)**2 + (centyp(I)-distcy)**2) C if(I.le.30) print*, I, PDIST(I) end do end if C stop C itype integer Type of file input and output C 0 = read in and write out a grd file with <= 5 integer digits C 1 = read in a grd file with <= 5 integer digits; write out a grd file with F8.1 floating values C 2 = read in a grd file with <= 5 integer digits; output a file with F8.1 floating values C 3 = read in and write out a grd file with F8.1 floating values C 4 = input a grd file with <= 5 integer digits; output with <= 5 integer digits values C 5 = input a grd file with <= 5 integer digits; output a file with F8.1 floating values C 6 = input a grd file with <= 5 integer digits; write out a grd file with F8.1 floating values C 7 = input a grd file with <= 5 integer digits; write out a grd file with <= 5 integer digits values C 8 = input a grd file with F8.1 floating values; write out a grd file with F8.1 floating values C 9 = input a grd file with F8.1 floating values; write out a grd file with <= 5 integer digits values C 10 = input a grd file with F8.1 floating values; output a grd file with F8.1 floating values C 11 = input a grd file with F8.1 floating values; output a file with F8.1 floating values C itype = 0 itype = 2 C C indx integer Type of operation for the rot_image_2pole subroutine C 0 = Rotate the image so that the pole is at the top (always do this) C 1 = indx 0 + shift index in y so pole is at the a given pixel location C 2 = indx 0 + 1 + warp the image relative to the y center pixel location C 3 = indx 0 + 1 + 2 + change the image to spherical coordinates C 4 = indx 0 + 1 + 2 + 3 + rotate the image location around the pole according to the new sidereal time indx = 0 inum1 = 2802 inum2 = 2813 inum3 = 4180 inum4 = 4191 C inum3 = 2802 C inum4 = 2813 if(itype.eq.0.or.itype.eq.6.and.inum.eq.500) cfileo = './ASHI_grd_files/ASHI_i90_10500.grd' ! fixed if(itype.eq.1.or.itype.eq.3.or.itype.eq.7.or.itype.eq.8.and.inum.eq.500) cfileo = './ASHI_grd_files/ASHI_img_20500.grd' ! floating do K=inum1,inum2 if(itype.eq.2) then write(*,'(A)') cfilei if(K.ge.1.and.K.le.9) write(cfilei(48:48),'(I1)') K if(K.ge.10.and.K.le.99) write(cfilei(47:48),'(I2)') K if(K.ge.100.and.K.le.999) write(cfilei(46:48),'(I3)') K if(K.ge.1000.and.K.le.9999) write(cfilei(45:48),'(I4)') K C write(*,'(A)') cfilei call read_grd_image(itype,cfilei,cfileo,NXY,dmax,cimghead,aimagexy,imagexy) do J=1,20 do I=1,20 C print*, I,J, aimagexy(I,J) aimage(I,J,K) = aimagexy(I,J) C aimage(I,J,K) = aimagexy(I,J) end do end do end if end do do K=inum3,inum4 if(itype.eq.2) then write(*,'(A)') cfilei if(K.ge.1.and.K.le.9) write(cfilei(48:48),'(I1)') K if(K.ge.10.and.K.le.99) write(cfilei(47:48),'(I2)') K if(K.ge.100.and.K.le.999) write(cfilei(46:48),'(I3)') K if(K.ge.1000.and.K.le.9999) write(cfilei(45:48),'(I4)') K C write(*,'(A)') cfilei call read_grd_image(itype,cfilei,cfileo,NXY,dmax,cimghead,aimagexy,imagexy) do J=1,NXY do I=1,NXY C aimage(I,J,K) = aimagexy(I,J) end do end do end if end do print*, 'Now stop here' stop end