Note
DLR Highway Traffic Dataset (DLR HT)#
This example should give a short overview on how to load the DLR Highway 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 HT dataset, we use the. The class contains a tasi.dlr.dataset.DLRHTVersion 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 DLRHTDatasetManager, DLRHTVersion
dataset = DLRHTDatasetManager(DLRHTVersion.latest)
path = dataset.load()
path
[2025-04-25 12:46:37 | dataset.py:load:112] > INFO: Checking if dataset already downloaded /tmp/DLR-Highway-Traffic-dataset_v1-1-0
[2025-04-25 12:46:37 | dataset.py:load:138] > INFO: Dataset already available at /tmp/DLR-Highway-Traffic-dataset_v1-1-0
[1]:
PosixPath('/tmp/DLR-Highway-Traffic-dataset_v1-1-0')
The dataset is now available in the /tmp directory. Let’s have a look into the dataset and list the available raw data
[2]:
raw_data = os.listdir(path.joinpath("raw_data"))
raw_data
[2]:
['road_condition', 'trajectories', 'weather']
Let’s list the available meta data
[3]:
meta_data = os.listdir(path.joinpath("meta_data"))
meta_data
[3]:
['openscenario', 'traffic_volume']
Load trajectory data#
We can now utilize the tasi.dlr.dataset.DLRHTTrajectoryDataset class to load the trajectory data from the directory. For demonstration purpose, let’s load the first batch of the dataset.
[4]:
from tasi.dlr import DLRTrajectoryDataset
ds = DLRTrajectoryDataset.from_csv(dataset.trajectory()[0])
ds
[4]:
| center | velocity | acceleration | yaw | dimension | classifications | interpolated | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | northing | easting | northing | magnitude | easting | northing | magnitude | signed | length | width | height | pedestrian | bicycle | motorbike | car | van | truck | ||||
| timestamp | id | ||||||||||||||||||||
| 2024-10-07 06:00:00.004659+00:00 | 1728280701706084 | 616517.884 | 5793321.779 | 14.053 | 29.593 | 32.760 | -0.079 | 0.064 | 0.101 | 0.140 | 64.434 | 6.910 | 2.386 | 2.229 | 0.000 | 0.0 | 0.000 | 0.000 | 0.395 | 0.605 | False |
| 1728280711579163 | 616874.078 | 5794184.485 | -8.869 | -23.115 | 24.758 | 0.089 | 0.593 | 0.600 | -1.000 | -110.835 | 4.603 | 1.862 | 1.896 | 0.000 | 0.0 | 0.000 | 0.363 | 0.502 | 0.135 | False | |
| 1728280715873385 | 616362.445 | 5793017.125 | 17.084 | 30.560 | 35.011 | -0.253 | 0.207 | 0.327 | 0.061 | 60.679 | 4.440 | 1.892 | 1.603 | 0.000 | 0.0 | 0.004 | 0.768 | 0.080 | 0.148 | False | |
| 1728280715982681 | 614672.366 | 5791271.783 | -37.444 | -20.108 | 42.502 | -0.313 | 0.017 | 0.314 | -0.045 | -151.427 | 6.250 | 1.932 | 1.859 | 0.000 | 0.0 | 0.000 | 0.392 | 0.375 | 0.233 | False | |
| 1728280716727948 | 616841.140 | 5794103.667 | -10.055 | -23.689 | 25.734 | 0.751 | 1.403 | 1.591 | -2.409 | -112.937 | 18.454 | 3.073 | 3.970 | 0.011 | 0.0 | 0.000 | 0.000 | 0.000 | 0.989 | False | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2024-10-07 06:04:59.954659+00:00 | 1728281098613793 | 616145.008 | 5792645.417 | 23.553 | 37.360 | 44.165 | 0.030 | 0.539 | 0.540 | 0.535 | 57.679 | 4.331 | 1.802 | 1.385 | 0.000 | 0.0 | 0.042 | 0.823 | 0.022 | 0.114 | False |
| 1728281099054783 | 617008.656 | 5794496.007 | 13.955 | 36.023 | 38.632 | -0.117 | -0.216 | 0.245 | -0.247 | 68.594 | 4.072 | 1.747 | 1.530 | 0.000 | 0.0 | 0.088 | 0.745 | 0.051 | 0.117 | False | |
| 1728281099273571 | 617563.625 | 5796127.372 | -9.853 | -31.505 | 33.009 | 0.137 | 0.078 | 0.157 | 0.055 | -107.753 | 4.534 | 1.906 | 1.494 | 0.000 | 0.0 | 0.002 | 0.749 | 0.111 | 0.138 | False | |
| 1728281099390791 | 617057.020 | 5794644.127 | -13.472 | -33.832 | 36.415 | -0.280 | -0.190 | 0.339 | 0.318 | -111.618 | 4.833 | 1.958 | 1.385 | 0.000 | 0.0 | 0.001 | 0.818 | 0.060 | 0.121 | False | |
| 1728281099712648 | 615754.276 | 5792109.517 | 15.734 | 18.737 | 24.467 | -0.354 | -0.556 | 0.660 | -1.290 | 49.541 | 16.306 | 3.250 | 3.932 | 0.002 | 0.0 | 0.000 | 0.000 | 0.000 | 0.986 | False | |
822653 rows × 20 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 weather data#
The DLR Test Bed Lower Saxony is equipped with a weather station that 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 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| timestamp | ||||||||||||||
| 2024-10-07 06:00:00+00:00 | 9.050 | 81.567 | 6.021 | 7.482 | 991.700 | 101.0 | 1.167 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:00:10+00:00 | 9.050 | 81.583 | 6.064 | 7.526 | 991.700 | 57.0 | 1.466 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:00:20+00:00 | 9.050 | 81.600 | 6.064 | 7.526 | 991.700 | 60.0 | 0.635 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:00:30+00:00 | 9.050 | 81.617 | 6.064 | 7.526 | 991.700 | 88.0 | 1.268 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:00:40+00:00 | 9.050 | 81.667 | 6.064 | 7.526 | 991.700 | 89.0 | 1.435 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:00:50+00:00 | 9.050 | 81.717 | 6.064 | 7.526 | 991.700 | 104.0 | 0.602 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:01:00+00:00 | 9.050 | 81.750 | 6.064 | 7.526 | 991.700 | 112.0 | 1.299 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:01:10+00:00 | 9.067 | 81.767 | 6.113 | 7.557 | 991.683 | 101.0 | 0.701 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:01:20+00:00 | 9.083 | 81.783 | 6.113 | 7.557 | 991.683 | 92.0 | 1.000 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:01:30+00:00 | 9.100 | 81.800 | 6.113 | 7.557 | 991.683 | 334.0 | 0.664 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:01:40+00:00 | 9.100 | 81.800 | 6.113 | 7.557 | 991.683 | 40.0 | 1.000 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:01:50+00:00 | 9.100 | 81.783 | 6.113 | 7.557 | 991.683 | 82.0 | 0.602 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:02:00+00:00 | 9.100 | 81.750 | 6.113 | 7.557 | 991.683 | 87.0 | 1.164 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:02:10+00:00 | 9.117 | 81.700 | 6.150 | 7.599 | 991.700 | 58.0 | 0.867 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:02:20+00:00 | 9.133 | 81.650 | 6.150 | 7.599 | 991.700 | 43.0 | 0.698 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:02:30+00:00 | 9.150 | 81.583 | 6.150 | 7.599 | 991.700 | 69.0 | 0.966 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:02:40+00:00 | 9.167 | 81.533 | 6.150 | 7.599 | 991.700 | 59.0 | 1.000 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:02:50+00:00 | 9.167 | 81.483 | 6.150 | 7.599 | 991.700 | 97.0 | 1.633 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:03:00+00:00 | 9.167 | 81.450 | 6.150 | 7.599 | 991.700 | 126.0 | 1.333 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:03:10+00:00 | 9.167 | 81.450 | 6.154 | 7.625 | 991.700 | 115.0 | 1.398 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:03:20+00:00 | 9.167 | 81.450 | 6.154 | 7.625 | 991.700 | 67.0 | 1.000 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:03:30+00:00 | 9.167 | 81.467 | 6.154 | 7.625 | 991.700 | 94.0 | 1.065 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:03:40+00:00 | 9.167 | 81.467 | 6.154 | 7.625 | 991.700 | 74.0 | 1.000 | 107.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:03:50+00:00 | 9.167 | 81.483 | 6.154 | 7.625 | 991.700 | 69.0 | 0.768 | 107.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:04:00+00:00 | 9.167 | 81.500 | 6.154 | 7.625 | 991.700 | 88.0 | 2.266 | 87.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:04:10+00:00 | 9.150 | 81.500 | 6.147 | 7.613 | 991.700 | 64.0 | 1.198 | 87.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:04:20+00:00 | 9.133 | 81.500 | 6.147 | 7.613 | 991.700 | 98.0 | 0.799 | 87.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:04:30+00:00 | 9.133 | 81.500 | 6.147 | 7.613 | 991.700 | 108.0 | 0.602 | 87.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:04:40+00:00 | 9.133 | 81.517 | 6.147 | 7.613 | 991.700 | 97.0 | 0.734 | 87.0 | 0.0 | NaN | NaN | NaN | NaN | NaN |
| 2024-10-07 06:04:50+00:00 | 9.150 | 81.533 | 6.147 | 7.613 | 991.700 | 88.0 | 1.135 | 87.0 | 0.0 | 20000.0 | 0.0 | 0.0 | 0.0 | 0.0 |
Load road quality information#
The same weather measurement station also collects information about the road condition.
[6]:
from tasi.dataset import RoadConditionDataset
road_conditions = RoadConditionDataset.from_csv(dataset.road_condition()[0])
road_conditions
[6]:
| surface_temperature | surface_state | surface_grip | water_layer_thickness | ice_layer_thickness | snow_layer_thickness | |
|---|---|---|---|---|---|---|
| timestamp | ||||||
| 2024-10-07 06:00:20+00:00 | 9.7 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:00:50+00:00 | 9.7 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:01:20+00:00 | 9.7 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:01:50+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:02:20+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:02:50+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:03:20+00:00 | 9.7 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:03:50+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:04:20+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
| 2024-10-07 06:04:50+00:00 | 9.8 | 1.0 | 0.82 | 0.0 | 0.0 | 0.0 |
Load traffic volume data#
The DLR HT dataset contains meta information like traffic volume data that were extracted from the raw data.
[7]:
from tasi.dataset import TrafficVolumeDataset
traffic_volume = TrafficVolumeDataset.from_csv(dataset.traffic_volume()[0])
traffic_volume
[7]:
| volume | ||
|---|---|---|
| timestamp | id | |
| 2024-10-07 06:00:00+00:00 | north_south_left | 0 |
| north_south_right | 0 | |
| south_north_left | 0 | |
| south_north_right | 1 | |
| 2024-10-07 06:00:01+00:00 | north_south_left | 0 |
| ... | ... | ... |
| 2024-10-07 06:04:58+00:00 | south_north_right | 0 |
| 2024-10-07 06:04:59+00:00 | north_south_left | 0 |
| north_south_right | 0 | |
| south_north_left | 0 | |
| south_north_right | 1 |
1200 rows × 1 columns
That’s it for now. We hope this page helps you get started 😎