Code Reference

wxrx.read_wxrx

wxrx.read_wxrx.load_tmp_file(filename: str) bytes

Load a raw ARINC 708 file.

Parameters:

filename (str) – The filename of the raw ARINC 708 file

Returns:

The raw ARINC 708 data

Return type:

bytes

wxrx.read_wxrx.parse_message(data: bytes) Arinc708Message

Parse a single ARINC 708 message. See the ARINC 708 specification for details.

Parameters:

data (bytes) – The data to parse

Returns:

The parsed message

Return type:

Arinc708Message

wxrx.read_wxrx.process(tempfiles: list[str], logfile: str, corefile: str, with_progress: bool = True) None

Process a list of raw ARINC 708 files and write the output to a NetCDF file.

Parameters:
  • tempfiles (list[str]) – A list of raw ARINC 708 files

  • logfile (str) – The filename of the log file

  • corefile (str) – The filename of the core file

  • with_progress (bool) – Whether to show a progress bar. Defaults to True.

wxrx.read_wxrx.process_tmp_file(data: bytes, tempfile: str, t: Timer, nc: NetCDFWriter, pbar: tqdm | None = None)

Process a single raw ARINC 708 file and write the output to a NetCDF file.

Parameters:
  • data (bytes) – The raw ARINC 708 data

  • tempfile (str) – The filename of the raw ARINC 708 file

  • t (Timer) – The timer object, used to convert the index of the message to a timestamp

  • nc (NetCDFWriter) – The NetCDF writer object

  • pbar (tqdm|None) – The progress bar object

wxrx.read_wxrx.scan_tmp_data(data: bytes) Generator[tuple[int, Arinc708Message], None, None]

Scan a raw ARINC 708 file and yield each message.

Parameters:

data (bytes) – The raw ARINC 708 data

Yields:

tuple[int, Arinc708Message] – The index of the message and the message

wxrx.converters

wxrx.converters.gain_from_int(i: int) int

Returns the gain. A value of 0 indicates maximum gain. A value of 1 indicates calibration.

May raise a KeyError if the gain is not in the lookup table.

Parameters:

i (int) – The encoded gain value.

Returns:

The gain, or an indicator of calibration.

Return type:

int

wxrx.converters.range_from_int(i: int) int

Returns the range in nautical miles. A value of 0 indicates maximum range, 320 nautical miles.

May raise a KeyError if the range is not in the lookup table.

Parameters:

i (int) – The encoded range value.

Returns:

The range in nautical miles.

Return type:

int

wxrx.converters.scan_angle_from_int(i: int) float

Returns the scan angle from the integer representation.

Parameters:

i (int) – The integer representation of the scan angle.

Returns:

The scan angle in degrees.

Return type:

float

wxrx.converters.tilt_from_int(i: int) float

Returns the tilt angle in degrees.

Parameters:

i (int) – The encoded tilt value.

Returns:

The tilt angle in degrees.

Return type:

float

wxrx.netcdf

wxrx.netcdf.GLOBAL_OVERWRITES(writer: NetCDFWriter) dict[str, Any]

Get the global attributes for the netCDF file which are not defined in the product definition or in the core file.

class wxrx.netcdf.NetCDFWriter(corefile: str)

Bases: object

A class to write a netCDF file from the ARINC708 databus weather radar data.

__init__(corefile: str) None

Create a new NetCDFWriter object.

Parameters:

corefile (str) – Path to the core file to use for the metadata

init_file() None

Initialise the netCDF file, creating the dimensions and variables from the product definition.

write_message(time: float, message: Arinc708Message) None

Write a single ARINC708 message to the netCDF file.

Parameters:
  • time (float) – Time of the message, in seconds since the epoch

  • message (Arinc708Message) – The ARINC708 message to write

wxrx.netcdf.get_duration(start_time: datetime, end_time: datetime) str

Get the duration of the flight in ISO8601 format

Parameters:
  • start_time (datetime.datetime) – Start time of the flight

  • end_time (datetime.datetime) – End time of the flight

Returns:

Duration of the flight in ISO8601 format

Return type:

str

wxrx.timer

class wxrx.timer.Timer(logfile: str, tmpfile: str = '')

Bases: object

Provides a timer for a given logfile and tmpfile. This allows the time at which a given size was reached to be calculated. This is used to add a timestamp to the ARINC708 data, which is not timestamped.

__init__(logfile: str, tmpfile: str = '') None

Create a new Timer object.

Parameters:
  • logfile (str) – Path to the logfile to use for the timer

  • tmpfile (str) – The tmpfile to use for the timer.

property date: date

Returns the date of the first entry in the logfile.

Returns:

The date of the first entry in the logfile

Return type:

datetime.date

classmethod get_tempfiles(logfile: str) list[str]

Returns a list of tempfiles in the given logfile.

Parameters:

logfile (str) – The logfile to check

Returns:

A list of tempfiles in the given logfile

Return type:

list[str]

includes(tempfile: str) bool

Indicates whether the timer includes a reference to the given tempfile.

Parameters:

tempfile (str) – The tempfile to check for

Returns:

True if the timer includes the tempfile, False otherwise

Return type:

bool

time_at_size(size: int, tmpfile: str = '') Timestamp

Returns the time at which the given size was reached.

Parameters:
  • size (int) – The size to check for

  • tmpfile (str) – The tempfile to check for

Returns:

The nearest time to which the given size was reached.

Return type:

pd.Timestamp