Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Ice Velocity

ESA
import numpy as np
import cartopy.crs as ccrs
import xarray as xr
import hvplot.xarray

url = 'https://s3.waw4-1.cloudferro.com/EarthCODE/OSCAssets/polar_cube_datasets/ice_velocity/ice_velocity.zarr/'
Loading...
Loading...
Loading...
Loading...
ds = xr.open_zarr(url, chunks={})
ds
Loading...
vx = "land_ice_surface_easting_velocity"
vy = "land_ice_surface_northing_velocity"
proj3031 = ccrs.SouthPolarStereo(central_longitude=0, true_scale_latitude=-71)

vectors = (
    ds[[vx, vy]]
    .sel(time="2019-01-01", method="nearest")
    .sel(x=slice(-1_800_000, -1_420_000), y=slice(-180_000, -760_000))
    .isel(x=slice(None, None, 80), y=slice(None, None, 80))
    .rename({vx: "vx", vy: "vy"})
    .copy()
)

vectors["speed"] = np.hypot(vectors.vx, vectors.vy)
vectors["angle"] = np.arctan2(vectors.vy, vectors.vx)

velocity_vectors = vectors.hvplot.vectorfield(
    x="x",
    y="y",
    angle="angle",
    mag="speed",
    color="#00e5ff",
    crs=proj3031,
    geo=True,
    tiles="EsriImagery",
    alpha=0.9,
    line_width=1.4,
    width=850,
    height=700,
    title=f"Ice velocity ({np.datetime_as_string(vectors.time.values, unit='D')})",
)
velocity_vectors
Loading...