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_Orientation(self):
self.df_buildings["orient"] = mm.Orientation(self.df_buildings).series
check = 41.05146788287027
assert self.df_buildings["orient"][0] == pytest.approx(check)
self.df_streets["orient"] = mm.Orientation(self.df_streets).series
check = 40.7607
assert self.df_streets["orient"][0] == pytest.approx(check)
def test_CellAlignment(self):
self.df_buildings["orient"] = blgori = mm.Orientation(self.df_buildings).series
self.df_tessellation["orient"] = tessori = mm.Orientation(
self.df_tessellation
).series
self.df_buildings["c_align"] = mm.CellAlignment(
self.df_buildings, self.df_tessellation, "orient", "orient", "uID", "uID"
).series
self.df_buildings["c_align_array"] = mm.CellAlignment(
self.df_buildings, self.df_tessellation, blgori, tessori, "uID", "uID"
).series
check = abs(
self.df_buildings["orient"][0]
- self.df_tessellation[
self.df_tessellation["uID"] == self.df_buildings["uID"][0]
]["orient"].iloc[0]
)
assert self.df_buildings["c_align"][0] == pytest.approx(check)
def test_CellAlignment(self):
self.df_buildings["orient"] = blgori = mm.Orientation(self.df_buildings).series
self.df_tessellation["orient"] = tessori = mm.Orientation(
self.df_tessellation
).series
self.df_buildings["c_align"] = mm.CellAlignment(
self.df_buildings, self.df_tessellation, "orient", "orient", "uID", "uID"
).series
self.df_buildings["c_align_array"] = mm.CellAlignment(
self.df_buildings, self.df_tessellation, blgori, tessori, "uID", "uID"
).series
check = abs(
self.df_buildings["orient"][0]
- self.df_tessellation[
self.df_tessellation["uID"] == self.df_buildings["uID"][0]
]["orient"].iloc[0]
)
assert self.df_buildings["c_align"][0] == pytest.approx(check)
def test_StreetAlignment(self):
self.df_buildings["orient"] = orient = mm.Orientation(self.df_buildings).series
self.df_buildings["street_alignment"] = mm.StreetAlignment(
self.df_buildings, self.df_streets, "orient", network_id="nID"
).series
self.df_buildings["street_alignment2"] = mm.StreetAlignment(
self.df_buildings,
self.df_streets,
"orient",
left_network_id="nID",
right_network_id="nID",
).series
self.df_buildings["street_a_arr"] = mm.StreetAlignment(
self.df_buildings,
self.df_streets,
orient,
left_network_id=self.df_buildings["nID"],
right_network_id=self.df_streets["nID"],
def test_Orientation(self):
self.df_buildings["orient"] = mm.Orientation(self.df_buildings).series
check = 41.05146788287027
assert self.df_buildings["orient"][0] == pytest.approx(check)
self.df_streets["orient"] = mm.Orientation(self.df_streets).series
check = 40.7607
assert self.df_streets["orient"][0] == pytest.approx(check)
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")
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")
def time_Orientation(self):
mm.Orientation(self.df_buildings)