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, the class DLRHHTDatasetManager is available in TASI that we will utilize in the following. The class DLRHTVersion is an enumerator that may be used to specify the version of the dataset to download or to get the latest version.
The following example will not download the dataset, but will use a local sample that is available in DATA_PATH. If you want to download the latest version, change to DLRHTVersion.latest and update the path attribute.
[1]:
import os
from tasi.dlr.dataset import DLRHTDatasetManager, DLRHTVersion
from tasi.tests import DATA_PATH
dataset = DLRHTDatasetManager(DLRHTVersion.v1_1_0, path=DATA_PATH)
path = dataset.load()
path
[1]:
PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/tasi/checkouts/stable/tasi/tests/data/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]:
['weather', 'road_condition', 'trajectories']
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]:
| acceleration | position | classifications | dimension | interpolated | velocity | yaw | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | magnitude | northing | signed | easting | northing | bicycle | car | motorbike | pedestrian | truck | van | height | length | width | easting | magnitude | northing | ||||
| timestamp | id | ||||||||||||||||||||
| 2024-10-07 06:00:00.004659+00:00 | 1728280701706084 | -0.079 | 0.101 | 0.064 | 0.140 | 616517.884 | 5.793e+06 | 0.0 | 0.000 | 0.000 | 0.000 | 0.605 | 0.395 | 2.229 | 6.910 | 2.386 | False | 14.053 | 32.760 | 29.593 | 64.434 |
| 1728280711579163 | 0.089 | 0.600 | 0.593 | -1.000 | 616874.078 | 5.794e+06 | 0.0 | 0.363 | 0.000 | 0.000 | 0.135 | 0.502 | 1.896 | 4.603 | 1.862 | False | -8.869 | 24.758 | -23.115 | -110.835 | |
| 1728280715873385 | -0.253 | 0.327 | 0.207 | 0.061 | 616362.445 | 5.793e+06 | 0.0 | 0.768 | 0.004 | 0.000 | 0.148 | 0.080 | 1.603 | 4.440 | 1.892 | False | 17.084 | 35.011 | 30.560 | 60.679 | |
| 1728280715982681 | -0.313 | 0.314 | 0.017 | -0.045 | 614672.366 | 5.791e+06 | 0.0 | 0.392 | 0.000 | 0.000 | 0.233 | 0.375 | 1.859 | 6.250 | 1.932 | False | -37.444 | 42.502 | -20.108 | -151.427 | |
| 1728280716727948 | 0.751 | 1.591 | 1.403 | -2.409 | 616841.140 | 5.794e+06 | 0.0 | 0.000 | 0.000 | 0.011 | 0.989 | 0.000 | 3.970 | 18.454 | 3.073 | False | -10.055 | 25.734 | -23.689 | -112.937 | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2024-10-07 06:04:59.954659+00:00 | 1728281098613793 | 0.030 | 0.540 | 0.539 | 0.535 | 616145.008 | 5.793e+06 | 0.0 | 0.823 | 0.042 | 0.000 | 0.114 | 0.022 | 1.385 | 4.331 | 1.802 | False | 23.553 | 44.165 | 37.360 | 57.679 |
| 1728281099054783 | -0.117 | 0.245 | -0.216 | -0.247 | 617008.656 | 5.794e+06 | 0.0 | 0.745 | 0.088 | 0.000 | 0.117 | 0.051 | 1.530 | 4.072 | 1.747 | False | 13.955 | 38.632 | 36.023 | 68.594 | |
| 1728281099273571 | 0.137 | 0.157 | 0.078 | 0.055 | 617563.625 | 5.796e+06 | 0.0 | 0.749 | 0.002 | 0.000 | 0.138 | 0.111 | 1.494 | 4.534 | 1.906 | False | -9.853 | 33.009 | -31.505 | -107.753 | |
| 1728281099390791 | -0.280 | 0.339 | -0.190 | 0.318 | 617057.020 | 5.795e+06 | 0.0 | 0.818 | 0.001 | 0.000 | 0.121 | 0.060 | 1.385 | 4.833 | 1.958 | False | -13.472 | 36.415 | -33.832 | -111.618 | |
| 1728281099712648 | -0.354 | 0.660 | -0.556 | -1.290 | 615754.276 | 5.792e+06 | 0.0 | 0.000 | 0.000 | 0.002 | 0.986 | 0.000 | 3.932 | 16.306 | 3.250 | False | 15.734 | 24.467 | 18.737 | 49.541 | |
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 boundingbox positions, 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.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 | visibility | wet_bulb_temperature | wind_direction | wind_gust_direction | wind_speed | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| timestamp | id | ||||||||||||||
| 2024-10-07 06:00:00+00:00 | DLR | 991.700 | 9.050 | 6.021 | 0.0 | NaN | NaN | NaN | 81.567 | NaN | NaN | 7.482 | 101.0 | 107.0 | 1.167 |
| 2024-10-07 06:00:10+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | NaN | NaN | NaN | 81.583 | NaN | NaN | 7.526 | 57.0 | 107.0 | 1.466 |
| 2024-10-07 06:00:20+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | 0.0 | 0.0 | 0.0 | 81.600 | 0.0 | 20000.0 | 7.526 | 60.0 | 107.0 | 0.635 |
| 2024-10-07 06:00:30+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | NaN | NaN | NaN | 81.617 | NaN | NaN | 7.526 | 88.0 | 107.0 | 1.268 |
| 2024-10-07 06:00:40+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | NaN | NaN | NaN | 81.667 | NaN | NaN | 7.526 | 89.0 | 107.0 | 1.435 |
| 2024-10-07 06:00:50+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | 0.0 | 0.0 | 0.0 | 81.717 | 0.0 | 20000.0 | 7.526 | 104.0 | 107.0 | 0.602 |
| 2024-10-07 06:01:00+00:00 | DLR | 991.700 | 9.050 | 6.064 | 0.0 | NaN | NaN | NaN | 81.750 | NaN | NaN | 7.526 | 112.0 | 107.0 | 1.299 |
| 2024-10-07 06:01:10+00:00 | DLR | 991.683 | 9.067 | 6.113 | 0.0 | NaN | NaN | NaN | 81.767 | NaN | NaN | 7.557 | 101.0 | 107.0 | 0.701 |
| 2024-10-07 06:01:20+00:00 | DLR | 991.683 | 9.083 | 6.113 | 0.0 | 0.0 | 0.0 | 0.0 | 81.783 | 0.0 | 20000.0 | 7.557 | 92.0 | 107.0 | 1.000 |
| 2024-10-07 06:01:30+00:00 | DLR | 991.683 | 9.100 | 6.113 | 0.0 | NaN | NaN | NaN | 81.800 | NaN | NaN | 7.557 | 334.0 | 107.0 | 0.664 |
| 2024-10-07 06:01:40+00:00 | DLR | 991.683 | 9.100 | 6.113 | 0.0 | NaN | NaN | NaN | 81.800 | NaN | NaN | 7.557 | 40.0 | 107.0 | 1.000 |
| 2024-10-07 06:01:50+00:00 | DLR | 991.683 | 9.100 | 6.113 | 0.0 | 0.0 | 0.0 | 0.0 | 81.783 | 0.0 | 20000.0 | 7.557 | 82.0 | 107.0 | 0.602 |
| 2024-10-07 06:02:00+00:00 | DLR | 991.683 | 9.100 | 6.113 | 0.0 | NaN | NaN | NaN | 81.750 | NaN | NaN | 7.557 | 87.0 | 107.0 | 1.164 |
| 2024-10-07 06:02:10+00:00 | DLR | 991.700 | 9.117 | 6.150 | 0.0 | NaN | NaN | NaN | 81.700 | NaN | NaN | 7.599 | 58.0 | 107.0 | 0.867 |
| 2024-10-07 06:02:20+00:00 | DLR | 991.700 | 9.133 | 6.150 | 0.0 | 0.0 | 0.0 | 0.0 | 81.650 | 0.0 | 20000.0 | 7.599 | 43.0 | 107.0 | 0.698 |
| 2024-10-07 06:02:30+00:00 | DLR | 991.700 | 9.150 | 6.150 | 0.0 | NaN | NaN | NaN | 81.583 | NaN | NaN | 7.599 | 69.0 | 107.0 | 0.966 |
| 2024-10-07 06:02:40+00:00 | DLR | 991.700 | 9.167 | 6.150 | 0.0 | NaN | NaN | NaN | 81.533 | NaN | NaN | 7.599 | 59.0 | 107.0 | 1.000 |
| 2024-10-07 06:02:50+00:00 | DLR | 991.700 | 9.167 | 6.150 | 0.0 | 0.0 | 0.0 | 0.0 | 81.483 | 0.0 | 20000.0 | 7.599 | 97.0 | 107.0 | 1.633 |
| 2024-10-07 06:03:00+00:00 | DLR | 991.700 | 9.167 | 6.150 | 0.0 | NaN | NaN | NaN | 81.450 | NaN | NaN | 7.599 | 126.0 | 107.0 | 1.333 |
| 2024-10-07 06:03:10+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | NaN | NaN | NaN | 81.450 | NaN | NaN | 7.625 | 115.0 | 107.0 | 1.398 |
| 2024-10-07 06:03:20+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | 0.0 | 0.0 | 0.0 | 81.450 | 0.0 | 20000.0 | 7.625 | 67.0 | 107.0 | 1.000 |
| 2024-10-07 06:03:30+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | NaN | NaN | NaN | 81.467 | NaN | NaN | 7.625 | 94.0 | 107.0 | 1.065 |
| 2024-10-07 06:03:40+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | NaN | NaN | NaN | 81.467 | NaN | NaN | 7.625 | 74.0 | 107.0 | 1.000 |
| 2024-10-07 06:03:50+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | 0.0 | 0.0 | 0.0 | 81.483 | 0.0 | 20000.0 | 7.625 | 69.0 | 107.0 | 0.768 |
| 2024-10-07 06:04:00+00:00 | DLR | 991.700 | 9.167 | 6.154 | 0.0 | NaN | NaN | NaN | 81.500 | NaN | NaN | 7.625 | 88.0 | 87.0 | 2.266 |
| 2024-10-07 06:04:10+00:00 | DLR | 991.700 | 9.150 | 6.147 | 0.0 | NaN | NaN | NaN | 81.500 | NaN | NaN | 7.613 | 64.0 | 87.0 | 1.198 |
| 2024-10-07 06:04:20+00:00 | DLR | 991.700 | 9.133 | 6.147 | 0.0 | 0.0 | 0.0 | 0.0 | 81.500 | 0.0 | 20000.0 | 7.613 | 98.0 | 87.0 | 0.799 |
| 2024-10-07 06:04:30+00:00 | DLR | 991.700 | 9.133 | 6.147 | 0.0 | NaN | NaN | NaN | 81.500 | NaN | NaN | 7.613 | 108.0 | 87.0 | 0.602 |
| 2024-10-07 06:04:40+00:00 | DLR | 991.700 | 9.133 | 6.147 | 0.0 | NaN | NaN | NaN | 81.517 | NaN | NaN | 7.613 | 97.0 | 87.0 | 0.734 |
| 2024-10-07 06:04:50+00:00 | DLR | 991.700 | 9.150 | 6.147 | 0.0 | 0.0 | 0.0 | 0.0 | 81.533 | 0.0 | 20000.0 | 7.613 | 88.0 | 87.0 | 1.135 |
Load road quality information#
The same weather measurement station also collects information about the road condition.
[6]:
from tasi.dlr.dataset import DLRRoadConditionDataset
road_conditions = DLRRoadConditionDataset.from_csv(dataset.road_condition()[0])
road_conditions
[6]:
| ice_layer_thickness | snow_layer_thickness | surface_grip | surface_state | surface_temperature | water_layer_thickness | ||
|---|---|---|---|---|---|---|---|
| timestamp | id | ||||||
| 2024-10-07 06:00:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.7 | 0.0 |
| 2024-10-07 06:00:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.7 | 0.0 |
| 2024-10-07 06:01:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.7 | 0.0 |
| 2024-10-07 06:01:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 0.0 |
| 2024-10-07 06:02:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 0.0 |
| 2024-10-07 06:02:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 0.0 |
| 2024-10-07 06:03:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.7 | 0.0 |
| 2024-10-07 06:03:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 0.0 |
| 2024-10-07 06:04:20+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 0.0 |
| 2024-10-07 06:04:50+00:00 | DLR | 0.0 | 0.0 | 0.82 | 1.0 | 9.8 | 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.dlr.dataset import DLRTrafficVolumeDataset
traffic_volume = DLRTrafficVolumeDataset.from_csv(dataset.traffic_volume()[0])
traffic_volume
[7]:
| north_south_left | north_south_right | south_north_left | south_north_right | ||
|---|---|---|---|---|---|
| timestamp | id | ||||
| 2024-10-07 06:00:00+00:00 | DLR | 0 | 0 | 0 | 1 |
| 2024-10-07 06:00:01+00:00 | DLR | 0 | 0 | 1 | 0 |
| 2024-10-07 06:00:02+00:00 | DLR | 0 | 0 | 0 | 0 |
| 2024-10-07 06:00:03+00:00 | DLR | 0 | 0 | 0 | 1 |
| 2024-10-07 06:00:04+00:00 | DLR | 0 | 0 | 1 | 0 |
| ... | ... | ... | ... | ... | ... |
| 2024-10-07 06:04:55+00:00 | DLR | 0 | 0 | 0 | 0 |
| 2024-10-07 06:04:56+00:00 | DLR | 1 | 1 | 0 | 0 |
| 2024-10-07 06:04:57+00:00 | DLR | 0 | 0 | 0 | 0 |
| 2024-10-07 06:04:58+00:00 | DLR | 0 | 0 | 0 | 0 |
| 2024-10-07 06:04:59+00:00 | DLR | 0 | 0 | 0 | 1 |
300 rows × 4 columns
That’s it for now. We hope this page helps you get started 😎