PROGRAM DEM_TO_GRADS C C This program converts CAPARS unformatted DEM data files to GRADS formats C C by John Ciolek Jr. 09-29-1999 C IMPLICIT NONE C C The MODEL_PARAMETERS include file must appear before any declarations C since it limits the size of most TRAC arrays. C INCLUDE 'MODEL_PARAMETERS.INC' INCLUDE 'DEM.INC' CHARACTER*80 OLD_FILE, NEW_FILE CHARACTER*15 STRING real MISSING INTEGER STATUS, GET_DEM INTEGER ROW_DATA_1(6000), ROW_DATA_2(6000) INTEGER OUT_COL, OUT_ROW, SUM, COUNT INTEGER SKIP_ROWS, SKIP_COLS, OUTPUT_ROWS, OUTPUT_COLS WRITE(6,*) 'Enter the input file name: ' READ(5,11) NEW_FILE WRITE(6,*) 'Enter the GRADS data file name: ' READ(5,11) OLD_FILE 11 FORMAT(A80) OPEN(UNIT=40, + STATUS='OLD', + FORM='UNFORMATTED', + FILE=NEW_FILE) READ(UNIT=40) OUTPUT_COLS WRITE(6,601) OUTPUT_COLS 601 FORMAT(' Number columns: ',I10) READ(UNIT=40) OUTPUT_ROWS WRITE(6,602) OUTPUT_ROWS 602 FORMAT(' Number rows: ',I10) READ(UNIT=40) DEM_BASEX WRITE(6,603) DEM_BASEX 603 FORMAT(' Western edge: ',F8.1) READ(UNIT=40) DEM_BASEY WRITE(6,604) DEM_BASEY 604 FORMAT(' Southern edge: ',F9.1) READ(UNIT=40) DEM_INC WRITE(6,605) DEM_INC 605 FORMAT(' spacing increment = ',F11.4) READ(UNIT=40) MISSING READ(UNIT=40) ((DEM_Z(DEM_COL,DEM_ROW), + DEM_COL=1,OUTPUT_COLS),DEM_ROW=1,OUTPUT_ROWS) CLOSE(UNIT=40) OPEN(UNIT=50, + FILE=OLD_FILE, + STATUS='UNKNOWN', + FORM='UNFORMATTED') WRITE(UNIT=50) ((DEM_Z(DEM_COL,DEM_ROW), + DEM_COL=1,OUTPUT_COLS),DEM_ROW=1,OUTPUT_ROWS) CLOSE(UNIT=50) WRITE(6,*) 'Done' END