output_year Subroutine

public subroutine output_year()

Arguments

None

Calls

proc~~output_year~~CallsGraph proc~output_year output_year proc~output_write_monthly output_write_monthly proc~output_year->proc~output_write_monthly proc~output_write_daily output_write_daily proc~output_year->proc~output_write_daily proc~output_write_annual output_write_annual proc~output_year->proc~output_write_annual proc~output_write_time output_write_time proc~output_write_monthly->proc~output_write_time proc~output_write_daily->proc~output_write_time proc~output_write_annual->proc~output_write_time proc~output_write_space_time_csv output_write_space_time_csv proc~output_write_time->proc~output_write_space_time_csv proc~output_array_to_bin output_array_to_bin proc~output_write_time->proc~output_array_to_bin proc~output_array_to_csv output_array_to_csv proc~output_write_space_time_csv->proc~output_array_to_csv proc~log_error log_error proc~output_write_space_time_csv->proc~log_error proc~output_array_to_csv->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~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~string_index string_index proc~colourise->proc~string_index

Called by

proc~~output_year~~CalledByGraph proc~output_year output_year proc~time_finish_year time_finish_year proc~time_finish_year->proc~output_year proc~time_process_years time_process_years proc~time_process_years->proc~time_finish_year program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine output_year
    ! Take annual averages and write to csv/bin, if interval is annual.
    integer :: sti(3, 3), stb(3, 3)
    integer i, nd

    ! Take average of annual values as needed
    nd = output_ndays_per_year
    do i = 1, output_nvars
      ! 0/1 (space, time) for current variable
      stb = output_is_requested(i, :, :)
      ! indeces in aggregation arrays of current variable
      sti = sum(output_is_requested(:i, :, :), dim=1)
      if (output_var_state(i)) then
        if (stb(1, 3) == 1) output_agg_hydrotope_annual(sti(1, 3), :, :) = &
          output_agg_hydrotope_annual(sti(1, 3), :, :) / nd
        if (stb(2, 3) == 1) output_agg_subbasin_annual(sti(2, 3), :, :) = &
          output_agg_subbasin_annual(sti(2, 3), :, :) / nd
        if (stb(3, 3) == 1) output_agg_catchment_annual(sti(3, 3), :, :) = &
          output_agg_catchment_annual(sti(3, 3), :, :) / nd
      end if
    end do
    ! Write out before reset counters
    if (output_write_interval == "Y") then
      call output_write_daily
      call output_write_monthly
      output_store_day_counter = 1
      output_store_month_counter = 1
    end if
    call output_write_annual
    output_ndays_per_year = 0
  end subroutine output_year