Note

Interactive online version: Binder badge

DLR Urban Traffic Dataset (DLR UT)#

This example should give a short overview on how to load the DLR Urban Traffic Dataset which is hosted on Zenodo.

Download dataset#

At first, we need to download the dataset. For that purpose, helper classes are available in tasi that we will utilize in the following. In particular, since we want to download the DLR UT dataset, we use the. The class contains a tasi.dlr.dataset.DLRUTVersion enumerator that may be used to specify the version of the dataset to download or to get the latest version.

[1]:
import os
from tasi.dlr.dataset import DLRUTDatasetManager, DLRUTVersion

dataset = DLRUTDatasetManager(DLRUTVersion.latest)
path = dataset.load()
path
[2025-04-25 12:46:40 | dataset.py:load:112] > INFO:  Checking if dataset already downloaded /tmp/DLR-Urban-Traffic-dataset_v1-2-0
[2025-04-25 12:46:40 | dataset.py:load:138] > INFO:  Dataset already available at /tmp/DLR-Urban-Traffic-dataset_v1-2-0
[1]:
PosixPath('/tmp/DLR-Urban-Traffic-dataset_v1-2-0')

The dataset is now available in the /tmp directory. Let’s have a look into the dataset and list the available traffic information

[2]:
folders = os.listdir(path)
folders
[2]:
['meta_data', 'raw_data']

Load trajectory data#

We can now utilize the tasi.dlr.dataset.DLRTrajectoryDataset class to load the trajectory data from the directory. For demonstration purpose, let’s load the first batch of the dataset.

[3]:
from tasi.dlr import DLRTrajectoryDataset

ds = DLRTrajectoryDataset.from_csv(dataset.trajectory()[0])
ds
[3]:
center velocity acceleration yaw dimension classifications interpolated
easting northing easting northing magnitude easting northing magnitude length width height pedestrian bicycle motorbike car van truck
timestamp id
2023-09-24 00:00:00.016482+00:00 1695513598769889 604825.208 5792819.993 -12.789 -4.311 13.496 0.047 0.080 0.093 -161.405 4.294 1.811 1.562 0.0 0.0 0.205 0.645 0.096 0.054 False
2023-09-24 00:00:00.066482+00:00 1695513598769889 604824.540 5792819.770 -12.788 -4.308 13.494 0.052 0.081 0.097 -161.411 4.294 1.811 1.562 0.0 0.0 0.205 0.645 0.096 0.054 False
2023-09-24 00:00:00.116482+00:00 1695513598769889 604823.871 5792819.547 -12.787 -4.305 13.493 0.058 0.083 0.101 -161.418 4.294 1.811 1.562 0.0 0.0 0.205 0.645 0.096 0.054 False
2023-09-24 00:00:00.166482+00:00 1695513598769889 604823.202 5792819.325 -12.786 -4.302 13.490 0.063 0.084 0.105 -161.426 4.294 1.811 1.562 0.0 0.0 0.205 0.645 0.096 0.054 False
2023-09-24 00:00:00.216482+00:00 1695513598769889 604822.533 5792819.103 -12.785 -4.298 13.488 0.069 0.085 0.109 -161.435 4.294 1.811 1.562 0.0 0.0 0.205 0.645 0.096 0.054 False
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2023-09-24 00:14:59.766482+00:00 1695514432518548 604743.005 5792776.259 -0.021 -0.006 0.022 -0.006 -0.012 0.013 8.619 1.058 0.675 1.656 0.0 0.0 0.865 0.135 0.000 0.000 False
2023-09-24 00:14:59.816482+00:00 1695514432518548 604743.003 5792776.260 -0.022 -0.008 0.023 -0.005 -0.011 0.012 8.619 1.058 0.675 1.656 0.0 0.0 0.865 0.135 0.000 0.000 False
2023-09-24 00:14:59.866482+00:00 1695514432518548 604743.001 5792776.261 -0.022 -0.011 0.025 -0.004 -0.010 0.011 8.619 1.058 0.675 1.656 0.0 0.0 0.865 0.135 0.000 0.000 False
2023-09-24 00:14:59.916482+00:00 1695514432518548 604742.999 5792776.262 -0.023 -0.013 0.027 -0.004 -0.009 0.009 8.619 1.058 0.675 1.656 0.0 0.0 0.865 0.135 0.000 0.000 False
2023-09-24 00:14:59.966482+00:00 1695514432518548 604742.996 5792776.258 -0.024 -0.015 0.028 -0.003 -0.007 0.008 8.619 1.058 0.675 1.656 0.0 0.0 0.865 0.135 0.000 0.000 False

33614 rows × 19 columns

Note that the Dataset is represented as a pandas.DataFrame since it inherits from it. The index of the Dataset contains the timestamp of a traffic participant’s state and its id as a unique identifier.

The traffic participant’s state include various information, including the center position, the velocity, dimension and classification type.

Load traffic light data#

The DLR UT dataset also contains information of the traffic lights. We utilize the tasi.dlr.dataset.DLRTrajectoryDataset class to load the information. For demonstration purpose, let’s load the first batch of the dataset.

[4]:
from tasi.dlr import DLRUTTrafficLightDataset

traffic_lights = DLRUTTrafficLightDataset.from_csv(dataset.traffic_lights()[0])
traffic_lights
[4]:
state
timestamp id
2023-09-24 00:00:00.992000+00:00 1 3
2 3
3 5
4 3
5 3
... ... ...
2023-09-24 00:14:59.987000+00:00 26 3
27 3
28 3
29 3
30 9

26910 rows × 1 columns

Load weather data#

The DLR Research Intersection is equipped with a weather station stat collects various information. We can utilize the tasi.dataset.WeatherDataset to load some of this information.

[5]:
from tasi.dataset import WeatherDataset

weather = WeatherDataset.from_csv(dataset.weather()[0])
weather
[5]:
air_temperature relative_humidity dew_point_temperature wet_bulb_temperature air_pressure_msl wind_direction wind_speed wind_gust_direction hail_intensity visibility present_weather rain_intensity rain_accumulation snow_accumulation solar_radiation
timestamp
2023-09-24 00:00:00+00:00 13.3 81.717 10.235 11.566 1021.141 154.0 2.034 147.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:00:10+00:00 13.3 81.717 10.238 11.567 1021.141 133.0 1.133 147.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:00:20+00:00 13.3 81.717 10.238 11.567 1021.141 163.0 2.333 147.0 0.0 20000.0 0.0 0.0 0.0 0.0 5.250
2023-09-24 00:00:30+00:00 13.3 81.733 10.238 11.567 1021.141 163.0 1.701 147.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:00:40+00:00 13.3 81.733 10.238 11.567 1021.141 122.0 1.500 147.0 0.0 NaN NaN NaN NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2023-09-24 00:14:10+00:00 13.1 82.500 10.185 11.454 1021.366 207.0 1.135 150.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:14:20+00:00 13.1 82.517 10.185 11.454 1021.366 196.0 0.898 150.0 0.0 20000.0 0.0 0.0 0.0 0.0 5.278
2023-09-24 00:14:30+00:00 13.1 82.533 10.185 11.454 1021.366 163.0 1.432 150.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:14:40+00:00 13.1 82.550 10.185 11.454 1021.366 182.0 0.734 150.0 0.0 NaN NaN NaN NaN NaN NaN
2023-09-24 00:14:50+00:00 13.1 82.567 10.185 11.454 1021.366 232.0 1.398 150.0 0.0 20000.0 0.0 0.0 0.0 0.0 NaN

90 rows × 15 columns

Load air quality data#

Although also collected by the same weather station, information about the local air quality is available via another dataset.

[6]:
from tasi.dataset import AirQualityDataset

air_quality = AirQualityDataset.from_csv(dataset.air_quality()[0])
air_quality
[6]:
no2_gas_concentration no_gas_concentration so2_gas_concentration o3_gas_concentration co_gas_concentration fine_particle_mass_concentration coarse_particle_mass_concentration
timestamp
2023-09-24 00:00:20+00:00 32.504 44.892 0.0 82.0 119.48 2.9 4.5
2023-09-24 00:01:20+00:00 32.504 44.892 0.0 84.0 118.32 2.9 4.5
2023-09-24 00:02:20+00:00 32.504 44.892 0.0 82.0 117.16 2.9 4.5
2023-09-24 00:03:20+00:00 30.592 44.892 0.0 84.0 116.00 2.9 4.5
2023-09-24 00:04:20+00:00 30.592 44.892 0.0 86.0 114.84 2.9 4.5
2023-09-24 00:05:20+00:00 30.592 44.892 0.0 86.0 114.84 2.9 4.5
2023-09-24 00:06:20+00:00 30.592 44.892 0.0 86.0 113.68 2.9 4.5
2023-09-24 00:07:20+00:00 32.504 44.892 0.0 86.0 112.52 2.9 4.5
2023-09-24 00:08:20+00:00 32.504 44.892 0.0 84.0 113.68 2.9 4.5
2023-09-24 00:09:20+00:00 32.504 44.892 0.0 84.0 112.52 2.9 4.5
2023-09-24 00:10:20+00:00 30.592 44.892 0.0 84.0 112.52 3.1 5.4
2023-09-24 00:11:20+00:00 32.504 44.892 0.0 84.0 112.52 3.1 5.4
2023-09-24 00:12:20+00:00 32.504 44.892 0.0 82.0 113.68 3.1 5.4
2023-09-24 00:13:20+00:00 32.504 44.892 0.0 82.0 113.68 3.1 5.4
2023-09-24 00:14:20+00:00 32.504 44.892 0.0 82.0 112.52 3.1 5.4

Load road quality information#

The same weather measurement station also collects information about the road condition.

[7]:
from tasi.dataset import RoadConditionDataset

road_conditions = RoadConditionDataset.from_csv(dataset.road_condition()[0])
road_conditions
[7]:
surface_temperature surface_state surface_grip water_layer_thickness ice_layer_thickness snow_layer_thickness
timestamp
2023-09-24 00:00:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:00:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:01:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:01:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:02:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:02:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:03:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:03:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:04:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:04:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:05:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:05:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:06:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:06:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:07:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:07:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:08:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:08:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:09:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:09:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:10:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:10:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:11:20+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:11:50+00:00 14.4 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:12:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:12:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:13:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:13:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:14:20+00:00 14.5 1.0 0.82 0.0 0.0 0.0
2023-09-24 00:14:50+00:00 14.5 1.0 0.82 0.0 0.0 0.0

Load traffic volume data#

The DLR UT dataset contains meta information like traffic volume data that were extracted from the raw trajectory data.

[8]:
from tasi.dataset import TrafficVolumeDataset

traffic_volume = TrafficVolumeDataset.from_csv(dataset.traffic_volume()[0])
traffic_volume
[8]:
volume
timestamp id
2023-09-24 00:00:00+00:00 East0South1 0
East1South1 0
East2West0 0
East2West1 0
East3West0 0
... ... ...
2023-09-24 00:14:59+00:00 West0West1 0
West1East0 0
West2East0 0
West2East1 0
West4South1 0

15300 rows × 1 columns

Load OpenSCENARIO files#

The DLR UT dataset contains the trajectory data in OpenSCENARIO format.

[9]:
from tasi.dataset import TrafficVolumeDataset

openscenario_files = dataset.openscenario()
openscenario_files
[9]:
['/tmp/DLR-Urban-Traffic-dataset_v1-2-0/meta_data/openscenario/openscenario_230924-120000_230924-121500.xosc',
 '/tmp/DLR-Urban-Traffic-dataset_v1-2-0/meta_data/openscenario/openscenario_230924-121500_230924-123000.xosc',
 '/tmp/DLR-Urban-Traffic-dataset_v1-2-0/meta_data/openscenario/openscenario_230924-123000_230924-124500.xosc',
 '/tmp/DLR-Urban-Traffic-dataset_v1-2-0/meta_data/openscenario/openscenario_230924-124500_230924-130000.xosc']

That’s it for now. We hope this page helps you get started 😎