program mkdat c c Read orography data and make data statements for use in timesgcm: c parameter(imx=73,jmx=36) dimension orog(jmx,imx),orog1(imx,jmx) dimension iasf(13) data iasf/13*1/, mkstate/1/ character*16 flnm character*32 datstat c call opngks call gsclip(0) call gsasf(iasf) call gsfais(1) c c Read orographic data and make simple contour: c (shift longitudes 90 deg west for -180 to +180) c (plot (i,j) array) c open(9,file="orog.dat",status="OLD",err=900) read(9,"(18f4.0)") ((orog(j,i),i=1,imx),j=1,jmx) do i=1,imx ix = mod(i+jmx-2,imx)+1 do j=1,jmx orog1(i,j) = orog(j,ix) enddo enddo call contour(orog1,imx,imx,jmx,0.,1.,0.) call frame c c Make data statements: c (one file per longitude -- cat them after the job and make into block data) c (Ray wants (j,i) array) c if (mkstate.gt.0) then do j=1,jmx if (j.le.9) then write(flnm,"('orog.dat0',i1)") j write(datstat,"('(OROG(I,',i1,'),I=1,73)')") j else write(flnm,"('orog.dat',i2)") j write(datstat,"('(OROG(I,',i2,'),I=1,73)')") j endif lu = 9+j open(lu,file=flnm,err=901) call wrdata(orog1(1,j),imx,datstat,lu) close(lu) enddo endif call clsgks stop 'done' 900 write(6,"('Error opening file orog.dat')") stop 901 write(6,"('Error opening file ',a,' (lu=',i2,')')") flnm,lu stop end c c------------------------------------------------------------------ c subroutine wrdata(x,n,lab,lu) c c This writes a data statement of x(n) to unit lu, using c lab as the variable name. c (B.Foster 2/92) c dimension x(n) character*(*) lab character*72 dline c num = n/5 leftover = mod(n,5) c write(lu,"('C')") c write(lu,"('C Data statement for ',a)") lab c write(lu,"('C')") write(lu,"(' DATA ',a,' /')") lab do i=1,num-1 i1 = (i-1)*5+1 write(lu,"(' +',5(e12.5,','))") (x(ii),ii=i1,i1+4) enddo if (leftover.gt.0) then i1 = (num-1)*5+1 write(lu,"(' +',5(e12.5,','))") (x(ii),ii=i1,i1+4) write(dline,"('('' +'',',I1,'(E12.5,'',''),E12.5,''/'')')") + leftover-1 write(lu,dline) (x(ii),ii=num*5+1,n) else i1 = (num-1)*5+1 write(lu,"(' +',4(e12.5,','),e12.5,'/')") + (x(ii),ii=i1,i1+4) endif c return end