NCAR / geocat-viz

GeoCAT-viz contains tools to help plot geoscience data, including convenience and plotting functions that are used to facilitate plotting geosciences data with Matplotlib, Cartopy, and other visualization packages.
https://geocat-viz.readthedocs.io
Other
48 stars 19 forks source link

Possible Testing Schemes #126

Closed jukent closed 3 months ago

jukent commented 1 year ago

Viz doesn't have many tests because the products are visually as expected or not, but how does matplotlib or cartopy have a testing scheme?

jukent commented 1 year ago

I think the first testing scheme we want to include is independent viz examples that build. First, let's take inventory of how many tests we need to add at minimum.

In util.py there are 16 different methods. In taylor.py there are 10 (external). I'll start with util.

Should these .py files formatted as in the geocat examples gallery or should they be notebooks? Removing upstream examples action, need to add infrastructure to build and add examples gallery to documentation (as done in comp).

jukent commented 1 year ago

Add example script to each function (divvy these up?):

Steps:

  1. Search geocat-examples for simple example of fx, par down even more
  2. Make .ipynb file for example
  3. Save thumbnail
  4. Add to docs/gallery.yml
  5. Add link to fx docstring under examples (before examples gallery examples) EX: ‘See this example notebook: :doc:../../examples/add_height_from_pressure_axis. More in-depth plotting examples that utilize this function are in the GeoCAT-Examples Gallery.’
  6. Add to examples.rst
jukent commented 1 year ago

Talked to @dcamron from Metpy about what they do. He directed me to their pizel-by-pixel testing using pytest-mpl, but indicated that they were unhappy with this scheme and didn't want us to get tangled up in it as they are investigating a better solution themselves. Still posting links here for now and will try to set up a meeting to learn about what it is they do not like about these tests.

https://github.com/Unidata/MetPy/blob/main/tests/plots/test_skewt.py https://github.com/Unidata/MetPy/tree/main/tests/plots/baseline

kafitzgerald commented 1 year ago

Maybe this belongs in a different issue, but I just noticed we're not actually building the docs in the nightly CI (which just failed, but because of a connectivity fluke). It would be nice to have some sort of tests run there.

We might also want to think about something a little more robust since a few things just got caught over on geocat-examples that probably should be failing over here as well (i.e. the matplotlib 3.8 API change and the problem with sphinx-book-theme and sphinx 7).

jukent commented 9 months ago

@kafitzgerald What is the status of truncate_colormap(), xr_add_cyclic_longitudes(), and set_map_boundary() examples?

kafitzgerald commented 9 months ago

All four w/ my initials are in progress. I got a bit hung up on how best to display the colormaps, but can get back to those this week and get them in.

jukent commented 9 months ago

I'll work on the skewT one this week.

jukent commented 8 months ago

Links to matplotlib's testing scheme, from our drop in on the new developers meeting:

They do test by comparing images. The most common unexpected failure trigger comes from the fonts changing They recently changed their testing scheme, and seems like they're still figuring it out to some extent

Seems like we could have a separate repo to not swamp this one down (or have it excluded from the __init___.py somehow that has images for every keyword argument entered into our functions that we can think of.