program convert_ocean_i8_to_i4 ! Reads an oceanic restart file written by the CSIRO Mk3 GCM when using ! 64-bit integers, and writes the data out using 32-bit integers. ! ! Note: This program must be compiled using -r8 ! ! Usage: convert_ocean_i8_to_i4 ! ! Steve Phipps 28 April 2003 implicit none ! Define constants integer, parameter :: inunit=10, outunit=11, ntb=689060 ! Declare variables character(len=80) :: infile, outfile integer(kind=8) :: itt real, dimension(ntb-1) :: data ! Get names of input and output files call getarg(1, infile) call getarg(2, outfile) ! Open input and output files open(unit=inunit, file=infile, status='old', form='unformatted', & action='read') open(unit=outunit, file=outfile, status='new', form='unformatted', & action='write') ! Read data from input file and write immediately to output file read (inunit) itt, data write (*, *) "itt = ", itt write (outunit) int(itt, 4), data ! Close input and output files close (unit=inunit) close (unit=outunit) end program convert_ocean_i8_to_i4