program gfill *** load a grid file with a single value implicit double precision(a-h,o-z) parameter(len=1000000) character*88 fname logical makpos integer hrec(len) real*4 zrec(len),val equivalence(hrec(1),zrec(1)) lout=2 write(6,1) 1 format('program gfill') write(6,'(a$)') 'Enter code for data kind (0=integer) --> ' read(5,*) ikind write(6,'(a$)') 'Enter min lon: ' read(5,*) glomn write(6,'(a$)') 'Enter max lon: ' read(5,*) glomx write(6,'(a$)') 'Enter # col: ' read(5,*) nlo idglo=idnint((glomx-glomn)/dble(nlo-1)*720000.d0) dglo=dble(idglo)/720000.d0 if(makpos(glomn)) continue if(makpos(glomx)) continue write(6,'(a$)') 'Enter min lat: ' read(5,*) glamn write(6,'(a$)') 'Enter max lat: ' read(5,*) glamx write(6,'(a$)') 'Enter # row: ' read(5,*) nla idgla=idnint((glamx-glamn)/dble(nla-1)*720000.d0) dgla=dble(idgla)/720000.d0 if(nlo.gt.len) stop 12345 write(6,2) 2 format(' grid output --> Enter file name: ',$) read(5,'(a)') fname open(lout,file=fname,status='new',form='unformatted') if(ikind.eq.0) then write(6,'(a$)') 'Enter integer value to fill grid: ' read(5,*) ival else write(6,'(a$)') 'Enter real*4 value to fill grid: ' read(5,*) val endif *** write the grid write(lout) glamn,glomn,dgla,dglo,nla,nlo,ikind if(ikind.eq.0) then do 12 i=1,nlo 12 hrec(i)=ival do 10 irow=1,nla 10 write(lout) (hrec(i),i=1,nlo) else do 13 i=1,nlo 13 zrec(i)=val do 11 irow=1,nla 11 write(lout) (zrec(i),i=1,nlo) endif stop end logical function makpos(glon) *** insure longitude is positive implicit double precision(a-h,o-z) makpos=.false. 1 if(glon.lt.0.d0) then glon=glon+360.d0 makpos=.true. go to 1 endif 2 if(glon.ge.360.d0) then glon=glon-360.d0 go to 2 endif return end