parameter(n=28000,pi=3.141592654) character str(n)*43 dimension julhr(n),ylat(n),xlon(n),li(n) integer year,day,hour real lesser data m/0/ c 100 m = m + 1 read(*,'(a)',end=200)str(m) call teger(str(m)(1:4),year,1770,2024) call teger(str(m)(5:6),month,1,12) call teger(str(m)(7:8),day,1,31) if (str(m)(9:12).eq.' 0') str(m)(9:12)=' 000' call teger(str(m)(9:10),hour,0,24) julhr(m) = ixdtnd(day,month,year) if (julhr(m).gt.-1) then if (hour.eq.99) hour=12 julhr(m) = julhr(m)*24+hour endif call teger(str(m)(13:17),lat,-9000,9000) call teger(str(m)(18:23),lon,-18060,18060) li(m)=9 if (lat.ne.99999) then li(m)=4 endif if (lon.ne.999999) then li(m)=4 endif call redths(lat,ylat(m)) call redths(lon,xlon(m)) if (lon.ne.999999) xlon(m)=mod(xlon(m)+360.,360.) goto 100 c 200 m = m - 1 do i=1,m if (ylat(i).ne.99999/100. .and. julhr(i).gt.-1) then k=i+1 goto 210 endif enddo goto 215 210 if (ylat(k).ne.99999/100. .and. julhr(k).gt.-1) then c1 = ylat(k)-ylat(i) c2 = julhr(k)-julhr(i) if (c2.ge.-23.and.c2.le.0) c2=c2+24. if (c2.gt.0 + .and. c2.lt.24.*31.*6. .and. abs(c1/c2).le.8./24. + .and. abs(c1).le.32.) then do j=i+1,k-1 if (julhr(j).gt.-1) then dt=julhr(j)-julhr(i) if (dt.lt.0) dt=dt+24. ylat(j)=ylat(i)+dt*c1/c2 li(j)=3 endif enddo endif i=k k=i+1 else k=k+1 endif if (k.le.m) goto 210 c 215 continue do i=1,m if (xlon(i).ne.999999/100. .and. julhr(i).gt.-1) then k=i+1 goto 220 endif enddo goto 300 220 if (xlon(k).ne.999999/100. .and. julhr(k).gt.-1) then c1 = lesser(xlon(k)-xlon(i)) c2 = julhr(k)-julhr(i) if (c2.ge.-23.and.c2.le.0) c2=c2+24. if (ylat(i).ne.99999/100. .and. ylat(k).ne.99999/100.) then c3 = ylat(k)-ylat(i) y=ylat(i)+c3/2. else c3 = 0. if (ylat(i).ne.99999/100.) then y=ylat(i) else if (ylat(k).ne.99999/100.) then y=ylat(k) else y=45. endif endif weight=cos(y*pi/180.) if (c2.gt.0 + .and. c2.lt.24.*31.*6. .and. abs(c1*weight/c2).le.8./24. + .and. sqrt(c1*weight*c1*weight+c3*c3).le.32.) then c WRITE(*,'(F9.1)')ABS(C1*WEIGHT/C2)*24. do j=i+1,k-1 if (julhr(j).gt.-1) then dt=julhr(j)-julhr(i) if (dt.lt.0) dt=dt+24. xlon(j)=mod(xlon(i)+dt*c1/c2+360.,360.) li(j)=3 endif enddo endif i=k k=i+1 else k=k+1 endif if (k.le.m) goto 220 c 300 do i=1,m if (nint(xlon(i)*100.).eq.36000) xlon(i)=0. write(*,'(a,i5,i6,a,i1,a)')str(i)(:12) + ,nint(ylat(i)*100.),nint(xlon(i)*100.) + ,str(i)(24:27),li(i),str(i)(29:) enddo end c-----------------------------------------------------------------------3456789 subroutine teger(str,int,min,max) character str*(*) c n = len(str) if (str.eq.' ') then str = '999999' goto 200 endif do 190 i=1,n if (str(i:i).eq.' ') goto 190 if (str(i:i).eq.'-') goto 190 if (str(i:i).lt.'0' .or. str(i:i).gt.'9') then str = '999999' goto 200 endif 190 continue 200 read(str,'(bz,i'//char(ichar('0')+n)//')')int if (index('999999',str).gt.0) return if (int.lt.min .or. int.gt.max) then str = '999999' goto 200 endif end c-----------------------------------------------------------------------3456789 subroutine redths(int,real) c if (abs(mod(int,100)).gt.60) then real = int/100. else real = int/100 + mod(int,100)/60. endif end C-----------------------------------------------------------------------3456789 real function lesser(x) if (abs(x).gt.360.-abs(x)) then lesser = -sign(360.-abs(x),x) else lesser = x endif end C-----------------------------------------------------------------------3456789 integer function ixdtnd(iday,imonth,iyear) c-----Convert from date (iday,imonth,iyear) to number of days since c 1 Jan 1770. c-----sjl, 17 Jun 1998. c-----sjw and sdw, 27 Apr 1999: return ixdtnd=-1 if date is invalid. c-----sdw, 26 Jan 2000: remove outdated variable ierr/comment. integer iday,imonth,iyear +,year,days(12) data days/31,28,31,30,31,30,31,31,30,31,30,31/ logical leap leap(year) = mod(year,4).eq.0 .and. mod(year,100).ne.0 + .or. mod(year,400).eq.0 c if (iyear.lt.1770 .or. iyear.gt.2024) then c print *,'ixdtnd error. iyear=',iyear ixdtnd = -1 return else if (imonth.lt.1 .or. imonth.gt.12) then c print *,'ixdtnd error. iyear=',iyear,', imonth=',imonth ixdtnd = -1 return else if (iday.lt.1 .or. iday.gt.days(imonth) + .and. (imonth.ne.2 .or. .not.leap(iyear) .or. iday.ne.29)) then c print *,'ixdtnd error. iyear=',iyear,', imonth=',imonth c + ,', iday=',iday ixdtnd = -1 return endif ndays = 0 do 190 year = 1770,iyear-1 ndays = ndays + 365 if (leap(year)) ndays = ndays + 1 190 continue do 290 month = 1,imonth-1 ndays = ndays + days(month) if (month.eq.2 .and. leap(iyear)) ndays = ndays + 1 290 continue ndays = ndays + iday-1 ixdtnd = ndays end