Skip to content

Commit 45537e7

Browse files
update docstrings
1 parent ce2629e commit 45537e7

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

climada/engine/impact.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,11 @@ def plot_rp_imp(
11951195
plot impact as log10(impact). Default: True
11961196
smooth : bool, optional
11971197
smooth plot to plot.RESOLUTIONxplot.RESOLUTION. Default: True
1198+
mask_rel_distance: float, optional
1199+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
1200+
points above which plot should not display values. For instance, to only plot values
1201+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
1202+
Default is None.
11981203
kwargs_local_exceedance_impact: dict
11991204
Dictionary of keyword arguments for the method impact.local_exceedance_impact.
12001205
kwargs : dict, optional

climada/hazard/plot.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def plot_rp_intensity(
5757
axis to use
5858
kwargs_local_exceedance_intensity: dict
5959
Dictionary of keyword arguments for the method hazard.local_exceedance_intensity.
60+
mask_rel_distance: float, optional
61+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
62+
points above which plot should not display values. For instance, to only plot values
63+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
64+
Default is None.
6065
kwargs: optional
6166
arguments for pcolormesh matplotlib function used in event plots
6267
@@ -130,6 +135,11 @@ def plot_intensity(
130135
in module `climada.util.plot`)
131136
axis: matplotlib.axes._subplots.AxesSubplot, optional
132137
axis to use
138+
mask_rel_distance: float, optional
139+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
140+
points above which plot should not display values. For instance, to only plot values
141+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
142+
Default is None.
133143
kwargs: optional
134144
arguments for pcolormesh matplotlib function
135145
used in event plots or for plot function used in centroids plots
@@ -165,7 +175,15 @@ def plot_intensity(
165175

166176
raise ValueError("Provide one event id or one centroid id.")
167177

168-
def plot_fraction(self, event=None, centr=None, smooth=True, axis=None, **kwargs):
178+
def plot_fraction(
179+
self,
180+
event=None,
181+
centr=None,
182+
smooth=True,
183+
axis=None,
184+
mask_rel_distance=None,
185+
**kwargs,
186+
):
169187
"""Plot fraction values for a selected event or centroid.
170188
171189
Parameters
@@ -187,6 +205,11 @@ def plot_fraction(self, event=None, centr=None, smooth=True, axis=None, **kwargs
187205
in module `climada.util.plot`)
188206
axis: matplotlib.axes._subplots.AxesSubplot, optional
189207
axis to use
208+
mask_rel_distance: float, optional
209+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
210+
points above which plot should not display values. For instance, to only plot values
211+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
212+
Default is None.
190213
kwargs: optional
191214
arguments for pcolormesh matplotlib function
192215
used in event plots or for plot function used in centroids plots
@@ -204,7 +227,13 @@ def plot_fraction(self, event=None, centr=None, smooth=True, axis=None, **kwargs
204227
if isinstance(event, str):
205228
event = self.get_event_id(event)
206229
return self._event_plot(
207-
event, self.fraction, col_label, smooth, axis, **kwargs
230+
event,
231+
self.fraction,
232+
col_label,
233+
smooth,
234+
axis,
235+
mask_rel_distance=mask_rel_distance,
236+
**kwargs,
208237
)
209238
if centr is not None:
210239
if isinstance(centr, tuple):
@@ -245,6 +274,11 @@ def _event_plot(
245274
axis to use
246275
figsize: tuple, optional
247276
figure size for plt.subplots
277+
mask_rel_distance: float, optional
278+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
279+
points above which plot should not display values. For instance, to only plot values
280+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
281+
Default is None.
248282
kwargs: optional
249283
arguments for pcolormesh matplotlib function
250284

climada/util/plot.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ def geo_im_from_array(
370370
adapt_fontsize : bool, optional
371371
If set to true, the size of the fonts will be adapted to the size of the figure. Otherwise
372372
the default matplotlib font size is used. Default is True.
373+
mask_rel_distance: float, optional
374+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
375+
points above which plot should not display values. For instance, to only plot values
376+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
377+
Default is None.
373378
**kwargs
374379
arbitrary keyword arguments for pcolormesh matplotlib function
375380
@@ -1123,6 +1128,11 @@ def plot_from_gdf(
11231128
adapt_fontsize: bool, optional
11241129
If set to true, the size of the fonts will be adapted to the size of the figure.
11251130
Otherwise the default matplotlib font size is used. Default is True.
1131+
mask_rel_distance: float, optional
1132+
Relative distance (with respect to maximal map extent in longitude or latitude) to data
1133+
points above which plot should not display values. For instance, to only plot values
1134+
at the centroids, use mask_rel_distance=0.01. If None, the plot is not masked.
1135+
Default is None.
11261136
kwargs: optional
11271137
Arguments for pcolormesh matplotlib function used in event plots.
11281138

0 commit comments

Comments
 (0)