program read_indoex c c program to read in header and 60X60X86 composite array for the indoex region c parameter (maxlat=60,maxlon=60,maxvars=86) dimension header(50) dimension tmpbuf(maxlon,maxlat,maxvars) character*80 filename integer ninunit character*80 outfilename integer ounit call getarg(1,filename) if(filename .eq. '') then print*,'usage: read_indoex file_name [out_file_name]' stop endif ninunit=10 c byte-swap modifications by codiac@ucar.edu (jja) c for intel boxen (linux,windows) use convert='BIG_ENDIAN' c open(ninunit,file=filename,form='unformatted', c . status='old',convert='BIG_ENDIAN') c for proper byte-ordered boxes (sun/solaris), leave it out open(ninunit,file=filename,form='unformatted', . status='old') read (ninunit) (header(kk),kk=1,4) nread=header(1) numlats=header(2) numlons=header(3) ntotvar=header(4) rewind(ninunit) read (ninunit) (header(kk),kk=1,nread) c print*,header do kk=1,numlats do jj=1,numlons read (ninunit) (tmpbuf(jj,kk,ii),ii=1,ntotvar) enddo enddo iyr=header(7) ijd=header(8) write(6,'("Composite: ",a40)') filename(1:40) write(6,'("Start Year: ",i4," Julian Day: ",i4)') iyr,ijd close (ninunit) c modifications by codiac@ucar.edu (jja) c write out the file if an outfile appears c useful to byte-swap the file for intel boxen call getarg(2,outfilename) if(outfilename .ne. '') then ounit=12 open(unit=ounit,file=outfilename,form='unformatted', . status='new') write (ounit) (header(kk),kk=1,nread) do kk=1,numlats do jj=1,numlons write (ounit) (tmpbuf(jj,kk,ii),ii=1,ntotvar) enddo enddo close(ounit) endif stop end