out_of_range_error Subroutine

public subroutine out_of_range_error(name, range, value, int_range, int_value, counter, index)

Arguments

Type IntentOptional AttributesName
character, intent(in) :: name
real(kind=dp), intent(in), optional :: range(2)
real(kind=dp), intent(in), optional :: value
integer, intent(in), optional :: int_range(2)
integer, intent(in), optional :: int_value
integer, intent(in), optional :: counter
integer, intent(in), optional :: index

Calls

proc~~out_of_range_error~~CallsGraph proc~out_of_range_error out_of_range_error proc~to_string to_string proc~out_of_range_error->proc~to_string proc~log_error log_error proc~out_of_range_error->proc~log_error proc~log_message log_message proc~log_error->proc~log_message 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~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~string_index string_index proc~colourise->proc~string_index

Called by

proc~~out_of_range_error~~CalledByGraph proc~out_of_range_error out_of_range_error proc~check_range check_range proc~check_range->proc~out_of_range_error proc~check_int_range check_int_range proc~check_int_range->proc~out_of_range_error proc~input_nc_read_grid input_nc_read_grid proc~input_nc_read_grid->proc~check_range proc~read_integer_column read_integer_column proc~read_integer_column->proc~check_int_range proc~soil_read_input soil_read_input proc~soil_read_input->proc~check_range proc~read_real_column read_real_column proc~read_real_column->proc~check_range proc~snow_read_input snow_read_input proc~snow_read_input->proc~read_real_column proc~reservoir_read_storage_file reservoir_read_storage_file proc~reservoir_read_storage_file->proc~read_real_column proc~evapotranspiration_read_input evapotranspiration_read_input proc~evapotranspiration_read_input->proc~read_real_column proc~management_read_ctrl management_read_ctrl proc~management_read_ctrl->proc~read_integer_column proc~management_read_ctrl->proc~read_real_column proc~groundwater_read_input groundwater_read_input proc~groundwater_read_input->proc~read_real_column proc~reservoir_read_month_file reservoir_read_month_file proc~reservoir_read_month_file->proc~read_real_column proc~catchment_read_subcatch_params catchment_read_subcatch_params proc~catchment_read_subcatch_params->proc~read_integer_column proc~catchment_read_subcatch_params->proc~read_real_column proc~soil_initialise soil_initialise proc~soil_initialise->proc~soil_read_input proc~river_read_input river_read_input proc~river_read_input->proc~read_real_column proc~subbasin_read_routing subbasin_read_routing proc~subbasin_read_routing->proc~read_integer_column proc~subbasin_read_climate subbasin_read_climate proc~subbasin_read_climate->proc~read_real_column proc~input_nc_initialise input_nc_initialise proc~input_nc_initialise->proc~input_nc_read_grid proc~crop_read_management_input crop_read_management_input proc~crop_read_management_input->proc~read_integer_column proc~crop_read_management_input->proc~read_real_column proc~crop_read_input crop_read_input proc~crop_read_input->proc~read_integer_column proc~crop_read_input->proc~read_real_column proc~subbasin_read_input subbasin_read_input proc~subbasin_read_input->proc~read_integer_column proc~subbasin_read_input->proc~read_real_column proc~landuse_read_input landuse_read_input proc~landuse_read_input->proc~read_integer_column proc~landuse_read_input->proc~read_real_column proc~hydrotope_read_input hydrotope_read_input proc~hydrotope_read_input->proc~read_integer_column proc~hydrotope_read_input->proc~read_real_column proc~reservoir_read_control_file reservoir_read_control_file proc~reservoir_read_control_file->proc~read_integer_column proc~reservoir_read_control_file->proc~read_real_column proc~erosion_read_input erosion_read_input proc~erosion_read_input->proc~read_real_column proc~management_read_time_series management_read_time_series proc~management_read_time_series->proc~read_real_column proc~time_initialise_year time_initialise_year proc~time_initialise_year->proc~read_real_column proc~erosion_initialise erosion_initialise proc~erosion_initialise->proc~erosion_read_input proc~reservoir_initialise reservoir_initialise proc~reservoir_initialise->proc~reservoir_read_storage_file proc~reservoir_initialise->proc~reservoir_read_month_file proc~reservoir_initialise->proc~reservoir_read_control_file proc~initialise initialise proc~initialise->proc~soil_initialise proc~initialise->proc~input_nc_initialise proc~initialise->proc~crop_read_input proc~initialise->proc~erosion_initialise proc~initialise->proc~reservoir_initialise proc~snow_initialise snow_initialise proc~initialise->proc~snow_initialise proc~catchment_initialise_parameters catchment_initialise_parameters proc~initialise->proc~catchment_initialise_parameters proc~landuse_initialise landuse_initialise proc~initialise->proc~landuse_initialise proc~crop_initialise crop_initialise proc~initialise->proc~crop_initialise proc~evapotranspiration_initialise evapotranspiration_initialise proc~initialise->proc~evapotranspiration_initialise proc~hydrotope_initialise hydrotope_initialise proc~initialise->proc~hydrotope_initialise proc~groundwater_initialise groundwater_initialise proc~initialise->proc~groundwater_initialise proc~river_initialise river_initialise proc~initialise->proc~river_initialise proc~subbasin_initialise subbasin_initialise proc~initialise->proc~subbasin_initialise proc~management_initialise management_initialise proc~initialise->proc~management_initialise proc~snow_initialise->proc~snow_read_input proc~catchment_initialise_parameters->proc~catchment_read_subcatch_params proc~landuse_initialise->proc~landuse_read_input proc~crop_initialise->proc~crop_read_management_input proc~evapotranspiration_initialise->proc~evapotranspiration_read_input proc~hydrotope_initialise->proc~hydrotope_read_input proc~management_read_wu_inout management_read_wu_inout proc~management_read_wu_inout->proc~management_read_time_series proc~time_process_years time_process_years proc~time_process_years->proc~time_initialise_year proc~time_process_month time_process_month proc~time_process_years->proc~time_process_month proc~groundwater_initialise->proc~groundwater_read_input proc~river_initialise->proc~river_read_input proc~subbasin_initialise->proc~subbasin_read_routing proc~subbasin_initialise->proc~subbasin_read_input proc~time_process_day time_process_day proc~time_process_day->proc~subbasin_read_climate proc~management_initialise->proc~management_read_ctrl proc~management_initialise->proc~management_read_wu_inout proc~time_process_month->proc~time_process_day program~swim swim program~swim->proc~initialise program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine out_of_range_error(name, range, value, int_range, int_value, counter, index)
    ! Abstracted fatal error used in check_range and check_int_range
    character(*), intent(in) :: name
    real(dp), intent(in), optional :: value, range(2)
    integer, intent(in), optional :: int_value, int_range(2), counter, index

    character(len=64) strvalue
    character(len=2*len(strvalue)) strrange, strat

    strrange = ""
    strvalue = ""
    if (present(range)) then
      if (present(value)) strvalue = to_string(value)
      strrange = trim(to_string(range(1)))//" - "//to_string(range(2))
    else if (present(int_range)) then
      if (present(int_value)) strvalue = to_string(int=int_value)
      strrange = trim(to_string(int=int_range(1)))//" - "//to_string(int=int_range(2))
    else
      call log_error("out_of_range_error", "range or int_range must be given")
    end if
    ! Array with counter
    if (present(counter)) then
      call log_error("out_of_range_error", "Number of values of "//name//" are out "// &
        "of range ("//trim(strrange)//")", int=counter)
    ! Single value with/without index
    else
      strat = ""
      if (present(index)) strat = "("//trim(to_string(int=index))//")"
      call log_error("out_of_range_error", name//trim(strat)//" = "//trim(strvalue)// &
        " is out of range", reals=range)
    end if
  end subroutine out_of_range_error