Skip to content

Commit

Permalink
Add bedrock isostasy example (#11).
Browse files Browse the repository at this point in the history
  • Loading branch information
juseg committed Mar 4, 2021
1 parent 0886d6f commit 257ee4f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions examples/plot_bedrock_isostasy.py
@@ -0,0 +1,41 @@
#!/usr/bin/env python
# Copyright (c) 2021, Julien Seguinot (juseg.github.io)
# GNU General Public License v3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)

"""
Plot bedrock isostasy
=====================
"""

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import hyoga.open
import hyoga.demo

# initialize figure
ax = plt.subplot(projection=ccrs.UTM(32))

# open demo data
with hyoga.open.dataset(hyoga.demo.get('pism.alps.out.2d.nc')) as ds:
ds = ds.hyoga.where_thicker(1)

# compute isostasy using separate boot file
ds.hyoga.assign_isostasy(hyoga.demo.get('pism.alps.in.boot.nc'))

# plot model output
ds.hyoga.plot.bedrock_altitude(ax=ax, vmin=0, vmax=4500)
ds.hyoga.plot.surface_altitude_contours(ax=ax)
ds.hyoga.plot.bedrock_isostasy(
ax=ax, levels=[-150, -100, -50, 0, 0.5, 1, 1.5])
ds.hyoga.plot.ice_margin(ax=ax)

# add coastlines and rivers
ax.coastlines(edgecolor='0.25', linewidth=0.5)
ax.add_feature(
cfeature.NaturalEarthFeature(
category='physical', name='rivers_lake_centerlines', scale='10m'),
edgecolor='0.25', facecolor='none', linewidth=0.5, zorder=0)

# show
plt.show()

0 comments on commit 257ee4f

Please sign in to comment.