program adjust_slope_inter c adjust for the slope and intercept... c c Just reads the ascii gempak files and adds or subtracts grids. DRB parameter (igemy=129, igemx=185) ! GEMPAK grid size c real prct(igemy,igemx,1),grd(igemx,igemy),grdl(igemx,igemy), & slope,yinter integer igemy,igemx,jstop,jdel,restart,lyrval character*150 pctfila,pctfilb,fslope character dummy*20,date*8,fhour*4,frun*2,dateetc*72,gfunc*6, & dowhat*3 call getarg(1,pctfila) ! forecast file c call getarg(2,pctfilb) ! forecast file2 call getarg(2,date) ! YYYYMMDD call getarg(3,frun) ! 00 or 12 call getarg(4,fhour) ! f000 ... f063... call getarg(5,gfunc) ! 6 character output name call getarg(6,fslope) ! slope and intercept file do i=1,72 dateetc(i:i) = ' ' enddo dateetc(1:6) = date(3:8) dateetc(7:7) = '/' dateetc(8:9) = frun(1:2) dateetc(10:12) = '00F' dateetc(13:15) = fhour(2:4) dateetc(40:40) = '0' dateetc(51:54) = 'NONE' dateetc(56:61) = gfunc(1:6) c 1 format(a) c Now read them in... c c 1. Read in the percent file: open(unit=10,file=pctfila,status='old',form='formatted') write(*,*) 'Reading the GEMPAK forecast file 1 now: ',pctfila 7775 read(10,1) dummy if(dummy(2:4).eq.'ROW') then backspace(unit=10) do j=igemy,1,-1 if(j.ge.100) then read(10,*) dummy(1:8),(prct(j,i,1),i=1,igemx) else read(10,*) dummy(1:8),irow,(prct(j,i,1),i=1,igemx) endif enddo else goto 7775 endif close(unit=10) c read the slope information off the disk... open(unit=12,file=fslope,status='old') read(12,*) slope read(12,*) yinter close(12) c c Now...add or subtract here... c do i=1,igemx do j=1,igemy if(nint(prct(j,i,1)).eq.-9999) then grd(i,j) = -9999.0 else grd(i,j) = yinter + (prct(j,i,1)*slope) if(grd(i,j).lt.0.0.and.grd(i,j).gt.-9000.0) grd(i,j)=0.0 if(grd(i,j).gt.100.0) grd(i,j)=100.0 endif enddo ! j loop enddo ! i loop c c Write the gempak file to the disk. GDEDIT will put in the gempak file. c c generic "stuff" follows open(unit=20,file='file3.out',status='unknown') restart = 0 805 continue write(20,1) ' GRID IDENTIFIER:' write(20,1) ' TIME1 TIME2 LEVL1 LEVL2 VC &ORD PARM' write(20,1) dateetc(1:72) write(20,*) ' AREA: GRID GRID SIZE: ',igemx,igemy write(20,*) 'COLUMNS: 1 ',igemx,' ROWS: 1 ',igemy write(20,*) ' ' write(20,1) ' Scale factor: 10** 0' write(20,1) ' ' write(20,1) ' ' jstop = 8 jdel = 7 20 continue if(jstop.eq.8) then write(20,29) ' COLUMN:',(j,j=jstop-jdel,jstop) else write(20,29) ' ',(j,j=jstop-jdel,jstop) endif jstop = jstop + 8 if(jstop.le.igemx) then goto 20 elseif(jstop.ne.(igemx+8)) then jdel = igemx - (jstop - 8) - 1 jstop = igemx goto 20 else jstop = 8 jdel = 7 endif 29 format(a8,2x,i5,7(4x,i5)) jstop = 8 jdel = 7 do i = igemy,1,-1 30 continue c write(*,*) 'row,jstart,jstop= ',i, jstop-jdel, jstop if(jstop.eq.8) then write(20,31) ' ROW',i,(grd(j,i),j=jstop-jdel,jstop) else write(20,32) ' ',' ',(grd(j,i),j=jstop-jdel,jstop) endif jstop = jstop + 8 if(jstop.le.igemx) then goto 30 elseif(jstop.ne.(igemx+8)) then jdel = igemx - (jstop - 8) - 1 jstop = igemx goto 30 else jstop = 8 jdel = 7 endif enddo 31 format(a4,i3,1x,8(1x,f8.2)) 32 format(a4,a3,1x,8(1x,f8.2)) close(unit=20) c stop 'Done adjusting probabilities with linear regression' end