The primary unstructured grid elements (nodes, edges, faces) each have corresponding latitude-longer coordinates that represent some aspect of the element, such as the center of each face. These coordinates can be transformed into points and shaded with a data variable for visualization.

This notebook showcases how to visualize data variables as points.


import cartopy.crs as ccrs
import geoviews.feature as gf
import uxarray as ux
from holoviews import opts

file_dir = "../../meshfiles/"
fig_size = 400
plot_kwargs = {"backend": "bokeh", "width": 900, "height": 450}
ortho_plot_kwargs = {"backend": "bokeh", "width": 700, "height": 700}
grid_filename_120 = file_dir + "oQU120.grid.nc"
data_filename_120 = file_dir + "oQU120.data.nc"
uxds_120km = ux.open_dataset(grid_filename_120, data_filename_120)
grid_filename_480 = file_dir + "oQU480.grid.nc"
data_filename_480 = file_dir + "oQU480.data.nc"
uxds_480km = ux.open_dataset(grid_filename_480, data_filename_480)

Representing Coordinates as Points

For 2D visualizations, we can shade pairs of longitude and latitude coordinates as Points. UXarray supports three types of latitude-longitude (i.e spherical) coordinates:

node_lon and node_lat:

  • Longitudes and Latitudes of the corner nodes of each face

  • Used for node-centered data variables

edge_lon and edge_lat:

  • Longitudes and Latitudes of the centers of each edge

  • Can be derived from node_lon and node_lat internally by using Cartesian averaging

  • Used for edge-centered data variables

face_lon and face_lat:

  • Longitudes and Latitudes of the centers of each face

  • Can be derived from node_lon and node_lat internally by using Cartesian averaging

  • Used for face-centered data variables

In the previous notebook, we discussed how Polygon plots can be used for visualizing face-centered data. An alternate visualization of the same data variable can be achieved by shading Points instead of Polygons, which will be showcased in this notebook.

Vector Point Plots

The UxDataArray.plot.points() method produces a Vector Point plot

We can plot each shaded data point using the latitude and longitude of either the nodes, edge centers, or face centers. Since bottomDepth is a face-centered variable, it is plotted using the node coordinates (i.e. node_lon and node_lat)


The size of each point can be increased or decreased by specifying the size parameter

uxds_480km["bottomDepth"].plot.points(size=5, **plot_kwargs)

You may also select what projection to transform the coordinates into using the projection argument.

    projection=ccrs.Orthographic(), size=5, **ortho_plot_kwargs

Rasterized Point Plots

Instead of plotting the geometry of each point directly, we can rasterize our set of points on a fixed-size grid.

        method="point", width=900, height=400, title="480km Grid"
    + uxds_120km["bottomDepth"].plot.rasterize(
        method="point", width=900, height=400, title="120km Grid"