Skip to content

Adding beginner friendly explanations on the Docs#1607

Open
dylannelson wants to merge 5 commits into
mainfrom
dylannelson/docs_updates
Open

Adding beginner friendly explanations on the Docs#1607
dylannelson wants to merge 5 commits into
mainfrom
dylannelson/docs_updates

Conversation

@dylannelson

Copy link
Copy Markdown
Collaborator

Closes #1582

Overview

While reading through the docs, there was a few ideas I reviewed that could be useful to new users. I was able to implement a few and test the changes

  1. Created a new page for further defining the differences between unstructured and structured grids to give more context, examples, and a deeper low level understanding of the concepts
    • This should helpfully contribute to the understanding of why unstructured grids are important and the value they provide
  2. Added images to the new page
    • There were only 2 examples before in the repo, so a few more were added that have a similar format.
    • 2 images were created from scratch to provide a more simple view of the concept of "predictability" in grids
  3. The Tutorials and video page only had 1 example, so I added 2 more and added more context to all of them
  4. Few style changes. Changed the colors of a table and a couple words in a notebook for a slightly easier read

PR Checklist

Documentation

  • New images for various pages
  • Created a new page for defining unstructured vs structured grids
  • Minor tweaks to styling across a few pages
  • Added videos to the Tutorials and Videos page with added context

@dylannelson dylannelson self-assigned this Jul 22, 2026
@dylannelson dylannelson added documentation Improvements or additions to documentation run-benchmark Run ASV benchmark workflow labels Jul 22, 2026
@dylannelson dylannelson linked an issue Jul 22, 2026 that may be closed by this pull request
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

ASV Benchmarking

Benchmark Comparison Results

Benchmarks that have improved:

Change Before [4c257f0] After [b2dd261] Ratio Benchmark (Parameter)
- 578M 390M 0.68 face_bounds.FaceBounds.peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
- 699M 390M 0.56 face_bounds.FaceBounds.peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
- 498M 383M 0.77 mpas_ocean.Gradient.peakmem_gradient('480km')

Benchmarks that have stayed the same:

Change Before [4c257f0] After [b2dd261] Ratio Benchmark (Parameter)
10.8±0.2μs 10.7±0.2μs 0.99 bench_connectivity.Connectivity.time_edge_face('120km')
11.0±0.1μs 11.0±0.07μs 1 bench_connectivity.Connectivity.time_edge_face('480km')
10.7±0.1μs 10.7±0.1μs 1 bench_connectivity.Connectivity.time_edge_node('120km')
10.9±0.1μs 11.1±0.2μs 1.02 bench_connectivity.Connectivity.time_edge_node('480km')
10.7±0.06μs 10.6±0.05μs 0.99 bench_connectivity.Connectivity.time_face_edge('120km')
11.1±0.2μs 11.0±0.04μs 1 bench_connectivity.Connectivity.time_face_edge('480km')
10.6±0.2μs 10.8±0.1μs 1.02 bench_connectivity.Connectivity.time_face_face('120km')
11.0±0.1μs 10.8±0.1μs 0.98 bench_connectivity.Connectivity.time_face_face('480km')
21.3±0.3μs 21.0±0.1μs 0.98 bench_connectivity.Connectivity.time_face_node('120km')
22.2±0.3μs 21.8±0.3μs 0.98 bench_connectivity.Connectivity.time_face_node('480km')
10.4±0.08μs 10.6±0.09μs 1.02 bench_connectivity.Connectivity.time_node_edge('120km')
11.2±0.09μs 11.1±0.1μs 0.99 bench_connectivity.Connectivity.time_node_edge('480km')
10.7±0.06μs 10.7±0.2μs 1 bench_connectivity.Connectivity.time_node_face('120km')
11.0±0.2μs 10.7±0.2μs 0.97 bench_connectivity.Connectivity.time_node_face('480km')
389M 390M 1 face_bounds.FaceBounds.peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
420M 420M 1 face_bounds.FaceBounds.peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
14.3±0.03ms 14.4±0.09ms 1 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
3.68±0.07ms 3.71±0.06ms 1.01 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
18.8±0.05ms 18.8±0.08ms 1 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
2.20±0.01ms 2.16±0.03ms 0.99 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.02±0.02s 1.06±0.01s 1.04 import.Imports.timeraw_import_uxarray
926±10ns 927±4ns 1 mpas_ocean.CheckNorm.time_check_norm('120km')
893±6ns 891±1ns 1 mpas_ocean.CheckNorm.time_check_norm('480km')
824±3ms 842±30ms 1.02 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('120km')
53.2±0.4ms 54.0±0.4ms 1.02 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('480km')
661±9μs 675±9μs 1.02 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('120km')
588±30μs 600±6μs 1.02 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('480km')
5.37±0.02ms 5.37±0.03ms 1 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('120km')
3.94±0.01ms 3.92±0.04ms 0.99 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('480km')
3.44±0.03s 3.45±0.03s 1 mpas_ocean.ConstructFaceLatLon.time_welzl('120km')
226±0.9ms 221±2ms 0.98 mpas_ocean.ConstructFaceLatLon.time_welzl('480km')
18.3±0.1ms 18.2±0.04ms 0.99 mpas_ocean.ConstructTreeStructures.time_ball_tree('120km')
1.03±0.01ms 1.05±0.01ms 1.01 mpas_ocean.ConstructTreeStructures.time_ball_tree('480km')
10.6±0.03ms 10.6±0.04ms 1 mpas_ocean.ConstructTreeStructures.time_kd_tree('120km')
711±10μs 724±10μs 1.02 mpas_ocean.ConstructTreeStructures.time_kd_tree('480km')
703±6ms 705±3ms 1 mpas_ocean.CrossSections.time_const_lat('120km', 1)
354±2ms 366±6ms 1.03 mpas_ocean.CrossSections.time_const_lat('120km', 2)
183±0.7ms 185±1ms 1.01 mpas_ocean.CrossSections.time_const_lat('120km', 4)
546±2ms 546±7ms 1 mpas_ocean.CrossSections.time_const_lat('480km', 1)
275±4ms 277±2ms 1.01 mpas_ocean.CrossSections.time_const_lat('480km', 2)
143±0.9ms 145±1ms 1.01 mpas_ocean.CrossSections.time_const_lat('480km', 4)
24.2±0.09ms 24.6±0.09ms 1.01 mpas_ocean.DualMesh.time_dual_mesh_construction('120km')
3.09±0.03ms 3.14±0.03ms 1.02 mpas_ocean.DualMesh.time_dual_mesh_construction('480km')
945±7ms 934±3ms 0.99 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', False)
51.0±0.7ms 51.0±0.6ms 1 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', True)
84.0±0.2ms 84.2±1ms 1 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', False)
5.84±0.1ms 5.69±0.2ms 0.97 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', True)
404M 404M 1 mpas_ocean.Gradient.peakmem_gradient('120km')
173±0.4ms 176±0.5ms 1.02 mpas_ocean.Gradient.time_gradient('120km')
12.5±0.1ms 12.2±0.08ms 0.98 mpas_ocean.Gradient.time_gradient('480km')
220±1μs 223±0.8μs 1.01 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('120km')
131±0.7μs 130±2μs 0.99 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('480km')
351M 351M 1 mpas_ocean.Integrate.peakmem_integrate('120km')
330M 330M 1 mpas_ocean.Integrate.peakmem_integrate('480km')
217±4μs 214±0.6μs 0.99 mpas_ocean.Integrate.time_integrate('120km')
197±0.9μs 196±0.4μs 1 mpas_ocean.Integrate.time_integrate('480km')
181±1ms 179±1ms 0.99 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'exclude')
178±0.8ms 182±1ms 1.02 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'include')
181±0.7ms 179±1ms 0.99 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'split')
13.7±0.2ms 13.8±0.08ms 1.01 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'exclude')
13.7±0.1ms 13.5±0.09ms 0.98 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'include')
13.5±0.05ms 13.4±0.1ms 0.99 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'split')
349±3μs 349±1μs 1 mpas_ocean.PointInPolygon.time_face_search_lonlat('120km')
346±3μs 356±5μs 1.03 mpas_ocean.PointInPolygon.time_face_search_lonlat('480km')
332±1μs 335±2μs 1.01 mpas_ocean.PointInPolygon.time_face_search_xyz('120km')
336±5μs 337±2μs 1 mpas_ocean.PointInPolygon.time_face_search_xyz('480km')
241±0.2ms 241±2ms 1 mpas_ocean.RemapDownsample.time_bilinear_remapping
297±2ms 299±4ms 1.01 mpas_ocean.RemapDownsample.time_inverse_distance_weighted_remapping
4.77±0.02ms 4.84±0.03ms 1.02 mpas_ocean.RemapDownsample.time_nearest_neighbor_remapping
1.43±0s 1.44±0.01s 1.01 mpas_ocean.RemapUpsample.time_bilinear_remapping
36.2±0.7ms 36.4±1ms 1.01 mpas_ocean.RemapUpsample.time_inverse_distance_weighted_remapping
9.47±0.2ms 9.54±0.05ms 1.01 mpas_ocean.RemapUpsample.time_nearest_neighbor_remapping
29.4±0.3ms 28.7±1ms 0.98 mpas_ocean.ZonalAverage.time_zonal_average('120km')
6.93±0.05ms 6.34±0.2ms 0.92 mpas_ocean.ZonalAverage.time_zonal_average('480km')
326M 328M 1.01 quad_hexagon.QuadHexagon.peakmem_open_dataset
326M 326M 1 quad_hexagon.QuadHexagon.peakmem_open_grid
7.16±0.2ms 7.33±0.3ms 1.02 quad_hexagon.QuadHexagon.time_open_dataset
5.96±0.09ms 6.49±0.4ms 1.09 quad_hexagon.QuadHexagon.time_open_grid

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for proposing and creating these additions to the docs pages! Overall, these all look like good changes which can help new users understand uxarray more easily.

I have a few miscellaneous questions / suggestions / requests:

  1. For the iso_grid.png, can the image be shrunk to be smaller without losing too much image quality? The docs are currently roughly 28 MB, so it's not a huge deal to add 1.5 MB, but if it wouldn't make the image too blurry it could be nice to reduce file size further.
  2. This phrasing was a bit confusing for me "Grid points store information about which faces, edges, and nodes they are connected to…" What are "grid points"? Additionally, it is not the grid points themselves which store such information, but rather the information is stored in the underlying uxarray.Grid object, if that makes sense?
  3. The unstructured_grid.png diagram bottom row was a bit confusing, in particular, why is there more empty space between hexagons there than above? In the structured_grid.png I can interpret the empty space between faces as being placed there for visual emphasis, to help talk about the different faces. I could interpret it that way for the unstructured_grid.png too if the empty space was consistent, but now that it is inconsistent I am not sure what to think.
  4. Optional suggestion: add a non-hexagon face in the unstructured_grid diagram to emphasize that "number of nodes per face" can also vary.
  5. Claims at the bottom of the new unstructured-grids.html about unstructured grids granting efficiency improvements are nice, and okay to move forward as-is, but may be more convincing with links to any relevant publications or resources providing direct evidence for unstructured grids' improvements over structured grids in practice. Maybe @erogluorhan and @rajeeja could provide suggestions about that?
  6. In data-structures.ipynb, maybe use the spelling "UxDataArray" instead of "Data Array"? Additionally, maybe edit the description of uxarray.UxDataArray to not call itself a data variable? It could say something like "A single array of data residing on the faces, nodes, or edges of a grid, along with the underlying Grid object."
  7. It looks like you tried to change the color for Yes and No cells in grid-formats.rst, but the tables still render with the same exact colors when I viewed them. Is this intentional?
  8. Can you explicitly clarify which changes solve which parts of issue #1582? For example, Point (2) of that issue refers to user-guide/representation, but I noticed none of the changes here touch that file. Is point (2) solved elsewhere, or still needs to be solved before that issue could be closed as completed?

@dylannelson

Copy link
Copy Markdown
Collaborator Author

@Sevans711 Good notes! And thank you for the through read!

  1. Good idea, I can compress it a bit and see how it looks, I'll include that next
  2. Yeah I struggled a bit when trying to find the best words to convey the ideas in a more approachable way as opposed to using too many terms. In retrospect "grid points" should likely be replaced by "Faces". For the 2nd point where data is stored, I was trying to visualize/explain it in a way that was more along the lines how objects in OOP and networks are explained/visualized. Like how each object has a set of variables, references, and properties that can be used to connect to others. I'll make a few revisions to make the distinction more clear
  3. @erogluorhan and I just talked about the graphs and I'll make a few tweaks regarding that and a few other things
  4. same as above
  5. Good idea for sure. If we could get some specific examples that would be great.
  6. I'll change it to UxDataArray. For the second suggestion, that sounds like it may be a bit hard to digest. That level of specificity may also be more valuable later on in the page where it goes into more detail here. I was trying to imagine it as how one might describe a series vs dataframe in pandas, where a Dataframe holds all your variables in your dataset, each in a Series, and each series is one individual variable. (Connecting the two definitions in an easy way when they are first introduced) This could make sense to people who only have excel experience, only understand what a dataset is, etc. And the more fine details come later on the page for those that need it
  7. It wasn't intentional, what's the best way to check how it rendered before pushing the changes? (the bot above made a link here. Is there anything you do to make a live preview? I have vscode extensions for live preview of html and markdown projects, but haven't tried with rst.
  8. I had been keeping track of all my changes and suggestions in a Doc outside of github as it got long and I wanted the extra formatting, and I let them get out of sync. I'll update both and send the doc to you directly

Use Cases
=========

Many kinds of unstructured grids can exist because of these features.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A main reason for unstructured grids is to avoid the singularity at the poles in a lat-lon grid.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. I'll definitely include that. Thank you!

@Sevans711

Copy link
Copy Markdown
Collaborator

Thank you for your detailed reply @dylannelson, the ideas here sound good, and I will take a closer look again once the changes are ready! In the meantime, following up on a few of those points:

  • (6) Avoiding being too specific too early definitely makes sense. Maybe worthwhile also to skim xarray's descriptions of DataArray and Dataset for clear/concise phrasing ideas? (Though, feel free to ignore it if it doesn't actually help).
  • (7) For a live preview, the easiest option is definitely to just click whatever link gets produced after you push them. Though, you could also consider installing sphinx and telling it to build the docs on your machine. If you end up trying that, let's message separately about it if you get stuck, and leave a note here afterwards to clarify the steps you used, for future reference to anyone else following this conversation.
  • (8) Sounds good! Just adding a quick note, even with updating the original issue and sending along the doc, I think my original comment here still stands, as it will be easier to review if you can describe at least one way in which each point from the original issue has been addressed.

@erogluorhan erogluorhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going great! I've added a few inline comments, and they refer to another document from our cookbooks. Once you review it, and if you want to modify anything in your comparison file here, once you're done with that, I can give another review on that file. Also:

  • If possible, add some randomness and break the symmetry in unstructured_grid.png‎, at least removing one of the two pentagons?

@@ -0,0 +1,124 @@
.. currentmodule:: uxarray

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this file from "Getting Started" to the first place of "User Guide" because the former is designed as a quick reference for getting the user to get going with UXarray, e.g. install & run it?


================================
Structured vs Unstructured Grids
================================

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this section and others in the rest of this file, you may want to check out this section from our UXarray Cookbook: https://projectpythia.org/unstructured-grid-viz-cookbook/notebooks/foundations/unstructured-grids/#structured-vs-unstructured-grids since a lot of text there can be reused here. However, it touched code etc. which may not be needed here.

================================

UXarray's ability to work on such a large variety of datasets and file formats
comes from its support for unstructured grids. Unstructured grids differ from

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first sentence feels a bit off-placed in this section. Maybe it can be replaced with something else that starts the actual subject of structured vs unstructured comparison?

For example, this is how the referenced cookbook above begins with: "Before diving into unstructured grids, it is helpful to understand the basic differences between structured and unstructured grids"

.. image:: ../_static/examples/grids/ocean.png
:width: 300
:align: center
:alt: An unstructured ocean grid with holes cut out over land regions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is being rendered too small in the doc:

Image

:width: 300
:align: center
:alt: A structured grid with a regular, matrix-like arrangement of cells

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is technically not false/impossible to define cells being centered on a particular (lon,lat) pair, grid cells in structured grids are defined with their boundary longitudes and latitudes as follows:

Image

So, rather than identifying cell centers with lon, lat pairs, maybe draw a diagram similar to the above but with only nine cells, tag the constant lon and lat lines instead of cell centers, and rephrase the text in this section accordingly?

navigated predictably because it follows a repeatable pattern.

Example
-------

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already a small section, maybe get rid of the "Example" title and just continue to the text and figure?

other faces to make connected faces. All the connected faces together make up the grid.

Example
-------

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, get rid of the "Example" title and provide the text directly?

Comment on lines +41 to +45

.. image:: ../_static/examples/grids/face_node_edge.png
:width: 300
:align: center
:alt: A visual of the components of a grid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to:

  • remove this figure (and corresponding text) from here, and
  • use a modification of unstructured_grid.png below where the geometric elements are visualized in the corresponding section in user_guide/terminology

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation run-benchmark Run ASV benchmark workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding beginner friendly explanations on the Docs

4 participants