Grid refinement#

Demonstrate two-dimensional model output interpolation onto grids with increasing spatial resolution. The leftmost panel shows the original data with a spatial resolution of 1 km, and other panels show interpolated results.

original, 500 m, 200 m, 100 m
import matplotlib.pyplot as plt
import hyoga

# initialize figure
fig, axes = plt.subplots(ncols=4)
resolutions = [500, 200, 100]

# open 100m resolution topography for edits
with'') as ds:
    topo = ds.hyoga.getvar('bedrock_altitude')
    topo = topo.sel(x=slice(402e3, 427e3))

# open demo data
with'') as ds:
    ds = ds.hyoga.assign_isostasy(''))

    # plot original data
    ax = axes[0]
    ds.hyoga.plot.bedrock_altitude(ax=ax, cmap='Topographic', center=False)
    ds.hyoga.plot.ice_margin(ax=ax, facecolor='w')

    # plot interpolated results
    for ax, res in zip(axes[1:], resolutions):
        stride = int(res/100)
        interp = ds.hyoga.interp(topo[::stride, ::stride])
            ax=ax, cmap='Topographic', center=False)
        interp.hyoga.plot.ice_margin(ax=ax, facecolor='w')
        ax.set_title(f'{res} m')

    # constrain original data axes limits

# show

Total running time of the script: ( 0 minutes 2.225 seconds)

Gallery generated by Sphinx-Gallery