Skip to content

Fixes possible incorrect mapping between eai metric values and exposure points in trajectories - #1297

Merged
emanuel-schmid merged 5 commits into
developfrom
fix-trajectory_eai_metric
Oct 28, 2026
Merged

emanuel-schmid merged 5 commits into
developfrom
fix-trajectory_eai_metric

Conversation

@spjuhel

@spjuhel spjuhel commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a bug in calc_eai_gdf (both for static and interpolated trajectories) where the exposure points coordinates are incorrectly mapped to the corresponding risk value when the exposure GeoDataFrame index is discontinuous.

The suggested fix directly uses the index, instead of creating it from a range.

PR Author Checklist

PR Reviewer Checklist

@peanutfun peanutfun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. But are there no tests for the results?

@spjuhel

spjuhel commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator Author

There are, just not for the very specific case where the index of the geodataframe of the exposure is not a continuous range of number.

@peanutfun

Copy link
Copy Markdown
Member

Is that a hassle to implement? Simply dropping a row from a built exposure object before the test should do it, right?

@chahank chahank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a test to avoid breaking it in the future?

@emanuel-schmid emanuel-schmid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice - but sorry, I don't get it. 😕 A test would be awesome. But also a more explanatory description could help.

@emanuel-schmid

Copy link
Copy Markdown
Collaborator

Does this need a test to avoid breaking it in the future?

I think it's less about the future and more about the change: show the bug and the prove that it's fixed.

@spjuhel

spjuhel commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

I've added a specific non range based index in the exposure factory.

With it and without the fix, two existing tests related to the computation of EAI fail.
The test run fine with the fix.

I would assume that's enough?

@emanuel-schmid
emanuel-schmid merged commit 0413eb7 into develop Oct 28, 2026
12 checks passed
@emanuel-schmid
emanuel-schmid deleted the fix-trajectory_eai_metric branch October 28, 2026 12:53
@emanuel-schmid

Copy link
Copy Markdown
Collaborator

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants