Package 'trrrj'

Title: Flight trajectories analysis
Description: Functions to a) read FlightRadar24's live feed JSON files, archived data; b) import CPR data from NM's archived files; c) Plot 2D trajectories, vertical profiles both in time and track distance; d) analyse trajectories.
Authors: Enrico Spinielli [aut, cre] (ORCID: <https://orcid.org/0000-0001-8584-9131>), EUROCONTROL [cph, fnd]
Maintainer: Enrico Spinielli <[email protected]>
License: MIT + file LICENSE
Version: 0.2.7
Built: 2026-12-05 20:32:09 UTC
Source: https://github.com/euctrl-pru/trrrj

Help Index


Return the ICAO IRAC id for a date

Description

Return the ICAO IRAC id for a date

Usage

airac(date)

Arguments

date

a date (or a ymd representation of it)

Value

the ICAO AIRCA id

See Also

Other airac: airac_epoch(), airac_interval(), airac_year_epoch(), cfmu_airac(), cfmu_airac_epoch(), cfmu_airac_epoch_number(), cfmu_airac_interval()

Examples

airac('2019-01-30')

AIRAC epoch as from ICAO Doc 8126

Description

AIRAC epoch is defined in section 2.6.2 b) of

Usage

airac_epoch()

Value

the AIRAC epoch according to ICAO scheme

See Also

Other airac: airac(), airac_interval(), airac_year_epoch(), cfmu_airac(), cfmu_airac_epoch(), cfmu_airac_epoch_number(), cfmu_airac_interval()

Examples

airac_epoch()

The interval od dates for an (ICAO) AIRAC

Description

The interval od dates for an (ICAO) AIRAC

Usage

airac_interval(airac)

Arguments

airac

the ICAO AIRAC, i.e. "1603" for the 3rd AIRAC of 2016

Value

an interval of (28) days coverad by the AIRAC airac

See Also

Other airac: airac(), airac_epoch(), airac_year_epoch(), cfmu_airac(), cfmu_airac_epoch(), cfmu_airac_epoch_number(), cfmu_airac_interval()

Examples

airac_interval("1603")

Return the effective date of the first AIRAC for year year

Description

Return the effective date of the first AIRAC for year year

Usage

airac_year_epoch(year)

Arguments

year

a year (as integer)

Value

the WEF date for the first AIRAC of the year year

See Also

Other airac: airac(), airac_epoch(), airac_interval(), cfmu_airac(), cfmu_airac_epoch(), cfmu_airac_epoch_number(), cfmu_airac_interval()

Examples

airac_year_epoch(2018)

Aircraft type as per ICAO.

Description

A dataset containing aircraft types as "published" at ICAO's Aicraft Type Designator page.

Usage

aircrafttype

Format

A data frame with 9290 rows and 19 variables. The variables are a joint of flight information from flts with the following ones:

ModelFullName

Full name of the aircraft model

Description

Description of the aircraft type. The first character is L = landplane, S = seaplane, A = amphibian, H = helicopter, G = gyrocopter, T = tilt-wing aircraft. The second character is about the number of engines 1 thru 8 or C applicable to fixed-wing aircraft only and indicating that two engines are coupled to drive a single propeller system. The fird character is for the type of engine with P = piston engine, T = turboprop/turboshaft engine, J = jet engine, E = electric engine

WTC

The Wake Turbulence Category (WTC) indicator defined according to the certificated maximum take-off mass (MTOM). H = heavy (300000 lb), M = medium (less than 136000 kg (300000 lb) and more than 7000 kg (15500 lb))

Designator

The aircraft type designator

ManufacturerCode

The aircraft manufacturer code

AircraftDescription

The aircraft kind, see the first character of the Description field.

EngineCount

The number of engines, see the second character of the Description field.

EngineType

The engine type, see the third character of the Description field.

Source

https://www.icao.int/publications/DOC8643/Pages/Search.aspx


Return an axis-aligned bounding box delimiting a circle at distance d

Description

[Experimental]

bbox_at_distance returns an st_bbox object representing the extent of an axis-aligned bounding box containing the (polygonal approximation of a) a circle at dithance d.

WARNING: current implementation relies on polygon_at_distance which is not robust to cope with circles containing the Poles or crossing the date line.

Usage

bbox_at_distance(geo, d, ...)

Arguments

geo

a geographical position [lon, lat]

d

a distance in Nautical Miles

...

other parameters passed to polygon_at_distance()

Value

an st_bbox object

See Also

Other spatial: bounding_box(), crs_tc(), filter_positions_at_range(), polygon_at_distance(), polygon_from_coords()

Examples

## Not run: 
fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude)
bbox_at_distance(fra, 40)

## End(Not run)

Calculate the coordinates of the axis-aligned bounding box

Description

[Experimental]

Calculate a bounding box for a center point given a set of coordinates.

Usage

bounding_box(lat, lon, d)

Arguments

lat

latitude of the center point [decimal degrees].

lon

longitude of the center point [decimal degrees].

d

distance from the center point [Nautical Miles].

Value

Returns a matrix with max/min latitude/longitude values.

References

http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates

See Also

Other spatial: bbox_at_distance(), crs_tc(), filter_positions_at_range(), polygon_at_distance(), polygon_from_coords()

Examples

## Not run: 
bounding_box(38.8977, 77.0366, 1)

## End(Not run)

return the CFMU AIRAC cycle number for a date

Description

return the CFMU AIRAC cycle number for a date

Usage

cfmu_airac(date)

Arguments

date

a date

Value

a number indicating the AIRAC cycle according to CFMU scheme

See Also

Other airac: airac(), airac_epoch(), airac_interval(), airac_year_epoch(), cfmu_airac_epoch(), cfmu_airac_epoch_number(), cfmu_airac_interval()

Examples

cfmu_airac('2019-01-30')

The interval of dates for a CFMU AIRAC number

Description

The interval of dates for a CFMU AIRAC number

Usage

cfmu_airac_interval(cfmu_airac)

Arguments

cfmu_airac

a CFMU AIRAC number

Value

an interval of dates (28 days)

See Also

Other airac: airac(), airac_epoch(), airac_interval(), airac_year_epoch(), cfmu_airac(), cfmu_airac_epoch(), cfmu_airac_epoch_number()

Examples

cfmu_airac_interval(441)

Sample Correlated Position Report (CPR) data.

Description

A dataset containing CPR's for 41 flights flying over Europe. One on 4th , 19 on 5th and 21 on 6th Feb 2017.

Usage

cprs

Format

A data frame with 53940 rows and 10 variables:

cpm_id

CPR Message (CPM) line number

tact_id

TACT Id, TACT (a.k.a. ETFMS) is an NM system

timestamp_etfms

time of CPM reception by the ETFMS system

timestamp_track

time of track

block

block number. ETFMS internal use

record

record number. ETFMS internal use

entry_node_sac

Entry Node (EN) system area code (SAC). To avoid ambiguity in the exchange of Surveillance related data, each system using the ASTERIX data format gets assigned a unique identifier composed of two values called SAC/SIC. See https://www.eurocontrol.int/services/system-area-code-list

entry_node_sic

Entry Node (EN) system identifier code (SIC). To avoid ambiguity in the exchange of Surveillance related data, each system using the ASTERIX data format gets assigned a unique identifier composed of two values called SAC/SIC. The System Identification Code (SIC) is allocated nationally by the responsible Air Traffic Services Organisation. It identifies each individual system (surveillance sensor, surveillance data processing system, etc) within the respective area defined by the SAC. See https://www.eurocontrol.int/services/system-area-code-list

callsign

Callsign for the flight as provided in the FPL (Flight PLan). It may be the registration marking of the aircraft or the ICAO designator for the aircraft operating agency followed by the flight identification

adep_icao

ICAO location identifier of the Airport of Departure (ADEP)

ades_icao

ICAO location identifier of the Airport of Destination (ADES)

eobt

Estimate Take-Off Date and Time (EOBT), the estimated time at which the aircraft will commence movement associated with departure

longitude

longitude (decimal degrees)

latitude

latitude (decimal degrees)

flight_level

flight level of the aircraft. Flight levels are surfaces of constant atmospheric pressure which are related to a specific pressure datum, 1013.2 HP (Hecto-Pascal). The expression ‘Flight level times 100’ is sometimes, not quite correctly, referred to as altitude in feet

track_service

Determines whether the CPR is the first (Begin), an intermediate (Continuing) or the last (End) CPR sent by the corresponding system for the relevant flight. (Begin_And_End is also possible)

ssr_code

A 4-Digit octal code used in the transponder to identify an aircraft (SSR Mode 3/A). See https://en.wikipedia.org/wiki/Aviation_transponder_interrogation_modes

track_speed

calculated ground velocity (knots) based on the previous radar position

track_heading

calculated heading of aircraft with respect to the magnetic North (decimal degrees)

climb_rate

Climb (positive) or descend (negative) rate (knots)

track_vertical_mode

a categorical value for the rate of climb, it can be one of CLIMB, DESCENT, LEVEL_FLIGHT or UNDETERMINED

ifps_id

a unique flight plan identifier assigned by the IFPS system

aircraft_address

a unique identification of the aircrafts frame (24-bit ICAO aircraft address)

Source

EUROCONTROL's Network Manager


PROJ4 CRS string used in Traffic Complexity

Description

Traffic Complexity score computation uses a custom Albers Equal Area projection.

Usage

crs_tc()

Value

the PROJ4 string for the map projection

See Also

parse_airspace_prisme for an example.

Other spatial: bbox_at_distance(), bounding_box(), filter_positions_at_range(), polygon_at_distance(), polygon_from_coords()


Calculate the cumulative distance (in km).

Description

The calculated distance also for position reports on the ground; the algorithm used is the one of distCosine.

Usage

cumulative_distance(positions)

Arguments

positions

the position reports for the flight

Value

a dataframe with a new cumulative_distance column (in km)

See Also

Other analysis: cumulative_time(), extract_segment(), filter_outlier(), resample(), smooth_positions()

Examples

## Not run: 
cumulative_distance(poss)
# calculate only the flown distance
# NOTE: there is a gap in FR24 data between last ground position (if any)
#       and first in air one (typically at ~1500 ft).
#       The following code would certainly work better
#       would poss contain a position report for a very low altitude.
cumulative_distance(poss %>% filter(altitude > 0))

## End(Not run)

Calculate the cumulative time (in s).

Description

Calculate the cumulative time (in s).

Usage

cumulative_time(positions, offblock = NULL, inblock = NULL)

Arguments

positions

the position reports for the flight

offblock

optional, the timestamp for offblock if different from the first timestamp in the dataset. It is either an integer (UNIX timestamp) or a date-time value

inblock

optional, the timestamp for inblock if different from the last timestamp in the dataset

Value

a dataframe with a new cumulative_time column (in min)

See Also

Other analysis: cumulative_distance(), extract_segment(), filter_outlier(), resample(), smooth_positions()

Examples

## Not run: 
cumulative_time(poss)
# calculate only the flown distance
# NOTE: there is a gap in FR24 data between last ground position (if any)
#       and first in air one (typically at ~1500 ft).
#       The following code would certainly work better
#       would poss contain a position report for a very low altitude.
cumulative_time(poss %>% filter(altitude > 0))

## End(Not run)

Convert Degree decimal Minute (DdM)) format to Decimal Degrees (DD).

Description

Convert Degree decimal Minute (DdM)) format to Decimal Degrees (DD).

Usage

ddm2dd(value)

Arguments

value

a string representation of an angle (i.e. longitude) in Degree decimal Minute (DdM)), i.e. N51°28.65'

Value

a decimal (degrees) value

See Also

Other coordinates: dms2dd(), parse_lat_icao(), parse_lon_icao()

Examples

ddm2dd("N51° 28.65'")

Convert Degree Minute Seconds (DMS) format to Decimal Degrees (DD)

Description

Convert Degree Minute Seconds (DMS) format to Decimal Degrees (DD)

Usage

dms2dd(value)

Arguments

value

a string representation of an angle (i.e. longitude) in Degree Minute Second (DMS)), i.e. "51° 43' 34.00\" N"

         \strong{Note} the escaping of double quote.

Value

a decimal degrees value

See Also

Other coordinates: ddm2dd(), parse_lat_icao(), parse_lon_icao()

Examples

ddm2dd("51° 43' 34.00\u0022 N")

EGLL data.

Description

EGLL data.

Usage

egll_apt

Format

An object of class tbl_df (inherits from tbl, data.frame) with 5 rows and 7 columns.

Source

UK AIP


Sample Reference Trajectories' flight data at EGLL.

Description

Sample Reference Trajectories' flight data at EGLL.

Usage

egll_flights

Format

An object of class spec_tbl_df (inherits from tbl_df, tbl, data.frame) with 45 rows and 9 columns.

Source

Reference Trajectories


Sample FlightRadar24's archived feed ADS-B flight data for EGLL.

Description

A dataset containing FlightRadar24's archived feed ADS-B flight information for XX flights. There are xx flights on d1 and yy on yy.

Usage

egll_flights_fr24

Format

A data frame with xxyy rows and 11 variables:

address

mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder

adep

ICAO code for scheduled departure airport

ades

ICAO code for scheduled arrival airport

callsign

e.g. CSA190, as supplied by the Mode-S or ADS-B transponder

flight_id

unique identifier for the flight leg (integer)

reg

unique aircraft identifier (text)

model

aircraft type (e.g. B733, as per ICAO classification?), GLID for gliders, GROUND for ground vehicles

flight

flight number, e.g. OK190

start_time

date of the flight (what about the ones crssing midnight?)

Source

FlightRadar24


Sample Reference Trajectories' position reports data at EGLL.

Description

Sample Reference Trajectories' position reports data at EGLL.

Usage

egll_positions

Format

An object of class grouped_df (inherits from tbl_df, tbl, data.frame) with 18574 rows and 10 columns.

Source

Reference Trajectories


Sample FlightRadar24's archived feed ADS-B position reports data at EGLL.

Description

A dataset containing FlightRadar24's archived ADS-B position reports (combined with flight information of flts) for xx flights at EGLL. There are xx flights on d1 and yy on d2.

Usage

egll_positions_fr24

Format

A data frame with zzzz rows and 19 variables. The variables are a joint of flight information from flts with the following ones:

flight_id

unique identifier for the flight leg (integer)

altitude

altitude in feet (integer), as supplied by the Mode-S or ADS-B transponder

latitude

latitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

longitude

longitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

speed

ground speed in knots (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

event_time

datetime for the position report

on_ground

1 = on ground, 0 = airborne

vert_speed

vertical speed

Source

FlightRadar24


EGLL runways.

Description

EGLL runways.

Usage

egll_rw_sf

Format

An object of class sf (inherits from tbl_df, tbl, data.frame) with 2 rows and 2 columns.

Source

UK AIP


Export ALL_FT+-based trajectories to SO6 format

Description

Extract ALL_FT+-based trajectories from PRISME database and convert to SO6 format.

Usage

export_allft_so6(wef, til, model = "CTFM", ...)

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl (excluded).

model

the trajectory model, one of FTFM, RTFM, CTFM, CPF

...

extra arguments passed to export_model_trajectory.

Details

You need to store your credentials to access the PRU tables in the following environment variables:

  • PRU_TEST_USR for the user id

  • PRU_TEST_PWD for the password

  • PRU_TEST_DBNAME for the database name

Value

a dataframe of trajectory segments in SO6 format, see read_so6 for a description of the SO6 format.

See Also

Other read/export: export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# BEWARE: this can take some long-ish time
export_allft_so6("2010-06-16", "2010-06-17", model = "FTFM")

# reduce the time scope to get the data quicker (and smaller)
export_allft_so6("2010-06-16 10:00", "2010-06-16T11:00:11")

## End(Not run)

Export APDS (airport) data

Description

Extract APDS data from PRISME database. Note: there are 129 columns...

Usage

export_apds(wef, til)

Arguments

wef

date of With Effect From (included)

til

date of TILl instant (excluded)

Details

You need to store your credentials to access the ATMAP tables in the following environment variables:

  • PRU_ATMAP_USR for the user id

  • PRU_ATMAP_PWD for the password

  • PRU_ATMAP_DBNAME for the database name

Value

a dataframe of airport reported movements

See Also

Other read/export: export_allft_so6(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_apds("2019-04-10", "2019-04-11")

## End(Not run)

Export "Event"-based trajectories to SO6 format

Description

Extract event-based trajectories from PRISME database and convert to SO6 format

Usage

export_event_so6(wef, til)

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl (excluded).

Details

You need to store your credentials to access the CPLX tables in the following environment variables:

  • PRU_CPLX_USR for the user id

  • PRU_CPLX_PWD for the password

  • PRU_CPLX_DBNAME for the database name

Value

a dataframe of trajectory segments in SO6 format, see read_so6 for a description of the SO6 format.

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# BEWARE: this can take some long-ish time
export_event_so6("2010-06-16", "2010-06-17")

# reduce the time scope to get the data quicker (and smaller)
export_event_so6("2010-06-16 10:00", "2010-06-16T11:00:11")

## End(Not run)

Export event-based NM trajectories

Description

Extract "Event"-based trajectories from PRISME database

Usage

export_event_trajectory(wef, til)

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl instant (excluded)

Details

You need to store your credentials to access the CPLX related tables in the following environment variables:

  • PRU_CPLX_USR for the user id

  • PRU_CPLX_PWD for the password

  • PRU_CPLX_DBNAME for the database name

Value

a dataframe of trajectory points.

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_event_trajectory("2010-06-16", "2010-06-17")
export_event_trajectory("2010-06-16 10:00", "2010-06-16T11:00:00Z")

## End(Not run)

Export the flight list

Description

Export the flight list

Usage

export_flight_info(wef, til, lobt_buffer = c(before = 28, after = 24))

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl instant (excluded)

lobt_buffer

The number of hours before and after LOBT to query [default before = 28, after = 24]. This is related to how LOBT is stored in the underlying database table.

Value

a data frame of flight info

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_flight_info("2020-01-20", "2020-01-21")

## End(Not run)

Export FlightRadar24 flight movements at an airport in an interval of time

Description

Extract FlightRadar24 flight movements in the specified period at an airport

Usage

export_flights_at_airport_fr24(wef, til, apt, flow = "ALL")

Arguments

wef

(UTC) timestamp of With Effect From (included)

til

(UTC) timestamp of TILl instant (excluded)

apt

IATA code of an airport, i.g. PSA for Pisa "Galileo Galilei"

flow

the flow of flights: "ARR" for arrivals, "DEP" for departures, "ALL" for both (default "ALL")

Details

You need to store your credentials to access the FR24 tables in the following environment variables:

  • PRU_FR24_USR for the user id

  • PRU_FR24_PWD for the password

  • PRU_FR24_DBNAME for the database name

Value

a dataframe of flights

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_flights_at_airport_fr24("2017-09-01T00:00:00", "2017-09-02T00:00:00",
            "SVG",
            flow = "ARR")

# only 2 hours interval
export_flights_at_airport_fr24("2017-09-01 10", "2017-09-02T11:00:00",
            "SVG",
            flow = "ARR")

## End(Not run)

Export FlightRadar24 flight movements for an interval of time

Description

Extract FlightRadar24 flight movements in the specified period

Usage

export_flights_fr24(wef, til)

Arguments

wef

(UTC) timestamp of With Effect From (included)

til

(UTC) timestamp of TILl instant (excluded)

Details

You need to store your credentials to access the FR24 tables in the following environment variables:

  • PRU_FR24_USR for the user id

  • PRU_FR24_PWD for the password

  • PRU_FR24_DBNAME for the database name

Value

a dataframe of flights

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_flights_fr24("2017-09-01T10:30:00", "2017-09-01 11")

## End(Not run)

Export list of hourly-binned flights and aircraft info

Description

Extract hourly-binned flights from PRISME database together with aircraft information such as registration, aircraft operator and ICAO 24-bit address

Usage

export_hourly_adsb(wef, til, model = "CTFM", bbox = NULL)

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl instant (excluded)

model

the model of the profile: one of "FTFM", "CTFM", "CPF". [default: "CFTM"]

bbox

(Optional) axis aligned bounding box (xmin, ymin, xmax, ymax)

Details

You need to store your credentials to access the PRU tables in the following environment variables:

  • PRU_DEV_USR for the user id

  • PRU_DEV_PWD for the password

  • PRU_DEV_DBNAME for the database name

Value

a dataframe with trajectory data

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# export all hourly CTFM flights within a bounding box 40 NM around EDDF
bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920)
export_hourly_adsb("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb)

## End(Not run)

Export point profile from NM trajectories

Description

Extract NM point profile trajectories from PRISME database

Usage

export_model_trajectory(
  wef,
  til,
  model = "CTFM",
  bbox = NULL,
  lobt_buffer = c(before = 28, after = 24),
  timeover_buffer = NULL
)

Arguments

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl instant (excluded)

model

the model of the profile: one of CPF, CTFM, DCT, FTFM, SCR, SRR, SUR [default: "CFTM"].

bbox

(Optional) axis aligned bounding box (xmin, ymin, xmax, ymax)

lobt_buffer

(Optional) number of (portion of) hours buffer for LOBT before/after wef and til (before, after). This is to cater for flights crossing wef and til. For example c(before = 24, after = 2.25) allows to retrieve flights with LOBT 24H before wef and 1H15M after til and then potentially crossing the interval.

timeover_buffer

(Optional) number of (portion of) hours buffer for time_over before/after wef and til (before, after). This is to cater for flights crossing wef and til. For example c(before = 2, after = 0.25) allows to retrieve points 2H before wef and 15M after til.

Details

You need to store your credentials to access the PRU tables in the following environment variables:

  • PRU_DEV_USR for the user id

  • PRU_DEV_PWD for the password

  • PRU_DEV_DBNAME for the database name

Value

a dataframe with trajectory data

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# export 1 day worth of NM (planned) trajectories
export_model_trajectory("2019-07-14", "2019-07-15", model = "FTFM")

# export 2 hours of NM (flown) trajectories
export_model_trajectory("2019-07-14 22:00", "2019-07-15")

# export 1 day of NM (flown) trajectories
export_model_trajectory("2019-07-14", "2019-07-15", lobt_buffer = c(before = 24, after = 1.25))

# export all CTFM trajectories within a bounding box 40 NM around EDDF
bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920)
export_model_trajectory("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb)

## End(Not run)

Export the flight list of movements at an airport

Description

Export the flight list of movements at an airport

Usage

export_movements(
  apt,
  wef,
  til,
  type = "both",
  lobt_buffer = c(before = 28, after = 24)
)

Arguments

apt

ICAO code of the airport, i.e. "EDDF"

wef

(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z"

til

(UTC) timestamp of LOBT TILl instant (excluded)

type

Type of movement; 'arr' for arrivals, 'dep' for departures 'both' for arrivals and departures. [default 'both']

lobt_buffer

The number of hours before and after LOBT to query [default before = 28, after = 24]. This is related to how LOBT is stored in the underlying database table.

Value

a data frame of flight movements

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_movements("EDDF", "2020-01-20", "2020-01-21")

## End(Not run)

Export FlightRadar24 position reports from flights flying around an airport

Description

Extract FlightRadar24 positions within a distance from the aerodrome for qualified airport movements (arrivals or departures or all)

Usage

export_positions_at_airport_fr24(
  wef,
  til,
  apt,
  lon_apt,
  lat_apt,
  flow = "ALL",
  radius = 40
)

Arguments

wef

(UTC) timestamp of With Effect From (included)

til

(UTC) timestamp of TILl instant (excluded)

apt

IATA airport code, i.e. PSA for Pisa "Galileo Galilei"

lon_apt

airport longitude (decimal degrees, WGS84)

lat_apt

airport latitude (decimal degrees, WGS84)

flow

the flow of flights: "ARR" for arrivals, "DEP" for departures, "ALL" for both [default "ALL"]

radius

radius around airport to keep position reports (nautical miles [NM])

Details

You need to store your credentials to access the FR24 tables in the following environment variables:

  • PRU_FR24_USR for the user id

  • PRU_FR24_PWD for the password

  • PRU_FR24_DBNAME for the database name

Value

dataframe of ADS-B position reports

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# half a day (UTC times, not local ones!) worth of all movements at Stavanger Airport,
# Sola, Sweden on 1st Sep 2017
export_positions_at_airport_fr24("2017-09-01T00:00:00",
                                 "2017-09-01T12:00:00",
                                 "SVG",
                                 5.638, 58.877)

# all arrivals within 50 NM on 25th Sep 2018 at Pisa Airport, Pisa, Italy
export_positions_at_airport_fr24("2018-09-25",
                                 "2018-09-26",
                                 "PSA", 10.39270, 43.68390,
                                 flow = "ARR",
                                 radius = 50)

## End(Not run)

Extract FR24 flights list for a time interval at an airport

Description

You need to store your credentials to access the FR24 tables in the following environment variables:

  • PRU_FR24_USR for the user id

  • PRU_FR24_PWD for the password

  • PRU_FR24_DBNAME for the database name

Usage

export_positions_fr24(wef, til)

Arguments

wef

(UT) timestamp of With Effect From (included)

til

(UT) timestamp of TILl instant (excluded)

Value

a dataframe of position reports

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
export_positions_fr24("2017-09-01T00:00:00Z", "2017-09-01T06:00:00Z")
export_positions_fr24("2017-09-01 10:05:00Z", "2017-09-01T11:33:00")

## End(Not run)

Extract level segment from a list of position reports.

Description

It is assumed that the dataset is grouped by flight id and that position reports are sorted by ascending timestamp.

Usage

extract_segment(prs, vert_limit = 5)

Arguments

prs

dataset containing position reports. Two variables are used: timestamp and altitude (feet)

vert_limit

the maximum absolute vertical rate for a segment to be considered level (default = 5 feet/s)

Value

a dataset of level segments. A level segment is defined by its beginning and end 4D position.

See Also

Other analysis: cumulative_distance(), cumulative_time(), filter_outlier(), resample(), smooth_positions()

Examples

## Not run: 
cumulative_time(poss)
f <- cprs %>%
 filter(callsign == "RYR40WJ") %>%
 arrange(timestamp_track) %>%
 rename(timestamp = timestamp_track) %>%
 mutate(altitude = flight_level * 100)
 extract_segment(f)

## End(Not run)

Identify and filter outliers

Description

The col values are processed through a median (i.e. low pass) filter to get .<col>_median, the squared differences between them .<col>_eps2, and its mean .<col>_sigma. A col value is considered an outlier if .<col>_eps2 is greater then .<col>_sigma.

Usage

filter_outlier(df, col, ksize, fill, keep = FALSE)

Arguments

df

a data frame of trajectory data

col

the variable to filter for outliers

ksize

the kernel size (must be odd)

fill

whether to substitute the outlier with the median

keep

whether to keep intermediate results

Details

This approach is inspired by (copied from ;-) the filter function in Xavier Olive's Python library traffic.

Value

a data frame with corrected outliers (if fill is TRUE). If keep is TRUE the intermediate columns .<col>_median, .<col>_eps2, .<col>_sigma and .<col>_outlier are included.

See Also

Other analysis: cumulative_distance(), cumulative_time(), extract_segment(), resample(), smooth_positions()

Examples

## Not run: 
library(readr)
library(dplyr)
library(anytime)
library(trrrj)
library(ggplot2)

ifile <- system.file("extdata", "belevingsvlucht.csv", package = "trrrj")
df <- readr::read_csv(ifile) %>%
  mutate(timestamp = anytime::anytime(time, tz = "UTC"))
df1 <- df %>%
  filter_outlier(col = baroaltitude, ksize = 17, fill = TRUE, keep = FALSE)
ggplot() +
  geom_line(data = df,  mapping = aes(x = timestamp, y = baroaltitude), colour = "blue") +
  geom_line(data = df1, mapping = aes(x = timestamp, y = baroaltitude), colour = "red")

## End(Not run)

Retain only positions within a range from a location.

Description

The points whose distance, .distance, satisfies

dm<=.distance<dMdm <= .distance < dM

are kept (.exclude = FALSE) or excluded (.exclude = TRUE)

Usage

filter_positions_at_range(
  df,
  geo,
  dm,
  dM,
  lon,
  lat,
  .exclude = FALSE,
  .keep = FALSE
)

Arguments

df

a (trajectory) data frame

geo

a geographical location in lon/lat (WGS84)

dm

a distance in Nautical Miles

dM

a distance in Nautical Miles

lon

the column for longitude in df

lat

the column for latitude in df

.exclude

exclude the point in the (dm, dM) [default is FALSE]

.keep

keep the calculated distance (in Nautical Miles) in the .distance column [default is FALSE]

Value

a subset of df

See Also

Other spatial: bbox_at_distance(), bounding_box(), crs_tc(), polygon_at_distance(), polygon_from_coords()

Examples

## Not run: 
fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude)

# keep the points 40 NM from FRA
poss %>% filter_positions_at_range(fra, 0, 40, longitude, latitude)
# keep the points from 10 to 40 NM from FRA
poss %>% filter_positions_at_range(fra, 10, 40, longitude, latitude)
# exclude the points from 10 to 40 NM from FRA
poss %>% filter_positions_at_range(fra, 10, 40, longitude, latitude, .exclude = TRUE)
# keep the points further away of 40 NM from FRA
poss %>% filter_positions_at_range(fra, 0, 40, longitude, latitude, .exclude = TRUE)

## End(Not run)

Sample FlightRadar24's archived feed ADS-B flight data.

Description

A dataset containing FlightRadar24's archived feed ADS-B flight information for 41 flights, 2 gliders (equip == "GLID") and one ground vehicle (equip == "GROUND"). There are 20 flights on 5th and 21 on 6th Feb 2017.

Usage

flts

Format

A data frame with 43 rows and 11 variables:

flight_id

unique identifier for the flight leg (integer)

aircraft_id

mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder

reg

unique aircraft identifier (text)

equip

aircraft type (e.g. B733, as per ICAO classification?), GLID for gliders, GROUND for ground vehicles

callsign

e.g. CSA190, as supplied by the Mode-S or ADS-B transponder

flight

flight number, e.g. OK190

schd_from

IATA code for scheduled departure airport

schd_to

IATA code for scheduled arrival airport

real_to

IATA code for actual arrival airport (when diverted)

date

date of the flight (what about the ones crssing midnight?)

Source

FlightRadar24


Export trajectory profiles to SO6 format

Description

The data frame for point trajectories needs to have the following columns:

Name Description Type
flight_id Flight ID int
time_over Time over point datetime
longitude Longitude (decimal degrees) double
latitude Latitude (decimal degrees) double
flight_level Flight level int
point_id Point ID or NO_POINT char
air_route Air route or NO_ROUTE char
lobt Last Off-block Time datetime
seq_id Positions's sequence number int
callsign Flight call sign char
registration Aircraft registration char
model Aircraft model char
aircraft_type Aircraft ICAO type char
aircraft_operator Aircraft operator char
adep Departing aerodrome (ICAO) ID char
ades Destination aerodrome (ICAO) ID char

Usage

generate_so6(trajectory)

Arguments

trajectory

A data frame for point trajectories.

Value

A data frame for trajectories in SO6 format, see read_so6 for a description of the SO6 format.

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
generate_so6(trj)

## End(Not run)

Parse PRISME Airspace format

Description

[Experimental]

parse_airspace_prisme reads the airspace PRISME format and returns a tibble where each row describes an airspace.

Each airspace in PRISME format is described by:

  1. Airspace description (one row):

    • an airspace Unit code

    • a Elementary Sector code

    • minimum flight level

    • maximum flight level

    • the number of vertices of the polygon of the Elementary Sector

    • the coordinates of vertices

  2. vertex coordinates (as many rows as the number of vertices)

Usage

parse_airspace_prisme(lines)

Arguments

lines

text lines of the PRISME airspace representation

Value

a tibble of airspaces (CRS = 4326)

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), read_cpr(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
es <- system.file("extdata", "airspace_prisme_462.prisme", package = "trrrj")
sectors <- readr::read_lines(es) %>%
  parse_airspace_prisme()

## End(Not run)

Parse latitude in ICAO format

Description

The format is as described in ICAO Doc 8126 section 5.5.2 bullet d):

  In the indication of the geographical coordinates of
  a location:
  - the latitude should be given first;
  - symbols for degrees, minutes or seconds should
    be omitted;
  - two digits should always be used in expressing
    values of less than 10 degrees of latitude; and
  - three digits should always be used in expressing
    values of less than 100 degrees of longitude.
  For example, 050735N 0652542W means five
  degrees, seven minutes and thirty-five seconds
  North, sixty-five degrees, twenty-five minutes and
  forty-two seconds West.

What is typical in AIP pubblications is the additional part of decimal seconds, like 554718.23N.

Usage

parse_lat_icao(lat)

Arguments

lat

a string representation for latitude, i.e. 554718N or 554718.23N

Details

This format is used in AIP pubblications, for examples for runway threshold coordinates, stand positions, etc. This is used also in ALL_FT+ files from NM.

Value

a latitude in decimal degrees

See Also

Other coordinates: ddm2dd(), dms2dd(), parse_lon_icao()

Examples

parse_lat_icao("554718N")

Parse longitude in ICAO format

Description

The format is as described in ICAO Doc 8126 section 5.5.2 bullet d):

  In the indication of the geographical coordinates of
  a location:
  - the latitude should be given first;
  - symbols for degrees, minutes or seconds should
    be omitted;
  - two digits should always be used in expressing
    values of less than 10 degrees of latitude; and
  - three digits should always be used in expressing
    values of less than 100 degrees of longitude.
  For example, 050735N 0652542W means five
  degrees, seven minutes and thirty-five seconds
  North, sixty-five degrees, twenty-five minutes and
  forty-two seconds West.

What is typical in AIP pubblications is the additional part of decimal seconds, like 554718.23N.

Usage

parse_lon_icao(lon)

Arguments

lon

a string representation for longitude, i.e. 0114901W or 0114901.23W

Details

This format is used in AIP pubblications, for examples for runway threshold coordinates, stand positions, etc. This is used also in ALL_FT+ files from NM.

Value

decimal degress value

See Also

Other coordinates: ddm2dd(), dms2dd(), parse_lat_icao()

Examples

parse_lon_icao("0114901W")

Plot CPR trajectories on a map

Description

Plot CPR trajectories on a map

Usage

plot_cpr_horizontal(poss, bbox = NULL, ...)

Arguments

poss

a dataframe of correlated position reports (CPRs) with (at least) callsign, timestamp_track (a date-time), flight_level (in flight levels), longitude (in decimal degrees) and latitude (in decimal degrees) columns

bbox

a bounding box in the format c(lowerleftlon, lowerleftlat, upperrightlon, upperrightlat).

...

Extra parameters to pass further on.

Value

a ggplot2 plot

See Also

Other plot: plot_flight_horizontal(), plot_flight_vertical_distance(), plot_flight_vertical_time()

Examples

## Not run: 
# plot CPR tryjectories
europe <- c(left = 5, bottom = 35, right = 30, top = 52)
plot_cpr_horizontal(cprs, europe)

## End(Not run)

Plot the recorded positions of a flight on a map.

Description

Plot the recorded positions of a flight on a map.

Usage

plot_flight_horizontal(
  poss,
  bbox = NULL,
  buffer = 100,
  legend.position = "none",
  shape = NULL,
  ...
)

Arguments

poss

a dataframe of position reports with (at least) callsign, timestamp (a date-time), altitude (in feet), longitude (in decimal degrees) and latitude (in decimal degrees) columns

bbox

a bounding box in the format c(lowerleftlon, lowerleftlat, upperrightlon, upperrightlat).

buffer

number of nautical miles (NM) around the bounding box (default 40)

legend.position

legend position as per ggplot2 (default "none", i.e. do not show it).

shape

shape of point to plot (default NULL, i.e. do not plot positions, only paths). See shape in geom_point.

...

Extra parameters to pass further on.

Value

a ggplot2 plot object.

See Also

Other plot: plot_cpr_horizontal(), plot_flight_vertical_distance(), plot_flight_vertical_time()

Examples

## Not run: 
library(dplyr)

# define the bounding box of interest
europe <- c(left = 5, bottom = 35, right = 30, top = 52)
plot_flight_horizontal(poss, europe)
plot_flight_horizontal(poss, buffer = 10) # 10km around the values

# from DB to plot
p <- export_flights_at_airport_fr24("2017-09-01T00:00:00Z",
                                    "2017-09-02T00:00:00Z",
                                    "SVG",
                                    5.638, 58.877) %>%
  # NOTE: convert till DB columns are properly changed
  mutate(longitude = as.numeric(LON), latitude = as.numeric(LAT)) %>%
  select(FLIGHT_ID, EVENT_TIME, longitude, latitude)

f <- export_flights_at_airport_fr24("2017-09-01T00:00:00Z",
                                    "2017-09-02T00:00:00Z",
                                    "SVG",
                                    flow = "ARR") %>%
  rename(callsign = CALLSIGN) %>%
  select(FLIGHT_ID, callsign)

p1 <- p %>% left_join(f) %>% filter(!is.na(callsign))
plot_flight_horizontal(p1)

## End(Not run)

Plot the vertical profile of the recorded positions of a flight from lapsed distance perspective.

Description

Plot the vertical profile of the recorded positions of a flight from lapsed distance perspective.

Usage

plot_flight_vertical_distance(poss)

Arguments

poss

a dataframe of position reports with (at least) timestamp (a date-time), altitude (in feet), longitude (in decimal degrees) and latitude (in decimal degrees) and callsign columns

Value

a ggplot2 plot object.

See Also

Other plot: plot_cpr_horizontal(), plot_flight_horizontal(), plot_flight_vertical_time()

Examples

## Not run: 
plot_flight_vertical_distance(poss)

## End(Not run)

Plot the vertical profile of the recorded positions of a flight from lapsed time perspective.

Description

Plot the vertical profile of the recorded positions of a flight from lapsed time perspective.

Usage

plot_flight_vertical_time(poss)

Arguments

poss

a dataframe of position reports with (at least) timestamp (a date-time) and altitude (in feet) columns

Value

a ggplot2 plot object.

See Also

Other plot: plot_cpr_horizontal(), plot_flight_horizontal(), plot_flight_vertical_distance()

Examples

## Not run: 
plot_flight_vertical_time(poss)

## End(Not run)

Generate the polygon at distance d from a geographical location

Description

[Experimental]

polygon_at_distance returns a polygon approximating a circonference at distance d, in Nautical Miles, from the location geo. You can control how many points per quadrant will be used via the nQuadSegs parameter (the default of 30 from st_buffer should suffice for most of the needs.)

WARNING: this is not tested to work across the date line or for polygons containing the poles or for polygons spanning more than half an emisphere.

Usage

polygon_at_distance(geo, d, ...)

Arguments

geo

a geographical location in lon/lat (WGS84)

d

a distance in Nautical Miles

...

other parameters, for example nQuadSegs; see also st_buffer

Value

a polygon.

See Also

Other spatial: bbox_at_distance(), bounding_box(), crs_tc(), filter_positions_at_range(), polygon_from_coords()

Examples

## Not run: 
fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude)
polygon_at_distance(fra, 40)

## End(Not run)

Return a polygon from (WGS84) coordinates

Description

Return a polygon from (WGS84) coordinates

Usage

polygon_from_coords(coords, dfMaxLength = units::set_units(1, "km"))

Arguments

coords

coordinates defining a polygon

dfMaxLength

maximum length of a line segment. If x has geographical coordinates (long/lat), dfMaxLength is either a numeric expressed in meter, or an object of class units with length units rad or degree; segmentation in the long/lat case takes place along the great circle, using st_geod_segmentize.

Value

an sf polygon

See Also

Other spatial: bbox_at_distance(), bounding_box(), crs_tc(), filter_positions_at_range(), polygon_at_distance()

Examples

## Not run: 
coords <- list(rbind(c(0, 0), c(1, 0), c(1, 1), c(0.5, 1.5), c(0, 1), c(0, 0)))
polygon_from_coords(coords)

## End(Not run)

Sample FlightRadar24's archived feed ADS-B position reports data.

Description

A dataset containing FlightRadar24's archived ADS-B position reports (combined with flight information of flts) for 41 flights. There are 20 flights on 5th and 21 on 6th Feb 2017.

Usage

poss

Format

A data frame with 9290 rows and 19 variables. The variables are a joint of flight information from flts with the following ones:

flight_id

unique identifier for the flight leg (integer)

timestamp

datetime for the position report (convertion of snapshot_id)

snapshot_id

time of sample as number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970

altitude

altitude in feet (integer), as supplied by the Mode-S or ADS-B transponder

heading

degrees from North, 0-359, (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

latitude

latitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

longitude

longitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

radar_id

unique identifier of primary ground receiver

speed

ground speed in knots (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)

squawk

code broadcast by airplane represented as four octal digits, data supplied directly from the mode-S or ADS-B transponder

aircraft_id

mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder

reg

unique aircraft identifier (text)

equip

aircraft type (e.g. B733, as per ICAO classification?), GLID for gliders, GROUND for ground vehicles

callsign

e.g. CSA190, as supplied by the Mode-S or ADS-B transponder

flight

flight number, e.g. OK190

schd_from

IATA code for scheduled departure airport

schd_to

IATA code for scheduled arrival airport

real_to

IATA code for actual arrival airport (when diverted)

date

date of the flight (what about the ones crossing midnight?)

Source

FlightRadar24


Read Network Manager's archived CPR file

Description

The payload of an archived CPR file contains the following fields:

Name Description Type
cpm_id CPR Message ID int
tact_id ETFMS flight ID int
timestamp_etfms ETFMS reception timestamp char (YY/MM/DD hh:mm:ss)
timestamp_track track timestamp char (YY/MM/DD hh:mm:ss)
block Block number int
record Record number (index within a block) int
entry_node_sac Entry Node system area code int
entry_node_sic Entry Node system identifier code int
callsign Callsign of flight char
adep_icao ICAO code of Departure aerodrome char
ades_icao ICAO code of Destination aerodrome char
eobt Estimated Off-block Time char (YY/MM/DD hh:mm:ss)
longitude Longitude (WGS84) decimal degrees
latitude Latitude (WGS84) decimal degrees
flight_level Flight level integer
track_service Track service char (Begin, Continuing, End or Begin_And_End)
ssr_code SSR code oct
track_speed Track velocity (in Knots) int
track_heading Track heading char
climb_rate Climb or descend rate int
track_vertical_mode vertical attitude char (Climb, Descend, Level_Flight or Undetermined)
ifps_id IFPS flight plan id char
aircraft_address ICAO 24-bit address char

Usage

read_cpr(file, delim = ";")

Arguments

file

A (gzipped) file containing archived CPR's as received received and processed by the Network Manager. Filenames are something like 1.201702061001tacop304ARCHIVED_OPLOG_ALL_CPR.gz

delim

the character delimiting the fields [default = ";"]

Value

A dataframe of correlated position reports (CPR's)

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_flights_fr24(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# read CPR's of the 20 sample flights for 5th Feb 2017
cprs_file <- system.file("extdata",
                        "1.201702051001tacop304ARCHIVED_OPLOG_ALL_CPR.gz",
                        package = "trrrj")
cprs05 <- read_cpr(cprs_file)

## End(Not run)

Read FR24's archived flights information for a day.

Description

read_flights_fr24 returns all flights as archived by FR24 for a given day (see path parameter for how the date is encoded).

Usage

read_flights_fr24(path)

Arguments

path

the filename of the <yyyymmdd>_flights<eventually>.csv file. The <yyyymmdd> part of the path's basename is extracted into the date field.

Details

The flights listed are the ones known to FR24 and fitting the the bounding box as contractually agreed.

Value

a data frame of the archived flights that have flown on <yyyymmdd>. Each flight has the following attributes (all optional, i.e. eventually empty, but flight_id):

  • date date of the flight

  • flight_id unique decimal identifier for the flight leg

  • aircraft_id mode-S address in hexadecimal

  • reg unique aircraft text identifier

  • equip equipment, e.g. B733

  • callsign callsign, e.g. NAX11S

  • flight flight number, e.g. DY311

  • schd_from IATA code for scheduled departure airport, e.g. KKN

  • schd_to IATA code for scheduled arrival airport

  • real_to IATA code for actual arrival airport (when diverted)

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_positions_fr24(), read_so6()

Examples

## Not run: 
# flights, as recorded by FR24, on 20170205 (5th Feb 2017)
flt_fr24_file <- system.file("extdata",
                         "20170205_flights.csv",
                         package = "trrrj")
read_flights_fr24(flt_fr24_file)

## End(Not run)

Read FR24's archived positions information for a flight.

Description

read_positions_fr24 returns all position reports as archived by FR24 for a given flight_id flown on a specific day (see path parameter for how the date and flight ID are encoded).

Usage

read_positions_fr24(path)

Arguments

path

the filename of the <yyyymmdd>_<flight_id>_positions.csv file

Details

The positions listed are the ones known to FR24 and fitting the the bounding box as contractually agreed.

Value

a data frame of the archived flight's positions for date <yyyymmdd>. Each position report has the following attributes (all mandatory, i.e. non empty, but speed, squawk and vert_speed):

  • flight_id FR24 unique (within a day?) flight leg identifier

  • timestamp snapshot_id converted to a date/time

  • snapshot_id time of sample in Unix epoch seconds, i.e. since 1st Jan 1970 00:00:00 UTC

  • altitude altitude (feet). Barometric relative to ISO 1013 hPa pressure in flight, always 0 on ground.

  • heading 0-359 degrees

  • latitude latitude in decimal degrees

  • longitude longitude in decimal degrees

  • radar_id unique identifier of primary ground receiver

  • speed ground speed (knots)

  • squawk code broadcast by airplane, represented as four octal digits

  • vert_speed vertical speed (feet/min). Calculated from rate of altitude changes, 0 for level flight or empty if unavailable

  • on_ground 1 for on ground, 0 for airborne. Calculated from low altitude and ground speed

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_so6()

Examples

## Not run: 
# positions, as recorded by FR24, for flight 207535493 on 20170205 (5th Feb 2017)
pos_fr24_file <- system.file("extdata",
                             "20170205_positions",
                             "20170205_207535493.csv",
                             package = "trrrj")
read_positions_fr24(pos_fr24_file)

## End(Not run)

Read SO6 file

Description

The SO6 file has variables of two types:

  • Segment-specific data (latitude/longitude, time/data information, ...)

  • Flight meta data (flight id, callsign, aircraft type, ...)

They are marked S or F respectively in the table below.

Name Description Type Kind
segment_id segment Id char S
adep Departing aerodrome (ICAO) ID char F
ades Destination aerodrome (ICAO) ID char S
aircraft_type ICAO aircraft type char S
segment_hhmm_begin Segment's begin timestamp (hhmmss) char S
segment_hhmm_end Segment's end timestamp (hhmmss) char S
segment_fl_begin Segment's begin flight level int S
segment_fl_end Segment's end flight level int S
status Segment's status (0=climb, 1=descent, 2=cruise) factor S
callsign Flight call sign char F
segment_date_begin Segment's begin date (YYMMDD) char S
segment_date_end Segment's end date (YYMMDD) char S
segment_latitude_begin Segment's begin latitude (Min decimal) char S
segment_longitude_begin Segment's begin longitude (Min decimal) char S
segment_latitude_end Segment's end latitude (Min decimal) char S
segment_longitude_end Segment's end longitude (Min decimal) char S
flight_id Flight ID int F
sequence Segment's sequence int S
segment_length Segment's length double S
segment_parity Segment's parity int S
segment_timestamp_begin Segment's begin timestamp datetime S
segment_timestamp_end Segment's end timestamp datetime S
point_id_begin Segment's begin point ID char S
point_id_end Segment's end point ID char S

Usage

read_so6(filename, delim = " ")

Arguments

filename

the file containing SO6 trajectories

delim

the field delimiter (default: " " [blank])

Value

a data frame where date and time are combined in a single datetime and longitude and latitude are in decimal degrees.

See Also

Other read/export: export_allft_so6(), export_apds(), export_event_so6(), export_event_trajectory(), export_flight_info(), export_flights_at_airport_fr24(), export_flights_fr24(), export_hourly_adsb(), export_model_trajectory(), export_movements(), export_positions_at_airport_fr24(), export_positions_fr24(), generate_so6(), parse_airspace_prisme(), read_cpr(), read_flights_fr24(), read_positions_fr24()

Examples

## Not run: 
so6file <- system.file("extdata",
                       "TRAFFIC_20180630_reduced.so6",
                       package = "trrrj")
read_so6(so6file)

## End(Not run)

resample a bunch of flight trajectories

Description

Each flight trajectory 4D positions are linearly interpolated at interval seconds. First and last positions are retained.

Usage

resample(df, interval = 1L)

Arguments

df

a data frame of flight trajectories, each identified by its own flight_id

interval

the amount of seconds to resample to

Value

a data frame of interpolated 4D positions at interval seconds

See Also

Other analysis: cumulative_distance(), cumulative_time(), extract_segment(), filter_outlier(), smooth_positions()

Examples

## Not run: 
poss |>
  resample(300L)

## End(Not run)

Smooth longitude, latitude and altitude.

Description

Smooth longitude, latitude and altitude.

Usage

smooth_positions(df, n = 5, type = "t")

Arguments

df

a data frame of trajectory positions

n

from pracma::movavg

type

from pracma::movavg

Value

return a smoothed trajectory

See Also

Other analysis: cumulative_distance(), cumulative_time(), extract_segment(), filter_outlier(), resample()

Examples

data(list = c("egll_positions_fr24"), package = "trrrj")
smooth_positions(egll_positions_fr24)

Get path to trrrj examples

Description

trrrj comes bundled with a number of sample files in its inst/extdata directory. This function make them easy to access

Usage

trrrj_example(path = NULL)

Arguments

path

Name of file. If NULL, the example files will be listed.

Examples

trrrj_example()
trrrj_example("20170205_flights.csv")