integer , allocatable :: lgrid(:,:) real , allocatable :: xdepth(:,:) ! x coordinate depth points real , allocatable :: ydepth(:,:) ! y coordinate depth points real , allocatable :: x(:) real , allocatable :: y(:) character*256 fil1, fil2, fil3, fil3lga, fil3cco call getarg(1,fil1) call getarg(2,fil2) call getarg(3,fil3) write(fil3lga,'(a,a)') trim(fil3), '.lga' write(fil3cco,'(a,a)') trim(fil3), '.cco' write (*,*) 'in dwq file=',trim(fil1) write (*,*) 'in cco file=',trim(fil2) write (*,*) 'out lga file=',trim(fil3lga) write (*,*) 'out cco file=',trim(fil3cco) write (*,*) ' ' open(10,file=fil1) open(11,file=fil2,form='binary') open(12,file=fil3lga,form='binary') open(13,file=fil3cco,form='binary') read(10,*) nmax,mmax,noseg,nolay,idum read(11) mmaxcco,nmaxcco,x0,y0,alpha,npart,nolaycco write(*,*) 'nolay in dwq =',nolay write(*,*) 'mmax in dwq =',mmax write(*,*) 'nmax in dwq =',nmax write (*,*) ' ' write(*,*) 'mmax in cco =',mmaxcco write(*,*) 'nmax in cco =',nmaxcco if (nmaxcco.ne.nmax.or.mmaxcco.ne.mmax) then write(*,*) 'error nmax, mmax of dwq and cco do not match' stop(1) end if allocate(lgrid(nmax,mmax),stat=ierr_alloc) if ( ierr_alloc .ne. 0 ) then write(*,*) 'error allocating lgrid array:',ierr_alloc stop endif read(10,*) lgrid noseg = maxval(lgrid) ! noseg = nmax*mmax noq1 = 1 noq2 = 2 noq3 = 3 write(12) nmax,mmax,noseg,nolay,noq1,noq2,noq3 write(12) lgrid ! now copy cco file with the number of layers from the dwq-file write(13) mmax,nmax,x0,y0,alpha,npart,nolay c allocate(x(nmax*mmax),y(nmax*mmax),stat=ierr_alloc) if ( ierr_alloc .ne. 0 ) then write(*,*) 'error allocating buffer arrays:',ierr_alloc stop(1) endif c do i=1 , 2*npart+9 read(11) rdum write(13) rdum enddo c read(11) x read(11) y write(13) x write(13) y c close ( 10 ) close ( 11 ) close ( 12 ) close ( 13 ) end