101 implicit real*8(a-h,o-z)
102 parameter(maxlat=5000,maxlon=5000,maxpts=300000)
103 parameter(maxplots=60)
105 character*10 olddtm,newdtm,region
113 character*200 suffix1,suffix2,suffix3
114 character*200 suffix2t04
115 character*200 gmtfile
116 character*3 ele(7),el0(7)
119 real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
121 real*4 b1(maxplots),b2(maxplots)
122 character*10 fn(maxplots)
125 real*8 lorvog(7),lorvoggi(7)
126 real*8 scaledd(7),scalegi(7)
127 real*8 basedd(7),basegi(7)
128 real*8 lorvogprime,lorvogmeters
129 real*8 lorvogprimegi,lorvogmetersgi
130 real*8 lorvoghorgis,lorvoghorgim
131 real*8 lorvoghordds,lorvoghorddm
134 logical lrv(maxplots)
135 real*8 rv0x(maxplots),rv0y(maxplots),rl0y(maxplots)
139 character*200 gfnvmtcdlat,gfnvstcdlat
140 character*200 gfnvmtcdlon,gfnvstcdlon
141 character*200 gfnvmtcdeht
142 character*200 gfnvmtcdhor,gfnvstcdhor
145 character*200 gfnvmdcdlat,gfnvsdcdlat
146 character*200 gfnvmdcdlon,gfnvsdcdlon
147 character*200 gfnvmdcdeht
148 character*200 gfnvmdcdhor,gfnvsdcdhor
150 character*200 bfnvmtcdlat,bfnvstcdlat
151 character*200 bfnvmtcdlon,bfnvstcdlon
152 character*200 bfnvmtcdeht
155 logical*1 nothinlat,nothinlon,nothineht
163 character*200 gfnvmagilat,gfnvmtgilat,gfnvmdgilat
164 character*200 gfnvsagilat,gfnvstgilat,gfnvsdgilat
165 character*200 gfnvmagilon,gfnvmtgilon,gfnvmdgilon
166 character*200 gfnvsagilon,gfnvstgilon,gfnvsdgilon
167 character*200 gfnvmagieht,gfnvmtgieht,gfnvmdgieht
169 character*200 gfnvmagihor,gfnvmtgihor,gfnvmdgihor
170 character*200 gfnvsagihor,gfnvstgihor,gfnvsdgihor
220 character*200 gfnvmaddlat,gfnvmtddlat,gfnvmdddlat
221 character*200 gfnvsaddlat,gfnvstddlat,gfnvsdddlat
222 character*200 gfnvmaddlon,gfnvmtddlon,gfnvmdddlon
223 character*200 gfnvsaddlon,gfnvstddlon,gfnvsdddlon
224 character*200 gfnvmaddeht,gfnvmtddeht,gfnvmdddeht
226 character*200 gfnvmaddhor,gfnvmtddhor,gfnvmdddhor
227 character*200 gfnvsaddhor,gfnvstddhor,gfnvsdddhor
233 real*8 glamn,glomn,dla,dlo
234 integer*4 nla,nlo,ikind
235 real*4 datlats(maxlat,maxlon)
236 real*4 datlons(maxlat,maxlon)
237 real*4 datehtm(maxlat,maxlon)
248 character*20 units(5)
274 real*8 vgrd(3),vgrdm(3),dd(3),ddm(3)
280 character*20 coord(3)
285 real*8 xla0(maxpts),xlo0(maxpts)
286 real*8 dd0(maxpts),ddm0(maxpts),gi0(maxpts),gim0(maxpts)
287 character*6 pid0(maxpts)
297 1001
format(
'BEGIN program checkgrid.f')
305 pi = 2.d0*dasin(1.d0)
308 s2m = (1.d0/3600.d0)*d2r*re
311 coord(1) =
'LATITUDE' 312 coord(2) =
'LONGITUDE' 313 coord(3) =
'ELLIPSOID HEIGHT' 315 units(1) =
'arcseconds' 316 units(2) =
'arcseconds' 327 read(5,
'(a)')agridsec
333 read(agridsec,*)igridsec
334 suffix1=trim(olddtm)//
'.'//trim(newdtm)//
'.'//trim(region)
335 suffix2=trim(suffix1)//
'.'//trim(agridsec)
337 suffix2t04=trim(suffix2)//
'.04' 339 suffix3=trim(suffix2)//
'.'//trim(mapflag)
357 gfnvstcdlat =
'vstcdlat.'//trim(suffix2)
358 open(21,file=gfnvstcdlat,status=
'old',form=
'formatted')
359 write(6,1012)trim(gfnvstcdlat)
361 gfnvstcdlon =
'vstcdlon.'//trim(suffix2)
362 open(22,file=gfnvstcdlon,status=
'old',form=
'formatted')
363 write(6,1012)trim(gfnvstcdlon)
365 gfnvmtcdeht =
'vmtcdeht.'//trim(suffix2)
366 open(23,file=gfnvmtcdeht,status=
'old',form=
'formatted')
367 write(6,1012)trim(gfnvmtcdeht)
369 gfnvmtcdlat =
'vmtcdlat.'//trim(suffix2)
370 open(26,file=gfnvmtcdlat,status=
'old',form=
'formatted')
371 write(6,1012)trim(gfnvmtcdlat)
373 gfnvmtcdlon =
'vmtcdlon.'//trim(suffix2)
374 open(27,file=gfnvmtcdlon,status=
'old',form=
'formatted')
375 write(6,1012)trim(gfnvmtcdlon)
382 call nlines(21,nthinlat,nothinlat)
383 call nlines(22,nthinlon,nothinlon)
384 call nlines(23,nthineht,nothineht)
387 1012
format(6x,
'checkgrid.f: ',
388 *
'Opening input thinned vector file ',a)
394 gfnvsdcdlat =
'vsdcdlat.'//trim(suffix2)
395 open(31,file=gfnvsdcdlat,status=
'old',form=
'formatted')
396 write(6,1013)trim(gfnvsdcdlat)
398 gfnvsdcdlon =
'vsdcdlon.'//trim(suffix2)
399 open(32,file=gfnvsdcdlon,status=
'old',form=
'formatted')
400 write(6,1013)trim(gfnvsdcdlon)
402 gfnvmdcdeht =
'vmdcdeht.'//trim(suffix2)
403 open(33,file=gfnvmdcdeht,status=
'old',form=
'formatted')
404 write(6,1013)trim(gfnvmdcdeht)
406 gfnvmdcdlat =
'vmdcdlat.'//trim(suffix2)
407 open(36,file=gfnvmdcdlat,status=
'old',form=
'formatted')
408 write(6,1013)trim(gfnvmdcdlat)
410 gfnvmdcdlon =
'vmdcdlon.'//trim(suffix2)
411 open(37,file=gfnvmdcdlon,status=
'old',form=
'formatted')
412 write(6,1013)trim(gfnvmdcdlon)
414 1013
format(6x,
'checkgrid.f: ',
415 *
'Opening input dropped vector file ',a)
422 if(.not.nothinlat)
then 423 bfnvstcdlat =
'vstcdlat.'//trim(suffix2t04)//
'.b' 424 open(11,file=bfnvstcdlat,status=
'old',form=
'unformatted')
425 write(6,1015)trim(bfnvstcdlat)
427 bfnvmtcdlat =
'vmtcdlat.'//trim(suffix2t04)//
'.b' 428 open(16,file=bfnvmtcdlat,status=
'old',form=
'unformatted')
429 write(6,1015)trim(bfnvmtcdlat)
432 if(.not.nothinlon)
then 433 bfnvstcdlon =
'vstcdlon.'//trim(suffix2t04)//
'.b' 434 open(12,file=bfnvstcdlon,status=
'old',form=
'unformatted')
435 write(6,1015)trim(bfnvstcdlon)
437 bfnvmtcdlon =
'vmtcdlon.'//trim(suffix2t04)//
'.b' 438 open(17,file=bfnvmtcdlon,status=
'old',form=
'unformatted')
439 write(6,1015)trim(bfnvmtcdlon)
442 if(.not.nothineht)
then 443 bfnvmtcdeht =
'vmtcdeht.'//trim(suffix2t04)//
'.b' 444 open(13,file=bfnvmtcdeht,status=
'old',form=
'unformatted')
445 write(6,1015)trim(bfnvmtcdeht)
448 1015
format(6x,
'checkgrid.f: ',
449 *
'Opening input grid file ',a)
457 if(.not.nothinlat)
then 458 gfnvsagilat =
'vsagilat.'//trim(suffix2)
459 open(91,file=gfnvsagilat,status=
'new',form=
'formatted')
460 write(6,1017)
'lat',trim(gfnvsagilat)
462 gfnvmagilat =
'vmagilat.'//trim(suffix2)
463 open(96,file=gfnvmagilat,status=
'new',form=
'formatted')
464 write(6,1017)
'lat',trim(gfnvmagilat)
466 gfnvstgilat =
'vstgilat.'//trim(suffix2)
467 open(71,file=gfnvstgilat,status=
'new',form=
'formatted')
468 write(6,1017)
'lat',trim(gfnvstgilat)
470 gfnvmtgilat =
'vmtgilat.'//trim(suffix2)
471 open(76,file=gfnvmtgilat,status=
'new',form=
'formatted')
472 write(6,1017)
'lat',trim(gfnvmtgilat)
474 gfnvsdgilat =
'vsdgilat.'//trim(suffix2)
475 open(81,file=gfnvsdgilat,status=
'new',form=
'formatted')
476 write(6,1017)
'lat',trim(gfnvsdgilat)
478 gfnvmdgilat =
'vmdgilat.'//trim(suffix2)
479 open(86,file=gfnvmdgilat,status=
'new',form=
'formatted')
480 write(6,1017)
'lat',trim(gfnvmdgilat)
485 if(.not.nothinlon)
then 486 gfnvsagilon =
'vsagilon.'//trim(suffix2)
487 open(92,file=gfnvsagilon,status=
'new',form=
'formatted')
488 write(6,1017)
'lon',trim(gfnvsagilon)
490 gfnvmagilon =
'vmagilon.'//trim(suffix2)
491 open(97,file=gfnvmagilon,status=
'new',form=
'formatted')
492 write(6,1017)
'lon',trim(gfnvmagilon)
494 gfnvstgilon =
'vstgilon.'//trim(suffix2)
495 open(72,file=gfnvstgilon,status=
'new',form=
'formatted')
496 write(6,1017)
'lon',trim(gfnvstgilon)
498 gfnvmtgilon =
'vmtgilon.'//trim(suffix2)
499 open(77,file=gfnvmtgilon,status=
'new',form=
'formatted')
500 write(6,1017)
'lon',trim(gfnvmtgilon)
502 gfnvsdgilon =
'vsdgilon.'//trim(suffix2)
503 open(82,file=gfnvsdgilon,status=
'new',form=
'formatted')
504 write(6,1017)
'lon',trim(gfnvsdgilon)
506 gfnvmdgilon =
'vmdgilon.'//trim(suffix2)
507 open(87,file=gfnvmdgilon,status=
'new',form=
'formatted')
508 write(6,1017)
'lon',trim(gfnvmdgilon)
513 if(.not.nothineht)
then 514 gfnvmagieht =
'vmagieht.'//trim(suffix2)
515 open(93,file=gfnvmagieht,status=
'new',form=
'formatted')
516 write(6,1017)
'eht',trim(gfnvmagieht)
518 gfnvmtgieht =
'vmtgieht.'//trim(suffix2)
519 open(73,file=gfnvmtgieht,status=
'new',form=
'formatted')
520 write(6,1017)
'eht',trim(gfnvmtgieht)
522 gfnvmdgieht =
'vmdgieht.'//trim(suffix2)
523 open(83,file=gfnvmdgieht,status=
'new',form=
'formatted')
524 write(6,1017)
'eht',trim(gfnvmdgieht)
529 if(.not.nothinlat .and. .not.nothinlon)
then 530 gfnvsagihor =
'vsagihor.'//trim(suffix2)
531 open(94,file=gfnvsagihor,status=
'new',form=
'formatted')
532 write(6,1017)
'hor',trim(gfnvsagihor)
534 gfnvmagihor =
'vmagihor.'//trim(suffix2)
535 open(95,file=gfnvmagihor,status=
'new',form=
'formatted')
536 write(6,1017)
'hor',trim(gfnvmagihor)
538 gfnvstgihor =
'vstgihor.'//trim(suffix2)
539 open(74,file=gfnvstgihor,status=
'new',form=
'formatted')
540 write(6,1017)
'hor',trim(gfnvstgihor)
542 gfnvmtgihor =
'vmtgihor.'//trim(suffix2)
543 open(75,file=gfnvmtgihor,status=
'new',form=
'formatted')
544 write(6,1017)
'hor',trim(gfnvmtgihor)
546 gfnvsdgihor =
'vsdgihor.'//trim(suffix2)
547 open(84,file=gfnvsdgihor,status=
'new',form=
'formatted')
548 write(6,1017)
'hor',trim(gfnvsdgihor)
550 gfnvmdgihor =
'vmdgihor.'//trim(suffix2)
551 open(85,file=gfnvmdgihor,status=
'new',form=
'formatted')
552 write(6,1017)
'hor',trim(gfnvmdgihor)
555 1017
format(6x,
'checkgrid.f: ',
556 *
'Opening output grid-interpolated ',a,
' vector file :',a)
563 if(.not.nothinlat)
then 564 gfnvstddlat =
'vstddlat.'//trim(suffix2)
565 open(41,file=gfnvstddlat,status=
'new',form=
'formatted')
566 write(6,1014)
'lat',trim(gfnvstddlat)
568 gfnvmtddlat =
'vmtddlat.'//trim(suffix2)
569 open(46,file=gfnvmtddlat,status=
'new',form=
'formatted')
570 write(6,1014)
'lat',trim(gfnvmtddlat)
573 if(.not.nothinlon)
then 574 gfnvstddlon =
'vstddlon.'//trim(suffix2)
575 open(42,file=gfnvstddlon,status=
'new',form=
'formatted')
576 write(6,1014)
'lon',trim(gfnvstddlon)
578 gfnvmtddlon =
'vmtddlon.'//trim(suffix2)
579 open(47,file=gfnvmtddlon,status=
'new',form=
'formatted')
580 write(6,1014)
'lon',trim(gfnvmtddlon)
583 if(.not.nothineht)
then 584 gfnvmtddeht =
'vmtddeht.'//trim(suffix2)
585 open(43,file=gfnvmtddeht,status=
'new',form=
'formatted')
586 write(6,1014)
'eht',trim(gfnvmtddeht)
589 if(.not.nothinlon .and. .not.nothinlat)
then 590 gfnvstddhor =
'vstddhor.'//trim(suffix2)
591 open(44,file=gfnvstddhor,status=
'new',form=
'formatted')
592 write(6,1014)
'hor',trim(gfnvstddhor)
594 gfnvmtddhor =
'vmtddhor.'//trim(suffix2)
595 open(45,file=gfnvmtddhor,status=
'new',form=
'formatted')
596 write(6,1014)
'hor',trim(gfnvmtddhor)
603 if(.not.nothinlat)
then 604 gfnvsdddlat =
'vsdddlat.'//trim(suffix2)
605 open(51,file=gfnvsdddlat,status=
'new',form=
'formatted')
606 write(6,1014)
'lat',trim(gfnvsdddlat)
608 gfnvmdddlat =
'vmdddlat.'//trim(suffix2)
609 open(56,file=gfnvmdddlat,status=
'new',form=
'formatted')
610 write(6,1014)
'lat',trim(gfnvmdddlat)
613 if(.not.nothinlon)
then 614 gfnvsdddlon =
'vsdddlon.'//trim(suffix2)
615 open(52,file=gfnvsdddlon,status=
'new',form=
'formatted')
616 write(6,1014)
'lon',trim(gfnvsdddlon)
618 gfnvmdddlon =
'vmdddlon.'//trim(suffix2)
619 open(57,file=gfnvmdddlon,status=
'new',form=
'formatted')
620 write(6,1014)
'lon',trim(gfnvmdddlon)
623 if(.not.nothineht)
then 624 gfnvmdddeht =
'vmdddeht.'//trim(suffix2)
625 open(53,file=gfnvmdddeht,status=
'new',form=
'formatted')
626 write(6,1014)
'eht',trim(gfnvmdddeht)
629 if(.not.nothinlat .and. .not.nothinlon)
then 630 gfnvsdddhor =
'vsdddhor.'//trim(suffix2)
631 open(54,file=gfnvsdddhor,status=
'new',form=
'formatted')
632 write(6,1014)
'hor',trim(gfnvsdddhor)
634 gfnvmdddhor =
'vmdddhor.'//trim(suffix2)
635 open(55,file=gfnvmdddhor,status=
'new',form=
'formatted')
636 write(6,1014)
'hor',trim(gfnvmdddhor)
643 if(.not.nothinlat)
then 644 gfnvsaddlat =
'vsaddlat.'//trim(suffix2)
645 open(61,file=gfnvsaddlat,status=
'new',form=
'formatted')
646 write(6,1014)
'lat',trim(gfnvsaddlat)
648 gfnvmaddlat =
'vmaddlat.'//trim(suffix2)
649 open(66,file=gfnvmaddlat,status=
'new',form=
'formatted')
650 write(6,1014)
'lat',trim(gfnvmaddlat)
653 if(.not.nothinlon)
then 654 gfnvsaddlon =
'vsaddlon.'//trim(suffix2)
655 open(62,file=gfnvsaddlon,status=
'new',form=
'formatted')
656 write(6,1014)
'lon',trim(gfnvsaddlon)
658 gfnvmaddlon =
'vmaddlon.'//trim(suffix2)
659 open(67,file=gfnvmaddlon,status=
'new',form=
'formatted')
660 write(6,1014)
'lon',trim(gfnvmaddlon)
663 if(.not.nothineht)
then 664 gfnvmaddeht =
'vmaddeht.'//trim(suffix2)
665 open(63,file=gfnvmaddeht,status=
'new',form=
'formatted')
666 write(6,1014)
'eht',trim(gfnvmaddeht)
669 if(.not.nothinlat .and. .not.nothinlon)
then 670 gfnvsaddhor =
'vsaddhor.'//trim(suffix2)
671 open(64,file=gfnvsaddhor,status=
'new',form=
'formatted')
672 write(6,1014)
'hor',trim(gfnvsaddhor)
674 gfnvmaddhor =
'vmaddhor.'//trim(suffix2)
675 open(65,file=gfnvmaddhor,status=
'new',form=
'formatted')
676 write(6,1014)
'hor',trim(gfnvmaddhor)
679 1014
format(6x,
'checkgrid.f: ',
680 *
'Opening output differential ',a,
' vector file :',a)
689 write(6,1004)trim(region),glamn,glamx,glomn,glomx
690 1004
format(6x,
'checkgrid.f: Region= ',a,/,
691 * 6x,
'checkgrid.f: North = ',f12.6,/,
692 * 6x,
'checkgrid.f: South = ',f12.6,/,
693 * 6x,
'checkgrid.f: West = ',f12.6,/,
694 * 6x,
'checkgrid.f: East = ',f12.6)
697 8002
format(50(
'*'),/,
698 *6x,
'checkgrid.f: BEGIN STATISTICAL REPORT ',
699 *
'(grid minus true vector diffs)')
713 if(i.eq.1 .and. nothinlat)
goto 1
714 if(i.eq.2 .and. nothinlon)
goto 1
715 if(i.eq.3 .and. nothineht)
goto 1
718 read(ifil)glamn,glomn,dla,dlo,nla,nlo,ikind
720 if(i.eq.1)
read(ifil)(datlats(j,k),k=1,nlo)
721 if(i.eq.2)
read(ifil)(datlons(j,k),k=1,nlo)
722 if(i.eq.3)
read(ifil)(datehtm(j,k),k=1,nlo)
726 glamx = glamn + (nla-1)*dla
727 glomx = glomn + (nlo-1)*dlo
773 if(i.eq.3)stat(i,j,k,l) = 99999.d0
774 if(i.eq.4)stat(i,j,k,l) =-99999.d0
813 if(j.eq.1 .and. nothinlat)
goto 2001
814 if(j.eq.2 .and. nothinlon)
goto 2001
815 if(j.eq.3 .and. nothineht)
goto 2001
821 if(k.eq.1)ifile = 20+j
822 if(k.eq.2)ifile = 30+j
826 101
read(ifile,
'(a)',end=103)card
831 if(j.eq.1 .or. j.eq.2)
read(card, 102)xlo,xla,vvec
832 if(j.eq.3 )
read(card,1102)xlo,xla,vvec
836 if(xla.gt.glamx .or. xla.lt.glamn .or.
837 * xlo.gt.glomx .or. xlo.lt.glomn)
then 847 pid0(itot) = card(74:79)
854 if(j.eq.1)
call bilin(datlats,glamn,glomn,dla,dlo,
855 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(1))
856 if(j.eq.2)
call bilin(datlons,glamn,glomn,dla,dlo,
857 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(1))
858 if(j.eq.3)
call bilin(datehtm,glamn,glomn,dla,dlo,
859 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(1))
862 if(j.eq.1)
call biquad(datlats,glamn,glomn,dla,dlo,
863 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(2))
864 if(j.eq.2)
call biquad(datlons,glamn,glomn,dla,dlo,
865 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(2))
866 if(j.eq.3)
call biquad(datehtm,glamn,glomn,dla,dlo,
867 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(2))
870 if(j.eq.1)
call bicubic(datlats,glamn,glomn,dla,dlo,
871 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(3))
872 if(j.eq.2)
call bicubic(datlons,glamn,glomn,dla,dlo,
873 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(3))
874 if(j.eq.3)
call bicubic(datehtm,glamn,glomn,dla,dlo,
875 * nla,nlo,maxlat,maxlon,xla,xlo,vgrd(3))
879 dd(l) = vgrd(l) - vvec
883 vgrdm(l) = vgrd(l) * s2m
886 coslat = dcos(xla*d2r)
887 vgrdm(l) = vgrd(l) * s2m * coslat
888 ddm(l) = dd(l) * s2m * coslat
913 stat(1,j,k,l) = stat(1,j,k,l) + dd(l)
914 stat(1,j,3,l) = stat(1,j,3,l) + dd(l)
916 stat(1,j+3,k,l) = stat(1,j+3,k,l) + ddm(l)
917 stat(1,j+3,3,l) = stat(1,j+3,3,l) + ddm(l)
921 stat(2,j,k,l) = stat(2,j,k,l) + dd(l)**2
922 stat(2,j,3,l) = stat(2,j,3,l) + dd(l)**2
924 stat(2,j+3,k,l) = stat(2,j+3,k,l) + ddm(l)**2
925 stat(2,j+3,3,l) = stat(2,j+3,3,l) + ddm(l)**2
928 if(dd(l).lt.stat(3,j,k,l))stat(3,j,k,l)=dd(l)
929 if(dd(l).lt.stat(3,j,3,l))stat(3,j,3,l)=dd(l)
931 if(ddm(l).lt.stat(3,j+3,k,l))stat(3,j+3,k,l)=ddm(l)
932 if(ddm(l).lt.stat(3,j+3,3,l))stat(3,j+3,3,l)=ddm(l)
936 if(dd(l).gt.stat(4,j,k,l))stat(4,j,k,l)=dd(l)
937 if(dd(l).gt.stat(4,j,3,l))stat(4,j,3,l)=dd(l)
939 if(ddm(l).gt.stat(4,j+3,k,l))stat(4,j+3,k,l)=ddm(l)
940 if(ddm(l).gt.stat(4,j+3,3,l))stat(4,j+3,3,l)=ddm(l)
957 gim0(itot) = vgrdm(2)
959 avegiprime = avegiprime + dabs(gi0(itot))
960 avegimeter = avegimeter + dabs(gim0(itot))
964 kstat(j,k)=kstat(j,k) + 1
966 kstat(j+3,k)=kstat(j+3,k) + 1
969 kstat(j,3)=kstat(j,3) + 1
971 kstat(j+3,3)=kstat(j+3,3) + 1
986 avegiprime = avegiprime / dble(kall)
987 avegimeter = avegimeter / dble(kall)
992 if(kall.ne.kthin+kdrop)
then 993 write(6,*)
' Thin+Drop .DNE. All => STOP' 997 write(6,*)
' itot .DNE. All => STOP' 1003 fac(j,k) = dble(kstat(j,k))/dble(kstat(j,k)-1)
1005 fac(j+3,k) = dble(kstat(j+3,k))/dble(kstat(j+3,k)-1)
1008 stat(1,j,k,l)=stat(1,j,k,l)/kstat(j,k)
1009 stat(2,j,k,l)=dsqrt(stat(2,j,k,l)/kstat(j,k))
1010 stat(5,j,k,l)=dsqrt(fac(j,k)*
1011 * (stat(2,j,k,l)**2 - stat(1,j,k,l)**2))
1014 stat(1,j+3,k,l)=stat(1,j+3,k,l)/kstat(j+3,k)
1015 stat(2,j+3,k,l)=dsqrt(stat(2,j+3,k,l)/kstat(j+3,k))
1016 stat(5,j+3,k,l)=dsqrt(fac(j+3,k)*
1017 * (stat(2,j+3,k,l)**2 - stat(1,j+3,k,l)**2))
1039 rms0prime = stat(2,j,3,2)
1040 lorvogprime =
onzd2(multiplierlorvog*rms0prime)
1045 gprime2pc = lorvopc / lorvogprime
1046 scaledd(j) = gprime2pc
1047 basedd(j) = rms0prime
1049 rms0meters = stat(2,j+3,3,2)
1050 lorvogmeters =
onzd2(multiplierlorvog*rms0meters)
1055 gmeters2pc = lorvopc / lorvogmeters
1056 scaledd(j+3) = gmeters2pc
1057 basedd(j+3) = rms0meters
1059 lorvog(j) = lorvogprime
1060 if(j.lt.3)lorvog(j+3) = lorvogmeters
1067 lorvogprimegi =
onzd2(multiplierlorvog*avegiprime)
1071 gprime2pcgi = lorvopc / lorvogprimegi
1072 scalegi(j) = gprime2pcgi
1073 basegi(j) = avegiprime
1075 lorvogmetersgi =
onzd2(multiplierlorvog*avegimeter)
1080 gmeters2pcgi = lorvopc / lorvogmetersgi
1081 scalegi(j+3) = gmeters2pcgi
1082 basegi(j+3) = avegimeter
1084 lorvoggi(j) = lorvogprimegi
1085 if(j.lt.3)lorvoggi(j+3) = lorvogmetersgi
1095 pvlat = (pvlat / 100.d0)
1096 pvlon = (pvlon / 100.d0)
1106 if(ipt.le.kthin)
then 1114 if(j.eq.1 .or. j.eq.3)
then 1115 if(dd0(ipt).lt.0)
then 1121 if(dd0(ipt).lt.0)
then 1129 if(j.eq.1 .or. j.eq.3)
then 1130 if(gi0(ipt).lt.0)
then 1136 if(gi0(ipt).lt.0)
then 1146 vcprime = dabs(dd0(ipt)*gprime2pc)
1148 vcmeters = dabs(ddm0(ipt) * gmeters2pc)
1151 giprime = dabs(gi0(ipt)*gprime2pcgi)
1153 gimeters = dabs(gim0(ipt) * gmeters2pcgi)
1160 if(j.eq.1 .or. j.eq.2)
then 1162 write(ifout1 ,140)xlo0(ipt),xla0(ipt),az,vcprime,
1163 * dd0(ipt),ddm0(ipt),pid0(ipt)
1165 write(ifout1+30,140)xlo0(ipt),xla0(ipt),azgi,giprime,
1166 * gi0(ipt),gim0(ipt),pid0(ipt)
1170 write(ifout2 ,140)xlo0(ipt),xla0(ipt),az,vcprime,
1171 * dd0(ipt),ddm0(ipt),pid0(ipt)
1173 write(ifout2+30,140)xlo0(ipt),xla0(ipt),azgi,giprime,
1174 * gi0(ipt),gim0(ipt),pid0(ipt)
1178 write(ifout1+5 ,140)xlo0(ipt),xla0(ipt),az,vcmeters,
1179 * dd0(ipt),ddm0(ipt),pid0(ipt)
1181 write(ifout1+35,140)xlo0(ipt),xla0(ipt),azgi,gimeters,
1182 * gi0(ipt),gim0(ipt),pid0(ipt)
1186 write(ifout2+5 ,140)xlo0(ipt),xla0(ipt),az,vcmeters,
1187 * dd0(ipt),ddm0(ipt),pid0(ipt)
1189 write(ifout2+35,140)xlo0(ipt),xla0(ipt),azgi,gimeters,
1190 * gi0(ipt),gim0(ipt),pid0(ipt)
1198 write(ifout1 ,140)xlo0(ipt),xla0(ipt),az,vcprime,
1199 * 0.d0 ,ddm0(ipt),pid0(ipt)
1201 write(ifout1+30,140)xlo0(ipt),xla0(ipt),azgi,giprime,
1202 * 0.d0 ,gim0(ipt),pid0(ipt)
1206 write(ifout2 ,140)xlo0(ipt),xla0(ipt),az,vcprime,
1207 * 0.d0 ,ddm0(ipt),pid0(ipt)
1209 write(ifout2+30,140)xlo0(ipt),xla0(ipt),azgi,giprime,
1210 * 0.d0 ,gim0(ipt),pid0(ipt)
1217 140
format(f16.10,1x,f15.10,1x,f6.2,1x,f12.2,1x,f9.5,1x,f9.3,1x,a6)
1223 write(6,8000)trim(coord(j)),units(j)
1225 write(6,8001)
type(k),
1226 * (kstat(j,k),l=1,3),
1227 * (stat(1,j,k,l),l=1,3),
1228 * (stat(2,j,k,l),l=1,3),
1229 * (stat(5,j,k,l),l=1,3),
1230 * (stat(3,j,k,l),l=1,3),
1231 * (stat(4,j,k,l),l=1,3)
1235 write(6,8000)trim(coord(j)),units(j+3)
1237 write(6,8001)
type(k),
1238 * (kstat(j+3,k),l=1,3),
1239 * (stat(1,j+3,k,l),l=1,3),
1240 * (stat(2,j+3,k,l),l=1,3),
1241 * (stat(5,j+3,k,l),l=1,3),
1242 * (stat(3,j+3,k,l),l=1,3),
1243 * (stat(4,j+3,k,l),l=1,3)
1252 102
format(f16.10,1x,f15.10,1x, 6x,1x, 12x,1x,f9.5,1x, 9x,1x,a6)
1254 1102
format(f16.10,1x,f15.10,1x, 6x,1x, 12x,1x, 9x,1x,f9.3,1x,a6)
1258 *//,25x,a,
' in ',a,/,
1260 *7x,
'Bilinear',5x,
'Biquadratic',
1263 *
'Num:',3(i15 ,1x),/,
1264 *5x,
'Ave:',3(f15.6,1x),/,
1265 *5x,
'RMS:',3(f15.6,1x),/,
1266 *5x,
'STD:',3(f15.6,1x),/,
1267 *5x,
'MIN:',3(f15.6,1x),/,
1268 *5x,
'MAX:',3(f15.6,1x),/,
1273 *6x,
'checkgrid.f: END STATISTICAL REPORT ',
1274 *
'(grid minus true vector diffs)',/,
1284 *6x,
'checkgrid.f: Generating HORIZONTAL vector files',
1285 *
' from lat/lon vector files')
1286 5072
format(
'FATAL in checkgrid: Mismatched PID for hor')
1287 5073
format(
'FATAL in checkgrid: Mismatched LON for hor')
1288 5074
format(
'FATAL in checkgrid: Mismatched LAT for hor')
1299 baseddhors = sqrt(basedd(1)**2+basedd(2)**2)
1300 baseddhorm = sqrt(basedd(4)**2+basedd(5)**2)
1301 basegihors = sqrt(basegi(1)**2+basegi(2)**2)
1302 basegihorm = sqrt(basegi(4)**2+basegi(5)**2)
1315 lorvoghorddm =
onzd2(multiplierlorvog*baseddhorm)
1319 gm2pchordd = lorvopc / lorvoghorddm
1321 lorvoghordds =
onzd2(multiplierlorvog*baseddhors)
1325 gs2pchordd = lorvopc / lorvoghordds
1327 lorvoghorgim =
onzd2(multiplierlorvog*basegihorm)
1331 gm2pchorgi = lorvopc / lorvoghorgim
1333 lorvoghorgis =
onzd2(multiplierlorvog*basegihors)
1337 gs2pchorgi = lorvopc / lorvoghorgis
1339 lorvog(6) = lorvoghordds
1340 lorvog(7) = lorvoghorddm
1342 lorvoggi(6) = lorvoghorgis
1343 lorvoggi(7) = lorvoghorgim
1345 convgs2pcddlat = lorvopc / lorvog(1)
1346 convgs2pcddlon = lorvopc / lorvog(2)
1348 convgm2pcddlat = lorvopc / lorvog(4)
1349 convgm2pcddlon = lorvopc / lorvog(5)
1351 convgs2pcgilat = lorvopc / lorvoggi(1)
1352 convgs2pcgilon = lorvopc / lorvoggi(2)
1354 convgm2pcgilat = lorvopc / lorvoggi(4)
1355 convgm2pcgilon = lorvopc / lorvoggi(5)
1369 convgs2pcddlat = scaledd(1)
1370 convgs2pcddlon = scaledd(2)
1371 convgm2pcddlat = scaledd(4)
1372 convgm2pcddlon = scaledd(5)
1373 convgs2pcgilat = scalegi(1)
1374 convgs2pcgilon = scalegi(2)
1375 convgm2pcgilat = scalegi(4)
1376 convgm2pcgilon = scalegi(5)
1390 convgs2pcddhor = dsqrt(convgs2pcddlat**2 + convgs2pcddlon**2)
1391 convgm2pcddhor = dsqrt(convgm2pcddlat**2 + convgm2pcddlon**2)
1392 convgs2pcgihor = dsqrt(convgs2pcgilat**2 + convgs2pcgilon**2)
1393 convgm2pcgihor = dsqrt(convgm2pcgilat**2 + convgm2pcgilon**2)
1403 convgs2pcddhor = gs2pchordd
1404 convgm2pcddhor = gm2pchordd
1405 convgs2pcgihor = gs2pchorgi
1406 convgm2pcgihor = gm2pchorgi
1418 if(i.le.60 .and. j.eq.1)conv = convgs2pcddhor
1419 if(i.le.60 .and. j.eq.2)conv = convgm2pcddhor
1420 if(i.ge.70 .and. j.eq.1)conv = convgs2pcgihor
1421 if(i.ge.70 .and. j.eq.2)conv = convgm2pcgihor
1423 ilat = i+1 + (j-1)*5
1424 ilon = i+2 + (j-1)*5
1425 ihor = i+4 + (j-1)*1
1430 5078
read(ilat,140,end=5071)ylo1,yla1,az1,vc1,sec1,xmet1,pid1
1431 read(ilon,140)ylo2,yla2,az2,vc2,sec2,xmet2,pid2
1432 if(pid1.ne.pid2)
then 1436 if(ylo1.ne.ylo2)
then 1440 if(yla1.ne.yla2)
then 1444 azhor = datan2(xmet2,xmet1)/d2r
1445 if(azhor.lt.0.d0)azhor=azhor+360.d0
1446 dhors = dsqrt(sec1**2 + sec2**2)
1447 dhorm = dsqrt(xmet1**2 + xmet2**2)
1449 if(j.eq.1)vchor = conv * dhors
1450 if(j.eq.2)vchor = conv * dhorm
1452 write(ihor,140)ylo1,yla1,azhor,vchor,dhors,dhorm,pid1
1464 sfn =
'dvstats.'//trim(suffix2)
1465 open(2,file=sfn,status=
'new',form=
'formatted')
1470 write(2,777)kstat(1,3),stat(2,1,3,2)
1471 write(2,777)kstat(2,3),stat(2,2,3,2)
1472 write(2,777)kstat(3,3),stat(2,3,3,2)
1473 write(2,777)kstat(1,3),stat(2,4,3,2)
1474 write(2,777)kstat(2,3),stat(2,5,3,2)
1476 rhors = sqrt(stat(2,1,3,2)**2 + stat(2,2,3,2)**2)
1477 rhorm = sqrt(stat(2,4,3,2)**2 + stat(2,5,3,2)**2)
1478 write(2,777)kstat(1,3),rhors
1479 write(2,777)kstat(2,3),rhorm
1482 777
format(i10,1x,f20.10)
1500 gmtfile =
'gmtbat04.'//trim(suffix3)
1501 open(99,file=gmtfile,status=
'new',form=
'formatted')
1502 write(6,1011)trim(gmtfile)
1503 1011
format(6x,
'checkgrid.f: Creating GMT batch file ',a)
1504 write(99,1030)trim(gmtfile)
1505 1030
format(
'echo BEGIN batch file ',a)
1515 *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
1527 write(6,1006)trim(region)
1528 1006
format(6x,
'checkgrid.f: Calling getmapbounds for region ',a)
1554 *
'# ------------------------------',/,
1555 *
'# Double Difference Vector Plots',/,
1556 *
'# ------------------------------',/,
1557 *
'echo Double Difference Vector Plots')
1560 *
'# ------------------------------',/,
1561 *
'# Grid Interpolated Vector Plots',/,
1562 *
'# ------------------------------',/,
1563 *
'echo Grid Interpolated Vector Plots')
1566 *
'# ------------------------------',/,
1567 *
'# Plots for region: ',a,
', sub-region: ',a,/,
1568 *
'# ------------------------------',/,
1569 *
'echo Creating plots for region: ',a,
', sub-region: ',a)
1578 write(99,990)trim(region),trim(fn(ij)),
1579 * trim(region),trim(fn(ij))
1624 if(j.eq.1.and.k.eq.1)gfn = gfnvstgilat
1625 if(j.eq.1.and.k.eq.2)gfn = gfnvsdgilat
1626 if(j.eq.1.and.k.eq.3)gfn = gfnvsagilat
1628 if(j.eq.2.and.k.eq.1)gfn = gfnvstgilon
1629 if(j.eq.2.and.k.eq.2)gfn = gfnvsdgilon
1630 if(j.eq.2.and.k.eq.3)gfn = gfnvsagilon
1632 if(j.eq.3.and.k.eq.1)gfn = gfnvmtgieht
1633 if(j.eq.3.and.k.eq.2)gfn = gfnvmdgieht
1634 if(j.eq.3.and.k.eq.3)gfn = gfnvmagieht
1636 if(j.eq.4.and.k.eq.1)gfn = gfnvmtgilat
1637 if(j.eq.4.and.k.eq.2)gfn = gfnvmdgilat
1638 if(j.eq.4.and.k.eq.3)gfn = gfnvmagilat
1640 if(j.eq.5.and.k.eq.1)gfn = gfnvmtgilon
1641 if(j.eq.5.and.k.eq.2)gfn = gfnvmdgilon
1642 if(j.eq.5.and.k.eq.3)gfn = gfnvmagilon
1644 if(j.eq.6.and.k.eq.1)gfn = gfnvstgihor
1645 if(j.eq.6.and.k.eq.2)gfn = gfnvsdgihor
1646 if(j.eq.6.and.k.eq.3)gfn = gfnvsagihor
1648 if(j.eq.7.and.k.eq.1)gfn = gfnvmtgihor
1649 if(j.eq.7.and.k.eq.2)gfn = gfnvmdgihor
1650 if(j.eq.7.and.k.eq.3)gfn = gfnvmagihor
1654 *
call bwplotvc(ele(j),gfn,bw,be,bs,bn,jm,b1,b2,
1655 * maxplots,olddtm,newdtm,region,el0(j),ij,xvlon,
1656 * xvlat,xllon,xllat,lorvoggi(j),lorvopc,igridsec,fn)
1658 if(kstat(1,k).ne.0 .and. kstat(2,k).ne.0)
1659 *
call bwplotvc(ele(j),gfn,bw,be,bs,bn,jm,b1,b2,
1660 * maxplots,olddtm,newdtm,region,el0(j),ij,xvlon,
1661 * xvlat,xllon,xllat,lorvoggi(j),lorvopc,igridsec,fn)
1676 write(99,990)trim(region),trim(fn(ij)),
1677 * trim(region),trim(fn(ij))
1723 if(j.eq.1.and.k.eq.1)gfn = gfnvstddlat
1724 if(j.eq.1.and.k.eq.2)gfn = gfnvsdddlat
1725 if(j.eq.1.and.k.eq.3)gfn = gfnvsaddlat
1727 if(j.eq.2.and.k.eq.1)gfn = gfnvstddlon
1728 if(j.eq.2.and.k.eq.2)gfn = gfnvsdddlon
1729 if(j.eq.2.and.k.eq.3)gfn = gfnvsaddlon
1731 if(j.eq.3.and.k.eq.1)gfn = gfnvmtddeht
1732 if(j.eq.3.and.k.eq.2)gfn = gfnvmdddeht
1733 if(j.eq.3.and.k.eq.3)gfn = gfnvmaddeht
1735 if(j.eq.4.and.k.eq.1)gfn = gfnvmtddlat
1736 if(j.eq.4.and.k.eq.2)gfn = gfnvmdddlat
1737 if(j.eq.4.and.k.eq.3)gfn = gfnvmaddlat
1739 if(j.eq.5.and.k.eq.1)gfn = gfnvmtddlon
1740 if(j.eq.5.and.k.eq.2)gfn = gfnvmdddlon
1741 if(j.eq.5.and.k.eq.3)gfn = gfnvmaddlon
1743 if(j.eq.6.and.k.eq.1)gfn = gfnvstddhor
1744 if(j.eq.6.and.k.eq.2)gfn = gfnvsdddhor
1745 if(j.eq.6.and.k.eq.3)gfn = gfnvsaddhor
1747 if(j.eq.7.and.k.eq.1)gfn = gfnvmtddhor
1748 if(j.eq.7.and.k.eq.2)gfn = gfnvmdddhor
1749 if(j.eq.7.and.k.eq.3)gfn = gfnvmaddhor
1753 *
call bwplotvc(ele(j),gfn,bw,be,bs,bn,jm,b1,b2,
1754 * maxplots,olddtm,newdtm,region,el0(j),ij,xvlon,
1755 * xvlat,xllon,xllat,lorvog(j),lorvopc,igridsec,fn)
1757 if(kstat(1,k).ne.0 .and. kstat(2,k).ne.0)
1758 *
call bwplotvc(ele(j),gfn,bw,be,bs,bn,jm,b1,b2,
1759 * maxplots,olddtm,newdtm,region,el0(j),ij,xvlon,
1760 * xvlat,xllon,xllat,lorvog(j),lorvopc,igridsec,fn)
1772 write(99,1031)trim(gmtfile)
1773 1031
format(
'echo END batch file ',a)
1777 9999
format(
'END program checkgrid.f')
1783 subroutine nlines(ifile,num,ilogic)
1790 1
read(ifile,
'(a)',end=2)dummy
1793 2
if(num.eq.0)ilogic = .true.
1800 include
'Subs/getmapbounds.f' 1801 include
'Subs/getgridbounds.f' 1802 include
'Subs/bwplotvc.f' 1803 include
'Subs/plotcoast.f' 1805 include
'Subs/bilin.f' 1806 include
'Subs/biquad.f' 1807 include
'Subs/bicubic.f' 1808 include
'Subs/onzd2.f' subroutine bwplotvc(ele, fname, bw, be, bs, bn, jm, b1, b2, maxplots, olddtm, newdtm, region, elecap, ij, xvlon, xvlat, xllon, xllat, lorvog, lorvopc, igridsec, fn)
Subroutine to make GMT calls to do a B/W vector plot.
subroutine nlines(ifile, num, ilogic)
subroutine bilin(data, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
Subroutine to perform bilinear interpolation.
real *8 function onzd2(x)
Function to round a digit to one significant figure (one non zero digit), double precision.
subroutine getmapbounds(mapflag, maxplots, region, nplots, olddtm, newdtm, bw, be, bs, bn, jm, b1, b2, fn, lrv, rv0x, rv0y, rl0y)
Subroutine to collect up the MAP boundaries for use in creating NADCON 5.
subroutine bicubic(z, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
Subroutine to perform a 2-D cubic ("bicubic") interpolation.
subroutine getgridbounds(region, xn, xs, xw, xe)
Subroutine to collect up the GRID boundaries for use in creating NADCON 5.
program checkgrid
Part of the NADCON5 build process, generates gmtbat04
subroutine biquad(z, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
Subroutine to perform a 2-D quadratic ("biquadratic") interpolation.