.settings
TntpDemandsReader property
The TntpDemandsReader
class instance can be created via the DemandsConverter
.
It provides the functionality to parse Origin-Destination trips from the TNTP format, and possibly persist it in the same or another
format using a DemandsWriter. Once created the user can configure its settings.
For information on the TNTP data format, please consult the Data formats/Input/tntp section
All configuration of this reader is performed via its .settings
property, providing access to
the TntpDemandsReaderSettings
.
The user is required to explicitly configure at least the following settings on TntpDemandsReader:
.settings.set_network_file(+)
N/A
This class exposes the following properties:
Property | Availability | Description |
---|---|---|
.settings |
Always | Access to TntpDemandsReaderSettings to configure the reader |
from planit import *
planit_instance = Planit()
# TNTP net reader - prep
tntp_net_reader = planit_instance.converter_factory.create(ConverterType.NETWORK).create_reader(NetworkReaderType.TNTP)
tntp_net_reader.settings.set_network_file(NETWORK_FILE_PATH)
tntp_net_reader.settings.set_node_coordinate_file(NODE_COORD_FILE_PATH)
tntp_net_reader.settings.set_network_file_columns(create_tntp_network_file_cols())
# ... other settings
# TNTP zon reader - prep (pass in net_reader)
tntp_zon_reader = planit_instance.converter_factory.create(ConverterType.ZONING).create_reader(ZoningReaderType.TNTP, tntp_net_reader)
tntp_zon_reader.settings.set_network_file_location(NETWORK_FILE_PATH)
# other settings
converter = planit_instance.converter_factory.create(ConverterType.DEMANDS)
# TNTP demands reader (pass in zon_reader)
tntp_dem_reader: TntpDemandsReaderWrapper = converter.create_reader(DemandsReaderType.TNTP, tntp_zon_reader)
tntp_dem_reader.settings.set_demand_file_location(DEMAND_FILE_PATH)
#PLANit demands writer
planit_writer = converter.create_writer(DemandsWriterType.PLANIT)
planit_writer.settings.set_output_directory("<path_to_output_dir>")
# perform conversion
converter.convert(tntp_reader, planit_writer)
TntpZoningReaderSettings
for configuration of the TNTP zoning reader
TntpDemandsReaderSettings
for configuration of the TNTP demands reader
ConverterFactory
for the converter factory to create other types of converters
DemandsReaderType
for the supported demands reader types
DemandsWriterType
for the supported demands writer types
Class TntpDemandsReaderWrapper
in converterwrappers.py
TntpDemandsReader property