Skip to content

Commit

Permalink
Make plot functions work with merged glaciers (#726)
Browse files Browse the repository at this point in the history
* adapt plot routines to work with merged glaciers

* small correction

* PEP8 correction

* removed duplicates

* whats new
  • Loading branch information
matthiasdusch committed Mar 29, 2019
1 parent 8d24192 commit 50bba97
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Tools to set-up and run OGGM.
workflow.gis_prepro_tasks
workflow.climate_tasks
workflow.inversion_tasks
workflow.merge_glacier_tasks
utils.compile_glacier_statistics
utils.compile_run_output
utils.compile_climate_input
Expand Down
4 changes: 4 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Breaking changes
Enhancements
~~~~~~~~~~~~

- Adapted `graphics.plot_domain`, `graphics.plot_centerlines` and
`graphics_plot_modeloutput_map` to work with merged glaciers (:pull:`726`).
By `Matthias DUsch <https://github.com/matthiasdusch>`_.

Bug fixes
~~~~~~~~~

Expand Down
22 changes: 11 additions & 11 deletions oggm/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ def plot_domain(gdirs, ax=None, smap=None):
poly_pix = geom['polygon_pix']
smap.set_geometry(poly_pix, crs=crs, fc='white',
alpha=0.3, zorder=2, linewidth=.2)
for l in poly_pix.interiors:
smap.set_geometry(l, crs=crs, color='black', linewidth=0.5)
poly_pix = utils.tolist(poly_pix)
for _poly in poly_pix:
for l in _poly.interiors:
smap.set_geometry(l, crs=crs, color='black', linewidth=0.5)
except FileNotFoundError:
smap.set_shapefile(gdir.read_shapefile('outlines'))

Expand Down Expand Up @@ -292,9 +294,10 @@ def plot_centerlines(gdirs, ax=None, smap=None, use_flowlines=False,

smap.set_geometry(poly_pix, crs=crs, fc='white',
alpha=0.3, zorder=2, linewidth=.2)
for l in poly_pix.interiors:
smap.set_geometry(l, crs=crs,
color='black', linewidth=0.5)
poly_pix = utils.tolist(poly_pix)
for _poly in poly_pix:
for l in _poly.interiors:
smap.set_geometry(l, crs=crs, color='black', linewidth=0.5)

# plot Centerlines
cls = gdir.read_pickle(filename)
Expand Down Expand Up @@ -583,12 +586,9 @@ def plot_modeloutput_map(gdirs, ax=None, smap=None, model=None,
crs = gdir.grid.center_grid
smap.set_geometry(poly_pix, crs=crs, fc='none', zorder=2, linewidth=.2)

if isinstance(poly_pix, shpg.MultiPolygon):
for _poly in poly_pix:
for l in _poly.interiors:
smap.set_geometry(l, crs=crs, color='black', linewidth=0.5)
else:
for l in poly_pix.interiors:
poly_pix = utils.tolist(poly_pix)
for _poly in poly_pix:
for l in _poly.interiors:
smap.set_geometry(l, crs=crs, color='black', linewidth=0.5)

# plot Centerlines
Expand Down

0 comments on commit 50bba97

Please sign in to comment.