.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/path_computation/plot_skimming.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_path_computation_plot_skimming.py: .. _example_usage_skimming: Network skimming ================ In this example, we show how to perform network skimming for Coquimbo, a city in La Serena Metropolitan Area in Chile. .. GENERATED FROM PYTHON SOURCE LINES 27-32 .. seealso:: Several functions, methods, classes and modules are used in this example: * :func:`aequilibrae.routing.graph` * :func:`aequilibrae.routing.network_skimming` .. GENERATED FROM PYTHON SOURCE LINES 34-43 .. code-block:: Python # Imports from uuid import uuid4 from tempfile import gettempdir from os.path import join from aequilibrae.examples import create_example from aequilibrae.utils import basic_config .. GENERATED FROM PYTHON SOURCE LINES 45-51 .. code-block:: Python # We create the example project inside our temp folder fldr = join(gettempdir(), uuid4().hex) project = create_example(fldr, "coquimbo") .. GENERATED FROM PYTHON SOURCE LINES 52-57 .. code-block:: Python # We'll also apply a basic logging configuration. basic_config() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 58-60 Network Skimming ---------------- .. GENERATED FROM PYTHON SOURCE LINES 62-64 .. code-block:: Python import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 65-66 Load the network snapshot .. GENERATED FROM PYTHON SOURCE LINES 66-70 .. code-block:: Python network = project.road.build_network() # Several fields in the project are filled with ``NaN``s. # This is true, but we won't use those fields. .. GENERATED FROM PYTHON SOURCE LINES 71-72 we also see what modes are available .. GENERATED FROM PYTHON SOURCE LINES 72-83 .. code-block:: Python network.modes # let's say we want to minimise the distance # And will skim distance while we are at it, other fields like ``free_flow_time`` or ``travel_time`` # can be added here as well # But let's say we only want a skim matrix for nodes 28-40, and 49-90 (inclusive), # these happen to be a selection of western centroids. centroids = np.array(list(range(28, 41)) + list(range(49, 91))) graph = network.build_graph(mode="c", cost="distance", skimming=["distance"], centroids=centroids, compact=True) .. GENERATED FROM PYTHON SOURCE LINES 84-85 And run the skimming .. GENERATED FROM PYTHON SOURCE LINES 85-87 .. code-block:: Python skm = graph.compute_skims() .. rst-class:: sphx-glr-script-out .. code-block:: none : 0%| | 0/55 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_skimming.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_skimming.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_