WEATHR.for
************************************************************************
************************************************************************
* 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
REAL SRAD,TMAX,TMIN,RAIN,PAR
INTEGER DATE
CHARACTER*5 DYN
!************************************************************************
!************************************************************************
! INITIALIZATION
!************************************************************************
IF (INDEX(DYN,'INIT') .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
************************************************************************
************************************************************************