---
source_url: https://floodlight.readthedocs.io/en/latest/modules/io/tracab.html
source_type: crawled
upstream_version:
crawled_at: 2026-08-11T09:08:54.625Z
---
`floodlight.io.tracab.``read_position_data_dat`(_`filepath_dat`_, _`filepath_metadata`_, _`teamsheet_home``=``None`_, _`teamsheet_away``=``None`_)[`[source]`](https://floodlight.readthedocs.io/en/latest/_modules/floodlight/io/tracab.html#read_position_data_dat) `floodlight.io.tracab.read_position_data_dat`

Parse TRACAB .dat-files (ASCII) and metadata (xml or json) and extract position data, possession and ballstatus codes, teamsheets as well as pitch information.

ChyronHego’s TRACAB system delivers two separate files, a .dat file containing the actual data as well as a metadata.xml containing information about pitch size, framerate and start- and endframes of match periods. This function provides a high-level access to TRACAB data by parsing “the full match” given both files.

**Parameters:**

-   **filepath_dat** (_str or pathlib.Path_) – Full path to dat-file.
    
-   **filepath_metadata** (_str or pathlib.Path_) – Full path to metadata.xml file.
    
-   **teamsheet_home** (_Teamsheet, optional_) – Teamsheet object for the home team used to create link dictionaries of the form links\[team\]\[jID\] = xID. The links are used to map players to a specific xID in the respective XY objects. Should be supplied for custom ordering. If given as None (default), teamsheet is extracted from the .dat or .json file (see Notes) and xIDs are assigned to the player’s jersey numbers ascendingly (dat case) or in order of appearance (json case).
    
-   **teamsheet_away** (_Teamsheet, optional_) – Teamsheet object for the away team. If given as None (default), teamsheet is extracted from the .dat or .json file. See teamsheet_home for details.

**Returns:**

**data_objects** – Tuple of (nested) floodlight core objects with shape (xy_objects, possession_objects, ballstatus_objects, teamsheets, pitch).

`` `xy_objects` `` is a nested dictionary containing `` `XY` `` objects for each team and segment of the form `` `xy_objects[segment][team]` `=` `XY` ``. For a typical league match with two halves and teams this dictionary looks like: `` `{'HT1':` `{'Home':` `XY,` `'Away':` `XY},` `'HT2':` `{'Home':` `XY,` `'Away':` `XY}}` ``.

`` `possession_objects` `` is a dictionary containing `` `Code` `` objects with possession information (home or away) for each segment of the form `` `possession_objects[segment]` `=` `Code` ``.

`` `ballstatus_objects` `` is a dictionary containing `` `Code` `` objects with ballstatus information (dead or alive) for each segment of the form `` `ballstatus_objects[segment]` `=` `Code` ``.

`` `teamsheets` `` is a dictionary containing `` `Teamsheet` `` objects for each team of the form `` `teamsheets[team]` `=` `Teamsheet` ``.

`` `pitch` `` is a `` `Pitch` `` object corresponding to the data.

**Return type:**

Tuple\[Dict\[str, Dict\[str, [XY](https://floodlight.readthedocs.io/en/latest/modules/core/xy.html#floodlight.core.xy.XY "floodlight.core.xy.XY")\]\], Dict\[str, [Code](https://floodlight.readthedocs.io/en/latest/modules/core/code.html#floodlight.core.code.Code "floodlight.core.code.Code")\], Dict\[str, [Code](https://floodlight.readthedocs.io/en/latest/modules/core/code.html#floodlight.core.code.Code "floodlight.core.code.Code")\], Dict\[str, [Teamsheet](https://floodlight.readthedocs.io/en/latest/modules/core/teamsheet.html#floodlight.core.teamsheet.Teamsheet "floodlight.core.teamsheet.Teamsheet")\], [Pitch](https://floodlight.readthedocs.io/en/latest/modules/core/pitch.html#floodlight.core.pitch.Pitch "floodlight.core.pitch.Pitch")\]

Notes

Tracab provides metadata in two file types: xml and json. The json metadata files typically include player information whereas the xml files do not. The dat file storing tracking data (e.g. from an ASCII stream) contain only player jersey numbers, but no additional player information.

This function will check whether the provided `` `filepath_metadata` `` points to a xml or json file. If it’s a json, teamsheets are generated from this source. If it’s a xml, teamsheets are generated from the dat file and players are named ‘Player i’ with i starting at 1. To identify players in this case, use the jersey numbers or provide custom teamsheets generated by a different parser if additional data is available.

`floodlight.io.tracab.``read_teamsheets_from_dat`(_`filepath_dat`_)[`[source]`](https://floodlight.readthedocs.io/en/latest/_modules/floodlight/io/tracab.html#read_teamsheets_from_dat) `floodlight.io.tracab.read_teamsheets_from_dat`

Parses the entire TRACAB .dat file for unique jIDs (jerseynumbers) and creates respective teamsheets for the home and the away team.

**Parameters:**

**filepath_dat** (_str or pathlib.Path_) – Full path to .dat file.

**Returns:**

**teamsheets** – Dictionary with teamsheets for the home team and the away team.

**Return type:**

Dict\[str, [Teamsheet](https://floodlight.readthedocs.io/en/latest/modules/core/teamsheet.html#floodlight.core.teamsheet.Teamsheet "floodlight.core.teamsheet.Teamsheet")\]

`floodlight.io.tracab.``read_teamsheets_from_meta_json`(_`filepath_metadata`_)[`[source]`](https://floodlight.readthedocs.io/en/latest/_modules/floodlight/io/tracab.html#read_teamsheets_from_meta_json) `floodlight.io.tracab.read_teamsheets_from_meta_json`

Reads TRACAB’s metadata file (json format) and creates respective teamsheets for the home and the away team.

**Parameters:**

**filepath_metadata** (_str or pathlib.Path_) – Full path to _metadata.json file.

**Returns:**

**teamsheets** – Dictionary with teamsheets for the home team and the away team.

**Return type:**

Dict\[str, [Teamsheet](https://floodlight.readthedocs.io/en/latest/modules/core/teamsheet.html#floodlight.core.teamsheet.Teamsheet "floodlight.core.teamsheet.Teamsheet")\]