This small repo is made for demand data generation and transformation, currently exclusively for the input format used in the Amodsim project.
You can generate random demand, or transform a public taxi trips dataset.
To install the required packages for this repo, run pip install -r requirements.txt
.
As a prerequisite for the random demand generation, you need a map in the geojson
format. You can obtain such a map using the Roadmaptools library.
- Open the script
generate_random_demand.py
and configure the settings on the topmap_path
: path to the geojson filedemand_file_path
path to the output filestart_time
andend_time
in minutes- the
size
of the demand
- Run the script.
- Find data you want prior to 2016. You can use for example this dataset this New York dataset from 2014 which contains data of trips in New York in 2014. You can also search your fo your own dataset, just be aware of required data format. Searching for combination of "New York taxi csv data 20xx" should give you a relevant output.
- Unzip the downloaded file.
- Edit config.py.
- Change
DATA_DIR
to the path where the downloaded data are stored - Change
MAP_ENVELOPE
to values you used to generate the map. This ensures that created demand fits into the map. - Don't change
DATA_TO_EXTRACT
unless you know why you want to change it. It corresponds to Amodsim data format.
- Change
- run the script:
python3 trips_process.py
Following these steps, a trips.txt file with the demand in SiMoD format should appear in the DATA_DIR
directory.
- Set your working directory in
OUTPUT_DIR
and changeMAP_ENVELOPE
to the one you are currently using for your simulation. - You can change the values in
AVERAGE_PACKAGES
to achieve different parcel generation across the categories - Run the script:
python3 generate_parcels.py
Following these steps, a parcel.txt file with the demand in SiMoD format should appear in the DATA_DIR
directory.