meshflow.utility.forcing_prep.calculate_time_difference
- meshflow.utility.forcing_prep.calculate_time_difference(initial_time_zone, target_time_zone)[source]
Calculate the time difference in hours between two IANA time zones.
- Parameters:
- Returns:
Time difference in hours between the two time zones. If the time zones are the same, returns 0.
- Return type:
- Raises:
AssertionError – If either time zone argument is not a string.
ValueError – If the time zone format is incorrect or not valid.
Notes
Time zone naming follows IANA conventions: https://data.iana.org/time-zones/releases/tzdb-2025b.tar.lz
Examples
>>> calculate_time_difference('UTC', 'America/Toronto') -4.0 >>> calculate_time_difference('America/Edmonton', 'America/Toronto') 2.0