Skip to content

Commit 059c487

Browse files
committed
partitions are as per cores
1 parent 0c72711 commit 059c487

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/calculators/qm_xn_lib_calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def calculate_quality_metric(self):
147147
gdf = gdf.to_crs(self.default_projection)
148148
tile_gdf = tile_gdf.to_crs(self.default_projection)
149149
tile_gdf = tile_gdf[['geometry']]
150-
151-
df_dask = dask_geopandas.from_geopandas(tile_gdf, npartitions=64)
150+
no_of_cores = os.cpu_count()
151+
df_dask = dask_geopandas.from_geopandas(tile_gdf, npartitions=no_of_cores)
152152

153153
output = df_dask.apply(self.qm_func,axis=1, meta=[
154154
('geometry', 'geometry'),

src/calculators/xn_qm_lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def calculate_xn_qm(osw_edge_file_path: str, qm_file_path: str, xn_polygon_path:
170170
tile_gdf = tile_gdf[['geometry']]
171171

172172
# Compute local stats using dask-geopandas
173-
df_dask = dask_geopandas.from_geopandas(tile_gdf, npartitions=64)
173+
no_of_cores = os.cpu_count()
174+
df_dask = dask_geopandas.from_geopandas(tile_gdf, npartitions=no_of_cores)
174175

175176
# print('computing stats...')
176177
output = df_dask.apply(qm_func, axis=1, meta=[

0 commit comments

Comments
 (0)