[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode program main
    implicit none
    character(*),parameter :: infile='Depth.txt',outfile='Depth2.txt'
    integer :: i,j
    real,dimension(521,1440):: m
    OPEN(UNIT=20,FILE=infile,STATUS='OLD',ACTION='read')
    OPEN(UNIT=30,FILE=outfile,status='replace',action='write')
   do i=1,521
        READ(20,'(1440(I6))',end=99) (m(i,j),j=1,1440)
        If(m(i,j)/=-999 .and. m(i,j+1)==-999) then
            m(i,j)=2                         ! 1 represents ocean
            m(i,j-1)=2                       ! 2 represents coastline
            m(i,j-2)=2                       ! -999 represents land
            m(i,j-3)=2
        else if(m(i,j)==-999 .and. m(i,j+1)/=-999) then
            m(i,j)=2
            m(i,j+1)=2
            m(i,j+2)=2
            m(i,j+3)=2
        else if (m(i,j)<200) then
            m(i,j)=2
        else
            m(i,j)=1
        End if
        write(30,'(1440(I6))') (m(i,j),j=1,1440)
        end do
!100 format (1440I6)
99 stop
end program main 
在 if 条件判断那里出了问题,不知道能不能这样读?请大家帮忙看看,读写都没问题,循环读取 赋值就开始出错 
 
 
 |