Note
Go to the end to download the full example code.
Bedrock isostasy#
Plot a composite map including bedrock altitude, surface altitude contours, bedroc isostatic adjustment relative to a reference topography in a separate model input file, and geographic elements.

/home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/latest/lib/python3.12/site-packages/hyoga/open/example.py:29: FutureWarning: In a future version, xarray will not decode timedelta values based on the presence of a timedelta-like units attribute by default. Instead it will rely on the presence of a timedelta64 dtype attribute, which is now xarray's default way of encoding timedelta64 values. To continue decoding timedeltas based on the presence of a timedelta-like units attribute, users will need to explicitly opt-in by passing True or CFTimedeltaCoder(decode_via_units=True) to decode_timedelta. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.
return xr.open_dataset(path)
downloading https://raw.githubusercontent.com/juseg/hyoga-data/main/pism/pism.alps.in.boot.nc...
/home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/latest/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
return lib.normalize(geometry, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/latest/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
return lib.normalize(geometry, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/latest/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
return lib.normalize(geometry, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/latest/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
return lib.normalize(geometry, **kwargs)
import matplotlib.pyplot as plt
import hyoga
# initialize figure
ax = plt.subplot()
cax = plt.axes([0.15, 0.55, 0.025, 0.25])
# open demo data
with hyoga.open.example('pism.alps.out.2d.nc') as ds:
# compute isostasy using separate boot file
ds = ds.hyoga.assign_isostasy(hyoga.open.example('pism.alps.in.boot.nc'))
# plot model output
ds.hyoga.plot.bedrock_altitude(ax=ax, center=False)
ds.hyoga.plot.surface_altitude_contours(ax=ax)
ds.hyoga.plot.bedrock_isostasy(
ax=ax, cbar_ax=cax, levels=[-150, -100, -50, 0, 0.5, 1, 1.5])
ds.hyoga.plot.ice_margin(ax=ax)
# add coastline and rivers
ds.hyoga.plot.natural_earth(ax=ax)
# set axes properties
cax.set_ylabel('')
ax.set_title('Bedrock isostatic adjustment (m)')
# show
plt.show()
Total running time of the script: (0 minutes 2.652 seconds)