Note
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:19:07 | dataset.py:load:130] > INFO: Checking if dataset already downloaded /tmp/DLR-Urban-Traffic-dataset_v1-2-0
[2025-04-25 12:19:07 | dataset.py:load:166] > 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]:
| acceleration | center | classifications | dimension | interpolated | velocity | yaw | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | magnitude | northing | easting | northing | bicycle | car | motorbike | pedestrian | truck | van | height | length | width | easting | magnitude | northing | ||||
| timestamp | id | |||||||||||||||||||
| 2023-09-24 00:00:00.016482+00:00 | 1695513598769889 | 0.047 | 0.093 | 0.080 | 604825.208 | 5792819.993 | 0.0 | 0.645 | 0.205 | 0.0 | 0.054 | 0.096 | 1.562 | 4.294 | 1.811 | False | -12.789 | 13.496 | -4.311 | -161.405 |
| 2023-09-24 00:00:00.066482+00:00 | 1695513598769889 | 0.052 | 0.097 | 0.081 | 604824.540 | 5792819.770 | 0.0 | 0.645 | 0.205 | 0.0 | 0.054 | 0.096 | 1.562 | 4.294 | 1.811 | False | -12.788 | 13.494 | -4.308 | -161.411 |
| 2023-09-24 00:00:00.116482+00:00 | 1695513598769889 | 0.058 | 0.101 | 0.083 | 604823.871 | 5792819.547 | 0.0 | 0.645 | 0.205 | 0.0 | 0.054 | 0.096 | 1.562 | 4.294 | 1.811 | False | -12.787 | 13.493 | -4.305 | -161.418 |
| 2023-09-24 00:00:00.166482+00:00 | 1695513598769889 | 0.063 | 0.105 | 0.084 | 604823.202 | 5792819.325 | 0.0 | 0.645 | 0.205 | 0.0 | 0.054 | 0.096 | 1.562 | 4.294 | 1.811 | False | -12.786 | 13.490 | -4.302 | -161.426 |
| 2023-09-24 00:00:00.216482+00:00 | 1695513598769889 | 0.069 | 0.109 | 0.085 | 604822.533 | 5792819.103 | 0.0 | 0.645 | 0.205 | 0.0 | 0.054 | 0.096 | 1.562 | 4.294 | 1.811 | False | -12.785 | 13.488 | -4.298 | -161.435 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 00:14:59.766482+00:00 | 1695514432518548 | -0.006 | 0.013 | -0.012 | 604743.005 | 5792776.259 | 0.0 | 0.135 | 0.865 | 0.0 | 0.000 | 0.000 | 1.656 | 1.058 | 0.675 | False | -0.021 | 0.022 | -0.006 | 8.619 |
| 2023-09-24 00:14:59.816482+00:00 | 1695514432518548 | -0.005 | 0.012 | -0.011 | 604743.003 | 5792776.260 | 0.0 | 0.135 | 0.865 | 0.0 | 0.000 | 0.000 | 1.656 | 1.058 | 0.675 | False | -0.022 | 0.023 | -0.008 | 8.619 |
| 2023-09-24 00:14:59.866482+00:00 | 1695514432518548 | -0.004 | 0.011 | -0.010 | 604743.001 | 5792776.261 | 0.0 | 0.135 | 0.865 | 0.0 | 0.000 | 0.000 | 1.656 | 1.058 | 0.675 | False | -0.022 | 0.025 | -0.011 | 8.619 |
| 2023-09-24 00:14:59.916482+00:00 | 1695514432518548 | -0.004 | 0.009 | -0.009 | 604742.999 | 5792776.262 | 0.0 | 0.135 | 0.865 | 0.0 | 0.000 | 0.000 | 1.656 | 1.058 | 0.675 | False | -0.023 | 0.027 | -0.013 | 8.619 |
| 2023-09-24 00:14:59.966482+00:00 | 1695514432518548 | -0.003 | 0.008 | -0.007 | 604742.996 | 5792776.258 | 0.0 | 0.135 | 0.865 | 0.0 | 0.000 | 0.000 | 1.656 | 1.058 | 0.675 | False | -0.024 | 0.028 | -0.015 | 8.619 |
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.dlr.dataset import DLRWeatherDataset
weather = DLRWeatherDataset.from_csv(dataset.weather()[0])
weather
[5]:
| air_pressure_msl | air_temperature | dew_point_temperature | hail_intensity | present_weather | rain_accumulation | rain_intensity | relative_humidity | snow_accumulation | solar_radiation | visibility | wet_bulb_temperature | wind_direction | wind_gust_direction | wind_speed | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| timestamp | id | |||||||||||||||
| 2023-09-24 00:00:00+00:00 | DLR | 1021.141 | 13.3 | 10.235 | 0.0 | NaN | NaN | NaN | 81.717 | NaN | NaN | NaN | 11.566 | 154.0 | 147.0 | 2.034 |
| 2023-09-24 00:00:10+00:00 | DLR | 1021.141 | 13.3 | 10.238 | 0.0 | NaN | NaN | NaN | 81.717 | NaN | NaN | NaN | 11.567 | 133.0 | 147.0 | 1.133 |
| 2023-09-24 00:00:20+00:00 | DLR | 1021.141 | 13.3 | 10.238 | 0.0 | 0.0 | 0.0 | 0.0 | 81.717 | 0.0 | 5.250 | 20000.0 | 11.567 | 163.0 | 147.0 | 2.333 |
| 2023-09-24 00:00:30+00:00 | DLR | 1021.141 | 13.3 | 10.238 | 0.0 | NaN | NaN | NaN | 81.733 | NaN | NaN | NaN | 11.567 | 163.0 | 147.0 | 1.701 |
| 2023-09-24 00:00:40+00:00 | DLR | 1021.141 | 13.3 | 10.238 | 0.0 | NaN | NaN | NaN | 81.733 | NaN | NaN | NaN | 11.567 | 122.0 | 147.0 | 1.500 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 00:14:10+00:00 | DLR | 1021.366 | 13.1 | 10.185 | 0.0 | NaN | NaN | NaN | 82.500 | NaN | NaN | NaN | 11.454 | 207.0 | 150.0 | 1.135 |
| 2023-09-24 00:14:20+00:00 | DLR | 1021.366 | 13.1 | 10.185 | 0.0 | 0.0 | 0.0 | 0.0 | 82.517 | 0.0 | 5.278 | 20000.0 | 11.454 | 196.0 | 150.0 | 0.898 |
| 2023-09-24 00:14:30+00:00 | DLR | 1021.366 | 13.1 | 10.185 | 0.0 | NaN | NaN | NaN | 82.533 | NaN | NaN | NaN | 11.454 | 163.0 | 150.0 | 1.432 |
| 2023-09-24 00:14:40+00:00 | DLR | 1021.366 | 13.1 | 10.185 | 0.0 | NaN | NaN | NaN | 82.550 | NaN | NaN | NaN | 11.454 | 182.0 | 150.0 | 0.734 |
| 2023-09-24 00:14:50+00:00 | DLR | 1021.366 | 13.1 | 10.185 | 0.0 | 0.0 | 0.0 | 0.0 | 82.567 | 0.0 | NaN | 20000.0 | 11.454 | 232.0 | 150.0 | 1.398 |
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.dlr.dataset import DLRAirQualityDataset
air_quality = DLRAirQualityDataset.from_csv(dataset.air_quality()[0])
air_quality
[6]:
| co_gas_concentration | coarse_particle_mass_concentration | fine_particle_mass_concentration | no2_gas_concentration | no_gas_concentration | o3_gas_concentration | so2_gas_concentration | ||
|---|---|---|---|---|---|---|---|---|
| timestamp | id | |||||||
| 2023-09-24 00:00:20+00:00 | DLR | 119.48 | 4.5 | 2.9 | 32.504 | 44.892 | 82.0 | 0.0 |
| 2023-09-24 00:01:20+00:00 | DLR | 118.32 | 4.5 | 2.9 | 32.504 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:02:20+00:00 | DLR | 117.16 | 4.5 | 2.9 | 32.504 | 44.892 | 82.0 | 0.0 |
| 2023-09-24 00:03:20+00:00 | DLR | 116.00 | 4.5 | 2.9 | 30.592 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:04:20+00:00 | DLR | 114.84 | 4.5 | 2.9 | 30.592 | 44.892 | 86.0 | 0.0 |
| 2023-09-24 00:05:20+00:00 | DLR | 114.84 | 4.5 | 2.9 | 30.592 | 44.892 | 86.0 | 0.0 |
| 2023-09-24 00:06:20+00:00 | DLR | 113.68 | 4.5 | 2.9 | 30.592 | 44.892 | 86.0 | 0.0 |
| 2023-09-24 00:07:20+00:00 | DLR | 112.52 | 4.5 | 2.9 | 32.504 | 44.892 | 86.0 | 0.0 |
| 2023-09-24 00:08:20+00:00 | DLR | 113.68 | 4.5 | 2.9 | 32.504 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:09:20+00:00 | DLR | 112.52 | 4.5 | 2.9 | 32.504 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:10:20+00:00 | DLR | 112.52 | 5.4 | 3.1 | 30.592 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:11:20+00:00 | DLR | 112.52 | 5.4 | 3.1 | 32.504 | 44.892 | 84.0 | 0.0 |
| 2023-09-24 00:12:20+00:00 | DLR | 113.68 | 5.4 | 3.1 | 32.504 | 44.892 | 82.0 | 0.0 |
| 2023-09-24 00:13:20+00:00 | DLR | 113.68 | 5.4 | 3.1 | 32.504 | 44.892 | 82.0 | 0.0 |
| 2023-09-24 00:14:20+00:00 | DLR | 112.52 | 5.4 | 3.1 | 32.504 | 44.892 | 82.0 | 0.0 |
Load road quality information#
The same weather measurement station also collects information about the road condition.
[7]:
from tasi.dlr.dataset import DLRRoadConditionDataset
road_conditions = DLRRoadConditionDataset.from_csv(dataset.road_condition()[0])
road_conditions
[7]:
| ice_layer_thickness | snow_layer_thickness | surface_grip | surface_state | surface_temperature | water_layer_thickness | ||
|---|---|---|---|---|---|---|---|
| timestamp | id | ||||||
| 2023-09-24 00:00:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:00:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:01:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:01:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:02:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:02:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:03:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:03:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:04:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:04:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:05:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:05:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:06:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:06:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:07:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:07:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:08:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:08:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:09:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:09:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:10:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:10:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:11:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:11:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.4 | 0.0 |
| 2023-09-24 00:12:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:12:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:13:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:13:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:14:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 0.0 |
| 2023-09-24 00:14:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 14.5 | 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.dlr.dataset import DLRTrafficVolumeDataset
traffic_volume = DLRTrafficVolumeDataset.from_csv(dataset.traffic_volume()[0])
traffic_volume
[8]:
| East0South1 | East1South1 | East2West0 | East2West1 | East3West0 | East3West1 | North1South0 | South1West1 | South2North1 | South3East0 | South4East1 | West0North1 | West0West1 | West1East0 | West2East0 | West2East1 | West4South1 | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| timestamp | id | |||||||||||||||||
| 2023-09-24 00:00:00+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:00:01+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:00:02+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:00:03+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:00:04+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 00:14:55+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:14:56+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:14:57+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:14:58+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2023-09-24 00:14:59+00:00 | DLR | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
900 rows × 17 columns
Load OpenSCENARIO files#
The DLR UT dataset contains the trajectory data in OpenSCENARIO format.
[9]:
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 😎