📄 readfig.f
字号:
subroutine readfig
!! ~ ~ ~ PURPOSE ~ ~ ~
!! reads in the routing information from the watershed configuration
!! input file (.fig) and calculates the number of subbasins, reaches,
!! and reservoirs
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! hru_sub(:) |none |subbasin in which HRU is located
!! icodes(:) |none |routing command code:
!! |0 = finish 9 = save
!! |1 = subbasin 10 = recday
!! |2 = route 11 = reccnst
!! |3 = routres 12 = structure
!! |4 = transfer 13 =
!! |5 = add 14 = saveconc
!! |6 = rechour 15 =
!! |7 = recmon 16 = autocal
!! |8 = recyear
!! ihouts(:) |none |For ICODES equal to
!! |0: not used
!! |1,2,3,5,7,8,10,11: hydrograph storage
!! | location number
!! |4: departure type
!! | (1=reach)
!! | (2=reservoir)
!! |9: hydrograph storage location of data to
!! | be printed to event file
!! |14:hydrograph storage location of data to
!! | be printed to saveconc file
!! inum1s(:) |none |For ICODES equal to
!! |0: not used
!! |1: subbasin number
!! |2: reach number
!! |3: reservoir number
!! |4: reach or res # flow is diverted from
!! |5: hydrograph storage location of 1st
!! | dataset to be added
!! |7,8,9,10,11,14: file number
!! inum2s(:) |none |For ICODES equal to
!! |0,1,7,8,10,11: not used
!! |2,3: inflow hydrograph storage location
!! |4: destination type
!! | (1=reach)
!! | (2=reservoir)
!! |5: hydrograph storage location of 2nd
!! | dataset to be added
!! |9,14:print frequency
!! | (0=daily)
!! | (1=hourly)
!! inum3s(:) |none |For ICODES equal to
!! |0,1,2,3,5,7,8,10,11: not used
!! |4: destination number. Reach or
!! | reservoir receiving water
!! |9: print format
!! | (0=normal, fixed format)
!! | (1=txt format for AV interface,recday)
!! inum4s(:) |none |For ICODES equal to
!! |0,2,3,5,7,8,9,10,11: not used
!! |1: GIS code printed to output file
!! | (optional)
!! |4: rule code governing transfer of water
!! | (1=fraction transferred out)
!! | (2=min volume or flow left)
!! | (3=exact amount transferred)
!! nrch |none |number of reaches in watershed
!! nres |none |number of reservoirs in watershed
!! rnum1s(:) |none |For ICODES equal to
!! |0,1,3,5,9: not used
!! |2: Fraction of flow in channel
!! |4: amount of water transferred (as
!! | defined by INUM4S)
!! |7,8,10,11: drainage area in square kilometers
!! | associated with the record file
!! subgis(:) |none |GIS code printed to output files(output.sub)
!! subtot |none |number of subbasins in watershed
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! a |NA |comment flag in .fig file(*=comment)
!! annual_in |NA |name of file containing average annual
!! |loadings to reach (fig command 11)
!! auto_in |NA |name of file containing measured data
!! |used in calibration
!! day_in |NA |name of file containing daily loadings
!! |to reach (fig command 10)
!! eof |none |end of file flag (=-1 at end of file)
!! hour_in |NA |name of file containing hourly loadings
!! |to reach (fig command 6)
!! idum |none |counter
!! ii |none |counter
!! lwqfile |NA |reservoir water quality file names (.lwq)
!! month_in |NA |name of file containing monthly loadings
!! |to reach (fig command 7)
!! resfile |NA |reservoir file names (.res)
!! rtefile |NA |reach input file (.rte)
!! swqfile |NA |stream water quality file (.swq)
!! titldum |NA |description line
!! year_in |NA |name of file containing annual loadings
!! |to reach (fig command 8)
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! Intrinsic: Max
!! SWAT: caps
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
character (len=80) :: titldum
character (len=1) :: a
character (len=13) :: month_in, day_in, annual_in, year_in
character (len=13) :: hour_in, resfile, lwqfile, rtefile, swqfile
character (len=13) :: subfile, auto_in
integer :: idum, ii, eof
!! initialize variables
idum = 0
eof = 0
do
a = ""
read (102,5002,iostat=eof) a
if (eof < 0) exit
if (a /= "*") then
backspace 102
idum = idum + 1
!! CEAP project
if (isproj == 2) then
read (102,5003) a, icodes(idum), ihouts(idum), inum1s(idum), &
& inum2s(idum), inum3s(idum), rnum1s(idum), inum4s(idum)
else
read (102,5000) a, icodes(idum), ihouts(idum), inum1s(idum), &
& inum2s(idum), inum3s(idum), rnum1s(idum), inum4s(idum)
end if
select case(icodes(idum))
case (0) !! icode = 0 FINISH command
exit
case (1) !! icode = 1 SUBBASIN command
subtot = subtot + 1
subgis(inum1s(idum)) = inum4s(idum)
subfile = ""
read (102,5100) subfile
call caps(subfile)
i = 0
i = inum1s(idum)
subed(ihouts(idum)) = inum4s(idum)
open (101,file=subfile)
call readsub
nhru = nhru + hrutot(i)
case (2) !! icode = 2 ROUTE command
nrch = nrch + 1
rtefile = ""
swqfile = ""
read (102,5100) rtefile, swqfile
call caps(rtefile)
call caps(swqfile)
i = 0
i = inum1s(idum)
open (103,file=rtefile)
open (104,file=swqfile)
call readrte
call readswq
case (3) !! icode = 3 ROUTE RESERVOIR command
nres = nres + 1
resfile = ""
lwqfile = ""
read (102,5100) resfile, lwqfile
call caps(resfile)
call caps(lwqfile)
i = 0
i = inum1s(idum)
open (105,file=resfile)
call readres
if (lwqfile /= ' ') then
open (106,file=lwqfile)
call readlwq
end if
!! lake water quality default values
call lwqdef
case (6) !! icode = 6 RECHOUR command: read in hourly values
!! with water in m^3 and rest in tons/kgs
hour_in = ""
read (102,5100) hour_in
call caps(hour_in)
open (200+inum1s(idum),file=hour_in,recl=350)
do ii = 1, 6
read (200+inum1s(idum),5200) titldum
end do
case (7) !! icode = 7 RECMON command:
!! read in monthly values
month_in = ""
read (102,5100) month_in
recmonps(ihouts(idum)) = month_in(1:index(month_in,'.')-1)
call caps(month_in)
i = 0
i = inum1s(idum)
open (107,file=month_in,recl=350)
call readmon
case (8) !! icode = 8 RECYEAR command:
!! read in average daily loadings for each year
year_in = ""
read (102,5100) year_in
call caps(year_in)
i = 0
i = inum1s(idum)
open (108,file=year_in,recl=350)
call readyr
close (108)
case (9) !! icode = 9 SAVE command: saves daily reach
!! constituent masses from a hydrograph node on
!! the channel network to an output file
day_in = ""
read (102,5100) day_in
call caps(day_in)
if (inum1s(idum) <= 10 .and. inum1s(idum) > 0) then
open (40+inum1s(idum),file=day_in,recl=350)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -