IATA season utilities

These functions are pure Python (no database required). They are also available as static methods on both backend classes.

eurocontrolpy.season_iata(year, season='summer')[source]

Start and end datetimes for an IATA season (both ends inclusive, UTC midnight).

Parameters:
  • year (int) – The year of the summer season definition. For ‘winter’, this is the year the winter season starts in.

  • season (str, default 'summer') – ‘summer’ or ‘winter’.

Returns:

(start, end) as UTC-aware datetimes at midnight.

Return type:

tuple[datetime, datetime]

Examples

>>> season_iata(2024, "summer")
(datetime(2024, 3, 31, 0, 0, tzinfo=timezone.utc),
 datetime(2024, 10, 26, 0, 0, tzinfo=timezone.utc))
eurocontrolpy.iata_season_for_date(date_input)[source]

Return the IATA season name for a given date.

Parameters:

date_input (str | datetime | date) – The date to check. Strings are parsed with date.fromisoformat.

Returns:

‘summer-yyyy’ or ‘winter-yyyy’, where yyyy is the year of the summer season that defines the period (matches R package behaviour).

Return type:

str

Examples

>>> iata_season_for_date("2024-06-15")
'summer-2024'
>>> iata_season_for_date("2024-12-01")
'winter-2024'
>>> iata_season_for_date("2024-01-15")
'winter-2023'
eurocontrolpy.iata_season_year(date_input)[source]

Return the year component of the IATA season for a given date.

This matches iata_season_year from the R package.

Parameters:

date_input (str | datetime | date)

Return type:

int