SUBROUTINE SGRIDS * SGRIDS is DFILES subroutine revised for state hpgn files * This subroutine opens the NADCON grids using the state HPGN * grid files. Only 1 state hpgn file can be open at any one time * the program loop will take care of using other states in the same * run - jmb 1/16/92 IMPLICIT DOUBLE PRECISION (A-H, O-Z) IMPLICIT INTEGER (I-N) * IMPLICIT UNDEFINED (A-Z) INTEGER MXAREA, MXDEF PARAMETER (MXAREA = 8, MXDEF = MXAREA, MXSAREA = 3, * MXSDEF = MXSAREA) CHARACTER*80 B80 CHARACTER*65 B65 CHARACTER*20 B20 CHARACTER*2 state,tstate(MXSDEF) PARAMETER (B20 = ' ', B80 = B20//B20//B20//B20) PARAMETER (B65 = B20//B20//B20//' ') DOUBLE PRECISION XMAX1, XMIN1, YMAX1, YMIN1 DOUBLE PRECISION DX1, DY1 INTEGER ITEMP, NC1 CHARACTER*80 DUM CHARACTER*65 AFILE c CHARACTER*15 DAREAS(MXDEF) LOGICAL NOGO, GFLAG CHARACTER*15 AREAS COMMON /AREAS/ AREAS(MXAREA) DOUBLE PRECISION DX, DY, XMAX, XMIN, YMAX, YMIN INTEGER NC, NAREA COMMON /GDINFO/ DX(MXAREA), DY(MXAREA), XMAX(MXAREA), + XMIN(MXAREA), YMAX(MXAREA), YMIN(MXAREA), + NC(MXAREA), NAREA INTEGER LUIN, LUOUT, NOUT, NIN, NAPAR, LUAREA COMMON /INOUT/ LUIN, LUOUT, NOUT, NIN, NAPAR, LUAREA(2*MXAREA) DATA DUM / B80 / c the following does not pertain to state grid files * DFILES contains the default locations (pathname) of the grid files * without the .las and .los extensions. (For example 'conus' would * indicate that the conus.las and conus.los grid files are in the * current working directory.) The length of each entry in DFILES may * be up to 65 characters. DAREAS contains the default names of these * areas. The names are used internally in the program and in the * program output. They may be no longer than 15 characters. They * must correspond on a one-to-one basis with the file locations in * the DFILES array. That is, the first area name in DAREAS must * be the name that you wish for the first data file set in the * DFILES array. You may, of course, have the arrays the same if * the location of the data file is no longer than 15 characters. * The locations of the grid files may be differ for each * installation. If the pathnames are not correct DFILES (and, possibly, * DAREAS) may be changed and the program recompiled. GFLAG = .FALSE. c pick up the state file if no file is in area.par. write(LUOUT,90) 90 FORMAT(//,' "README.210" documentation file contains ', + 'the names of the states',/, + 'which have High Precision grids.',/, + ' Please refer to that file before running NADCON', + ///) write(LUOUT,91) MXSAREA 91 format('When prompted, enter the two-letter name for the ',/, + 'states or state groups you choose',/,'Enter when ', + 'finished',/,'MAXIMUM STATES = ',I3) c 3/94 - read up to maxsdef states first; then loop to open files c looks better do j=1,mxsdef write(6,*) 'enter a 2-letter state or to end' READ(LUIN,95) tstate(j) 95 FORMAT(A2) if(tstate(j).eq.' ') then jt = j -1 go to 96 else jt = j end if c end of reading in states end do 96 do 140 IDEF = 1,jt c WRITE(LUOUT,'(/)') AFILE = B65 c attach SUN directory locations; assume same for both vixen, venus c 3/94 - jmb state = tstate(IDEF) AFILE='/ngslib/data/'//state//'hpgn' c AFILE(1:2) = state c AFILE(3:6) = 'hpgn' * Do not print error messages for non-existing files. ITEMP = NAREA + 1 CALL OPENFL (AFILE, ITEMP, GFLAG, NOGO, DX1, DY1, + XMAX1, XMIN1, YMAX1, YMIN1, NC1, DUM) IF (.NOT. NOGO) THEN * Set of files opened OK and variables read NAREA = ITEMP c AREAS(NAREA) = DAREAS(IDEF) AREAS(NAREA) = state//'hpgn' DX(NAREA) = DX1 DY(NAREA) = DY1 XMAX(NAREA) = XMAX1 XMIN(NAREA) = XMIN1 YMAX(NAREA) = YMAX1 YMIN(NAREA) = YMIN1 NC(NAREA) = NC1 c WRITE (LUOUT,120) NAREA, AREAS(NAREA) c 120 FORMAT (2X, I2, 2X, A15) write(LUOUT,121) NAREA, state 121 FORMAT (2X,I2,2X,A2) ENDIF 140 CONTINUE 999 RETURN END