(1) 为甚末之前将deallocate放在下一个do循环之前就会报错,放在end program 之前就没事
DEALLOCATE(site2, lonx, laty)之後, 尚未再次ALLOCATE(site2(...), lonx(...), laty(...))之前, 不得access "site2, lonx, laty"等arrays
(2) '/=,.or.'和‘==,.and.’这里有点转不过来
[Fortran] 纯文本查看 复制代码 DO i = 1, m
IF( a /= b ) CYCLE
... ! do something for (a==b)
END DO
or,
DO i = 1, m
IF( a == b ) THEN
... ! do something for (a==b)
END IF
END DO
(3) 可嘗試:
[Fortran] 纯文本查看 复制代码 REWIND( UNIT=11 )
mm = 0
DO i = 1, m
mm = mm + 1
READ(11,*) site1(mm), lat(mm), lon(mm), h(mm), year(mm), month(mm), day(mm), ave, tmax(mm), tmin(mm)
IF( year(mm)/=iyear .OR. month(mm)/=imonth .OR. &
tmax(mm)==3270.0 .OR. tmax(mm)==3276.6 .OR. tmin(mm)==3270.0 .OR. tmin(mm)==3276.6 ) mm = mm - 1
END DO
CLOSE( UNIT=11 )
WHERE( h(1:mm) >= 100000.0 ) h(1:mm) = h(1:mm) - 100000.0
h (1:mm) = h (1:mm)*0.1
tmax(1:mm) = tmax(1:mm)*0.1
tmin(1:mm) = tmin(1:mm)*0.1
lon (1:mm) = lon (1:mm)/100.0
lat (1:mm) = lat (1:mm)/100.0 |