output_write_time Subroutine

public subroutine output_write_time(timeix, time_label, hydrotope, subbasin, catchment)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: timeix
character(len=*), intent(in), dimension(:):: time_label
real, intent(in), dimension(:, :, :):: hydrotope
real, intent(in), dimension(:, :, :):: subbasin
real, intent(in), dimension(:, :, :):: catchment

Calls

proc~~output_write_time~~CallsGraph proc~output_write_time 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_write_time~~CalledByGraph proc~output_write_time output_write_time proc~output_write_monthly output_write_monthly proc~output_write_monthly->proc~output_write_time proc~output_write_daily output_write_daily proc~output_write_daily->proc~output_write_time proc~output_write_annual output_write_annual proc~output_write_annual->proc~output_write_time proc~output_day output_day proc~output_day->proc~output_write_daily proc~output_year output_year proc~output_year->proc~output_write_monthly proc~output_year->proc~output_write_daily proc~output_year->proc~output_write_annual proc~output_month output_month proc~output_month->proc~output_write_monthly proc~output_month->proc~output_write_daily proc~time_finish_year time_finish_year proc~time_finish_year->proc~output_year proc~time_process_day time_process_day proc~time_process_day->proc~output_day proc~time_process_month time_process_month proc~time_process_month->proc~output_month proc~time_process_month->proc~time_process_day proc~time_process_years time_process_years proc~time_process_years->proc~time_finish_year proc~time_process_years->proc~time_process_month program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine output_write_time(timeix, time_label, hydrotope, subbasin, catchment)
    ! Abstraction of write out storage/agg arrays
    integer, intent(in) :: timeix
    character(len=*), dimension(:), intent(in) :: time_label
    real, dimension(:, :, :), intent(in) :: hydrotope, subbasin, catchment
    type(output_file) :: fl
    integer i, t, nv, ntm, osix(output_nvars)

    ntm = size(time_label)
    do i = 1, output_nfiles
      fl = output_files(i)
      ! Only continue with files of the timeix frequency
      if (fl%time /= timeix) cycle
      ! Abbreviations
      nv = fl%nvars
      osix = output_storage_index(i, :)
      ! CSV output
      if (fl%format == 1) then
        select case (fl%space)
          case (1)
            call output_write_space_time_csv(fl%file_id, hydrotope(osix(:nv), :, :), &
              output_hydrotope_id, time_label)
          case (2)
            call output_write_space_time_csv(fl%file_id, subbasin(osix(:nv), :, :), &
              output_subbasin_id, time_label)
          case (3)
            call output_write_space_time_csv(fl%file_id, catchment(osix(:nv), :, :), &
              output_catchment_id, time_label)
          case (4)
            call output_write_space_time_csv(fl%file_id, hydrotope(osix(:nv), &
              output_hydrotope_label_ix, :), time_label=time_label, &
              space_label=output_hydrotope_label(output_hydrotope_label_ix))
          case (5)
            call output_write_space_time_csv(fl%file_id, subbasin(osix(:nv), &
              output_subbasin_label_ix, :), time_label=time_label, &
              space_label=output_subbasin_label(output_subbasin_label_ix))
        end select
      ! Binary output
      else if (fl%format == 2) then
        select case (fl%space)
          case (1)
            do t = 1, ntm
              call output_array_to_bin(fl%file_id, hydrotope(osix(:nv), :, t), fl%current_record)
              output_files(i)%current_record = output_files(i)%current_record + 1
            end do
          case (2)
            do t = 1, ntm
              call output_array_to_bin(fl%file_id, subbasin(osix(:nv), :, t), fl%current_record)
              output_files(i)%current_record = output_files(i)%current_record + 1
            end do
          case (3)
            do t = 1, ntm
              call output_array_to_bin(fl%file_id, catchment(osix(:nv), :, t), fl%current_record)
              output_files(i)%current_record = output_files(i)%current_record + 1
            end do
          case (4)
            do t = 1, ntm
              call output_array_to_bin(fl%file_id, hydrotope(osix(:nv), &
                output_hydrotope_label_ix, t), fl%current_record)
              output_files(i)%current_record = output_files(i)%current_record + 1
            end do
          case (5)
            do t = 1, ntm
              call output_array_to_bin(fl%file_id, subbasin(osix(:nv), &
                output_subbasin_label_ix, t), fl%current_record)
              output_files(i)%current_record = output_files(i)%current_record + 1
            end do
        end select
      end if
    end do
  end subroutine output_write_time