Documentation
¶
Overview ¶
Package airac provides calculations on Aeronautical Information Regulation And Control (AIRAC) cycles, i.e. cycle identifiers and effective calendar dates.
Regular, planned Aeronautical Information Publications (AIP) as defined by the International Civil Aviation Organization (ICAO) are published and become effective at fixed dates. This package implements the AIRAC cycle definition as published in the ICAO Aeronautical Information Services Manual (DOC 8126; AN/872; 6th Edition; 2003). Test cases validate documented dates from 1998 until 2020, including the rare case of a 14th cycle in the year 2020.
Licensed under the Apache License, Version 2.0.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIRAC ¶ added in v1.0.4
type AIRAC uint16
AIRAC represents an Aeronautical Information Regulation And Control (AIRAC) cycle.
func FromDate ¶
FromDate returns the AIRAC cycle that occurred at date. A date before the internal epoch (1901-01-10) may return wrong data. The upper limit is year 2192.
Example ¶
shalom := time.Date(2012, time.August, 26, 0, 0, 0, 0, time.UTC) airac := FromDate(shalom) fmt.Printf("At %s the current AIRAC cycle was %s.\n\n", shalom.Format("2006-01-02"), airac.LongString(), ) fmt.Printf("Short identifier: %s", airac)
Output: At 2012-08-26 the current AIRAC cycle was 1209 (effective: 2012-08-23; expires: 2012-09-19). Short identifier: 1209
func FromString ¶
FromString returns an AIRAC cycle that matches the identifier <yyoo>, i.e. the last two digits of the year and the ordinal, each with leading zeros. This works for years between 1964 and 2063. Identifiers between "6401" and "9913" are interpreted as AIRAC cycles between the years 1964 and 1999 inclusive. AIRAC cycles between "0001" and "6313" are interpreted as AIRAC cycles between the years 2000 and 2063 inclusive.
func FromStringMust ¶
FromStringMust returns an AIRAC cycle that matches the identifier <yyoo> like FromString, but does not return an error. If there is an error it will panic instead.
func (AIRAC) LongString ¶ added in v1.0.4
LongString returns a verbose representation of this AIRAC cycle. "YYOO (effective: YYYY-MM-DD; expires: YYYY-MM-DD)"
func (AIRAC) Ordinal ¶ added in v1.0.4
Ordinal returns the ordinal for this AIRAC cycle's identifier.
type ByChrono ¶
type ByChrono []AIRAC
ByChrono is an []AIRAC wrapper, that satisfies sort.Interface and can be used to chronologically sort AIRAC instances.
Example ¶
airacs := []AIRAC{ FromStringMust("1213"), FromStringMust("1201"), FromStringMust("1207"), } fmt.Println("Not Sorted: ", airacs) sort.Sort(ByChrono(airacs)) fmt.Println("Sorted: ", airacs) sort.Sort(sort.Reverse(ByChrono(airacs))) fmt.Println("Sorted reverse:", airacs)
Output: Not Sorted: [1213 1201 1207] Sorted: [1201 1207 1213] Sorted reverse: [1213 1207 1201]
Notes ¶
Bugs ¶
The two digit year identifier of the FromString method will
interpret the year as between 1964 and 2063. Other methods than FromString do not show this range restriction. This time window is more or less arbitrary and may change.
This package assumes that AIRAC cycles are effective from
the effective date at 00:00:00 UTC until 27 days later at 23:59:59.999999999 UTC. That is not correct: ICAO DOC 8126, 6th Edition (2003), paragraph 2.6.4: "In addition to the use of a predetermined schedule of effective AIRAC dates, Coordinated Universal Time (UTC) must also be used to indicate the time when the AIRAC information will become effective. Since Annex 15, paragraph 3.2.3 specifies that the Gregorian calendar and UTC must be used as the temporal reference system for international civil aviation, in addition to AIRAC dates, 00:01 UTC must be used to indicate the time when the AIRAC-based information will become effective." However I won't "fix" this, because that may just confuse users.
Calculations that include calendar dates before the internal
epoch (1901-01-10; 63 years before the AIRAC system was introduced by the ICAO) and after year 2192 may silently produce wrong data.
This package only provides calculations on effective dates,
not publication or reception dates etc. Although effective dates are clearly defined and are consistent at least between 1998 until 2020, the derivative dates changed historically.[citation needed]