-
Notifications
You must be signed in to change notification settings - Fork 0
/
hmeas.f
110 lines (97 loc) · 4.51 KB
/
hmeas.f
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
subroutine hmeas
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine reads in relative humidity data from file and
!! assigns the data to the HRUs
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! hru_sub(:) |none |subbasin in which HRU is located
!! id1 |julian date |first day of simulation in current year
!! ifirsth |none |relative humidity data search code
!! |0 first day of relative humidity data located
!! | in file
!! |1 first day of relative humidity data not
!! | located in file
!! ihgage(:) |none |HRU relative humidity data code (gage # for
!! |relative humidity data used in HRU)
!! iyr |none |beginning year of simulation
!! mrg |none |maximum number of rainfall/temp gages
!! nhru |none |number of HRUs in watershed
!! nhtot |none |total number of relative humidity records
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ifirsth |none |relative humidity data search code
!! |0 first day of relative humidity data located
!! | in file
!! |1 first day of relative humidity data not
!! | located in file
!! rhd(:) |none |relative humidity for the day in HRU
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! idap |julian date |julian date of measured weather data
!! inum3sprev |none |subbasin number of previous HRU
!! iyp |none |last 2 digits of year measured weather data
!! k |none |counter
!! l |none |counter
!! rhdbsb |none |generated relative humidity for subbasin
!! rhmeas(:) |none |relative humidity read in from file (fraction)
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! SWAT: rhgen
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer :: k, iyp, idap, l, inum3sprev
real :: rhdbsb
real, dimension (mrg) :: rhmeas
!! initialize variables for the day
rhmeas = 0.
!! read relative humidity data from file
if (ifirsth == 0) then
read (138,5200) (rhmeas(l), l = 1, nhtot)
else
ifirsth = 0
do
iyp = 0
idap = 0
read (138,5300) iyp, idap, (rhmeas(l), l = 1, nhtot)
if (iyp + idap <= 0) exit
if (iyp == iyr .and. idap == id1) exit
end do
end if
!! assign relative humidity data to HRUs
inum3sprev = 0
do k = 1, nhru
!! generate values to replace missing data
if (rhmeas(ihgage(hru_sub(k))) < -97.) then
!! use same generated data for all HRUs in a subbasin
if (hru_sub(k) == inum3sprev .and. hru_sub(k) /= 0) then
rhd(k) = rhdbsb
else
call rhgen(k)
!! set subbasin generated values
inum3sprev = 0
rhdbsb = 0.
inum3sprev = hru_sub(k)
rhdbsb = rhd(k)
end if
else
!! if (i == 1) then
if (rhmeas(ihgage(hru_sub(k))) < 1. .and.
* rhmeas(ihgage(hru_sub(k))) > 0.) then
rhd(k) = rhmeas(ihgage(hru_sub(k)))
else
tmpmean=(tmpmx(i_mo,hru_sub(k))+tmpmn(i_mo,hru_sub(k)))/2.
rhd(k) = Ee(rhmeas(ihgage(hru_sub(k)))) / Ee(tmpmean)
endif
end if
end do
return
! 5200 format (7x,300f8.3)
! 5300 format (i4,i3,300f8.3)
5200 format (7x,1800f8.3)
5300 format (i4,i3,1800f8.3)
end