Ejemplo n.º 1
0
def test_write_cube_roadway(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = ModelRoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )

    net.write_roadway_as_fixedwidth()
Ejemplo n.º 2
0
def test_network_split_variables_by_time(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = ModelRoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )

    net.split_properties_by_time_period_and_category()
    assert "trn_priority_AM" in net.links_df.columns
    print(net.links_df.info())
Ejemplo n.º 3
0
def test_calculate_count(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = ModelRoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )

    net.add_counts()
    assert "AADT" in net.links_df.columns
    print(net.links_df[net.links_df.drive_access == 1].AADT.value_counts())
Ejemplo n.º 4
0
def test_calculate_area_type(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = RoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )

    model_road_net = ModelRoadwayNetwork.from_RoadwayNetwork(net)

    model_road_net.calculate_area_type()
    assert "area_type" in net.links_df.columns
    print("Area Type  Frequency")
    print(net.links_df.area_type.value_counts())
Ejemplo n.º 5
0
def test_network_calculate_variables(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = ModelRoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )
    net.calculate_county()
    print("County  Frequency")
    print(net.links_df["county"].value_counts())

    net.calculate_mpo()
    print("MPO   Frequency")
    print(net.links_df["mpo"].value_counts())
Ejemplo n.º 6
0
def test_calculate_assign_group_rdclass(request):
    """
    Tests that parameters are read
    """
    print("\n--Starting:", request.node.name)

    net = ModelRoadwayNetwork.read(
        link_file=STPAUL_LINK_FILE,
        node_file=STPAUL_NODE_FILE,
        shape_file=STPAUL_SHAPE_FILE,
        fast=True,
    )

    net.calculate_assign_group()
    net.calculate_roadway_class()
    assert "assign_group" in net.links_df.columns
    assert "roadway_class" in net.links_df.columns
    print("Assign Group  Frequency")
    print(net.links_df[net.links_df.drive_access ==
                       1].assign_group.value_counts())
    print("Roadway Class  Frequency")
    print(net.links_df[net.links_df.drive_access ==
                       1].roadway_class.value_counts())
Ejemplo n.º 7
0
        WranglerLogger.info("\nCreating project card objects for scenario")
    project_cards_list = [
        ProjectCard.read(filename, validate=False)
        for filename in my_config["scenario"]["project_cards_filenames"]
    ]

    WranglerLogger.info("\nCreating scenario")
    my_scenario = Scenario.create_scenario(
        base_scenario=base_scenario,
        card_directory=my_config["scenario"]["card_directory"],
        tags=my_config["scenario"]["tags"],
        project_cards_list=project_cards_list,
        glob_search=my_config["scenario"]["glob_search"],
    )

    WranglerLogger.info(
        "\nApplying projects: {}".format("\n".join(my_scenario.get_project_names()))
    )
    print("Applying these projects to the base scenario ...")
    print("\n".join(my_scenario.get_project_names()))

    my_scenario.apply_all_projects()

    print("Creating model network...")
    WranglerLogger.info("\nCreating model network")
    model_road_net = ModelRoadwayNetwork.from_RoadwayNetwork(
        my_scenario.road_net, parameters=my_config.get("my_parameters", {})
    )
    WranglerLogger.info("\nCalculating additional variables and writing as shapefile")
    model_road_net.write_roadway_as_shp()