Skip to content

Improve default behavior of nearest neighbor matching to avoid using a fixed distance threshold #1079

@luseverin

Description

@luseverin

Description of the issue
When two sets of coordinates are tried to be matched in util.coordinates.match_coordinates, non-exact matching is allowed only if the distance between the points to be matched is smaller than a fixed threshold parameter. This threshold parameter has a default value of 100 (km) and can be updated by the user. However, using a fixed-value threshold as a default is sub-optimal as it results in always using the same default limit value of 100 regardless of the unit of the input coordinates system. Furthermore, it can lead to frequent warnings when hazard and exposures data with differing resolutions are tried to be matched.

Proposed fix
I suggest using a relative threshold i.e. that is based on the resolution of the input data instead of a fixed threshold. E.g. we could get the resolutions of the input data using util.coordinates.get_resolution and then set a default threshold in function of that and alternatively warn if the difference of resolution between the two input data is too large.

Additional context
This issue has been discussed in the context of improving functions to also allow for non-geographic coordinates to be used as input (see [#1020 ]).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions