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.

Vapor has a built-in image renderer that can be used to draw land beneath your visualization. However, if you load the data using XArray or if the dataset lacks georeferencing information, the geographic extent of the image renderer will be incorrect. In this guide we will create a map image with custom bounds and custom Cartopy features that can be displayed with Vapor’s image renderer.

Requirements

This guide requires vapor and cartopy libraries. To access NASA satellite images, you will also need owslib:

conda install -c conda-forge -c ncar-vapor vapor
conda install conda-forge::cartopy
conda install conda-forge::owslib

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 7
      3 import requests
      4 import zipfile
      5 
      6 # Plotting libraries:
----> 7 import matplotlib.pyplot as plt
      8 import cartopy.crs as ccrs
      9 import cartopy.feature as cf
     10 

ModuleNotFoundError: No module named 'matplotlib'

We will also use vapor’s Katrina sample dataset:

Select Parameters for our Image

Specify where the new image file will be saved:

Specify the lon/lat bounds of your image. Make sure it is exactly the same as the geographic extent of your dataset:

Choose the size of your output figure. Note: If your specified lat/lon extents have a different aspect ratio than your width and height, the geotiff will have either of its dimensions scaled to match the aspect ratio of the specified extents of the west/north/east/south variables.

Optional: to include a satellite image, identify the url and layer of the image. The following cell selects a Blue Marble image from NASA. (You can try other layers, like the VIIRS city lights layer)

Create a cartopy map

Set up your figure and optionally add a satellite image

Add Cartopy Features

For this example, we’ll add state borders, coastlines, and roads

View and save image

Example: loading the map as an image in Vapor

To view our map in Vapor, create an image renderer and set its path to the file we just created.
Important: our image does not contain georeferencing information, to be sure the set ‘IsGeoRef’ to false