Skip to content

Commit

Permalink
Add shapes argument to geo_im_from_array() in climada.util.plot (#805)
Browse files Browse the repository at this point in the history
* Add shapes arguement to geo_im_from_array() to enable flexible turn on/off coastline

* add author in AUTHORS.md

* add changes to CHANGELOG.md

* changelog: moved 805 from added to changed

---------

Co-authored-by: emanuel-schmid <[email protected]>
  • Loading branch information
yklpaul0902 and emanuel-schmid authored Nov 17, 2023
1 parent 8c8ee96 commit 158b1d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
* Raphael Portmann
* Nicolas Colombi
* Leonie Villiger
* Kam Lam Yeung
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Code freeze date: YYYY-MM-DD

### Changed

- Add `shapes` argument to `geo_im_from_array` to allow flexible turning on/off of plotting coastline in `plot_intensity`. [#805](https://github.com/CLIMADA-project/climada_python/pull/805)
- Update `CONTRIBUTING.md` to better explain types of contributions to this repository [#797](https://github.com/CLIMADA-project/climada_python/pull/797)
- The default tile layer in Exposures maps is not Stamen Terrain anymore, but [CartoDB Positron](https://github.com/CartoDB/basemap-styles). Affected methods are `climada.engine.Impact.plot_basemap_eai_exposure`,`climada.engine.Impact.plot_basemap_impact_exposure` and `climada.entity.Exposures.plot_basemap`. [#798](https://github.com/CLIMADA-project/climada_python/pull/798)

Expand Down
8 changes: 6 additions & 2 deletions climada/util/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _plot_scattered_data(method, array_sub, geo_coord, var_name, title,


def geo_im_from_array(array_sub, coord, var_name, title,

Check warning on line 253 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

too-complex

LOW: 'geo_im_from_array' is too complex. The McCabe rating is 15
Raw output
no description found

Check warning on line 253 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

too-many-arguments

LOW: Too many arguments (10/7)
Raw output
Used when a function or method takes too many arguments.

Check warning on line 253 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

too-many-locals

LOW: Too many local variables (38/15)
Raw output
Used when a function or method has too many local variables.

Check warning on line 253 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

too-many-branches

LOW: Too many branches (16/12)
Raw output
Used when a function or method has too many branches, making it hard tofollow.

Check warning on line 253 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

too-many-statements

LOW: Too many statements (54/50)
Raw output
Used when a function or method has too many statements. You should then splitit in smaller functions / methods.
proj=None, smooth=True, axes=None, figsize=(9, 13), adapt_fontsize=True,
proj=None, smooth=True, shapes=True, axes=None, figsize=(9, 13), adapt_fontsize=True,

Check warning on line 254 in climada/util/plot.py

View check run for this annotation

Jenkins - WCR / Pylint

line-too-long

LOW: Line too long (107/100)
Raw output
Used when a line is longer than a given number of characters.
**kwargs):
"""Image(s) plot defined in array(s) over input coordinates.
Expand All @@ -272,6 +272,9 @@ def geo_im_from_array(array_sub, coord, var_name, title,
coordinate reference system used in coordinates, by default None
smooth : bool, optional
smooth plot to RESOLUTIONxRESOLUTION, by default True
shapes : bool, optional
Overlay Earth's countries coastlines to matplotlib.pyplot axis.
The default is True
axes : Axes or ndarray(Axes), optional
by default None
figsize : tuple, optional
Expand Down Expand Up @@ -349,7 +352,8 @@ def geo_im_from_array(array_sub, coord, var_name, title,
extent[2], extent[3]), crs=proj)

# Add coastline to axis
add_shapes(axis)
if shapes:
add_shapes(axis)
# Create colormesh, colorbar and labels in axis
cbax = make_axes_locatable(axis).append_axes('right', size="6.5%",
pad=0.1, axes_class=plt.Axes)
Expand Down

0 comments on commit 158b1d8

Please sign in to comment.