152 implicit double precision(a-h,o-z)
153 parameter(maxedits = 10000)
169 character*10 dummy1,dummy2,dummy3
170 character*10 EditRegion(maxedits)
171 character*10 EditOldDtm(maxedits)
172 character*10 EditNewDtm(maxedits)
173 character*6 EditPID(maxedits)
174 character*1 EditRejLat(maxedits)
175 character*1 EditRejLon(maxedits)
176 character*1 EditRejEht(maxedits)
190 character*13 clath,clatf
191 character*14 clonh,clonf
192 character*9 cehth,cehtf
194 character*10 olddtm,newdtm,region
196 character*1 rejlat,rejlon,rejeht
198 character*200 suffix1
200 logical badlat,badlon,badeht
205 logical EditTracker(maxedits)
211 1001
format(
'BEGIN program makework.f')
231 suffix1=trim(olddtm)//
'.'//trim(newdtm)//
'.'//trim(region)
236 cfname=
'Control/control.'//trim(suffix1)
237 open(1,file=cfname,status=
'old',form=
'formatted')
238 write(6,1004)trim(cfname)
239 1004
format(6x,
'makework.f: Accessing control file ',a)
244 efname=
'Work/workedits' 245 open(20,file=efname,status=
'old',form=
'formatted')
246 write(6,1006)trim(efname)
247 1006
format(6x,
'makework.f: Accessing workedits file ',a)
253 wfname =
'Work/work.'//trim(suffix1)
254 open(2,file=wfname,status=
'new',form=
'formatted')
256 write(6,1002)trim(wfname)
257 1002
format(6x,
'makework.f: Creating work file ',a)
262 pi = 2.d0*dasin(1.d0)
290 if(card(1:6).ne.cline)
then 291 write(6,6000)cline,trim(cfname)
294 cheader = trim(card(8:200))
300 if(card(1:6).ne.cline)
then 301 write(6,6000)cline,trim(cfname)
304 cregion = trim(card(8:200))
309 if(card(1:6).ne.cline)
then 310 write(6,6000)cline,trim(cfname)
313 cdatum1 = trim(card(8:200))
318 if(card(1:6).ne.cline)
then 319 write(6,6000)cline,trim(cfname)
322 cdatum2 = trim(card(8:200))
334 if(card(1:6).ne.cline)
then 335 write(6,6000)cline,trim(cfname)
338 read(trim(card(8:200)),*)rejmet
345 if(card(1:6).ne.cline)
then 346 write(6,6000)cline,trim(cfname)
349 read(card(9:10),*)nfiles
351 6000
format(6x,
'makework.f: Expecting ',a6,
' line in ',
352 *a,
' but not found. Stopping')
368 neditsrelevantlat = 0
369 neditsrelevantlon = 0
370 neditsrelevanteht = 0
372 neditsrelevantused = 0
373 neditsrelevantusedlat = 0
374 neditsrelevantusedlon = 0
375 neditsrelevantusedeht = 0
377 701
read(20,702,end=703)card
380 if(card(1:1).eq.
'#' .or. card(1:1).eq.
' ')
goto 701
381 neditstotal = neditstotal + 1
382 if(trim(card( 1: 10)) .eq. trim(olddtm) .and.
383 * trim(card( 12: 21)) .eq. trim(newdtm) .and.
384 * trim(card( 23: 32)) .eq. trim(region) )
then 385 neditsrelevant = neditsrelevant + 1
387 edittracker(neditsrelevant) = .false.
389 if(card(41:41).eq.
'1')
then 390 neditsrelevantlat = neditsrelevantlat + 1
392 if(card(42:42).eq.
'1')
then 393 neditsrelevantlon = neditsrelevantlon + 1
395 if(card(43:43).eq.
'1')
then 396 neditsrelevanteht = neditsrelevanteht + 1
399 editolddtm(neditsrelevant) = card( 1: 10)
400 editnewdtm(neditsrelevant) = card( 12: 21)
401 editregion(neditsrelevant) = card( 23: 32)
402 editpid(neditsrelevant) = card( 34: 39)
403 editrejlat(neditsrelevant) = card( 41: 41)
404 editrejlon(neditsrelevant) = card( 42: 42)
405 editrejeht(neditsrelevant) = card( 43: 43)
407 if(editrejlat(neditsrelevant).eq.
'0')
then 408 editrejlat(neditsrelevant) =
' ' 410 if(editrejlon(neditsrelevant).eq.
'0')
then 411 editrejlon(neditsrelevant) =
' ' 413 if(editrejeht(neditsrelevant).eq.
'0')
then 414 editrejeht(neditsrelevant) =
' ' 423 703
write(6,704)neditstotal,neditsrelevant,
424 *neditsrelevantlat,neditsrelevantlon,neditsrelevanteht
425 704
format(6x,
'makework.f: Total Manual Edits Found: ',i6,/,
426 * 6x,
' Initial Relevant Manual Edits Found: ',i6,/,
427 * 6x,
' ...of these, # in LAT : ',i6,/,
428 * 6x,
' # in LON : ',i6,/,
429 * 6x,
' # in EHT : ',i6)
435 fname=
'InFiles/'//trim(fname0)
436 write(6,999)trim(fname)
437 999
format(6x,
'makework.f: Processing file: ',a)
438 open(10,file=fname,status=
'old',form=
'formatted')
440 read(10,100)nameh,namef
442 2
read(10,101,end=98)pid,state,clath,clonh,cehth,clatf,clonf,cehtf
446 if(clath(11:13).eq.
'N/A' .or.
447 * clatf(11:13).eq.
'N/A')badlat=.true.
448 if(clonh(12:14).eq.
'N/A' .or.
449 * clonf(12:14).eq.
'N/A')badlon=.true.
450 if(cehth( 7: 9).eq.
'N/A' .or.
451 * cehtf( 7: 9).eq.
'N/A')badeht=.true.
454 if ( badlat .and. badlon .and. badeht)
then 458 elseif( badlat .and. badlon .and. .not.badeht)
then 462 elseif( badlat .and. .not.badlon .and. badeht)
then 466 elseif( badlat .and. .not.badlon .and. .not.badeht)
then 470 elseif(.not.badlat .and. badlon .and. badeht)
then 474 elseif(.not.badlat .and. badlon .and. .not.badeht)
then 478 elseif(.not.badlat .and. .not.badlon .and. badeht)
then 482 elseif(.not.badlat .and. .not.badlon .and. .not.badeht)
then 492 read(clath(2: 3),
'(i2.2)')ilatdh
493 read(clath(4: 5),
'(i2.2)')ilatmh
494 read(clath(6:13),
'(f8.5)')xlatsh
495 read(clatf(2: 3),
'(i2.2)')ilatdf
496 read(clatf(4: 5),
'(i2.2)')ilatmf
497 read(clatf(6:13),
'(f8.5)')xlatsf
498 xlath = dble(ilatdh) + dble(ilatmh)/60.d0 + xlatsh/3600.d0
499 if(clath(1:1).eq.
'S')xlath = -xlath
500 xlatf = dble(ilatdf) + dble(ilatmf)/60.d0 + xlatsf/3600.d0
501 if(clatf(1:1).eq.
'S')xlatf = -xlatf
504 dlatsec = dlat * 3600.d0
510 read(clonh(2: 4),
'(i3.3)')ilondh
511 read(clonh(5: 6),
'(i2.2)')ilonmh
512 read(clonh(7:14),
'(f8.5)')xlonsh
513 read(clonf(2: 4),
'(i3.3)')ilondf
514 read(clonf(5: 6),
'(i2.2)')ilonmf
515 read(clonf(7:14),
'(f8.5)')xlonsf
516 xlonh = dble(ilondh) + dble(ilonmh)/60.d0 + xlonsh/3600.d0
517 if(clonh(1:1).eq.
'W')xlonh = 360.d0 - xlonh
518 xlonf = dble(ilondf) + dble(ilonmf)/60.d0 + xlonsf/3600.d0
519 if(clonf(1:1).eq.
'W')xlonf = 360.d0 - xlonf
524 if(clath(11:13).ne.
'N/A')
then 525 coslat = dcos(xlath*d2r)
527 if(clatf(11:13).ne.
'N/A')
then 528 coslat = dcos(xlatf*d2r)
536 dlonsec = dlon * 3600.d0
537 dlonm = coslat*dlon*d2r*re
541 read(cehth(1: 9),
'(f9.3)')xehth
542 read(cehtf(1: 9),
'(f9.3)')xehtf
543 dehtm = xehtf - xehth
546 if(.not.badlat .and. .not.badlon)
then 547 dhorsec = dsqrt(dlatsec**2 + dlonsec**2)
548 dhorm = dsqrt(dlatm**2 + dlonm**2)
549 azhor = datan2(dlonm,dlatm)/d2r
550 if(azhor.lt.0)azhor = azhor + 360.d0
554 if(dabs(dlatm).gt.rejmet .or.
555 * dabs(dlonm).gt.rejmet .or.
556 * dabs(dhorm ).gt.rejmet )
then 594 if(xlath.lt.xs.or.xlath.gt.xn .or.
595 * xlonh.lt.xw.or.xlonh.gt.xe)
then 596 noutside = noutside + 1
603 write(6,2003)pid,xlath,xlonh
606 * 6x,
'program makework.f: InFile point found',
607 *
' and flagged with 444 which is outside ',
608 *
' the grid boundaries:',a6,1x,f14.10,1x,f14.10)
613 if(.not.badlat .and. .not.badlon)
then 614 if(xlath.lt.xlatmin)xlatmin=xlath
615 if(xlath.gt.xlatmax)xlatmax=xlath
616 if(xlonh.lt.xlonmin)xlonmin=xlonh
617 if(xlonh.gt.xlonmax)xlonmax=xlonh
624 do 720 irel = 1,neditsrelevant
626 751
format(
'Checking irel=',i4,
' PID=',a6,
627 *
' against true pid=',a6)
628 if(trim(editpid(irel)).ne.pid)
goto 720
633 edittracker(irel) = .true.
645 if(rejlat.eq.
'0' .or. rejlat.eq.
' ')
646 * rejlat = editrejlat(irel)
647 if(rejlon.eq.
'0' .or. rejlon.eq.
' ')
648 * rejlon = editrejlon(irel)
649 if(rejeht.eq.
'0' .or. rejeht.eq.
' ')
650 * rejeht = editrejeht(irel)
663 write(2,104)pid,state,rejlat,rejlon,rejeht,xlath,xlonh,xehth,
664 * dlatsec,dlonsec,dehtm,dhorsec,azhor,dlatm,dlonm,dhorm,
669 if(rejlat.eq.
' ')nptslat = nptslat + 1
670 if(rejlon.eq.
' ')nptslon = nptslon + 1
671 if(rejeht.eq.
' ')nptseht = nptseht + 1
673 104
format(a6,1x,a2,a1,a1,a1,1x,f14.10,1x,f14.10,1x,f8.3,1x,
674 * f9.5,1x,f9.5,1x,f9.3,1x,f9.5,1x,f9.5,1x,f9.3,1x,f9.3,1x,f9.3,
735 do 740 irel = 1,neditsrelevant
736 if(edittracker(irel))
goto 740
737 inotrel = inotrel + 1
738 if(editrejlat(irel).eq.
'1')
then 739 inotrellat = inotrellat + 1
741 if(editrejlon(irel).eq.
'1')
then 742 inotrellon = inotrellon + 1
744 if(editrejeht(irel).eq.
'1')
then 745 inotreleht = inotreleht + 1
747 write(6,731)editpid(irel)
749 * 6x,
'program makework.f: So-called Relevant Edit not used',
750 *
' since PID is not in the incoming data:',a6)
753 neditsrelevantused = neditsrelevant - inotrel
754 neditsrelevantusedlat = neditsrelevantlat - inotrellat
755 neditsrelevantusedlon = neditsrelevantlon - inotrellon
756 neditsrelevantusedeht = neditsrelevanteht - inotreleht
758 write(6,732)neditsrelevantused,neditsrelevantusedlat,
759 * neditsrelevantusedlon,neditsrelevantusedeht
760 732
format(6x,
'makework.f: ',/,
761 * 6x,
' Final Relevant Manual Edits Found: ',i6,/,
762 * 6x,
' ...of these, # in LAT : ',i6,/,
763 * 6x,
' # in LON : ',i6,/,
764 * 6x,
' # in EHT : ',i6)
768 write(6,1005)xlatmin,xlatmax,xlonmin,xlonmax
770 *6x,
'program makework.f: Minimum latitude: ',f14.10,/,
771 *6x,
'program makework.f: Maximum latitude: ',f14.10,/,
772 *6x,
'program makework.f: Minimum longitude: ',f14.10,/,
773 *6x,
'program makework.f: Maximum longitude: ',f14.10)
777 write(6,1010)npts,nptslat,nptslon,nptseht
779 *6x,
'program makework.f: Total records in work file: ',i9,/,
780 *6x,
'program makework.f: With a usable LAT diff : ',i9,/,
781 *6x,
'program makework.f: With a usable LON diff : ',i9,/,
782 *6x,
'program makework.f: With a usable EHT diff : ',i9)
787 1003
format(
'END program makework.f')
792 100
format(27x,a15,26x,a15)
793 101
format(a6,1x,a2,5x,a13,1x,a14,1x,a9,3x,a13,1x,a14,1x,a9)
794 102
format(f15.9,1x,f14.9,1x,f5.1)
795 103
format(6x,
'makework.f: Done with file : ',a)
799 include
'Subs/getgridbounds.f' program makework
Program to create a work file which will serve as the primary information needed to analyze and creat...
subroutine getgridbounds(region, xn, xs, xw, xe)
Subroutine to collect up the GRID boundaries for use in creating NADCON 5.