PROGRAM convert_rfe1 c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Program: convert_rfe1.f c c Description: This program reads in a 10-day rainfall estimate c (version 1) in .dat format and creates an ascii integer c file for use with GIS systems. Each file contains c header information as well as rfe data ordered by rows. c The program was written in Fortran90 on the HP operating c system, while each dat file was created on a SGI. c Rainfall resolution is 0.1 degree with a domain of c 20W-55E, 40S-20N. c c Inputs: 'input_file' = the 10-day binary precip file to be converted c c Output: '10day_rfe1.txt' = the output ascii converted text file c c Modified: July 15, 2002 by Tim Love (Tim.Love@noaa.gov) c c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc REAL:: rfe(751,601),arr1(751) INTEGER:: x,y,a,b character*20:: input_file c ##### CHANGE FILE NAME BELOW TO INPUT FILE ##### input_file="afpfinalcal00121.dat" c ################################################## c ##### Initialize the arrays ##### do 3001 x = 1, 751 do 3001 y = 1, 601 rfe (x,y) = -999 3001 continue do 3002 x = 1, 751 arr1(x) = -999 3002 continue c ##### Open the input file and read the data ##### open (unit=22, # file=input_file, # access="direct",status="unknown",recl=751*601*4) read (22, rec=1) rfe c ##### Open the output file ##### open (unit=88, # file="10day_rfe1.txt", # access='sequential', # status='unknown',form='formatted') c ##### The lines below write out header information ##### write (88,FMT=200) "ncols 751" write (88,FMT=200) "nrows 601" write (88,FMT=200) "xllcenter -20.0" write (88,FMT=200) "yllcenter -40.0" write (88,FMT=200) "cellsize 0.1" write (88,FMT=200) "nodata_value -999" 200 format(A) c ##### The following code reads the binary precip data, row by row, c into an array and writes it to the output file do b=1,601 do a=1,751 arr1(a)=rfe(a,b) end do write (88,FMT=400) arr1 400 format(751I4) c ##### Reset the row array ##### do 3003 y = 1, 751 arr1(y) = -999 3003 continue end do END PROGRAM convert_rfe1