Skip to content

Commit bed6bfb

Browse files
committed
Use position-based index for reaggregation
1 parent 9cfa8ad commit bed6bfb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

climada/util/lines_polys_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ def _aggregate_impact_mat(imp_pnt, gdf_pnt, agg_met):
232232
row_pnt = np.arange(len(col_geom))
233233

234234
if agg_met is AggMethod.SUM:
235-
mask = np.ones(len(col_geom))
235+
mask = np.ones(len(row_pnt))
236236
else:
237237
raise NotImplementedError(
238238
f"The available aggregation methods are {AggMethod._member_names_}"
239239
) # pylint: disable=no-member, protected-access
240240
csr_mask = sp.sparse.csr_matrix(
241-
(mask, (row_pnt, col_geom)), shape=(len(row_pnt), len(np.unique(col_geom)))
241+
(mask, (row_pnt, row_pnt)), shape=(len(row_pnt), len(np.unique(row_pnt)))
242242
)
243243

244244
return imp_pnt.imp_mat.dot(csr_mask)

0 commit comments

Comments
 (0)