c********************************************************* c* fortran program to read and write gem.asc (file X ) * c********************************************************* integer nlin integer id real long, lat, fco2, fhco3 c********************************************************* c* initialize a counter and open files for input/output * c********************************************************* nlin=0 open(unit=5,file='gem.asc',readonly,status='old') open(unit=6,file='gem.out',status='new') c********************************************************* c* read/write the data variables * c********************************************************* 10 read(5,100,end=999) id, long, lat, fco2, fhco3 if (nlin.gt.63) nlin=0 if (nlin.eq.0) write (6,110) nlin=nlin+1 write(6,105) id, long, lat, fco2, fhco3 20 continue go to 10 100 format (i5,2f8.2,2f9.2) 105 format (1x,i5,2f8.2,2f9.2) 110 format (4x,'id',3x,'long',5x,'lat',4x,'fco2', 1 6x, 'fhco3', /,26x, 'in mol km2/yr') c*********************************************************** c***** close files and end ****** c*********************************************************** 999 close(unit=5) close(unit=6) stop end