Classes

EUROCONTROLpy (SQLAlchemy)

class eurocontrolpy.EUROCONTROLpy(engine=None, schema='PRU_DEV')[source]

Bases: _EUROCONTROLBase

SQLAlchemy / pandas client for EUROCONTROL PRISME/NM Oracle data.

All methods return pandas DataFrames unless noted otherwise. In addition to the methods inherited from _EUROCONTROLBase, this class provides acc_sf, ansp_sf, es_sf, and fir_sf for airspace geometries (returned as geopandas GeoDataFrames).

Parameters:
  • engine (sqlalchemy.engine.Engine, optional) – Existing SQLAlchemy engine. If omitted, one is created using build_sqlalchemy_oracle_engine(schema).

  • schema (str, default 'PRU_DEV') – Environment variable prefix used when auto-creating the engine. Reads {schema}_USR, {schema}_PWD, {schema}_DBNAME from the environment.

__init__(engine=None, schema='PRU_DEV')[source]
Parameters:

schema (str)

Return type:

None

acc_sf(cfmu_airac)[source]

ACC/OAC airspace geometries for the given CFMU AIRAC cycle.

Parameters:

cfmu_airac (str | int) – CFMU AIRAC cycle number, e.g. 517.

Returns:

Columns: AC_ID, AV_AIRSPACE_ID, MIN_FLIGHT_LEVEL, MAX_FLIGHT_LEVEL, NAME, CODE, AIRSPACE_TYPE, geometry.

Return type:

geopandas.GeoDataFrame

ansp_sf(cfmu_airac)[source]

ACE ANSP airspace geometries for the given CFMU AIRAC cycle.

Excludes entries with CODE in (‘AIRPORT’, ‘UNKNOWN’, ‘MILITARY’).

Returns:

Columns: airac_cfmu, id, code, name, ace_code, min_fl, max_fl, airspace_type, geometry.

Return type:

geopandas.GeoDataFrame

Parameters:

cfmu_airac (str | int)

es_sf(cfmu_airac)[source]

Elementary Sector airspace geometries for the given CFMU AIRAC cycle.

Returns:

Columns: AC_ID, AV_AIRSPACE_ID, MIN_FLIGHT_LEVEL, MAX_FLIGHT_LEVEL, NAME, CODE, AIRSPACE_TYPE, geometry.

Return type:

geopandas.GeoDataFrame

Parameters:

cfmu_airac (str | int)

fir_sf(cfmu_airac)[source]

FIR (Flight Information Region) airspace geometries for the given CFMU AIRAC cycle.

An icao column (first 2 characters of code) is derived automatically.

Returns:

Columns: airac_cfmu, icao, id, code, name, min_fl, max_fl, airspace_type, geometry.

Return type:

geopandas.GeoDataFrame

Parameters:

cfmu_airac (str | int)

EUROCONTROLSpark (PySpark)

class eurocontrolpy.EUROCONTROLSpark(spark=None, url=None, props=None)[source]

Bases: _EUROCONTROLBase

PySpark client for EUROCONTROL PRISME/NM Oracle data via JDBC.

All methods return Spark DataFrames unless noted otherwise.

Parameters:
  • spark (SparkSession, optional) – Existing session. If omitted, one is created via build_spark_oracle_session.

  • url (str, optional) – JDBC URL. Required if spark is provided.

  • props (dict, optional) – JDBC connection properties. Required if spark is provided.

__init__(spark=None, url=None, props=None)[source]
Parameters:
Return type:

None

airspace_profiles_tidy(wef, til, airspace='FIR', profile='CTFM')[source]

Airspace profile segments intersecting [wef, til).

Uses two separate JDBC reads + Spark join for better performance on large datasets (avoids pushing a large IN-subquery over JDBC).

Parameters:
flights_airspace_profiles_tidy(wef, til, airspace='FIR', profile='CTFM')[source]

Flights whose airspace segments intersect [wef, til).

Returns the same columns as flights_tidy. Uses two-step Spark approach for performance.

Parameters:
polyfill_h3(gdf, resolution, explode=False)[source]

Fill airspace polygons with H3 cells and return a Spark DataFrame.

Parameters:
  • gdf (geopandas.GeoDataFrame) – Output from EUROCONTROLpy.*_sf methods.

  • resolution (int) – H3 resolution (0–15).

  • explode (bool, default False) – If True, one row per H3 cell (other columns duplicated). If False, one row per airspace with h3_index as ArrayType.

Returns:

The geometry column is dropped; all other properties are kept alongside h3_index (ArrayType of StringType, or a single StringType when exploded).

Return type:

pyspark.sql.DataFrame

Notes

Requires h3-py (pip install h3) on the driver and every Spark worker node (or included in spark.archives / a conda env).

Abstract base class

The following class is not intended to be instantiated directly; it documents the methods shared by both backends.

class eurocontrolpy._base._EUROCONTROLBase[source]

Bases: ABC

Shared logic for Oracle PRISME/NM data access.

Subclasses must implement:
  • _execute_query(sql) -> backend DataFrame

  • _execute_table(table) -> backend DataFrame

  • _select_columns(df, cols) -> backend DataFrame

static airports_oa()[source]

Latest airport list from OurAirports (requires internet access).

Includes a set of manually added offshore heliports not present in the OurAirports dataset.

Return type:

DataFrame

static iata_season_for_date(date)[source]

Return the IATA season name for a given date.

Returns:

Format: ‘summer-yyyy’ or ‘winter-yyyy’.

Return type:

str

Parameters:

date (str | datetime)

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

Start and end dates of an IATA season (inclusive on both ends).

Parameters:
  • year (int)

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

Returns:

(start, end) as UTC-aware datetimes.

Return type:

tuple[datetime, datetime]

adrr_flights_tidy(wef, til)[source]

ADRR (Aviation Data Repository for Research) flight list.

Returns only S/N (scheduled/non-scheduled, non-military) flights with column names matching the ADRR manual specification.

Parameters:
Return type:

Any

airlines_tbl()[source]

Return PRUDEV.V_COVID_DIM_AO as a backend-native DataFrame.

Return type:

Any

airlines_tidy(member_state_iso2c=None)[source]

Airline info with EU membership flag.

Parameters:

member_state_iso2c (iterable of str, optional) – ISO 2-letter codes of EUROCONTROL Member States used to set the EU column. If None, the bundled member_state dataset is used.

Return type:

Any

airspace_profile_tbl()[source]

Return FSD.ALL_FT_ASP_PROFILE as a backend-native DataFrame.

Return type:

Any

airspace_profiles_tidy(wef, til, airspace='FIR', profile='CTFM')[source]

All airspace profile segments intersecting [wef, til).

Parameters:
  • wef (str | datetime) – UTC time window (right-open).

  • til (str | datetime) – UTC time window (right-open).

  • airspace (str, default 'FIR') – One of ‘FIR’, ‘NAS’, ‘AUA’, ‘ES’.

  • profile (str, default 'CTFM') – One of ‘FTFM’, ‘RTFM’, ‘CTFM’, ‘CPF’, ‘DCT’, ‘SCR’, ‘SRR’, ‘SUR’.

Return type:

Any

apdf_tbl()[source]

Return SWH_FCT.FAC_APDS_FLIGHT_IR691 as a backend-native DataFrame.

Return type:

Any

apdf_tidy(wef, til)[source]

Clean airport operator data flow (APDF) list for [wef, til).

Note: can only reliably cover one month at a time.

Parameters:
Return type:

Any

export_airports(wef, til)[source]

Airports from SWH_FCT.DIM_AIRPORT that are valid in [wef, til).

Parameters:
Return type:

Any

export_model_trajectory(wef, til, profile='CTFM', bbox=None, lobt_buffer=None, timeover_buffer=None)[source]

Point profiles for flights in [wef, til) for the given trajectory model.

Parameters:
  • profile (str, default 'CTFM') – One of ‘CPF’, ‘CTFM’, ‘DCT’, ‘FTFM’, ‘SCR’, ‘SRR’, ‘SUR’.

  • bbox (dict, optional) – Keys ‘xmin’, ‘xmax’, ‘ymin’, ‘ymax’ in decimal degrees.

  • lobt_buffer (dict, optional) – Keys ‘before’ and ‘after’ (hours). Defaults to 28/24.

  • timeover_buffer (dict, optional) – Keys ‘before’ and ‘after’ (hours) to filter TIME_OVER.

  • wef (str | datetime)

  • til (str | datetime)

Return type:

Any

flights_airspace_profiles_tidy(wef, til, airspace='FIR', profile='CTFM')[source]

Flights whose airspace profile segments intersect [wef, til).

Returns the same columns as flights_tidy.

Parameters:
Return type:

Any

flights_tbl()[source]

Return SWH_FCT.V_FAC_FLIGHT_MS as a backend-native DataFrame.

Return type:

Any

flights_tidy(wef, til, icao_flt_types=('S', 'N'), ids=None, include_sensitive=False, include_military=False, include_head=False, extra_cols=None)[source]

Clean flight list for the interval [wef, til).

Parameters:
  • wef (str | datetime) – Inclusive start (UTC).

  • til (str | datetime) – Exclusive end (UTC).

  • icao_flt_types (iterable of str, default (``’S’, ``'N')) – ICAO flight type filter. Pass None to include all.

  • ids (iterable of int | str, optional) – Restrict to specific SAM IDs.

  • include_sensitive (bool, default False)

  • include_military (bool, default False)

  • include_head (bool, default False)

  • extra_cols (list of str, optional) – Additional columns to pull from V_FAC_FLIGHT_MS.

Return type:

Any

generate_so6(trajectory)[source]

Convert point profile trajectories to SO6 segment format.

Parameters:

trajectory (pandas.DataFrame) – Must contain: FLIGHT_ID, TIME_OVER, LONGITUDE, LATITUDE, FLIGHT_LEVEL, POINT_ID, AIR_ROUTE, LOBT, SEQ_ID, CALLSIGN, REGISTRATION, MODEL_TYPE, AIRCRAFT_TYPE, AIRCRAFT_OPERATOR, ADEP, ADES.

Return type:

DataFrame

point_profile_tbl()[source]

Return FSD.ALL_FT_POINT_PROFILE as a backend-native DataFrame.

Return type:

Any

point_profiles_tidy(wef, til=None, profile='CTFM', bbox=None)[source]

Convenience wrapper for export_model_trajectory with default LOBT buffers.

til defaults to current UTC midnight when omitted.

Parameters:
Return type:

Any

polyfill_h3(gdf, resolution, explode=False)[source]

Fill airspace polygons with Uber H3 cells at the given resolution.

Parameters:
  • gdf (geopandas.GeoDataFrame) – Output from any *_sf method (acc_sf, ansp_sf, es_sf, fir_sf).

  • resolution (int) – H3 resolution level (0 = coarsest, 15 = finest). Typical airspace use cases: 3–6 for FIRs, 5–7 for smaller sectors.

  • explode (bool, default False) – If False (default), return one row per airspace with h3_index as a Python list of cell strings. If True, return one row per H3 cell — all other columns duplicated.

Returns:

The geometry column is dropped; all other properties are retained alongside the new h3_index column.

Return type:

pandas.DataFrame

Notes

Requires h3-py (pip install h3) and geopandas (pip install geopandas).

EUROCONTROLSpark overrides this method to return a Spark DataFrame using a PySpark UDF, so the polyfill runs on Spark workers.