Plot Velocities
This notebook demonstrates reading and visualizing ice velocity grids over the Larsen-C ice shelf
Note
This notebook uses Jupyter widgets to set parameters for calculating the velocity maps.
import ipywidgets
import numpy as np
import IceAdvect as adv
import matplotlib.pyplot as plt
import matplotlib.colors as colors
Load database and select velocity dataset
# load database of velocity datasets
db = adv.datasets.load_database()
# reduce to Antarctic MEaSUREs datasets
db = {k: v for k, v in db.items() if v['crs'] == 'EPSG:3031'}
dataset = ipywidgets.Dropdown(
options=list(db.keys()),
value="NSIDC-0484",
description="Dataset:",
disabled=False,
)
display(dataset)
Query CMR and retrieve velocity files
kwargs = db[dataset.value]
granules = adv.datasets.fetch(**kwargs)
Open velocity and trim to bounds
# grid bounds to read
bounds = (-2470000, -2050000, 895000, 1325000)
# read velocity mosaic
ds = adv.io.open_dataset(granules, **kwargs)
ds = ds.advect.crop(bounds)
Create plots of ice velocity
# create output figure axis
fig, ax = plt.subplots(num=1, ncols=2, sharex=True, sharey=True, figsize=(13,6))
# create color map
cmap = adv.tools.custom_colormap(180, 'Rignot')
# show velocity magnitude
ds.advect.speed.plot(ax=ax[0], cmap=cmap, norm=colors.LogNorm(vmin=1, vmax=3000), alpha=0.75)
# show velocity divergence
ds.advect.divergence.plot(ax=ax[1], cmap=plt.cm.coolwarm, vmin=-0.1, vmax=0.1, alpha=0.75)
# tight layout
fig.tight_layout()
plt.show()