73 implicit real*8(a-h,o-z)
82 parameter(maxppcell=5000)
91 character*80 cards(max)
98 integer*4 ilapcell(max),ilopcell(max)
99 integer*4 poscode(max)
107 integer*4 whichcell(max)
112 integer*4 ppcell(max)
114 character*10 olddtm,newdtm,region
115 character*200 suffix1,suffix2
116 character*200 suffix2t00,suffix2t04,suffix2t10
117 character*200 suffix2d1,suffix2d2,suffix2d3
119 character*200 gfncvacdlat
120 character*200 gfncvacdlon
121 character*200 gfncvacdeht
122 character*200 gfnvmacdlat
123 character*200 gfnvmacdlon
124 character*200 gfnvmacdeht
125 character*200 gfnvmacdhor
126 character*200 gfnvsacdlat
127 character*200 gfnvsacdlon
128 character*200 gfnvsacdhor
130 character*200 gfncvtcdlat
131 character*200 gfncvtcdlon
132 character*200 gfncvtcdeht
133 character*200 gfnvmtcdlat
134 character*200 gfnvmtcdlon
135 character*200 gfnvmtcdeht
136 character*200 gfnvmtcdhor
137 character*200 gfnvstcdlat
138 character*200 gfnvstcdlon
139 character*200 gfnvstcdhor
141 character*200 gfncvdcdlat
142 character*200 gfncvdcdlon
143 character*200 gfncvdcdeht
144 character*200 gfnvmdcdlat
145 character*200 gfnvmdcdlon
146 character*200 gfnvmdcdeht
147 character*200 gfnvmdcdhor
148 character*200 gfnvsdcdlat
149 character*200 gfnvsdcdlon
150 character*200 gfnvsdcdhor
152 character*200 gfnsmtcdlat
153 character*200 gfnsmtcdlon
154 character*200 gfnsmtcdeht
155 character*200 gfnsstcdlat
156 character*200 gfnsstcdlon
158 character*200 rfnvmtcdlat04
159 character*200 rfnvmtcdlon04
160 character*200 rfnvmtcdeht04
161 character*200 rfnvstcdlat04
162 character*200 rfnvstcdlon04
164 character*200 rfnvmtcdlat00
165 character*200 rfnvmtcdlon00
166 character*200 rfnvmtcdeht00
167 character*200 rfnvstcdlat00
168 character*200 rfnvstcdlon00
170 character*200 rfnvmtcdlat10
171 character*200 rfnvmtcdlon10
172 character*200 rfnvmtcdeht10
173 character*200 rfnvstcdlat10
174 character*200 rfnvstcdlon10
183 character*200 zfnvmtcdlat04
184 character*200 zfnvmtcdlon04
185 character*200 zfnvmtcdeht04
186 character*200 zfnvstcdlat04
187 character*200 zfnvstcdlon04
189 character*200 zfnvmtcdlat00
190 character*200 zfnvmtcdlon00
191 character*200 zfnvmtcdeht00
192 character*200 zfnvstcdlat00
193 character*200 zfnvstcdlon00
195 character*200 zfnvmtcdlat10
196 character*200 zfnvmtcdlon10
197 character*200 zfnvmtcdeht10
198 character*200 zfnvstcdlat10
199 character*200 zfnvstcdlon10
208 character*200 bfnvmtcdlat04
209 character*200 bfnvmtcdlon04
210 character*200 bfnvmtcdeht04
211 character*200 bfnvstcdlat04
212 character*200 bfnvstcdlon04
214 character*200 bfnvmtcdlat00
215 character*200 bfnvmtcdlon00
216 character*200 bfnvmtcdeht00
217 character*200 bfnvstcdlat00
218 character*200 bfnvstcdlon00
220 character*200 bfnvmtcdlat10
221 character*200 bfnvmtcdlon10
222 character*200 bfnvmtcdeht10
223 character*200 bfnvstcdlat10
224 character*200 bfnvstcdlon10
227 character*200 dbfnvmtcdlat1000
228 character*200 dbfnvstcdlat1000
229 character*200 dbfnvmtcdlon1000
230 character*200 dbfnvstcdlon1000
231 character*200 dbfnvmtcdeht1000
233 character*200 adbfnvmtcdlat1000
234 character*200 adbfnvstcdlat1000
235 character*200 adbfnvmtcdlon1000
236 character*200 adbfnvstcdlon1000
237 character*200 adbfnvmtcdeht1000
239 character*200 sadbfnvmtcdlat1000
240 character*200 sadbfnvstcdlat1000
241 character*200 sadbfnvmtcdlon1000
242 character*200 sadbfnvstcdlon1000
243 character*200 sadbfnvmtcdeht1000
245 character*200 sadrfnvmtcdlat1000
246 character*200 sadrfnvstcdlat1000
247 character*200 sadrfnvmtcdlon1000
248 character*200 sadrfnvstcdlon1000
249 character*200 sadrfnvmtcdeht1000
259 character*200 gmtfile
269 character*80 cardcvlat,cardcvlon,cardcveht
270 character*80 cardvmlat,cardvmlon,cardvmeht,cardvmhor
271 character*80 cardvslat,cardvslon, cardvshor
282 1001
format(
'BEGIN program mymedian5.f')
287 pi = 2.d0*dasin(1.d0)
289 rng2std = 1.d0/1.6929d0
297 read(5,
'(a)')agridsec
302 read(agridsec,*)igridsec
303 suffix1=trim(olddtm)//
'.'//trim(newdtm)//
'.'//trim(region)
304 suffix2=trim(suffix1)//
'.'//trim(agridsec)
306 suffix2t00=trim(suffix2)//
'.00' 307 suffix2t04=trim(suffix2)//
'.04' 308 suffix2t10=trim(suffix2)//
'.10' 310 suffix2d1=trim(suffix2)//
'.d1' 311 suffix2d2=trim(suffix2)//
'.d2' 312 suffix2d3=trim(suffix2)//
'.d3' 318 gmtfile =
'gmtbat02.'//trim(suffix2)
319 open(99,file=gmtfile,status=
'new',form=
'formatted')
320 write(6,1011)trim(gmtfile)
321 1011
format(6x,
'mymedian5.f: Creating GMT batch file ',a)
322 write(99,1030)trim(gmtfile)
323 1030
format(
'echo BEGIN batch file ',a)
331 gfncvacdlat =
'cvacdlat.'//trim(suffix1)
332 open(11,file=gfncvacdlat,status=
'old',form=
'formatted')
333 write(6,1010)trim(gfncvacdlat)
335 gfncvacdlon =
'cvacdlon.'//trim(suffix1)
336 open(12,file=gfncvacdlon,status=
'old',form=
'formatted')
337 write(6,1010)trim(gfncvacdlon)
339 gfncvacdeht =
'cvacdeht.'//trim(suffix1)
340 open(13,file=gfncvacdeht,status=
'old',form=
'formatted')
341 write(6,1010)trim(gfncvacdeht)
345 gfnvmacdlat =
'vmacdlat.'//trim(suffix1)
346 open(21,file=gfnvmacdlat,status=
'old',form=
'formatted')
347 write(6,1010)trim(gfnvmacdlat)
349 gfnvmacdlon =
'vmacdlon.'//trim(suffix1)
350 open(22,file=gfnvmacdlon,status=
'old',form=
'formatted')
351 write(6,1010)trim(gfnvmacdlon)
353 gfnvmacdeht =
'vmacdeht.'//trim(suffix1)
354 open(23,file=gfnvmacdeht,status=
'old',form=
'formatted')
355 write(6,1010)trim(gfnvmacdeht)
357 gfnvmacdhor =
'vmacdhor.'//trim(suffix1)
358 open(24,file=gfnvmacdhor,status=
'old',form=
'formatted')
359 write(6,1010)trim(gfnvmacdhor)
362 gfnvsacdlat =
'vsacdlat.'//trim(suffix1)
363 open(26,file=gfnvsacdlat,status=
'old',form=
'formatted')
364 write(6,1010)trim(gfnvsacdlat)
366 gfnvsacdlon =
'vsacdlon.'//trim(suffix1)
367 open(27,file=gfnvsacdlon,status=
'old',form=
'formatted')
368 write(6,1010)trim(gfnvsacdlon)
370 gfnvsacdhor =
'vsacdhor.'//trim(suffix1)
371 open(29,file=gfnvsacdhor,status=
'old',form=
'formatted')
372 write(6,1010)trim(gfnvsacdhor)
375 1010
format(6x,
'mymedian5.f: ',
376 *
'Opening existing unthinned file ',a)
384 gfncvtcdlat =
'cvtcdlat.'//trim(suffix2)
385 open(31,file=gfncvtcdlat,status=
'new',form=
'formatted')
386 write(6,1022)trim(gfncvtcdlat)
388 gfncvtcdlon =
'cvtcdlon.'//trim(suffix2)
389 open(32,file=gfncvtcdlon,status=
'new',form=
'formatted')
390 write(6,1022)trim(gfncvtcdlon)
392 gfncvtcdeht =
'cvtcdeht.'//trim(suffix2)
393 open(33,file=gfncvtcdeht,status=
'new',form=
'formatted')
394 write(6,1022)trim(gfncvtcdeht)
397 gfnvmtcdlat =
'vmtcdlat.'//trim(suffix2)
398 open(41,file=gfnvmtcdlat,status=
'new',form=
'formatted')
399 write(6,1012)trim(gfnvmtcdlat)
401 gfnvmtcdlon =
'vmtcdlon.'//trim(suffix2)
402 open(42,file=gfnvmtcdlon,status=
'new',form=
'formatted')
403 write(6,1012)trim(gfnvmtcdlon)
405 gfnvmtcdeht =
'vmtcdeht.'//trim(suffix2)
406 open(43,file=gfnvmtcdeht,status=
'new',form=
'formatted')
407 write(6,1012)trim(gfnvmtcdeht)
409 gfnvmtcdhor =
'vmtcdhor.'//trim(suffix2)
410 open(44,file=gfnvmtcdhor,status=
'new',form=
'formatted')
411 write(6,1012)trim(gfnvmtcdhor)
414 gfnvstcdlat =
'vstcdlat.'//trim(suffix2)
415 open(46,file=gfnvstcdlat,status=
'new',form=
'formatted')
416 write(6,1012)trim(gfnvstcdlat)
418 gfnvstcdlon =
'vstcdlon.'//trim(suffix2)
419 open(47,file=gfnvstcdlon,status=
'new',form=
'formatted')
420 write(6,1012)trim(gfnvstcdlon)
422 gfnvstcdhor =
'vstcdhor.'//trim(suffix2)
423 open(49,file=gfnvstcdhor,status=
'new',form=
'formatted')
424 write(6,1012)trim(gfnvstcdhor)
427 1012
format(6x,
'mymedian5.f: ',
428 *
'Opening output thinned vector file ',a)
429 1022
format(6x,
'mymedian5.f: ',
430 *
'Opening output thinned coverage file ',a)
438 gfncvdcdlat =
'cvdcdlat.'//trim(suffix2)
439 open(51,file=gfncvdcdlat,status=
'new',form=
'formatted')
440 write(6,1023)trim(gfncvdcdlat)
442 gfncvdcdlon =
'cvdcdlon.'//trim(suffix2)
443 open(52,file=gfncvdcdlon,status=
'new',form=
'formatted')
444 write(6,1023)trim(gfncvdcdlon)
446 gfncvdcdeht =
'cvdcdeht.'//trim(suffix2)
447 open(53,file=gfncvdcdeht,status=
'new',form=
'formatted')
448 write(6,1023)trim(gfncvdcdeht)
451 gfnvmdcdlat =
'vmdcdlat.'//trim(suffix2)
452 open(61,file=gfnvmdcdlat,status=
'new',form=
'formatted')
453 write(6,1013)trim(gfnvmdcdlat)
455 gfnvmdcdlon =
'vmdcdlon.'//trim(suffix2)
456 open(62,file=gfnvmdcdlon,status=
'new',form=
'formatted')
457 write(6,1013)trim(gfnvmdcdlon)
459 gfnvmdcdeht =
'vmdcdeht.'//trim(suffix2)
460 open(63,file=gfnvmdcdeht,status=
'new',form=
'formatted')
461 write(6,1013)trim(gfnvmdcdeht)
463 gfnvmdcdhor =
'vmdcdhor.'//trim(suffix2)
464 open(64,file=gfnvmdcdhor,status=
'new',form=
'formatted')
465 write(6,1013)trim(gfnvmdcdhor)
468 gfnvsdcdlat =
'vsdcdlat.'//trim(suffix2)
469 open(66,file=gfnvsdcdlat,status=
'new',form=
'formatted')
470 write(6,1013)trim(gfnvsdcdlat)
472 gfnvsdcdlon =
'vsdcdlon.'//trim(suffix2)
473 open(67,file=gfnvsdcdlon,status=
'new',form=
'formatted')
474 write(6,1013)trim(gfnvsdcdlon)
476 gfnvsdcdhor =
'vsdcdhor.'//trim(suffix2)
477 open(69,file=gfnvsdcdhor,status=
'new',form=
'formatted')
478 write(6,1013)trim(gfnvsdcdhor)
481 1013
format(6x,
'mymedian5.f: ',
482 *
'Opening output dropped vector file ',a)
483 1023
format(6x,
'mymedian5.f: ',
484 *
'Opening output dropped coverage file ',a)
493 gfnsmtcdlat =
'smtcdlat.'//trim(suffix2)
494 open(71,file=gfnsmtcdlat,status=
'new',form=
'formatted')
495 write(6,1014)trim(gfnsmtcdlat)
497 gfnsmtcdlon =
'smtcdlon.'//trim(suffix2)
498 open(72,file=gfnsmtcdlon,status=
'new',form=
'formatted')
499 write(6,1014)trim(gfnsmtcdlon)
501 gfnsmtcdeht =
'smtcdeht.'//trim(suffix2)
502 open(73,file=gfnsmtcdeht,status=
'new',form=
'formatted')
503 write(6,1014)trim(gfnsmtcdeht)
506 gfnsstcdlat =
'sstcdlat.'//trim(suffix2)
507 open(76,file=gfnsstcdlat,status=
'new',form=
'formatted')
508 write(6,1014)trim(gfnsstcdlat)
510 gfnsstcdlon =
'sstcdlon.'//trim(suffix2)
511 open(77,file=gfnsstcdlon,status=
'new',form=
'formatted')
512 write(6,1014)trim(gfnsstcdlon)
515 1014
format(6x,
'mymedian5.f: ',
516 *
'Opening output thinned vector file (for surface):',a)
525 write(6,1004)trim(region),glamn,glamx,glomn,glomx
526 1004
format(6x,
'mymedian5.f: Region= ',a,/,
527 * 6x,
'mymedian5.f: North = ',f12.6,/,
528 * 6x,
'mymedian5.f: South = ',f12.6,/,
529 * 6x,
'mymedian5.f: West = ',f12.6,/,
530 * 6x,
'mymedian5.f: East = ',f12.6)
537 dgla = dble(igridsec)/3600.d0
538 dglo = dble(igridsec)/3600.d0
540 nla=idnint((glamx-glamn)/dgla)+1
541 nlo=idnint((glomx-glomn)/dglo)+1
543 write(6,3001)glamn,glamx,glomn,glomx,dgla,dglo,nla,nlo
544 3001
format(6x,
'mymedian5.f : Cell Structure:',/,
545 *8x,
'North = ',f16.10,/,
546 *8x,
'South = ',f16.10,/,
547 *8x,
'West = ',f16.10,/,
548 *8x,
'East = ',f16.10,/,
549 *8x,
'DLat = ',f16.10,/,
550 *8x,
'DLon = ',f16.10,/,
551 *8x,
'NLat = ',i16 ,/,
587 elseif(iloop.eq.2)
then 592 write(6,2002)trim(fused)
593 2002
format(6x,
'mymedian5.f: Median filtering file : ',a)
594 101
format(f16.10,1x,f15.10,1x,6x ,1x,12x ,1x,9x ,1x,f9.3,1x,a6)
599 2003
format(6x,
'mymedian5.f: FATAL ERROR: ',
600 *
'Point outside boundaries: ',
601 * f16.10,1x,f15.10,1x,f9.5,1x,a6)
616 100
read(lin,
'(a)',end=777)card
620 read(card,101)glo,gla,z,pid
626 if(gla.lt.glamn.or.gla.gt.glamx .or.
627 * glo.lt.glomn.or.glo.gt.glomx)
then 628 write(6,2003)gla,glo,z,pid
645 ila=idnint((gla-glamn)/dgla)+1
646 ilo=idnint((glo-glomn)/dglo)+1
652 xla = glamn + (ila-1)*dgla
653 xlo = glomn + (ilo-1)*dglo
654 dist(ikt) = dsqrt((gla-xla)**2+(glo-xlo)**2)
663 if(ipos.eq.poscode(j))
then 664 ppcell(j) = ppcell(j) + 1
674 poscode(ncells) = ipos
675 ilapcell(ncells) = ila
676 ilopcell(ncells) = ilo
679 whichcell(ikt) = ncells
695 write(6,2004) trim(fused),nkt,igridsec,ncells
697 *6x,
'mymedian5.f: Done Reading from : ',a,/,
698 *6x,
'mymedian5.f: Points in File : ',i10,/,
699 *6x,
'mymedian5.f: Cell Size (Arcseconds) : ',i10,/,
700 *6x,
'mymedian5.f: Number of Cells with Data : ',i10)
702 2005
format(6x,
'mymedian5.f: Begin median filtering')
711 2020
format(6x,
'mymedian5.f: Sorting data...')
713 call indexxi(nkt,max,whichcell,indx)
726 2010
format(i8,1x,a80,1x,4(i10))
732 do 401 icell=1,ncells
734 inumhi = inumlo + ppcell(icell) - 1
736 do 402 jpt=1,ppcell(icell)
742 call getmedian(zs,max,inumlo,inumhi,indx,
743 * maxppcell,dist,iiival)
747 if(iiival.lt.0)stop 10001
748 if(iiival.gt.nkt)stop 10002
749 lpass(iiival) = .true.
752 408
format(6x,
'mymedian5.f: Done finding medians',/,
753 * 6x,
'mymedian5.f: Populating thinned and dropped files')
764 read(11,
'(a)')cardcvlat
765 read(12,
'(a)')cardcvlon
767 read(21,
'(a)')cardvmlat
768 read(22,
'(a)')cardvmlon
769 read(24,
'(a)')cardvmhor
771 read(26,
'(a)')cardvslat
772 read(27,
'(a)')cardvslon
773 read(29,
'(a)')cardvshor
777 write(31,
'(a)')cardcvlat
778 write(32,
'(a)')cardcvlon
780 write(41,
'(a)')cardvmlat
781 write(42,
'(a)')cardvmlon
782 write(44,
'(a)')cardvmhor
784 write(46,
'(a)')cardvslat
785 write(47,
'(a)')cardvslon
786 write(49,
'(a)')cardvshor
794 write(71,
'(a,a,a)')cardvmlat(1:33),cardvmlat(64:72),
796 write(72,
'(a,a,a)')cardvmlon(1:33),cardvmlon(64:72),
799 write(76,
'(a,a,a)')cardvslat(1:33),cardvslat(54:62),
801 write(77,
'(a,a,a)')cardvslon(1:33),cardvslon(54:62),
806 write(51,
'(a)')cardcvlat
807 write(52,
'(a)')cardcvlon
809 write(61,
'(a)')cardvmlat
810 write(62,
'(a)')cardvmlon
811 write(64,
'(a)')cardvmhor
813 write(66,
'(a)')cardvslat
814 write(67,
'(a)')cardvslon
815 write(69,
'(a)')cardvshor
819 read(13,
'(a)')cardcveht
821 read(23,
'(a)')cardvmeht
825 write(33,
'(a)')cardcveht
826 write(43,
'(a)')cardvmeht
828 write(73,
'(a,a,a)')cardvmeht(1:33),cardvmeht(64:72),
832 write(53,
'(a)')cardcveht
833 write(63,
'(a)')cardvmeht
838 write(6,*)
' Number kept : ',ithin
839 write(6,*)
' Number dropped : ',idrop
879 cmidlat=dcos(((glamn+glamx)/2.d0)*d2r)
880 rfnvmtcdlat00 =
'vmtcdlat.'//trim(suffix2t00)//
'.grd' 881 rfnvmtcdlon00 =
'vmtcdlon.'//trim(suffix2t00)//
'.grd' 882 rfnvmtcdeht00 =
'vmtcdeht.'//trim(suffix2t00)//
'.grd' 883 rfnvstcdlat00 =
'vstcdlat.'//trim(suffix2t00)//
'.grd' 884 rfnvstcdlon00 =
'vstcdlon.'//trim(suffix2t00)//
'.grd' 885 rfnvmtcdlat04 =
'vmtcdlat.'//trim(suffix2t04)//
'.grd' 886 rfnvmtcdlon04 =
'vmtcdlon.'//trim(suffix2t04)//
'.grd' 887 rfnvmtcdeht04 =
'vmtcdeht.'//trim(suffix2t04)//
'.grd' 888 rfnvstcdlat04 =
'vstcdlat.'//trim(suffix2t04)//
'.grd' 889 rfnvstcdlon04 =
'vstcdlon.'//trim(suffix2t04)//
'.grd' 890 rfnvmtcdlat10 =
'vmtcdlat.'//trim(suffix2t10)//
'.grd' 891 rfnvmtcdlon10 =
'vmtcdlon.'//trim(suffix2t10)//
'.grd' 892 rfnvmtcdeht10 =
'vmtcdeht.'//trim(suffix2t10)//
'.grd' 893 rfnvstcdlat10 =
'vstcdlat.'//trim(suffix2t10)//
'.grd' 894 rfnvstcdlon10 =
'vstcdlon.'//trim(suffix2t10)//
'.grd' 896 sadrfnvmtcdlat1000 =
'vmtcdlat.'//trim(suffix2d3)//
'.grd' 897 sadrfnvstcdlat1000 =
'vstcdlat.'//trim(suffix2d3)//
'.grd' 898 sadrfnvmtcdlon1000 =
'vmtcdlon.'//trim(suffix2d3)//
'.grd' 899 sadrfnvstcdlon1000 =
'vstcdlon.'//trim(suffix2d3)//
'.grd' 900 sadrfnvmtcdeht1000 =
'vmtcdeht.'//trim(suffix2d3)//
'.grd' 902 zfnvmtcdlat00 =
'vmtcdlat.'//trim(suffix2t00)//
'.xyz' 903 zfnvmtcdlon00 =
'vmtcdlon.'//trim(suffix2t00)//
'.xyz' 904 zfnvmtcdeht00 =
'vmtcdeht.'//trim(suffix2t00)//
'.xyz' 905 zfnvstcdlat00 =
'vstcdlat.'//trim(suffix2t00)//
'.xyz' 906 zfnvstcdlon00 =
'vstcdlon.'//trim(suffix2t00)//
'.xyz' 907 zfnvmtcdlat04 =
'vmtcdlat.'//trim(suffix2t04)//
'.xyz' 908 zfnvmtcdlon04 =
'vmtcdlon.'//trim(suffix2t04)//
'.xyz' 909 zfnvmtcdeht04 =
'vmtcdeht.'//trim(suffix2t04)//
'.xyz' 910 zfnvstcdlat04 =
'vstcdlat.'//trim(suffix2t04)//
'.xyz' 911 zfnvstcdlon04 =
'vstcdlon.'//trim(suffix2t04)//
'.xyz' 912 zfnvmtcdlat10 =
'vmtcdlat.'//trim(suffix2t10)//
'.xyz' 913 zfnvmtcdlon10 =
'vmtcdlon.'//trim(suffix2t10)//
'.xyz' 914 zfnvmtcdeht10 =
'vmtcdeht.'//trim(suffix2t10)//
'.xyz' 915 zfnvstcdlat10 =
'vstcdlat.'//trim(suffix2t10)//
'.xyz' 916 zfnvstcdlon10 =
'vstcdlon.'//trim(suffix2t10)//
'.xyz' 918 bfnvmtcdlat00 =
'vmtcdlat.'//trim(suffix2t00)//
'.b' 919 bfnvmtcdlon00 =
'vmtcdlon.'//trim(suffix2t00)//
'.b' 920 bfnvmtcdeht00 =
'vmtcdeht.'//trim(suffix2t00)//
'.b' 921 bfnvstcdlat00 =
'vstcdlat.'//trim(suffix2t00)//
'.b' 922 bfnvstcdlon00 =
'vstcdlon.'//trim(suffix2t00)//
'.b' 923 bfnvmtcdlat04 =
'vmtcdlat.'//trim(suffix2t04)//
'.b' 924 bfnvmtcdlon04 =
'vmtcdlon.'//trim(suffix2t04)//
'.b' 925 bfnvmtcdeht04 =
'vmtcdeht.'//trim(suffix2t04)//
'.b' 926 bfnvstcdlat04 =
'vstcdlat.'//trim(suffix2t04)//
'.b' 927 bfnvstcdlon04 =
'vstcdlon.'//trim(suffix2t04)//
'.b' 928 bfnvmtcdlat10 =
'vmtcdlat.'//trim(suffix2t10)//
'.b' 929 bfnvmtcdlon10 =
'vmtcdlon.'//trim(suffix2t10)//
'.b' 930 bfnvmtcdeht10 =
'vmtcdeht.'//trim(suffix2t10)//
'.b' 931 bfnvstcdlat10 =
'vstcdlat.'//trim(suffix2t10)//
'.b' 932 bfnvstcdlon10 =
'vstcdlon.'//trim(suffix2t10)//
'.b' 935 dbfnvmtcdlat1000 =
'vmtcdlat.'//trim(suffix2d1)//
'.b' 936 dbfnvstcdlat1000 =
'vstcdlat.'//trim(suffix2d1)//
'.b' 937 dbfnvmtcdlon1000 =
'vmtcdlon.'//trim(suffix2d1)//
'.b' 938 dbfnvstcdlon1000 =
'vstcdlon.'//trim(suffix2d1)//
'.b' 939 dbfnvmtcdeht1000 =
'vmtcdeht.'//trim(suffix2d1)//
'.b' 941 adbfnvmtcdlat1000 =
'vmtcdlat.'//trim(suffix2d2)//
'.b' 942 adbfnvstcdlat1000 =
'vstcdlat.'//trim(suffix2d2)//
'.b' 943 adbfnvmtcdlon1000 =
'vmtcdlon.'//trim(suffix2d2)//
'.b' 944 adbfnvstcdlon1000 =
'vstcdlon.'//trim(suffix2d2)//
'.b' 945 adbfnvmtcdeht1000 =
'vmtcdeht.'//trim(suffix2d2)//
'.b' 947 sadbfnvmtcdlat1000 =
'vmtcdlat.'//trim(suffix2d3)//
'.b' 948 sadbfnvstcdlat1000 =
'vstcdlat.'//trim(suffix2d3)//
'.b' 949 sadbfnvmtcdlon1000 =
'vmtcdlon.'//trim(suffix2d3)//
'.b' 950 sadbfnvstcdlon1000 =
'vstcdlon.'//trim(suffix2d3)//
'.b' 951 sadbfnvmtcdeht1000 =
'vmtcdeht.'//trim(suffix2d3)//
'.b' 955 xgridmin = dble(igridsec)/60.d0
961 if(nthinhor.ne.0)
then 962 write(99,501)trim(gfnsmtcdlat),glomn,glomx,glamn,glamx,
963 * xgridmin,trim(rfnvmtcdlat00),0.0,cmidlat
964 write(99,501)trim(gfnsstcdlat),glomn,glomx,glamn,glamx,
965 * xgridmin,trim(rfnvstcdlat00),0.0,cmidlat
967 write(99,501)trim(gfnsmtcdlat),glomn,glomx,glamn,glamx,
968 * xgridmin,trim(rfnvmtcdlat04),0.4,cmidlat
969 write(99,501)trim(gfnsstcdlat),glomn,glomx,glamn,glamx,
970 * xgridmin,trim(rfnvstcdlat04),0.4,cmidlat
972 write(99,501)trim(gfnsmtcdlat),glomn,glomx,glamn,glamx,
973 * xgridmin,trim(rfnvmtcdlat10),1.0,cmidlat
974 write(99,501)trim(gfnsstcdlat),glomn,glomx,glamn,glamx,
975 * xgridmin,trim(rfnvstcdlat10),1.0,cmidlat
979 if(nthinhor.ne.0)
then 980 write(99,501)trim(gfnsmtcdlon),glomn,glomx,glamn,glamx,
981 * xgridmin,trim(rfnvmtcdlon00),0.0,cmidlat
982 write(99,501)trim(gfnsstcdlon),glomn,glomx,glamn,glamx,
983 * xgridmin,trim(rfnvstcdlon00),0.0,cmidlat
985 write(99,501)trim(gfnsmtcdlon),glomn,glomx,glamn,glamx,
986 * xgridmin,trim(rfnvmtcdlon04),0.4,cmidlat
987 write(99,501)trim(gfnsstcdlon),glomn,glomx,glamn,glamx,
988 * xgridmin,trim(rfnvstcdlon04),0.4,cmidlat
990 write(99,501)trim(gfnsmtcdlon),glomn,glomx,glamn,glamx,
991 * xgridmin,trim(rfnvmtcdlon10),1.0,cmidlat
992 write(99,501)trim(gfnsstcdlon),glomn,glomx,glamn,glamx,
993 * xgridmin,trim(rfnvstcdlon10),1.0,cmidlat
997 if(nthineht.ne.0)
then 998 write(99,501)trim(gfnsmtcdeht),glomn,glomx,glamn,glamx,
999 * xgridmin,trim(rfnvmtcdeht00),0.0,cmidlat
1001 write(99,501)trim(gfnsmtcdeht),glomn,glomx,glamn,glamx,
1002 * xgridmin,trim(rfnvmtcdeht04),0.4,cmidlat
1004 write(99,501)trim(gfnsmtcdeht),glomn,glomx,glamn,glamx,
1005 * xgridmin,trim(rfnvmtcdeht10),1.0,cmidlat
1009 if(nthinhor.ne.0)
then 1010 write(99,502)trim(rfnvmtcdlat00),trim(zfnvmtcdlat00)
1011 write(99,502)trim(rfnvstcdlat00),trim(zfnvstcdlat00)
1013 write(99,502)trim(rfnvmtcdlat04),trim(zfnvmtcdlat04)
1014 write(99,502)trim(rfnvstcdlat04),trim(zfnvstcdlat04)
1016 write(99,502)trim(rfnvmtcdlat10),trim(zfnvmtcdlat10)
1017 write(99,502)trim(rfnvstcdlat10),trim(zfnvstcdlat10)
1020 if(nthinhor.ne.0)
then 1021 write(99,502)trim(rfnvmtcdlon00),trim(zfnvmtcdlon00)
1022 write(99,502)trim(rfnvstcdlon00),trim(zfnvstcdlon00)
1024 write(99,502)trim(rfnvmtcdlon04),trim(zfnvmtcdlon04)
1025 write(99,502)trim(rfnvstcdlon04),trim(zfnvstcdlon04)
1027 write(99,502)trim(rfnvmtcdlon10),trim(zfnvmtcdlon10)
1028 write(99,502)trim(rfnvstcdlon10),trim(zfnvstcdlon10)
1031 if(nthineht.ne.0)
then 1032 write(99,502)trim(rfnvmtcdeht00),trim(zfnvmtcdeht00)
1034 write(99,502)trim(rfnvmtcdeht04),trim(zfnvmtcdeht04)
1036 write(99,502)trim(rfnvmtcdeht10),trim(zfnvmtcdeht10)
1040 if(nthinhor.ne.0)
then 1041 write(99,503)trim(zfnvmtcdlat00),trim(bfnvmtcdlat00)
1042 write(99,503)trim(zfnvstcdlat00),trim(bfnvstcdlat00)
1044 write(99,503)trim(zfnvmtcdlat04),trim(bfnvmtcdlat04)
1045 write(99,503)trim(zfnvstcdlat04),trim(bfnvstcdlat04)
1047 write(99,503)trim(zfnvmtcdlat10),trim(bfnvmtcdlat10)
1048 write(99,503)trim(zfnvstcdlat10),trim(bfnvstcdlat10)
1051 if(nthinhor.ne.0)
then 1052 write(99,503)trim(zfnvmtcdlon00),trim(bfnvmtcdlon00)
1053 write(99,503)trim(zfnvstcdlon00),trim(bfnvstcdlon00)
1055 write(99,503)trim(zfnvmtcdlon04),trim(bfnvmtcdlon04)
1056 write(99,503)trim(zfnvstcdlon04),trim(bfnvstcdlon04)
1058 write(99,503)trim(zfnvmtcdlon10),trim(bfnvmtcdlon10)
1059 write(99,503)trim(zfnvstcdlon10),trim(bfnvstcdlon10)
1062 if(nthineht.ne.0)
then 1063 write(99,503)trim(zfnvmtcdeht00),trim(bfnvmtcdeht00)
1065 write(99,503)trim(zfnvmtcdeht04),trim(bfnvmtcdeht04)
1067 write(99,503)trim(zfnvmtcdeht10),trim(bfnvmtcdeht10)
1072 *
'surface ',a,
' -R',f9.5,
'/',f9.5,
'/',sp,f9.5,
'/',f9.5,s,
1073 *
' -I',f0.2,
'm -G',a,
' -T',f3.1,
' -A',s,f6.4,
' -C0.01 -V')
1080 *
'grd2xyz ',a,
' -bo3f > ',a)
1092 *a,/,f10.5,/,a,/,
'!')
1094 *
'b2xyz << !',/,a,/,
'!',/,
1095 *
'xyz2grd temp.xyz -R',f9.5,
'/',f9.5,
'/',sp,f9.5,
'/',f9.5,s,
1096 *
' -I',f0.2,
'm -bi3f -G',a,/,
1111 if(nthinhor.ne.0)
then 1112 write(99,504)trim(bfnvmtcdlat10),trim(bfnvmtcdlat00),
1113 * trim(dbfnvmtcdlat1000)
1114 write(99,504)trim(bfnvstcdlat10),trim(bfnvstcdlat00),
1115 * trim(dbfnvstcdlat1000)
1117 write(99,504)trim(bfnvmtcdlon10),trim(bfnvmtcdlon00),
1118 * trim(dbfnvmtcdlon1000)
1119 write(99,504)trim(bfnvstcdlon10),trim(bfnvstcdlon00),
1120 * trim(dbfnvstcdlon1000)
1123 if(nthineht.ne.0)
then 1124 write(99,504)trim(bfnvmtcdeht10),trim(bfnvmtcdeht00),
1125 * trim(dbfnvmtcdeht1000)
1129 if(nthinhor.ne.0)
then 1130 write(99,505)trim(dbfnvmtcdlat1000),trim(adbfnvmtcdlat1000)
1131 write(99,505)trim(dbfnvstcdlat1000),trim(adbfnvstcdlat1000)
1132 write(99,505)trim(dbfnvmtcdlon1000),trim(adbfnvmtcdlon1000)
1133 write(99,505)trim(dbfnvstcdlon1000),trim(adbfnvstcdlon1000)
1136 if(nthineht.ne.0)
then 1137 write(99,505)trim(dbfnvmtcdeht1000),trim(adbfnvmtcdeht1000)
1141 if(nthinhor.ne.0)
then 1142 write(99,506)trim(adbfnvmtcdlat1000),rng2std,
1143 * trim(sadbfnvmtcdlat1000)
1144 write(99,506)trim(adbfnvstcdlat1000),rng2std,
1145 * trim(sadbfnvstcdlat1000)
1146 write(99,506)trim(adbfnvmtcdlon1000),rng2std,
1147 * trim(sadbfnvmtcdlon1000)
1148 write(99,506)trim(adbfnvstcdlon1000),rng2std,
1149 * trim(sadbfnvstcdlon1000)
1152 if(nthineht.ne.0)
then 1153 write(99,506)trim(adbfnvmtcdeht1000),rng2std,
1154 * trim(sadbfnvmtcdeht1000)
1160 if(nthinhor.ne.0)
then 1161 write(99,507)trim(sadbfnvmtcdlat1000)
1162 * ,glomn,glomx,glamn,glamx,xgridmin,trim(sadrfnvmtcdlat1000)
1163 write(99,507)trim(sadbfnvstcdlat1000)
1164 * ,glomn,glomx,glamn,glamx,xgridmin,trim(sadrfnvstcdlat1000)
1165 write(99,507)trim(sadbfnvmtcdlon1000)
1166 * ,glomn,glomx,glamn,glamx,xgridmin,trim(sadrfnvmtcdlon1000)
1167 write(99,507)trim(sadbfnvstcdlon1000)
1168 * ,glomn,glomx,glamn,glamx,xgridmin,trim(sadrfnvstcdlon1000)
1171 if(nthineht.ne.0)
then 1172 write(99,507)trim(sadbfnvmtcdeht1000)
1173 * ,glomn,glomx,glamn,glamx,xgridmin,trim(sadrfnvmtcdeht1000)
1179 if(trim(olddtm).eq.
'nad83_harn' .and.
1180 * trim(newdtm).eq.
'nad83_fbn' .and.
1181 * trim(region).eq.
'conus' )
then 1189 if(nthinhor.ne.0)
then 1190 write(99,602)trim(bfnvmtcdlat04),
1191 * trim(bfnvmtcdlat04)//
'.premask',
1192 * trim(bfnvmtcdlat04)//
'.premask',
1193 * trim(bfnvmtcdlat04),
1194 * igridsec/30,igridsec/30
1196 write(99,602)trim(bfnvstcdlat04),
1197 * trim(bfnvstcdlat04)//
'.premask',
1198 * trim(bfnvstcdlat04)//
'.premask',
1199 * trim(bfnvstcdlat04),
1200 * igridsec/30,igridsec/30
1202 write(99,602)trim(bfnvmtcdlon04),
1203 * trim(bfnvmtcdlon04)//
'.premask',
1204 * trim(bfnvmtcdlon04)//
'.premask',
1205 * trim(bfnvmtcdlon04),
1206 * igridsec/30,igridsec/30
1208 write(99,602)trim(bfnvstcdlon04),
1209 * trim(bfnvstcdlon04)//
'.premask',
1210 * trim(bfnvstcdlon04)//
'.premask',
1211 * trim(bfnvstcdlon04),
1212 * igridsec/30,igridsec/30
1215 if(nthineht.ne.0)
then 1216 write(99,602)trim(bfnvmtcdeht04),
1217 * trim(bfnvmtcdeht04)//
'.premask',
1218 * trim(bfnvmtcdeht04)//
'.premask',
1219 * trim(bfnvmtcdeht04),
1220 * igridsec/30,igridsec/30
1225 if(nthinhor.ne.0)
then 1227 * trim(zfnvmtcdlat04),trim(zfnvmtcdlat04)//
'.premask',
1228 * trim(bfnvmtcdlat04),
1229 * trim(zfnvmtcdlat04),
1230 * trim(rfnvmtcdlat04),
1231 * trim(rfnvmtcdlat04)//
'.premask',
1232 * trim(zfnvmtcdlat04),
1233 * glomn,glomx,glamn,glamx,xgridmin,trim(rfnvmtcdlat04)
1236 * trim(zfnvstcdlat04),trim(zfnvstcdlat04)//
'.premask',
1237 * trim(bfnvstcdlat04),
1238 * trim(zfnvstcdlat04),
1239 * trim(rfnvstcdlat04),
1240 * trim(rfnvstcdlat04)//
'.premask',
1241 * trim(zfnvstcdlat04),
1242 * glomn,glomx,glamn,glamx,xgridmin,trim(rfnvstcdlat04)
1245 * trim(zfnvmtcdlon04),trim(zfnvmtcdlon04)//
'.premask',
1246 * trim(bfnvmtcdlon04),
1247 * trim(zfnvmtcdlon04),
1248 * trim(rfnvmtcdlon04),
1249 * trim(rfnvmtcdlon04)//
'.premask',
1250 * trim(zfnvmtcdlon04),
1251 * glomn,glomx,glamn,glamx,xgridmin,trim(rfnvmtcdlon04)
1254 * trim(zfnvstcdlon04),trim(zfnvstcdlon04)//
'.premask',
1255 * trim(bfnvstcdlon04),
1256 * trim(zfnvstcdlon04),
1257 * trim(rfnvstcdlon04),
1258 * trim(rfnvstcdlon04)//
'.premask',
1259 * trim(zfnvstcdlon04),
1260 * glomn,glomx,glamn,glamx,xgridmin,trim(rfnvstcdlon04)
1263 if(nthineht.ne.0)
then 1265 * trim(zfnvmtcdeht04),trim(zfnvmtcdeht04)//
'.premask',
1266 * trim(bfnvmtcdeht04),
1267 * trim(zfnvmtcdeht04),
1268 * trim(rfnvmtcdeht04),
1269 * trim(rfnvmtcdeht04)//
'.premask',
1270 * trim(zfnvmtcdeht04),
1271 * glomn,glomx,glamn,glamx,xgridmin,trim(rfnvmtcdeht04)
1276 *
'b2xyz << !',/,a,/,
'!',/,
1277 *
'mv temp.xyz ',a,/,
1279 *
'xyz2grd ',a,
' -R',f9.5,
'/',f9.5,
'/',sp,f9.5,
'/',f9.5,s,
1280 *
' -I',f0.2,
'm -bis -G',a)
1283 601
format(
'echo Applying MASK for HARN FBN CONUS 04 grids')
1295 *
'Masks/mask.harnfbn.30.b',/,
1304 *
'rm -f dummy1.b',/,
1318 write(99,1031)trim(gmtfile)
1319 1031
format(
'echo END batch file ',a)
1323 9999
format(
'END mymedian5.f')
1326 2006
format(
'Cell ',i8,
' Poscode: ',i12)
1327 2007
format(6x,
'Pt : ',i5)
1332 subroutine getmedian(zs,max,inumlo,inumhi,indx,
1333 *maxppcell,dist,iiival)
1334 real*8 zs(max),dist(max)
1335 integer*4 indx(max),indx2(maxppcell)
1336 integer*4 inumlo,inumhi
1338 real*8 zz(maxppcell)
1354 nval = inumhi-inumlo+1
1356 do 2 i=inumlo,inumhi
1358 zz(iq) = zs(indx(i))
1361 3
format(i10,1x,i10,1x,f20.10)
1366 call indexxd(nval,maxppcell,zz,indx2)
1373 5
format(i10,1x,f20.10)
1378 if(mod(nval,2).eq.1)
then 1387 if(dist(indx2(ival1)).lt.dist(indx2(ival2)))
then 1400 igood1 = indx2(ival)
1403 iival = inumlo + indx2(ival) - 1
1405 iiival = indx(iival)
1412 include
'Subs/getgridbounds.f' 1413 include
'Subs/indexxi.for' 1414 include
'Subs/indexxd.for' subroutine indexxd(n, nd, arr, indx)
Subroutine to perform ?? indexing on floating point data (double precision)
subroutine indexxi(n, nd, arr, indx)
Subroutine to perform ?? indexing on integer data.
subroutine getgridbounds(region, xn, xs, xw, xe)
Subroutine to collect up the GRID boundaries for use in creating NADCON 5.
program mymedian5
Program to filter Map Data for GMT Plotting.