subbasin_initialise Subroutine

public subroutine subbasin_initialise()

Uses

  • proc~~subbasin_initialise~~UsesGraph proc~subbasin_initialise subbasin_initialise module~input input proc~subbasin_initialise->module~input module~utilities utilities proc~subbasin_initialise->module~utilities module~output output proc~subbasin_initialise->module~output module~input->module~utilities module~output->module~utilities

Arguments

None

Calls

proc~~subbasin_initialise~~CallsGraph proc~subbasin_initialise subbasin_initialise proc~hydrograph_storage_location hydrograph_storage_location proc~subbasin_initialise->proc~hydrograph_storage_location proc~subbasin_allocate subbasin_allocate proc~subbasin_initialise->proc~subbasin_allocate proc~input_count_rows input_count_rows proc~subbasin_initialise->proc~input_count_rows proc~header_column_index header_column_index proc~subbasin_initialise->proc~header_column_index proc~subbasin_allocate_obs_discharge subbasin_allocate_obs_discharge proc~subbasin_initialise->proc~subbasin_allocate_obs_discharge proc~get_config_fid get_config_fid proc~subbasin_initialise->proc~get_config_fid proc~output_register_subbasin_var output_register_subbasin_var proc~subbasin_initialise->proc~output_register_subbasin_var proc~input_open_file input_open_file proc~subbasin_initialise->proc~input_open_file proc~subbasin_read_routing subbasin_read_routing proc~subbasin_initialise->proc~subbasin_read_routing proc~subbasin_read_input subbasin_read_input proc~subbasin_initialise->proc~subbasin_read_input proc~log_error log_error proc~input_count_rows->proc~log_error proc~move_lines move_lines proc~header_column_index->proc~move_lines proc~input_error_column_not_found input_error_column_not_found proc~header_column_index->proc~input_error_column_not_found proc~has_column has_column proc~subbasin_allocate_obs_discharge->proc~has_column proc~open_file open_file proc~get_config_fid->proc~open_file proc~output_register_var output_register_var proc~output_register_subbasin_var->proc~output_register_var proc~input_open_file->proc~open_file proc~subbasin_read_routing->proc~input_count_rows proc~subbasin_read_routing->proc~input_open_file proc~read_integer_column read_integer_column proc~subbasin_read_routing->proc~read_integer_column proc~read_string_column read_string_column proc~subbasin_read_input->proc~read_string_column proc~read_real_column read_real_column proc~subbasin_read_input->proc~read_real_column proc~subbasin_read_input->proc~read_integer_column proc~log_message log_message proc~log_error->proc~log_message proc~output_register_var->proc~log_error proc~string_index string_index proc~output_register_var->proc~string_index proc~open_file->proc~log_error proc~read_string_column->proc~header_column_index proc~read_string_column->proc~move_lines proc~read_string_column->proc~log_error proc~read_string_column->proc~input_error_column_not_found proc~read_csv_item read_csv_item proc~read_string_column->proc~read_csv_item proc~has_column->proc~header_column_index proc~read_real_column->proc~header_column_index proc~read_real_column->proc~move_lines proc~read_real_column->proc~log_error proc~read_real_column->proc~input_error_column_not_found proc~input_type_conversion_error input_type_conversion_error proc~read_real_column->proc~input_type_conversion_error proc~check_range check_range proc~read_real_column->proc~check_range proc~read_real_column->proc~read_csv_item proc~input_error_column_not_found->proc~log_error proc~read_integer_column->proc~header_column_index proc~read_integer_column->proc~move_lines proc~read_integer_column->proc~log_error proc~read_integer_column->proc~input_error_column_not_found proc~read_integer_column->proc~input_type_conversion_error proc~check_int_range check_int_range proc~read_integer_column->proc~check_int_range proc~read_integer_column->proc~read_csv_item proc~input_type_conversion_error->proc~log_error proc~check_int_range->proc~log_error proc~log_warn log_warn proc~check_int_range->proc~log_warn proc~out_of_range_error out_of_range_error proc~check_int_range->proc~out_of_range_error proc~check_range->proc~log_error proc~check_range->proc~log_warn proc~check_range->proc~out_of_range_error proc~log_write log_write proc~log_message->proc~log_write proc~log_format_message log_format_message proc~log_message->proc~log_format_message proc~to_string to_string proc~log_write->proc~to_string proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~log_warn->proc~log_message proc~out_of_range_error->proc~log_error proc~out_of_range_error->proc~to_string proc~colourise->proc~string_index

Called by

proc~~subbasin_initialise~~CalledByGraph proc~subbasin_initialise subbasin_initialise proc~initialise initialise proc~initialise->proc~subbasin_initialise program~swim swim program~swim->proc~initialise

Contents

Source Code


Source Code

  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