Esempio n. 1
0
    def test_create_umiproject_from_geojson_testfile(self):
        filename = Path("tests/oshkosh_demo.geojson")
        epw = Path("tests/USA_MA_Boston-Logan.Intl.AP.725090_TMY3.epw")
        template_lib = Path("tests/BostonTemplateLibrary.json")
        assert epw.exists()
        umi = UmiProject.from_gis(
            filename,
            "Height",
            template_lib=template_lib,
            template_map=TestUmiProject.depth2,
            map_to_columns=["Use_Type"],
            epw=epw,
        )
        # Add a Street Graph
        umi.add_street_graph(network_type="all_private",
                             retain_all=True,
                             clean_periphery=False)
        umi.add_pois(
            tags=dict(natural=["tree_row", "tree", "wood"], trees=True),
            on_file3dm_layer="umi::Context::Trees",
        ).add_pois(
            tags=dict(leisure="park", amenity="park", landuse="park"),
            on_file3dm_layer="umi::Context::Parks",
        ).add_pois(tags=dict(landuse="commercial"),
                   on_file3dm_layer="umi::Context")
        # save UmiProject to created package.
        projectName = "oshkosh_demo.umi"
        umi.save(projectName)

        # assert the name has changed
        assert umi.name == projectName
Esempio n. 2
0
 def project_from_gis(self):
     filename = Path("tests/oshkosh_demo.geojson")
     epw = Path("tests/USA_MA_Boston-Logan.Intl.AP.725090_TMY3.epw")
     template_lib = Path("tests/BostonTemplateLibrary.json")
     assert epw.exists()
     yield UmiProject.from_gis(
         filename,
         "Height",
         template_lib=template_lib,
         template_map=TestUmiProject.depth2,
         map_to_columns="Use_Type",
         epw=epw,
     )
Esempio n. 3
0
    def test_multilevel(self, multi_attributes, map_to_columns):
        filename = Path("tests/oshkosh_demo.geojson")
        template_lib = Path("tests/BostonTemplateLibrary.json")
        umi = UmiProject.from_gis(
            filename,
            "Height",
            template_lib=template_lib,
            template_map=multi_attributes,
            map_to_columns=map_to_columns,
            epw=None,
            fid="ID",
        )
        # save UmiProject to created package.
        umi.save()

        # Assert ewp is downloaded for correct location
        assert umi.epw.location.city == "Wittman Rgnl"
Esempio n. 4
0
 def umi_project(self):
     yield UmiProject()
Esempio n. 5
0
 def test_open_with_origin_unset(self):
     umi = UmiProject.open("tests/oshkosh_demo.umi",
                           origin_unset=(0, 0),
                           fast_open=True)
Esempio n. 6
0
 def test_open(self):
     umi = UmiProject.open("tests/oshkosh_demo.umi", fast_open=True)
Esempio n. 7
0
    def test_save_to_valid_path_no_extension(self, project_from_gis):
        umi = UmiProject()
        umi.save("empty_project_other_name_no_extension")

        assert Path("empty_project_other_name_no_extension.umi").exists()
Esempio n. 8
0
    def test_save_to_valid_path(self, project_from_gis):
        umi = UmiProject()
        umi.save("empty_project.umi")

        assert Path("empty_project.umi").exists()
Esempio n. 9
0
 def test_save_to_non_existent_path(self):
     umi = UmiProject()
     with pytest.raises(FileNotFoundError):
         umi.save("./temp/should_fail.umi")