|
编写了一个代码,通过光合有效辐射求日照时数,如图,但是总是显示NAN揭示浮点数异常,自己通过调试发现日落时角以后都是NaN,可是实在不知道原因,我把代码和工式发上来,希望大神指导!跪谢!
[Fortran] 纯文本查看 复制代码 06 | real , parameter :: pi = 3.1415926 |
07 | real :: ws ( 365 ) , dr ( 365 ) , angle ( 365 ) , rizhao ( 365 ) , q ( 365 ) , qq ( 365 ) , tianwen ( 365 ) |
13 | open ( 10 , file = "D:\1998PAR.txt" ) |
14 | open ( 11 , file = "D:\1998.txt" ) |
19 | angle ( n ) = 0.409 * sin ( ( 2 * pi / 365.0 ) * n -1.39 ) |
20 | dr ( n ) = 1 +0.033 * cos ( ( 2 * pi / 365.0 ) * n ) |
21 | ws ( n ) = acos ( - tan ( lat ) * tan ( dr ( n ) ) ) |
23 | qq ( n ) = 24.0 * ( 60.0 / pi ) * G * dr ( n ) * ( ws ( n ) * sin ( lat ) * sin ( dr ( n ) ) + cos ( lat ) * cos ( dr ( n ) ) * sin ( ws ( n ) ) ) |
24 | rizhao ( n ) = ( q ( n ) / qq ( n ) - a ) / b * tianwen ( n ) |
26 | write ( * , "(f8.2)" ) rizhao |
|
|