Classes¶
EUROCONTROLpy (SQLAlchemy)¶
- class eurocontrolpy.EUROCONTROLpy(engine=None, schema='PRU_DEV')[source]¶
Bases:
_EUROCONTROLBaseSQLAlchemy / 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 providesacc_sf,ansp_sf,es_sf, andfir_sffor airspace geometries (returned as geopandas GeoDataFrames).- Parameters:
engine (
sqlalchemy.engine.Engine, optional) – Existing SQLAlchemy engine. If omitted, one is created usingbuild_sqlalchemy_oracle_engine(schema).schema (
str, default'PRU_DEV') – Environment variable prefix used when auto-creating the engine. Reads{schema}_USR,{schema}_PWD,{schema}_DBNAMEfrom the environment.
- 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’).
EUROCONTROLSpark (PySpark)¶
- class eurocontrolpy.EUROCONTROLSpark(spark=None, url=None, props=None)[source]¶
Bases:
_EUROCONTROLBasePySpark client for EUROCONTROL PRISME/NM Oracle data via JDBC.
All methods return Spark DataFrames unless noted otherwise.
- Parameters:
- 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).
- 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.
- polyfill_h3(gdf, resolution, explode=False)[source]¶
Fill airspace polygons with H3 cells and return a Spark DataFrame.
- Parameters:
- 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 inspark.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:
ABCShared 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:
- static season_iata(year, season='summer')[source]¶
Start and end dates of an IATA season (inclusive on both ends).
- 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.
- airspace_profile_tbl()[source]¶
Return FSD.ALL_FT_ASP_PROFILE as a backend-native DataFrame.
- Return type:
- airspace_profiles_tidy(wef, til, airspace='FIR', profile='CTFM')[source]¶
All airspace profile segments intersecting [wef, til).
- apdf_tbl()[source]¶
Return SWH_FCT.FAC_APDS_FLIGHT_IR691 as a backend-native DataFrame.
- Return type:
- 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.
- 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.
- Return type:
- 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.
- 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 (
iterableofstr, default(``’S’, ``'N')) – ICAO flight type filter. Pass None to include all.ids (
iterableofint | str, optional) – Restrict to specific SAM IDs.extra_cols (
listofstr, optional) – Additional columns to pull from V_FAC_FLIGHT_MS.
- Return type:
- 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:
- point_profile_tbl()[source]¶
Return FSD.ALL_FT_POINT_PROFILE as a backend-native DataFrame.
- Return type:
- 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.
- 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*_sfmethod (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, defaultFalse) – If False (default), return one row per airspace withh3_indexas 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_indexcolumn.- Return type:
Notes
Requires
h3-py(pip install h3) andgeopandas(pip install geopandas).EUROCONTROLSpark overrides this method to return a Spark DataFrame using a PySpark UDF, so the polyfill runs on Spark workers.