input_nc_read_climate Subroutine

public subroutine input_nc_read_climate(flu, humi, mb, ra, subp, tmn, tmx, tx)

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in), dimension(:):: flu
real(kind=dp), intent(out), dimension(:):: humi
integer, intent(in) :: mb
real(kind=dp), intent(out), dimension(:):: ra
real(kind=dp), intent(out), dimension(:):: subp
real(kind=dp), intent(out), dimension(:):: tmn
real(kind=dp), intent(out), dimension(:):: tmx
real(kind=dp), intent(out), dimension(:):: tx

Calls

proc~~input_nc_read_climate~~CallsGraph proc~input_nc_read_climate input_nc_read_climate proc~input_nc_weighted_mean input_nc_weighted_mean proc~input_nc_read_climate->proc~input_nc_weighted_mean proc~log_debug log_debug proc~input_nc_read_climate->proc~log_debug proc~input_nc_check_error input_nc_check_error proc~input_nc_weighted_mean->proc~input_nc_check_error nf90_get_var nf90_get_var proc~input_nc_weighted_mean->nf90_get_var proc~log_message log_message proc~log_debug->proc~log_message nf90_strerror nf90_strerror proc~input_nc_check_error->nf90_strerror proc~log_error log_error proc~input_nc_check_error->proc~log_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_error->proc~log_message proc~string_index string_index proc~colourise->proc~string_index

Called by

proc~~input_nc_read_climate~~CalledByGraph proc~input_nc_read_climate input_nc_read_climate proc~time_process_day time_process_day proc~time_process_day->proc~input_nc_read_climate proc~time_process_month time_process_month proc~time_process_month->proc~time_process_day proc~time_process_years time_process_years proc~time_process_years->proc~time_process_month program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  subroutine input_nc_read_climate(flu, humi, mb, ra, subp, tmn, tmx, tx)
    real(dp), dimension(:), intent(in) :: flu
    real(dp), dimension(:), intent(out) :: humi
    integer, intent(in) :: mb
    real(dp), dimension(:), intent(out) :: ra
    real(dp), dimension(:), intent(out) :: subp
    real(dp), dimension(:), intent(out) :: tmn
    real(dp), dimension(:), intent(out) :: tmx
    real(dp), dimension(:), intent(out) :: tx
    ! counters need for day length
    integer j
    ! reals need for day length
    real(dp) :: mm(6) = 0

    call input_nc_weighted_mean(1, tx, mb)
    call input_nc_weighted_mean(2, tmn, mb)
    call input_nc_weighted_mean(3, tmx, mb)
    call input_nc_weighted_mean(4, subp, mb)
    call input_nc_weighted_mean(5, ra, mb)
    call input_nc_weighted_mean(6, humi, mb)

    if (NC_DEBUG) then
      mm = 0
      do j = 1, mb
        mm(1) = mm(1) + tx(j) * flu(j)
        mm(2) = mm(2) + tmn(j) * flu(j)
        mm(3) = mm(3) + tmx(j) * flu(j)
        mm(4) = mm(4) + subp(j) * flu(j)
        mm(5) = mm(5) + ra(j) * flu(j)
        mm(6) = mm(6) + humi(j) * flu(j)
      enddo
      call log_debug("input_nc_read_climate", &
        'ncdf climate (tmean, tmin, tmax, prec, rad, hum) avarage on day:', &
        int=nc_nday, reals=mm)
    endif

    ! update current record number
    nc_nday = nc_nday + 1

    ! If relative humidity is not provided
    if (isNaN(humi(1)) ) humi = - 999.9
    if (isNaN(ra(1)) ) ra = 1.

  end subroutine input_nc_read_climate