time_initialise_year Subroutine

public subroutine time_initialise_year(year)

Uses

  • proc~~time_initialise_year~~UsesGraph proc~time_initialise_year time_initialise_year module~input input proc~time_initialise_year->module~input module~subbasin subbasin proc~time_initialise_year->module~subbasin module~crop crop proc~time_initialise_year->module~crop module~utilities utilities module~input->module~utilities module~subbasin->module~utilities module~crop->module~utilities

Arguments

Type IntentOptional AttributesName
integer :: year

Calls

proc~~time_initialise_year~~CallsGraph proc~time_initialise_year time_initialise_year proc~read_real_column read_real_column proc~time_initialise_year->proc~read_real_column proc~input_type_conversion_error input_type_conversion_error proc~read_real_column->proc~input_type_conversion_error proc~move_lines move_lines proc~read_real_column->proc~move_lines proc~log_error log_error proc~read_real_column->proc~log_error proc~check_range check_range proc~read_real_column->proc~check_range proc~read_csv_item read_csv_item proc~read_real_column->proc~read_csv_item proc~header_column_index header_column_index proc~read_real_column->proc~header_column_index proc~input_error_column_not_found input_error_column_not_found proc~read_real_column->proc~input_error_column_not_found proc~input_type_conversion_error->proc~log_error proc~log_message log_message proc~log_error->proc~log_message proc~check_range->proc~log_error proc~log_warn log_warn proc~check_range->proc~log_warn proc~out_of_range_error out_of_range_error proc~check_range->proc~out_of_range_error proc~header_column_index->proc~move_lines proc~header_column_index->proc~input_error_column_not_found proc~input_error_column_not_found->proc~log_error proc~log_warn->proc~log_message proc~out_of_range_error->proc~log_error proc~to_string to_string proc~out_of_range_error->proc~to_string 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~~time_initialise_year~~CalledByGraph proc~time_initialise_year time_initialise_year proc~time_process_years time_process_years proc~time_process_years->proc~time_initialise_year program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine time_initialise_year(year)
  ! ----------------------------------------------------------------------
    use input, only : read_real_column
    use crop, only : &
      arylda, &
      avylda, &
      mcrdb, &
      iyrrot, &
      nrotyrs
    use subbasin, only : &
      bRunoffdat, &
      discharge_input_file_id, &
      obs_discharge, &
      nqobs
    integer year, jj, k, skip

    !     iy - current year
    !     mo - current month
    !     nt - =1 if 365 days, =0 if 366 days
    !     nd - number of days in the current year

    iy = year

    mo = 1
    nt = 1
    if (mod(iyr, 4) .eq. 0) nt = 0
    ida = 1
    nd = 366 - nt
    ndsum = ndsum + nd

    !#### INITIALIZE CROPS: CALL INITCROP

    do jj = 1, mcrdb
      avylda(iy, jj) = 0.
      arylda(iy, jj) = 0.
    end do

    if (bRunoffdat) then
      ! read all columns by index (+1 for date column)
      ! skipping back up before reading except for 1st
      do k = 1, nqobs
        skip = -nd
        if (k == 1) skip = 0
        call read_real_column(discharge_input_file_id, array=obs_discharge(:nd, k), index=k+1, skip=skip)
      end do
    end if

    ! count year of rotation (1-3)
    if (iyrrot < nrotyrs) then
      iyrrot = iyrrot + 1
    else
      iyrrot = 1
    end if
    if (iy == 1) iyrrot = 0

  end subroutine time_initialise_year