subroutine subbasin_initialise
use input, only : &
header_column_index, &
input_open_file, &
input_count_rows, &
get_config_fid
use output, only: output_register_subbasin_var
use utilities, only: hydrograph_storage_location
integer sfid, i
read(get_config_fid(), SUBBASIN_PARAMETERS)
!**** OPEN subbasin-level driving data (if not using NetCDF)
#ifndef with_netcdf
subbasin_climate_file_id = input_open_file(climate_input_file)
sfid = subbasin_climate_file_id
tmean_column_ix = header_column_index('tmean', sfid, required=.True.)
tmin_column_ix = header_column_index('tmin', sfid, required=.True.)
tmax_column_ix = header_column_index('tmax', sfid, required=.True.)
precipitation_column_ix = header_column_index('precipitation', sfid, required=.True.)
! Optional columns
radiation_column_ix = header_column_index('radiation', sfid)
humidity_column_ix = header_column_index('humidity', sfid)
#endif
if (bRunoffDat) then
discharge_input_file_id = input_open_file(discharge_input_file)
obssb(:) = 1
end if
river_runoff_output_id = output_register_subbasin_var("river_runoff")
subbasin_input_file_id = input_open_file(subbasin_input_file)
mb = input_count_rows(subbasin_input_file_id, .true.)
mch = mb
allocate(neap(mb)) ! number of HRUs in subbasin
neap = 0
allocate(sbar(mb)) ! subbasin area [m2]
sbar = 0.
call subbasin_read_routing
call subbasin_allocate
call subbasin_read_input
if (bRunoffDat) call subbasin_allocate_obs_discharge
! subbasin hydrograph storage location for routed Q output
do i = 1, mb
subs(i) = i
end do
! Identify hydrograph storage location for each subbasin
subouthyd = hydrograph_storage_location(icodes, ihouts, inum1s, mhyd, mb, subs)
! array subs not used thereafter...
deallocate(subs)
end subroutine subbasin_initialise