def test_volume_aray(self): area = self.df_buildings.geometry.area height = np.linspace(10., 30., 144) self.df_buildings['volume'] = mm.volume(self.df_buildings, height, area) check = self.df_buildings.geometry[0].area * self.df_buildings.height[0] assert self.df_buildings['volume'][0] == check
def test_volume_facade_ratio_array(self): peri = self.df_buildings.geometry.length volume = mm.volume(self.df_buildings, 'height') self.df_buildings['vfr'] = mm.volume_facade_ratio( self.df_buildings, 'height', volume, peri) check = self.df_buildings.volume[0] / ( self.df_buildings.geometry[0].length * self.df_buildings.height[0]) assert self.df_buildings['vfr'][0] == check
def test_form_factor_array(self): self.df_buildings['ff'] = mm.form_factor( self.df_buildings, mm.volume(self.df_buildings, 'height'), areas=self.df_buildings.geometry.area) check = (self.df_buildings.geometry[0].area) / ( self.df_buildings.volume[0]**(2 / 3)) assert self.df_buildings['ff'][0] == check
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., 30., 144) self.df_buildings['volume'] = mm.volume(self.df_buildings, 'height')
def test_volume_missing_col(self): with pytest.raises(KeyError): self.df_buildings['volume'] = mm.volume(self.df_buildings, 'height', 'area')
def test_volume_no_area(self): self.df_buildings['volume'] = mm.volume(self.df_buildings, 'height') check = self.df_buildings.geometry[0].area * self.df_buildings.height[0] assert self.df_buildings['volume'][0] == check