Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_network_id(self):
buildings_id = mm.get_network_id(self.df_buildings, self.df_streets, "nID")
assert not buildings_id.isna().any()
def setup_method(self):
test_file_path = mm.datasets.get_path("bubenec")
self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
self.df_streets = gpd.read_file(test_file_path, layer="streets")
self.df_tessellation = gpd.read_file(test_file_path, layer="tessellation")
self.df_streets["nID"] = mm.unique_id(self.df_streets)
self.df_buildings["height"] = np.linspace(10.0, 30.0, 144)
self.df_tessellation["area"] = self.df_tessellation.geometry.area
self.df_buildings["area"] = self.df_buildings.geometry.area
self.df_buildings["fl_area"] = mm.FloorArea(self.df_buildings, "height").series
self.df_buildings["nID"] = mm.get_network_id(
self.df_buildings, self.df_streets, "nID"
)
blocks = mm.Blocks(
self.df_tessellation, self.df_streets, self.df_buildings, "bID", "uID"
)
self.blocks = blocks.blocks
self.df_buildings["bID"] = blocks.buildings_id
self.df_tessellation["bID"] = blocks.tessellation_id
def setup_method(self):
test_file_path = mm.datasets.get_path("bubenec")
self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
self.df_streets = gpd.read_file(test_file_path, layer="streets")
self.df_tessellation = gpd.read_file(test_file_path, layer="tessellation")
self.df_buildings["height"] = np.linspace(10.0, 30.0, 144)
self.df_buildings["volume"] = mm.Volume(self.df_buildings, "height").series
self.df_streets["nID"] = mm.unique_id(self.df_streets)
self.df_buildings["nID"] = mm.get_network_id(
self.df_buildings, self.df_streets, "nID"
)
def test_get_network_id_duplicate(self):
self.df_buildings["nID"] = range(len(self.df_buildings))
buildings_id = mm.get_network_id(self.df_buildings, self.df_streets, "nID")
assert not buildings_id.isna().any()
def test_get_node_id(self):
nx = mm.gdf_to_nx(self.df_streets)
nodes, edges = mm.nx_to_gdf(nx)
self.df_buildings["nID"] = mm.get_network_id(
self.df_buildings, self.df_streets, "nID"
)
ids = mm.get_node_id(self.df_buildings, nodes, edges, "nodeID", "nID")
assert not ids.isna().any()
def setup(self):
test_file_path = mm.datasets.get_path("bubenec")
self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
self.df_streets = gpd.read_file(test_file_path, layer="streets")
self.df_tessellation = gpd.read_file(test_file_path, layer="tessellation")
self.df_buildings["height"] = np.linspace(10.0, 30.0, 144)
self.df_buildings["volume"] = mm.Volume(self.df_buildings, "height").series
self.df_streets["nID"] = mm.unique_id(self.df_streets)
self.df_buildings["nID"] = mm.get_network_id(
self.df_buildings, self.df_streets, "nID"
)
self.df_buildings["orient"] = mm.Orientation(self.df_buildings).series
self.df_tessellation["orient"] = mm.Orientation(self.df_tessellation).series
self.sw = Queen.from_dataframe(self.df_tessellation, ids="uID")
self.swh = mm.sw_high(k=3, gdf=self.df_tessellation, ids="uID")
self.swb = Queen.from_dataframe(self.df_buildings, ids="uID")