summer_time_europe Function

public function summer_time_europe(date_array) result(summer_time)

Returns true if supplied date is during summer time in Europe, else false

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: date_array(6)

Datetime [y,m,d,h,m,s]

Return Value logical

True if summer time, else false


Calls

proc~~summer_time_europe~~CallsGraph proc~summer_time_europe summer_time_europe proc~date_to_number date_to_number proc~summer_time_europe->proc~date_to_number sngl sngl proc~date_to_number->sngl

Called by

proc~~summer_time_europe~~CalledByGraph proc~summer_time_europe summer_time_europe proc~uemep_read_time_profiles uEMEP_read_time_profiles proc~uemep_read_time_profiles->proc~summer_time_europe proc~uemep_calculate_emissions_for_emep uEMEP_calculate_emissions_for_EMEP proc~uemep_calculate_emissions_for_emep->proc~uemep_read_time_profiles program~uemep uEMEP program~uemep->proc~uemep_read_time_profiles program~uemep->proc~uemep_calculate_emissions_for_emep

Source Code

    function summer_time_europe(date_array) result(summer_time)
        !! Returns true if supplied date is during summer time in Europe, else false
        integer, intent(in) :: date_array(6) !! Datetime [y,m,d,h,m,s]
        logical :: summer_time !! True if summer time, else false

        ! Local variables
        integer :: a(6), b_start(6), b_end(6)
        integer :: ref_year, year
        real(dp) :: datenum_start, datenum_end, datenum

        a = date_array
        ref_year = 2000
        b_start = 0
        b_end = 0
        year = a(1)
        b_start(1) = a(1)
        b_start(2) = 3
        b_start(3) = (31 - mod((((5 * year)/4) + 4), 7))
        b_start(4) = 1
        b_end(1) = a(1)
        b_end(2) = 10
        b_end(3) = (31 - mod((((5 * year)/4) + 1), 7))
        b_end(4) = 1

        datenum_start = date_to_number(b_start, ref_year)
        datenum_end = date_to_number(b_end, ref_year)
        datenum = date_to_number(a, ref_year)

        summer_time = .false.
        if (datenum .ge. datenum_start .and. datenum .lt. datenum_end) summer_time = .true.
    end function summer_time_europe