Annotating your 3D glacier visualisations#

To enhance the clarity and appeal of your 3D glacier visualizations, we’ve incorporated additional annotation options. This guide will walk you through what’s currently available and how to utilize them effectively. Here’s a brief overview of what we offer:

  • Arrow annotation (e.g. north arrow)

  • Point annotation (e.g. labeling a mountain peak)

  • Text annotation (e.g. adding a heading)

  • Mask annotation (e.g. indicating the glacier extent from a previous time)

  • Legend annotation (e.g. adding a legend for the displayed outline)

For more detailed information on each annotation type, please refer to the following sections. Enjoy exploring!

Open data and create 3D object#

import xarray as xr
from glacier3dviz.tools import Glacier3DViz

ds_glacier = xr.open_dataset("oggm_constant_climate_dummy_data.nc")

viz = Glacier3DViz(
    ds_glacier,  # the dataset for visualisation
    camera_args={  # arguments for the point of view
        'azimuth': -135, # rotate the map aroung the z-axis
        'elevation': 20,  # set the elevation above ground of the point of view
    }
)

ArrowAnnotation#

This feature allows you to add an arrow with accompanying text to your plot. You can utilize it to highlight points of interest or provide orientation, such as a north arrow, as demonstrated in the example below.

from glacier3dviz.tools.map_annotations import ArrowAnnotation

# if you want to see all available options uncomment the line below
# ArrowAnnotation?
north_arrow = ArrowAnnotation(
    text='N',
    y_position=0.5,
    x_position=-0.1,
    arrow_magnitude=0.2,
    text_position_offset=[-0.02, 0.02, 0],
    )

viz.plot_year(2050,
              additional_annotations=[north_arrow])
../_images/4cc0f5be10b49f87c3495b37a06cf84bb23b4682730905f8eee5cac9de646dcf.png

PointAnnotation#

With a point annotation, you can label interesting points in your visualization, such as a mountain peak:

from glacier3dviz.tools.map_annotations import PointAnnotation

# if you want to see all available options uncomment the line below
#PointAnnotation?
finsteraarhorn = PointAnnotation(
    latitude=46.53703, #46.53677,
    longitude=8.12611, #7.96258,
    height=4274,
    text='Finsteraarhorn\n    4274 m',
    font_size=25,
    text_color='blue',
    point_color='black',
    point_size=10,
    shape=None,
    render_points_as_spheres=True,
    always_visible=True,
)

viz.plot_year(2050,
              additional_annotations=[finsteraarhorn])
../_images/0a053345b2bc7b04b1d85fcd618d38a9c9688ef25c95fb0d4aed8f81a8e4cc35.png

TextAnnotation#

Adding plain text to the visualisation:

from glacier3dviz.tools.map_annotations import TextAnnotation

# if you want to see all available options uncomment the line below
#TextAnnotation?
heading = TextAnnotation(
    text='Visualizing dummy data',
    position='upper_edge',
)

viz.plot_year(2050,
              additional_annotations=[heading])
../_images/872f0310abe83d0e7a5cd62f066bf5a6b39ef04d32d7e0d820aa37f1eec67743.png

MaskAnnotation#

Adding a mask to the topography can be a useful reference tool. This might include displaying past extents of a glacier area or simply its outline. Conveniently, both our test data and the default output from OGGM include these masks. Let’s explore how incorporating a mask can enhance our visualizations:

from glacier3dviz.tools.map_annotations import MaskAnnotation

# if you want to see all available options uncomment the line below
# MaskAnnotation?
outline_area = MaskAnnotation(
    mask_data='glacier_mask',
    mask_color=[255, 0, 255, 150],  # provided in RGBA with 255 convention
    add_z=20,  # make it a bit higher to see everything
)

viz.plot_year(2050,
              additional_annotations=[outline_area])
../_images/5f9a03a92145e2f7010103fd7c6468705344f5094f761114116cad1264f98dfc.png
outline = MaskAnnotation(
    mask_data='glacier_ext',
    mask_color=[0, 0, 0, 255],  # provided in RGBA with 255 convention
    add_z=0.1,  # add some height for plotting the MaskAnnotation on top of topography
)

viz.plot_year(2050,
              additional_annotations=[outline])
../_images/2d2f03f7550b1cfb0aa4d2c60e6ccca04d96541383f4bc76db6141f7ab529c7c.png

LegendAnnotation#

To provide additional information about what is displayed, we can include a legend, for example, for the outline added above:

from glacier3dviz.tools.map_annotations import LegendAnnotation

# if you want to see all available options uncomment the line below
# LegendAnnotation?
outline_legend = LegendAnnotation(
    labels=[[' RGI Outlines', 'black']],
)

viz.plot_year(2050,
              additional_annotations=[outline, outline_legend])
../_images/e303c832d8f97589b39294a603de2394eb8162a0deecec348be5d403ff2f271d.png

All Annotations together#

For adding multiple annotations you just can provide them as a list:

viz.plot_year(2050,
              additional_annotations=[north_arrow, finsteraarhorn, outline, outline_legend])
../_images/65df4c0c8cb97b4aaf441f5033d814f22ea0623ac72c2f84424d278fc70a13e9.png

What’s next?#