C+ C NAME: C pr_t_lat_lon_2rot_delt_rm.f C PURPOSE: C print_the Image #, Julian date, Sidereal Time, interpolated latitude and longitude of each image, and the rotations C and delta rotations. C C CATEGORY: C I/O C CALLING SEQUENCE: C pr_t_lat_lon_2rot_delt_rm(NOBS,NSTAR,JJ,Iave,JDbeg,JDX,ST,alatyy,alonxx,AROTA) C C INPUTS: C NOBS integer Number of star images used' C NSTAR integer Number of stars with determined centroids C JJ integer Star that is used to determine the pole (1 for Polaris) C Iave integer number of image distances relative to the center to provide a running mean, 1,2,3, etc. C JDbeg real*8 Julian date that is used to begin the ASHI observations (8 pm MST August 25, 2022 or 2 am UT August 26, 2022) C JDX (NOBS) real*8 Julian Date of the image observation time (in UT) C ST (NOBS) real Sidereal time (in degrees) C alatyy(NOBS) real Interpolated latitude of ASHI C alonxx(NOBS) real Interpolated longitude of ASHI C AROTA (NOBS) real Rotation to get the pole to the image top without sidereal time C C OUTPUTS: C I integer The image number measured C JDX (NOBS) real*8 Julian Date of the image observation time C JDX in hours, min, sec C ST Sidereal time in degrees C alatyy(NOBS) real Interpolated latitude C alonxx(NOBS) real Interpolated longitude C AROTA (NOBS) real rotation to get back to the pole in degrees C DAROTA delta rotation to get to the pole in degrees C AROTAS rotation to get back to the pole in degrees, sidereal time imposed C DAROTAS delta rotation to get back to the pole in degrees, sidereal time imposed C C FUNCTIONS/SUBROUTINES: C C MODIFICATION HISTORY: C September-2022, Bernard Jackson (UCSD) C- subroutine pr_t_lat_lon_2rot_delt_rm(NOBS,NSTAR,JJ,Iave,JDbeg,JDX,ST,alatyy,alonxx,AROTA) real alatyy(NOBS), & alonxx(NOBS), & ST (NOBS) real AROTA (NSTAR,NOBS) real DAROTA(NOBS), ! scratch arrays & DARPST(NOBS) real*8 JDX (NOBS), & JDbeg print*, ' ' print*, ' Into pr_t_lat_lon_2rot_delt_rm' do I=1,NOBS if(I.eq.1) then print*,'JD = Julian Date, and in UT in hours min, and secs of 26 August, 2022' print*,'ST = Sidereal time in degrees' print*,'lat,lon = latitude and west longitude of ASHI at the UT time (both in degrees)' print*,'Rot = Mean Rotation to place pole at the top of the image deltas are means' write(*,'(A,I3,A)')' Iave =',Iave,' is the image # distance from the Ith image used in the average' print*,'RotS = Mean Rot (HA-ST) from center Pol placed at one location delts mean 2' print*,' ' write(*,'(A)')'Image JD hh mm ss ST lat lon Rotrm DRot RotSrm DRotS' end if AJDsthu = (JDX(I) - JDbeg)*24.0d0 + 2.0d0 IAJDsthu = AJDsthu thum = (AJDsthu - IAJDsthu)*60.0 ithum = thum tsecu = (thum - ithum)*60.0 IAJDsthl = IAJDsthu - 6 if(IAJDsthl.lt.0) IAJDsthl = IAJDsthl + 12 ARPST = -AROTA(JJ,I)-ST(I) if(Iave.eq.0) then if(I.ne.NOBS) then DAROTA(I) = (-AROTA(JJ,I+1)) - (-AROTA(JJ,I)) DAROTAL = DAROTA(I) if(DAROTA(I).lt.-180.0) DAROTA(I) = DAROTA(I) + 360.0 if(DAROTA(I).gt.180.0) DAROTA(I) = DAROTA(I) - 360.0 DARPST(I) = (-AROTA(JJ,I+1)-ST(I+1)) - (-AROTA(JJ,I)-ST(I)) if(DARPST(I).lt.-180.0) DARPST(I) = DARPST(I) + 360.0 if(DARPST(I).gt.180.0) DARPST(I) = DARPST(I) - 360.0 DARPSTL = DARPST(I) else DAROTA = DAROTAL DARPST = DARPSTL end if if(ARPST.lt.0.0) ARPST = ARPST + 360.0 if(ARPST.gt.360.0) ARPST = ARPST - 360.0 end if if(I.gt.Iave.and.I.le.(NOBS-Iave).and.Iave.ne.0) then ANAVE = 0.0 ARPSTRM = 0.0 do II=I-Iave,I+Iave ANAVE = ANAVE + 1.0 AROTAST = -AROTA(JJ,II)-ST(II) if(II.eq.(I-Iave)) then ARPSTRM = AROTAST AROTAST1 = AROTAST end if if(II.gt.(I-Iave).and.abs(-AROTAST+AROTAST1).lt.180.0) then ! No problem ARPSTRM = ARPSTRM + AROTAST ! Not bad end if ! AROTARM is going to be either .lt. 0.0 or .gt. 360.0 if(II.gt.(I-Iave).and.abs(-AROTAST+AROTAST1).gt.180.0) then ! A problem if(-AROTAST+AROTAST1.lt.180.0) AROTAST = -360.0 + AROTAST if(-AROTAST+AROTAST1.gt.180.0) AROTAST = AROTAST + 360.0 ARPSTRM = ARPSTRM + AROTAST end if end do ARPSTRM = ARPSTRM/ANAVE if(ARPSTRM.gt.360.0) ARPSTRM = ARPSTRM - 360.0 if(ARPSTRM.lt.0.0) ARPSTRM = ARPSTRM + 360.0 end if if(I.gt.Iave.and.I.le.(NOBS-Iave).and.Iave.ne.0) then ! This seems to work ANAVE = 0.0 AROTARM = 0.0 do II=I-Iave,I+Iave ANAVE = ANAVE + 1.0 if(II.eq.(I-Iave)) AROTARM = -AROTA(JJ,II) C if(I.lt.5000) write(*,'(A,3I5,4F9.4)')' here 2 ',I,Iave,II,-AROTA(JJ,II),-AROTA(JJ,I-Iave),ANAVE,AROTARM if(II.gt.(I-Iave).and.abs(-AROTA(JJ,II)+AROTA(JJ,I-Iave)).lt.180.0) then ! No problem AROTARM = AROTARM - AROTA(JJ,II) Ibad = 0 ! Not bad C if(I.lt.5000) write(*,'(A,3I5,4F9.4)')' here 2a',I,Iave,II,-AROTA(JJ,II),-AROTA(JJ,I-Iave),ANAVE,AROTARM end if ! AROTARM is going to be either .lt. 0.0 or .gt. 360.0 if(II.gt.(I-Iave).and.abs(-AROTA(JJ,II)+AROTA(JJ,I-Iave)).gt.180.0) then ! A problem C if(I.lt.5000) write(*,'(A,3I5,4F9.4)')'here 2b1',I,Iave,II,-AROTA(JJ,II),-AROTA(JJ,I-Iave),ANAVE,AROTARM if(-AROTA(JJ,II)+AROTA(JJ,I-Iave).lt.180.0) AROTARM = AROTARM -AROTA(JJ,II) + 360.0 if(-AROTA(JJ,II)+AROTA(JJ,I-Iave).gt.180.0) AROTARM = AROTARM -AROTA(JJ,II) - 360.0 C if(I.lt.5000) write(*,'(A,3I5,4F9.4)')'here 2b2',I,Iave,II,-AROTA(JJ,II),-AROTA(JJ,I-Iave),ANAVE,AROTARM Ibad = 1 end if end do AROTARM = AROTARM/ANAVE if(Ibad.eq.1.and.AROTARM.gt.360.0) AROTARM = AROTARM - 360.0 if(Ibad.eq.1.and.AROTARM.lt.0.0) AROTARM = AROTARM + 360.0 C if(I.lt.5000) write(*,'(A,3I5,18X,2F9.4)')' here 3 ',I,Iave,II,ANAVE,AROTARM end if if(I.gt.Iave.and.I.le.(NOBS-Iave).and.Iave.ne.0) then ! Bad =-see 2740 2474 2050 ANAVE = 0.0 DAROTARM = 0.0 DARPSTRM = 0.0 do II=I-Iave,I+Iave-1 DARO = (-AROTA(JJ,II+1)) - (-AROTA(JJ,II)) if(DARO.lt.-180.0) DARO = DARO + 360.0 if(DARO.gt.180.0) DARO = DARO - 360.0 DAROTARM = DAROTARM + DARO DAROS = (-AROTA(JJ,II+1)-ST(II+1)) - (-AROTA(JJ,II)-ST(II)) if(DAROS.lt.-180.0) DAROS = DAROS + 360.0 if(DAROS.gt.180.0) DAROS = DAROS - 360.0 DARPSTRM = DARPSTRM + DAROS ANAVE = ANAVE + 1.0 C print*,'here 1',Iave,II,DAROTARM,DARPSTRM,ANAVE end do DAROTARM = DAROTARM/ANAVE DARPSTRM = DARPSTRM/ANAVE else if(Iave.gt.0.and.I.le.Iave) then ANAVE = 0.0 DAROTARM = 0.0 DARPSTRM = 0.0 do II=1,I+Iave-1 DAROTARM = DAROTARM + (-AROTA(JJ,II+1)) - (-AROTA(JJ,II)) DARPSTRM = DARPSTRM + (-AROTA(JJ,II+1)-ST(II+1)) - (-AROTA(JJ,II)-ST(II)) ANAVE = ANAVE + 1.0 C print*,'here 2',Iave,II,DAROTARM,DARPSTRM,ANAVE end do DAROTARM = DAROTARM/ANAVE DARPSTRM = DARPSTRM/ANAVE end if if(Iave.gt.0.and.I.gt.(NOBS-Iave)) then ANAVE = 0.0 DAROTARM = 0.0 DARPSTRM = 0.0 do II=I-Iave,NOBS-1 DAROTARM = DAROTARM + (-AROTA(JJ,II+1)) - (-AROTA(JJ,II)) DARPSTRM = DARPSTRM + (-AROTA(JJ,II+1)-ST(II+1)) - (-AROTA(JJ,II)-ST(II)) ANAVE = ANAVE + 1.0 C print*,'here 3',Iave,II,DAROTARM,DARPSTRM,ANAVE end do DAROTARM = DAROTARM/ANAVE DARPSTRM = DARPSTRM/ANAVE end if end if if(Iave.eq.0) write(*,'(I4,F14.5,I2,I3,F5.1,F8.3,F6.2,F7.2,2(F7.2,F7.3))'), & I,JDX(I),IAJDsthu,ithum,tsecu,ST(I),alatyy(I),alonxx(I),-AROTA(JJ,I),DAROTA(I),ARPST,DARPST(I) if(Iave.ne.0) write(*,'(I4,F14.5,I2,I3,F5.1,F8.3,F6.2,F7.2,2(F7.2,F7.3))'), & I,JDX(I),IAJDsthu,ithum,tsecu,ST(I),alatyy(I),alonxx(I),AROTARM,DAROTARM,ARPSTRM,DARPSTRM end do print*, ' Out of pr_t_lat_lon_2rot_delt_rm' return end