C+ C NAME: C read_image_t_x_y.f C PURPOSE: C Read the ASHI image times and te centroid of the star from a file, and provide them to the main program as Julian dates C and x y pixel positions C CATEGORY: C I/O C CALLING SEQUENCE: C call read_image_t_x_y(cfilei,NLOBSM,NOBS,JDX,x,y) C C INPUTS: C cfilei character Name of the ASHI image time file C NOBSM integer Maximum number of image values possible in the file C C OUTPUTS: C NOBS integer # valid number of image times recorded for this star C JDX (NOBSM) real*8 Julian date of the observation C x (NOBSM) real x position of the stellar centroid C y (NOBSM) real y position of the stellar centroid C C FUNCTIONS/SUBROUTINES: C julian8, date_doy C C MODIFICATION HISTORY: C April-2022, Bernard Jackson (UCSD) C- subroutine read_image_t_x_y(cfilei,NOBSM,NOBS,JDX,x,y) character cfilei*27 character SRC(10)*60 real x (NOBSM) real y (NOBSM) real*8 JDX(NOBSM) real*8 doy8,doy8x,doy8l,JDio,JEpoch print*,' ' print*, ' Into read_image_t_x_y' print*, cfilei open (13, file=cfilei,status='old',recl=120,access='sequential',form='formatted',iostat=iReadashi) if(iReadashi.ne.0) then print *, 'There is no ashi image file in this directory.' close(13) stop end if NOBS = 0 C doy8l = -1.0d0 C doy8x = 0.0d0 do I=1,NOBSM read (13,'(I5,2X,I4,2(1X,I2),3(1X,I2),2X,2F8.3)',iostat=iReadashi) inum,iY,iMM,iD,iH,iM,iS,xx,yy if(iReadashi.eq.0) then if(I.ge.2) then NOBS = NOBS + 1 call DATE_DOY(0,iY,cMon,iMM,iD,iDoy) doy8 = dfloat(iDoy)+(dfloat(iH)/24.d0)+(dfloat(iM)/(1440.d0))+(dfloat(iS)/(86400.d0)) + doy8x C if(doy8.lt.doy8l) then C doy8x = 1.0d0 C doy8 = doy8 + 1.0d0 C end if C doy8l = doy8 call Julian8(0,iy,doy8,JDio,JEpoch) JDX(NOBS) = JDio ! Julian date in days C Add 6 hours to make up for MDT to UTC difference, +5m 18s of slow computer diff, and -2.5 s of image difference JDX(NOBS) = JDX(NOBS) + 6.0d0/24.0d0 + 5.0d0/1440.0d0 + 18.0d0/86400.0d0 - 2.5d0/86400.0d0 x (NOBS) = xx y (NOBS) = YY if(inum.ne.NOBS) write(*,'(A,2I6)') 'NOBS .ne. inum',NOBS, inum end if else close(13) print *, ' ' print *, 'Number of ASHI image x, y values read in =',NOBS print *, ' ' return end if C if(NOBS.gt.0.and.NOBS.le.30) write (*,'(I4,I5,2I3,2X,3I3,F15.7,F22.7)') NOBS,iY,iMM,iD,iH,iM,iS,doy8,JDX(NOBS) C if(NOBS.eq.1000) print*, ' ' C if(NOBS.gt.4567) write (*,'(I4,I5,2I3,2X,3I3,F15.7,F22.7)') NOBS,iY,iMM,iD,iH,iM,iS,doy8,JDX(NOBS) end do return end