c read_matrix subroutine c This program reads in the binary input matrices c It requires a data file and an error file. c created 9/96 subroutine read_matrix(grid,grerror,nx,ny,xres,yres,xleft, 1 xright,ytop,ybot) parameter (ngx=1000,ngy=700) character*80, fin,finerror integer nx, ny, iost, i, j real xres,yres,xleft,xright,ytop,ybot real grid(ngy,ngx),grerror(ngy,ngx) c prompt user for input files print *,"Enter the name of the input grid data file" read *,fin print *,"Enter the name of the input gridded error file" read *,finerror iost = 10 ioster = 11 c c open grid file open(iost,file=fin,status='old',form='unformatted',iostat=icd) if (icd .ne. 0) then write(6,*) 'error opening input file iostat= ',icd stop 99 end if c read header read(iost) nx,ny,xres,yres,xleft,xright,ytop,ybot c c open grid error file open(ioster,file=finerror,status='old', 1 form='unformatted',iostat=icd) if (icd .ne. 0) then write(6,*) 'error opening input error file iostat= ',icd stop 99 end if c read error file header read(ioster) nxe,nye,xrese,yrese,xlefte,xrighte,ytope,ybote c c test that error file is compatible with data file c stop if they do not have the same header line call checkerr(nx,ny,xres,yres,xleft,xright,ytop,ybot, 1 nxe,nye,xrese,yrese,xlefte,xrighte,ytope,ybote) c c read data and errors do i = 1, ny read(iost) (grid(i,j),j=1,nx) read(ioster) (grerror(i,j),j=1,nx) enddo close(iost) close(ioster) return end