[Fortran] 纯文本查看 复制代码
PROGRAM MAIN
IMPLICIT NONE
INTEGER::I,J,K
INTEGER::DEMCOLS,DEMROWS !DEM数据列数、行数
INTEGER::DEMNODATA !DEM无效值
INTEGER,ALLOCATABLE,DIMENSION(:,:)::PROVALUE
REAL::CORNERLON,CORNERLAT,CELLSIZE
REAL,ALLOCATABLE,DIMENSION(:,:)::DEMLON,DEMLAT
CHARACTER(LEN=30)::DEMTEMP
OPEN(UNIT=1201503,FILE="DATA.txt")
READ(1201503,*)DEMTEMP,DEMCOLS
READ(1201503,*)DEMTEMP,DEMROWS
READ(1201503,*)DEMTEMP,CORNERLON
READ(1201503,*)DEMTEMP,CORNERLAT
READ(1201503,*)DEMTEMP,CELLSIZE
READ(1201503,*)DEMTEMP,DEMNODATA
ALLOCATE(PROVALUE(DEMROWS,DEMCOLS),DEMLON(DEMROWS,DEMCOLS),DEMLAT(DEMROWS,DEMCOLS))
DO I=1,DEMROWS
DEMLAT(I,:)=CORNERLAT+(DEMROWS-I)*CELLSIZE
END DO
DO I=1,DEMCOLS
DEMLON(:,I)=CORNERLON+(I-1)*CELLSIZE
END DO
DO I=1,DEMROWS
READ(1201503,*)(PROVALUE(I,J),J=1,DEMCOLS)
END DO
OPEN(UNIT=2201501,FILE="ResultsCAREPOINTS.txt")
DO J=1,DEMROWS
DO K=1,DEMCOLS
IF((DEMLON(J,K)==101.95.AND.DEMLAT(J,K)==27.05).OR.(DEMLON(J,K)==101.45.AND.DEMLAT(J,K)==26.95).OR.(DEMLON(J,K)==101.75.AND.DEMLAT(J,K)==26.65))THEN
WRITE(2201501,'(2F10.3,I10)')DEMLON(J,K),DEMLAT(J,K),PROVALUE(J,K)
END IF
END DO
END DO
END PROGRAM