FMS
2024.03
Flexible Modeling System
|
Computes a weight and dates/indices for linearly interpolating between two dates. More...
Data Types | |
interface | time_interp |
Returns a weight and dates or indices for interpolating between two dates. The interface fraction_of_year is provided for backward compatibility with the previous version. . More... | |
Functions/Subroutines | |
subroutine | bisect (Timelist, Time, index1, index2) |
Given an array of times in ascending order and a specific time returns values of index1 and index2 such that the Timelist(index1)<=Time and Time<=Timelist(index2), and index2=index1+1 index1=0, index2=1 or index=n, index2=n+1 are returned to indicate that the time is out of range. | |
subroutine | error_handler (string) |
real(r8_kind) function, public | fraction_of_year (Time) |
Wrapper function to return the fractional time into the current year Always returns an r8_kind, conversion to r4 will be done implicitly if needed. More... | |
type(time_type) function | month_midpt (yr, mo) |
type(time_type) function | set_modtime (Tin, modtime) |
subroutine | time_interp_day_ (Time, weight, year1, year2, month1, month2, day1, day2) |
Calculates fractional time between mid points of consecutive days. | |
subroutine | time_interp_frac_ (Time, weight) |
Calculates the fractional time into the current year. More... | |
subroutine, public | time_interp_init () |
subroutine | time_interp_list_ (Time, Timelist, weight, index1, index2, modtime, err_msg) |
subroutine | time_interp_modulo_ (Time, Time_beg, Time_end, Timelist, weight, index1, index2, correct_leap_year_inconsistency, err_msg) |
Part of the time_interp interface, calculates for cyclical data Time_beg and Time_end mark a repeating period. More... | |
subroutine | time_interp_month_ (Time, weight, year1, year2, month1, month2) |
Calculates fractional time between mid points of consecutive months. | |
subroutine | time_interp_year_ (Time, weight, year1, year2) |
Calculates fractional time between mid points of consecutive years. More... | |
type(time_type) function | year_midpt (yr) |
Computes a weight and dates/indices for linearly interpolating between two dates.
A time type is converted into two consecutive dates plus a fraction representing the distance between the dates. This information can be used to interpolate between the dates. The dates may be expressed as years, months, or days or as indices in an array.
interface time_interp_mod::time_interp |
Returns a weight and dates or indices for interpolating between two dates. The interface fraction_of_year is provided for backward compatibility with the previous version.
.
Returns weight by interpolating Time between Time1 and Time2. i.e. weight = (Time-Time1)/(Time2-Time1) Time1 and Time2 may be specified by any of several different ways, which is the reason for multiple interfaces.
Example usages:
For all routines in this module the calendar type in module time_manager must be set.
The following private parameters are set by this module:
seconds per minute = 60 minutes per hour = 60 hours per day = 24 months per year = 12
Time | The time at which the the weight is computed. |
Time_beg | For cyclical interpolation: Time_beg specifies the begining time of a cycle. |
Time_end | For cyclical interpolation: Time_end specifies the ending time of a cycle. |
Timelist | For cyclical interpolation: Timelist is an array of times between Time_beg and Time_end. Must be monotonically increasing. |
index1 | Timelist(index1) = The largest value of Timelist which is less than mod(Time,Time_end-Time_beg) |
index2 | Timelist(index2) = The smallest value of Timelist which is greater than mod(Time,Time_end-Time_beg) |
correct_leap_year_inconsistency | Turns on a kluge for an inconsistency which may occur in a special case. When the modulo time period (i.e. Time_end - Time_beg) is a whole number of years and is not a multiple of 4, and the calendar in use has leap years, then it is likely that the interpolation will involve mapping a common year onto a leap year. In this case it is often desirable, but not absolutely necessary, to use data for Feb 28 of the leap year when it is mapped onto a common year. To turn this on, set correct_leap_year_inconsistency=.true. |
weight | weight = (mod(Time,Time_end-Time_beg) - Timelist(index1)) / (Timelist(index2) - Timelist(index1)) |
Definition at line 127 of file time_interp.F90.
real(r8_kind) function, public time_interp_mod::fraction_of_year | ( | type(time_type), intent(in) | Time | ) |
Wrapper function to return the fractional time into the current year Always returns an r8_kind, conversion to r4 will be done implicitly if needed.
Time | time to calculate fraction with |
Definition at line 184 of file time_interp.F90.
subroutine time_interp_frac_ | ( | type(time_type), intent(in) | Time, |
real(fms_ti_kind_), intent(out) | weight | ||
) |
Calculates the fractional time into the current year.
[out] | weight | fractional time |
Definition at line 24 of file time_interp.inc.
subroutine time_interp_modulo_ | ( | type(time_type), intent(in) | Time, |
type(time_type), intent(in) | Time_beg, | ||
type(time_type), intent(in) | Time_end, | ||
type(time_type), dimension(:), intent(in) | Timelist, | ||
real(fms_ti_kind_), intent(out) | weight, | ||
integer, intent(out) | index1, | ||
integer, intent(out) | index2, | ||
logical, intent(in), optional | correct_leap_year_inconsistency, | ||
character(len=*), intent(out), optional | err_msg | ||
) |
Part of the time_interp interface, calculates for cyclical data Time_beg and Time_end mark a repeating period.
Finds mid points and fractional weight for a time perioid
[in] | time | a specific time value |
[in] | time_beg | begining of period to search with |
[in] | time_end | end of period to search with |
[in] | timelist | ascending time values to search between |
[out] | index2 | indices of bounding time values within Timelist |
[in] | correct_leap_year_inconsistency | When true turns on a kluge for an inconsistency which may occur in a special case. When the modulo time period (i.e. Time_end - Time_beg) is a whole number of years and is not a multiple of 4, and the calendar in use has leap years, then it is likely that the interpolation will involve mapping a common year onto a leap year. In this case it is often desirable, but not absolutely necessary, to use data for Feb 28 of the leap year when it is mapped onto a common year. |
Definition at line 181 of file time_interp.inc.
subroutine time_interp_year_ | ( | type(time_type), intent(in) | Time, |
real(fms_ti_kind_), intent(out) | weight, | ||
integer, intent(out) | year1, | ||
integer, intent(out) | year2 | ||
) |
Calculates fractional time between mid points of consecutive years.
[out] | weight | fractional time between midpoints of year1 and year2 |
Definition at line 48 of file time_interp.inc.