forked from chporter/SimpleCrop
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Weathr.for
63 lines (56 loc) · 2.8 KB
/
Weathr.for
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
************************************************************************
************************************************************************
* SUBROUTINE WEATHR - Reads daily weather data from file
************************************************************************
*
* LIST OF VARIABLES
*
* DATE = date of weather record (YYDDD)
* DYN = dynamic control variable
* PAR = photosynthetically active radiation (MJ/m2/d)
* RAIN = daily rainfall (mm)
* SRAD = daily solar radiation (MJ/m2/d)
* TMAX = daily maximum temperature (Celsius)
* TMIN = daily minimum temperature (Celsius)
*
***********************************************************************
SUBROUTINE WEATHR(SRAD,TMAX,TMIN,RAIN,PAR,DYN)
!-----------------------------------------------------------------------
IMPLICIT NONE
SAVE
REAL SRAD,TMAX,TMIN,RAIN,PAR
INTEGER DATE
CHARACTER*10 DYN
!************************************************************************
!************************************************************************
! INITIALIZATION
!************************************************************************
IF (INDEX(DYN,'INITIAL') .NE. 0) THEN
!************************************************************************
OPEN (4,FILE='WEATHER.INP',STATUS='UNKNOWN')
!************************************************************************
!************************************************************************
! RATE CALCULATIONS
!************************************************************************
ELSEIF (INDEX(DYN,'RATE') .NE. 0) THEN
!************************************************************************
C Loop to compute data for one year. Climatic data of the year 1987,
C for Gainesville, Florida, were used as verification of the module.
READ(4,20) DATE,SRAD,TMAX,TMIN,RAIN,PAR
20 FORMAT(I5,2X,F4.1,2X,F4.1,2X,F4.1,F6.1,14X,F4.1)
PAR = 0.5 * SRAD ! Par is defined as 50% of SRAD
!************************************************************************
!************************************************************************
ELSEIF (INDEX(DYN,'CLOSE') .NE. 0) THEN
!************************************************************************
CLOSE(4)
!************************************************************************
!************************************************************************
! End of dynamic 'IF' construct
!************************************************************************
ENDIF
!************************************************************************
RETURN
END SUBROUTINE WEATHR
************************************************************************
************************************************************************