Skip to content

Commit a22a047

Browse files
author
Chahan Kropf
committed
Improve docstrings
1 parent df3e303 commit a22a047

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

climada/engine/impact_calc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def impact(
9292
Default: True
9393
assign_centroids : bool, optional
9494
indicates whether centroids are assigned to the self.exposures object.
95+
The default centroids assignement uses euclidean distance and a threshold equal to
96+
twice the highest resolution of the centroids (assuming a regular grid).
9597
Recommendation: assign the centroids directly with control
9698
over the distance metric and the distance threshold using
9799
`exposure.assign_centroids(hazard)`. In this case, set assign_centroids to ``False``.

climada/entity/exposures/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,11 @@ def assign_centroids(
612612
Possible values are "euclidean", "haversine" and "approx".
613613
Default: "euclidean"
614614
threshold : float
615-
If the distance (in km) to the nearest neighbor exceeds `threshold`,
615+
If the distance (in the exposure's crs) to the nearest neighbor exceeds `threshold`,
616616
the index `-1` is assigned.
617617
Set `threshold` to 0, to disable nearest neighbor matching and enforce
618618
exact matching.
619-
Default: 100 (km)
619+
Default: twice the highest resolution of the hazard centroids
620620
overwrite: bool
621621
If True, overwrite centroids already present. If False, do
622622
not assign new centroids. Default is True.
@@ -633,7 +633,7 @@ def assign_centroids(
633633
coordinates is needed, please use 'haversine' distance metric,
634634
which however is slower.
635635
636-
Caution: bearest neighbourg matching can introduce serious artefacts
636+
Caution: nearest neighbourg matching can introduce serious artefacts
637637
such as:
638638
- exposure and hazard centroids with shifted grids can lead
639639
to systematically wrong assignements.

climada/util/coordinates.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@ def match_coordinates(
11901190
nearest neighbor. If the distance to the nearest neighbor exceeds `threshold`, the index `-1`
11911191
is assigned.
11921192
1193+
Make sure that all coordinates are according to the same coordinate reference system (crs).
1194+
11931195
You can disable nearest neighbor matching by setting `threshold` to 0, in which case
11941196
only exactly matching coordinates are assigned to each other.
11951197
@@ -1205,9 +1207,9 @@ def match_coordinates(
12051207
distance : str, optional
12061208
Distance to use for non-exact matching. Possible values are "euclidean", "haversine" and
12071209
"approx". Default: "euclidean"
1208-
unit : str, optional
1209-
Unit to use for non-exact matching. Possible values are "degree", "m", "km".
1210-
Default: "degree"
1210+
crs : str or pyproj crs, optinal
1211+
Coordinate reference system (crs) of the input coordinates.
1212+
Default: EPSG:4326
12111213
threshold : float, optional
12121214
If the distance to the nearest neighbor exceeds `threshold`, the index `-1` is assigned.
12131215
Set `threshold` to 0 to disable nearest neighbor matching. Default: 100 (km or crs.unit)

0 commit comments

Comments
 (0)