TntpZoningReader

TntpZoningReader instance

The TntpZoningReader class instance can be created via the ZoningConverter. It provides the functionality to parse Origin-Destination zones from the TNTP format, and possibly persist it in the same or another format using a ZoningWriter. 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 TntpZoningReaderSettings.

It is worth noting that the TNTP format is simple in how it models zones and/or connectors. Each zone is modelled as a node in the network with a physical link connecting it to the rest of the network. There is no differences between a connector link and physical link, nor between a physical node and a zone (node). Therefore, we parse these nodes as zones, and model a zero length connectoid cost on top of each zone to represent the (non-existent) connector.

Minimum configuration requirements

The user is required to explicitly configure at least the following settings on TntpZoningReader:

  • set a network file via .settings.set_network_file(+)
  • provide a TNTP network reader to extract the network as a starting point (the TNTP network reader is to be configured via its own settings)

Methods

N/A

Properties

This class exposes the following properties:

Property Availability Description
.settings Always Access to TntpZoningReaderSettings to configure the reader

Example 1

from planit import *

planit_instance = Planit()

# TNTP net reader - prep
tntp_net_reader: TntpNetworkReaderWrapper = planit_instance.converter_factory.create(ConverterType.NETWORK) \
    .create_reader(NetworkReaderType.TNTP)
network_settings: TntpNetworkReaderSettingsWrapper = tntp_net_reader.settings
network_settings.set_network_file(NETWORK_FILE_PATH)
network_settings.set_node_coordinate_file(NODE_COORD_FILE_PATH)
network_settings.set_network_file_columns(create_tntp_network_file_cols())
# ... other settings

converter = planit_instance.converter_factory.create(ConverterType.ZONING)

# TNTP zon reader - prep (pass in net_reader)
tntp_zon_reader: TntpNetworkReaderWrapper = converter.create(ConverterType.ZONING) \
    .create_reader(ZoningReaderType.TNTP, tntp_net_reader)
zoning_settings = tntp_zon_reader.settings
zoning_settings.set_network_file_location(NETWORK_FILE_PATH)

#PLANit zoning writer
planit_writer = converter.create_writer(ZoningWriterType.PLANIT)
planit_writer.settings.set_output_directory("<path_to_output_dir>")

# perform conversion
converter.convert(tntp_reader, planit_writer)

See also

TntpNetworkReaderSettings for configuration of the TNTP network reader TntpZoningReaderSettings for configuration of the TNTP zoning reader ConverterFactory for the converter factory to create other types of converters
ZoningReaderType for the supported zoning reader types
ZoningWriterType for the supported zoning writer types

Source code

Class TntpZoningReaderWrapper in converterwrappers.py


.settings

TntpZoningReader property