diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /lib/get_q3list.f90 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'lib/get_q3list.f90')
| -rw-r--r-- | lib/get_q3list.f90 | 99 |
1 files changed, 88 insertions, 11 deletions
diff --git a/lib/get_q3list.f90 b/lib/get_q3list.f90 index a6b6de81..d9b66e2d 100644 --- a/lib/get_q3list.f90 +++ b/lib/get_q3list.f90 @@ -1,5 +1,8 @@ subroutine get_q3list(fname,bDiskData,nlist,list) + use jpl_ephemeris_status, only: EPHEMERIS_INVALID_INPUT, & + EPHEMERIS_UNAVAILABLE + type q3list character*6 call character*4 grid @@ -8,13 +11,15 @@ subroutine get_q3list(fname,bDiskData,nlist,list) integer moonel end type q3list - parameter (MAX_CALLERS=40) + parameter (MAX_CALLERS=50) character*(*) fname - character*36 list(40) + character*37 list(MAX_CALLERS) character*8 grid6 logical*1 bDiskData integer time integer nt(8) + integer utc_year,utc_month,utc_day + integer ephemeris_result integer indx(MAX_CALLERS) type(q3list) ctmp(MAX_CALLERS),callers(MAX_CALLERS) character*256 jpleph_file_name,file24name @@ -24,7 +29,7 @@ subroutine get_q3list(fname,bDiskData,nlist,list) nhist2=0 open(24,file=fname,status='unknown',form='unformatted') read(24,end=1) nhist2 - if(nhist2.ge.1 .and. nhist2.le.40) then + if(nhist2.ge.1 .and. nhist2.le.MAX_CALLERS) then read(24,end=1) ctmp(1:nhist2) else nhist2=0 @@ -34,7 +39,7 @@ subroutine get_q3list(fname,bDiskData,nlist,list) now=time() call date_and_time(values=nt) - uth=nt(5) + (nt(6)-nt(4))/60.0 + nt(7)/3600.0 + call normalize_utc_calendar(nt,utc_year,utc_month,utc_day,uth) j=0 do i=1,nhist2 @@ -42,10 +47,13 @@ subroutine get_q3list(fname,bDiskData,nlist,list) if(age.gt.24.0) cycle grid6=ctmp(i)%grid//'mm' call grid2deg(grid6,xlon,xlat) - call sun(nt(1),nt(2),nt(3),uth,-xlon,xlat,RASun,DecSun,xLST, & - AzSun,ElSun,mjd,day) - call moondopjpl(nt(1),nt(2),nt(3),uth,-xlon,xlat,RAMoon,DecMoon, & - xLST,HA,AzMoon,ElMoon,vr,techo) + call sun(utc_year,utc_month,utc_day,uth,-xlon,xlat,RASun,DecSun, & + xLST,AzSun,ElSun,mjd,day) + call moondopjpl(utc_year,utc_month,utc_day,uth,-xlon,xlat,RAMoon, & + DecMoon, & + xLST,HA,AzMoon,ElMoon,vr,techo,ephemeris_result) + if(ephemeris_result.eq.EPHEMERIS_INVALID_INPUT .or. & + ephemeris_result.eq.EPHEMERIS_UNAVAILABLE) cycle if(ElMoon.lt.-5.0 .and. (.not.bDiskData)) cycle j=j+1 !Keep this one... callers(j)=ctmp(i) @@ -63,7 +71,7 @@ subroutine get_q3list(fname,bDiskData,nlist,list) age=(now - callers(j)%nsec)/3600.0 write(list(i),1000) i,callers(j)%nfreq,callers(j)%call, & callers(j)%grid,callers(j)%moonel,age,char(0) -1000 format(i2,'.',i6,2x,a6,2x,a4,i5,f7.1,a1) +1000 format(i2,'.',i6,2x,a6,2x,a4,i5,f7.1,1x,a1) ! h1=mod(now,86400)/3600.0 ! h2=mod(callers(i)%nsec,86400)/3600.0 @@ -81,9 +89,70 @@ subroutine get_q3list(fname,bDiskData,nlist,list) return end subroutine get_q3list +subroutine normalize_utc_calendar(values,year,month,day,uth) + + implicit none + + integer, intent(in) :: values(8) + integer, intent(out) :: year,month,day + real, intent(out) :: uth + real :: utc_seconds + + year=values(1) + month=values(2) + day=values(3) + utc_seconds=3600.0*values(5) + 60.0*values(6) + values(7) + & + 0.001*values(8) - 60.0*values(4) + + if(utc_seconds.lt.0.0) then + utc_seconds=utc_seconds + 86400.0 + day=day - 1 + if(day.lt.1) then + month=month - 1 + if(month.lt.1) then + year=year - 1 + month=12 + endif + day=days_in_month(year,month) + endif + else if(utc_seconds.ge.86400.0) then + utc_seconds=utc_seconds - 86400.0 + day=day + 1 + if(day.gt.days_in_month(year,month)) then + day=1 + month=month + 1 + if(month.gt.12) then + year=year + 1 + month=1 + endif + endif + endif + uth=utc_seconds/3600.0 + +contains + + integer function days_in_month(calendar_year,calendar_month) + integer, intent(in) :: calendar_year,calendar_month + logical :: leap_year + + select case(calendar_month) + case(4,6,9,11) + days_in_month=30 + case(2) + leap_year=mod(calendar_year,400).eq.0 .or. & + (mod(calendar_year,4).eq.0 .and. mod(calendar_year,100).ne.0) + days_in_month=28 + if(leap_year) days_in_month=29 + case default + days_in_month=31 + end select + end function days_in_month + +end subroutine normalize_utc_calendar + subroutine rm_q3list(dxcall0) - parameter (MAX_CALLERS=40) + parameter (MAX_CALLERS=50) type q3list character*6 call character*4 grid @@ -125,8 +194,16 @@ subroutine rm_q3list(dxcall0) end subroutine rm_q3list subroutine jpl_setup(fname) + use jpl_ephemeris_status, only: reset_jpl_reader character*256 fname,jpleph_file_name common/jplcom/jpleph_file_name - jpleph_file_name=fname + j = index(fname,char(0)) + if(j.eq.0) then + jpleph_file_name=fname + else + jpleph_file_name(1:j)=fname(1:j) + jpleph_file_name(j:)=' ' + endif + call reset_jpl_reader() return end subroutine jpl_setup |
