program find_region C$$$ MAIN PROGRAM DOCUMENTATION BLOCK C C MAIN PROGRAM: GFDL_FIND_REGION C PRGMMR: MARCHOK ORG: NP22 DATE: 2001-03-22 C C ABSTRACT: this program selects the ocean domain to run with the coupled C GFDL hurricane model. The selection is done on the basis of the C previous forecast. C C PROGRAM HISTORY LOG: C 98-06-02 frolov - original implementation C 00-03-21 rowe - reorganized, corrected C C INPUT FILES: C UNIT 5 standart input, 'shortstats' (stats.6) file produced C by GFDL hurricane model C C OUTPUT FILES: C UNIT 6 standart output C C ATTRIBUTES: C LANGUAGE: FORTRAN 77 C C$$$ c this program reads the shortstats file, extracts the track information c and picks the ocean domain. c c dail - march 20,2000 implicit none integer nreg, nobsmax parameter (nreg=3, nobsmax=500) real xw(nreg), xe(nreg), ys(nreg), yn(nreg) character*15 cregion(nreg) integer inbox c region definitions and names (in longitude and latitude) data xw/-98.5,-82.0,-60.0/ data xe/-75.0,-50.0,-30.0/ data ys/ 15.0, 10.0, 10.0/ data yn/ 31.0, 47.5, 40.0/ data cregion/'gulf_new','west_atlantic','east_atlantic'/ c track and storm information real hour(nobsmax), lon(nobsmax), lat(nobsmax), pmin(nobsmax), | wsf(nobsmax) c utility variables integer nobs, i, j, ninreg(nreg), region, ii CALL W3TAGB('GFDL_FIND_REGION',2001,0081,0097,'NP22') c load the track information from the standard input. the input must c be formatted consistent with label 200 i = 1 do while (.true.) read(5,*,end=201) hour(i), lon(i), lat(i), pmin(i), wsf(i) c bail out if bad data if (hour(i).eq.-99.9) goto 201 i = i+1 end do ! while .true. c 200 format(5x,f5.1,7x,f8.2,6x,f7.2,19x,f7.2,25x,f6.2) 201 continue nobs = i - 1 c count the number of track points in each region do i=1,nreg ninreg(i) = 0 do j=1,nobs ii = inbox( lon(j),lat(j),xw(i),xe(i),ys(i),yn(i) ) if (ii.ne.0) then ninreg(i) = ninreg(i) + 1 write(61, |'("hour: ",f7.2," lat: ",f7.2,", long: ",f7.2,", region: ",a15)') | hour(j), lat(j), lon(j), cregion(i) end if end do end do c determine which region the track is in j = 0 do i=1,nreg if (ninreg(i).gt.j) then j = max(j,ninreg(i)) region = i end if end do c check to see if the track is all in one region if (j.lt.nobs) then write(61,'("Track occupies multiple regions.")') write(61,'(i3," of ",i3," points in region ",a15)') | j,nobs,cregion(region) else write(61,'("Track is entirely in region ",a15)') | cregion(region) end if c one line output for simplicity in script write(61,'(a15)') cregion(region) stop end integer function inbox(x,y,xl,xr,yb,yt) implicit none real x, y, xl, xr, yb, yt if(x.gt.xl.and.x.lt.xr.and.y.gt.yb.and.y.lt.yt) then inbox=1 else inbox=0 endif CALL W3TAGE('GFDL_FIND_REGION') return end