Data
data
Downloaders and preprocessers for third-party data.
adsblol
adsb.lol Mode-S/ADS-B snapshots and aircraft data links.
Requires extras:
networkingdownloading metadataplatformdirsstoring metadata to default cache
Requires:
- curl for downloading datalinks
- zstd for datalink decompression
DEFAULT_GH_API_BASE_URL
DEFAULT_GH_API_BASE_URL = 'https://api.github.com'
MAX_RELEASES_PER_PAGE
MAX_RELEASES_PER_PAGE = 100
fp_modes_adsb_jsonl
Source code in src/aerocore/data/adsblol.py
47 48 | |
fp_datalinks_jsonl
Source code in src/aerocore/data/adsblol.py
51 52 | |
GitHubReleaseAsset
GitHubRelease
Bases: TypedDict
ReleasePage
AdsblolAsset
RepositoryMetadataSyncResult
MetadataFileSyncResult
MetadataFileSyncResult(path: Path, existing_assets: int, appended_assets: int, repositories: tuple[RepositoryMetadataSyncResult, ...])
get_github_auth_token
get_github_auth_token() -> str | None
Source code in src/aerocore/data/adsblol.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
github_headers
Source code in src/aerocore/data/adsblol.py
137 138 139 140 141 142 143 144 | |
fetch_release_page
fetch_release_page(client: AsyncClient, repository: str, *, page: int = 1, per_page: int = MAX_RELEASES_PER_PAGE) -> ReleasePage | None
Source code in src/aerocore/data/adsblol.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
iter_release_asset_downloads
iter_release_asset_downloads(page: ReleasePage) -> Iterator[AdsblolAsset]
Source code in src/aerocore/data/adsblol.py
169 170 171 172 173 174 175 176 177 178 179 180 | |
iter_metadata_rows
iter_metadata_rows(path: Path) -> Iterator[AdsblolAsset]
Source code in src/aerocore/data/adsblol.py
183 184 185 186 187 | |
run_metadata
run_metadata(*, grouped_specs: Mapping[Path, Iterable[str]], base_url: str, auth_token: str | None, per_page: int = MAX_RELEASES_PER_PAGE, max_pages: int | None = None) -> MetadataSyncResult
Incrementally append newest adsb.lol GitHub release asset metadata.
It treats the release history as an append-only newest-first log and stops per repository once a fetched page contains no unknown asset ids. It does not repair or backfill, in those cases delete the metadata JSONL and rerun to rebuild.
Source code in src/aerocore/data/adsblol.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
append_jsonl_rows_sync
append_jsonl_rows_sync(path: Path, rows: Iterable[AdsblolAsset]) -> int
Source code in src/aerocore/data/adsblol.py
327 328 329 330 331 332 333 334 | |
AssetTimePeriod
ModeAssetPeriod
ModeAssetPeriod(asset_name: str, day: date, variant: ModeVariant, replica: str, part: str | None)
ModeDailySizes
parse_asset_time_period
parse_asset_time_period(asset_name: str) -> AssetTimePeriod
Source code in src/aerocore/data/adsblol.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
parse_mode_asset_period
parse_mode_asset_period(asset_name: str) -> ModeAssetPeriod
Source code in src/aerocore/data/adsblol.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
KNOWN_UNAVAILABLE_DATALINK_URLS
KNOWN_UNAVAILABLE_DATALINK_URLS = {'https://github.com/adsblol/aircraft-data-links-2026/releases/download/adsblol-adl-2026-05-14/adsblol-adl-vdl2_20260514-165234_20260514-165745.jsonl'}
dir_datalinks
Source code in src/aerocore/data/adsblol.py
468 469 | |
DatalinkDownloadItem
DatalinkPlan
DatalinkPlan(metadata_path: Path, output_root: Path, items: tuple[DatalinkDownloadItem, ...], selected_by_repo: Mapping[str, int], existing_by_repo: Mapping[str, int])
DatalinkDownloadResult
plan_datalinks
plan_datalinks(*, metadata_path: Path, output_root: Path, start_date: date | datetime | None = None, end_date: date | datetime | None = None) -> DatalinkPlan
Source code in src/aerocore/data/adsblol.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
datalinks_download
datalinks_download(*, metadata_path: Path, output_root: Path, start_date: date | datetime | None = None, end_date: date | datetime | None = None, dry_run: bool = False, jobs: int | None = None) -> DatalinkDownloadResult
Source code in src/aerocore/data/adsblol.py
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | |
load_metadata_daily_sizes
Source code in src/aerocore/data/adsblol.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | |
load_modes_daily_sizes
Source code in src/aerocore/data/adsblol.py
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | |
build_adsblol_figure
build_adsblol_figure(modes_daily_sizes: Mapping[date, ModeDailySizes], datalinks_daily_sizes: Mapping[date, int], *, line_color: str = '#5470c6', datalink_color: str = '#d9a15b', prod_color: str = '#5a9a8b', staging_color: str = '#c97c76', mlatonly_color: str = '#7d8a8c', test_color: str = '#8c7bd6') -> Figure
Source code in src/aerocore/data/adsblol.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | |
DatalinkAppRequired
DatalinkApp
Bases: DatalinkAppRequired
DatalinkAdsblolMeta
Bases: TypedDict
DatalinkTime
AcarsFlightId
AcarsFlightId = str
Flight id/number from ACARS, e.g. 'UA0097'. Not exactly the callsign
AcarsDatalinkRequired
Bases: TypedDict
timestamp
timestamp: TimestampUtcS[float]
Decoder Unix epoch seconds, UTC; usually within ~1s of received_at
assstat
AcarsDatalink
Bases: AcarsDatalinkRequired
timestamp
timestamp: TimestampUtcS[float]
Decoder Unix epoch seconds, UTC; usually within ~1s of received_at
assstat
EmbeddedAcarsRequired
Bases: TypedDict
EmbeddedAcars
Bases: EmbeddedAcarsRequired
Vdl2AddressRequired
Vdl2Address
Vdl2Param
Vdl2XidRequired
Vdl2Xid
Bases: Vdl2XidRequired
Vdl2AvlcRequired
Bases: TypedDict
frame_type
AVLC frame type; typically information and unnumbered frames
Vdl2Avlc
Bases: Vdl2AvlcRequired
frame_type
AVLC frame type; typically information and unnumbered frames
Vdl2Payload
Vdl2Datalink
Bases: TypedDict
HfdlCodeDescription
HfdlTypeCode
HfdlAircraftInfo
HfdlEndpointRequired
HfdlEndpoint
Bases: HfdlEndpointRequired
HfdlPosition
Bases: TypedDict
HfdlPduStats
Bases: TypedDict
HfdlFrequencyData
Bases: TypedDict
HfdlHfnpduRequired
Bases: TypedDict
HfdlHfnpdu
Bases: HfdlHfnpduRequired
HfdlLpduRequired
Bases: TypedDict
HfdlLpdu
Bases: HfdlLpduRequired
HfdlGsStatus
Bases: TypedDict
HfdlSpdu
Bases: TypedDict
HfdlPayloadRequired
Bases: TypedDict
HfdlPayload
Bases: HfdlPayloadRequired
HfdlDatalink
Bases: TypedDict
era5
Google Research's Analysis-Ready & Cloud Optimized (ARCO) ERA5 dataset
Format: netcdf, indexed by the specific date and pressure level.
See:
- https://cloud.google.com/storage/docs/public-datasets/era5
- https://github.com/google-research/arco-era5
Data License: Copernicus license
Requires extras:
httpx,polarsgcloudCLI to be installed and authenticated
GOOGLE_STORAGE_URI
GOOGLE_STORAGE_URI = 'gs://gcp-public-data-arco-era5/raw/date-variable-pressure_level'
PRESSURE_LEVELS
PRESSURE_LEVELS: PressureHPA[tuple[int, ...]] = (*(range(100, 275, 25)), *(range(300, 750, 50)), *(range(750, 1025, 25)))
EcmwfParameter
VARIABLES
VARIABLES: list[EcmwfParameter] = [EcmwfParameter(248, 'fraction_of_cloud_cover', 'cc', Dimensionless('fraction')), EcmwfParameter(129, 'geopotential', 'z', M ** 2 * S ** -2), EcmwfParameter(203, 'ozone_mass_mixing_ratio', 'o3', Dimensionless('mass_mixing_ratio')), EcmwfParameter(60, 'potential_vorticity', 'pv', S ** -1), EcmwfParameter(247, 'specific_cloud_ice_water_content', 'ciwc', Dimensionless('mass_mixing_ratio')), EcmwfParameter(246, 'specific_cloud_liquid_water_content', 'clwc', Dimensionless('mass_mixing_ratio')), EcmwfParameter(133, 'specific_humidity', 'q', Dimensionless('mass_mixing_ratio')), EcmwfParameter(130, 'temperature', 't', STATIC_TEMPERATURE(K)), EcmwfParameter(131, 'u_component_of_wind', 'u', WIND_SPEED(M_PERS)), EcmwfParameter(132, 'v_component_of_wind', 'v', WIND_SPEED(M_PERS)), EcmwfParameter(135, 'vertical_velocity', 'w', PA * S ** -1)]
Available variables under the raw bucket.
dates
Generate dates in the format YYYY/MM/DD from start to end, inclusive.
Source code in src/aerocore/data/era5.py
102 103 104 105 106 107 108 109 | |
fetch_weather
fetch_weather(date_start: datetime = datetime(2023, 2, 1, tzinfo=utc), date_end: datetime = datetime(2023, 2, 1, tzinfo=utc), *, base_dir: Path, variables: list[str] = list(keys()), pressure_levels: tuple[int, ...] = PRESSURE_LEVELS, gs_base: str = GOOGLE_STORAGE_URI) -> None
Recursively download all global ERA5 data for the specified date interval, pressure levels and variables as NetCDF files.
The directory structure will be mirrored as:
{base_dir}/{YYYY}/{MM}/{DD}/{variable_name}/{pressure_level}.nc.
Source code in src/aerocore/data/era5.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
concat_dataset
Concatenates all pressure levels for a given variable and date into a single dataset
Example:
<xarray.Dataset> Size: 5GB
Dimensions: (isobaricInhPa: 27, time: 24, latitude: 721, longitude: 1440)
Coordinates:
* longitude (longitude) float32 6kB 0.0 0.25 0.5 ... 359.2 359.5 359.8
* latitude (latitude) float32 3kB 90.0 89.75 89.5 ... -89.5 -89.75 -90.0
* time (time) datetime64[ns] 192B 2023-02-01 ... 2023-02-01T23:00:00
* isobaricInhPa (isobaricInhPa) int64 216B 100 1000 125 150 ... 925 950 975
Data variables:
z (isobaricInhPa, time, latitude, longitude) float64 5GB dask.array
<chunksize=(1, 24, 721, 1440), meta=np.ndarray>
Attributes:
Conventions: CF-1.6
history: 2023-06-24 08:54:57 GMT by grib_to_netcdf-2.25.1: /opt/ecmw...
Source code in src/aerocore/data/era5.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
build_path
Source code in src/aerocore/data/era5.py
211 212 | |
get_data_for_trajectory
get_data_for_trajectory(trajectory: LazyFrame, *, base_dir: Path, year: int, month: int, day: int) -> LazyFrame
Extract weather data for the given trajectory
Returns:
| Type | Description |
|---|---|
LazyFrame
|
a lazyframe with the weather data |
Source code in src/aerocore/data/era5.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
engine_emissions
ICAO Aircraft Engine Emissions Databank
Requires extras:
httpx,polars
URL_EMISSIONS
URL_EMISSIONS = 'https://www.easa.europa.eu/en/downloads/131424/en'
EmissionsData
Bases: NamedTuple
data
data: DataFrame
schema
schema: DataFrame
fetch_emissions_data
fetch_emissions_data(client: AsyncClient) -> EmissionsData
Source code in src/aerocore/data/engine_emissions.py
43 44 45 | |
aircraft_types
List of aircraft types, from ICAO DOC8643
Requires extras:
httpx,polars
SCHEMA_AIRCRAFT_TYPES
SCHEMA_AIRCRAFT_TYPES = {'ModelFullName': String(), 'Description': String(), 'WTC': Enum(['H', 'M', 'L', 'J', 'L/M']), 'WTG': Enum(['E', 'Z', 'F', 'C', 'D', 'G', 'A', 'B']), 'Designator': String(), 'ManufacturerCode': String(), 'ShowInPart3Only': Boolean(), 'AircraftDescription': Enum(['Helicopter', 'SeaPlane', 'LandPlane', 'Tiltrotor', 'Gyrocopter', 'Amphibian']), 'EngineCount': String(), 'EngineType': Enum(['Piston', 'Turboprop/Turboshaft', 'Jet', 'Rocket', 'Electric'])}
Schema for aircraft types dataset.
SCHEMA_MANUFACTURERS
SCHEMA_MANUFACTURERS = {'Code': String(), 'Names': List(String()), 'StateName': String()}
Schema for manufacturers dataset.
URL_BASE_DOC8643
URL_BASE_DOC8643 = 'https://doc8643.icao.int/External'
fetch_aircraft_types
fetch_aircraft_types(client: AsyncClient) -> DataFrame
Source code in src/aerocore/data/aircraft_types.py
63 64 65 | |
fetch_manufacturers
fetch_manufacturers(client: AsyncClient) -> DataFrame
Source code in src/aerocore/data/aircraft_types.py
68 69 70 | |
airports
List of airports, from ourairports
Requires extras:
httpx,polars
SCHEMA_AIRPORTS
SCHEMA_AIRPORTS = {'id': Int32(), 'ident': String(), 'type': String(), 'name': String(), 'latitude_deg': Float32(), 'longitude_deg': Float32(), 'elevation_ft': Int16(), 'continent': String(), 'iso_country': String(), 'iso_region': String(), 'municipality': String(), 'scheduled_service': String(), 'gps_code': String(), 'iata_code': String(), 'local_code': String(), 'home_link': String(), 'wikipedia_link': String(), 'keywords': String()}
Schema for airports dataset.
scan_airports
scan_airports(fp: Path) -> LazyFrame
Lazily load list of airports from parquet file.
Schema: aerocore.data.airports.SCHEMA_AIRPORTS
Source code in src/aerocore/data/airports.py
42 43 44 45 46 47 48 49 50 51 52 | |
URL_BASE
URL_BASE = 'https://davidmegginson.github.io/ourairports-data'
fetch_airports
fetch_airports(client: AsyncClient) -> DataFrame
Download all airports from ourairports.
Schema: aerocore.data.airports.SCHEMA_AIRPORTS
Source code in src/aerocore/data/airports.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |