cable_timing_mod Module

Module for handling timing in CABLE.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: seconds_per_hour = 3600
integer, public, parameter :: hours_per_day = 24
integer, public, parameter :: seconds_per_day = 86400
integer, public, parameter :: months_in_year = 12
integer, private, parameter, dimension(months_in_year) :: last_day = [31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]

Cumulative day of year at the end of each month for a non-leap year.

integer, private, parameter, dimension(months_in_year) :: last_day_leap = [31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]

Cumulative day of year at the end of each month for a leap year.

character(len=16), public, parameter :: cable_timing_frequencies(5) = [character(len=16)::"timestep", "3hrly", "daily", "monthly", "yearly"]

Frequencies at which output can be written, from finest to coarsest.

integer, private, parameter :: START_YEAR_UNDEFINED = -1
integer, private :: start_year = START_YEAR_UNDEFINED

Start year of the simulation.


Functions

public pure function cable_timing_frequency_rank(frequency) result(rank)

Position of frequency in cable_timing_frequencies, from finest (1) to coarsest, or 0 if it is not a known frequency.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: frequency

Return Value integer

public function cable_timing_date_string(start_year, start_day_of_year, elapsed_days, leap_years) result(date)

The date elapsed_days after the given day of the given year, as YYYY-MM-DD.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: start_year

Year of the starting date.

integer, intent(in) :: start_day_of_year

Day of the year of the starting date, from 1.

integer, intent(in) :: elapsed_days

Days after the starting date; not negative.

logical, intent(in) :: leap_years

Whether leap years have 366 days.

Return Value character(len=10)

private pure function days_in_year(year, leap_years) result(days)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: year
logical, intent(in) :: leap_years

Return Value integer

public function cable_timing_frequency_matches(dels, ktau, frequency) result(match)

Determines whether the current time step is the end of a period of the given frequency.

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: dels

Model time step in seconds

integer, intent(in) :: ktau

Current time step index

character(len=*), intent(in) :: frequency

One of cable_timing_frequencies: timestep, 3hrly, daily, monthly or yearly.

Return Value logical


Subroutines

public subroutine cable_timing_set_start_year(year)

Set the start year of the simulation. This is used for calculating monthly timing.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: year