Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Figure.grdimage tests to use dvc #1169

Merged
merged 8 commits into from
Apr 10, 2021
Merged

Migrate Figure.grdimage tests to use dvc #1169

merged 8 commits into from
Apr 10, 2021

Conversation

willschlitzer
Copy link
Contributor

Per #1131, this pull request moves reference images to use dvc and replaces tests that use @check_figures_equal. It also removes some tests, including those that use pytest.mark.parameterize to repeatedly pass different arguments to a test.

Description of proposed changes

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

… set one projection type and central meridian
@willschlitzer willschlitzer added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog labels Apr 3, 2021
@willschlitzer willschlitzer added this to the 0.4.0 milestone Apr 3, 2021
@pytest.mark.parametrize("lon0", [0, 123, 180])
@pytest.mark.parametrize("proj_type", ["H", "W"])
def test_grdimage_central_meridians(grid, proj_type, lon0):
def test_grdimage_central_meridians(grid):
Copy link
Member

Choose a reason for hiding this comment

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

Err, could you revert this change please. This parametrize test was set up explicitly at #560 (comment) to catch a bug (#390).

Copy link
Contributor Author

@willschlitzer willschlitzer Apr 3, 2021

Choose a reason for hiding this comment

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

Will do; I had just assumed it was repeatedly testing the same arguments. On that note, how should this handle a reference image then, since it produces 6 different images?

Also, why don't we test this on all plotting modules that have a projection parameter? I assume it's the same issue?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I would recommend to keep this test on @check_figures_equal for now because it's quite a serious bug we want resolved at some point (differences between plotting NetCDF and xarray grids should not exist).

Copy link
Contributor Author

@willschlitzer willschlitzer Apr 3, 2021

Choose a reason for hiding this comment

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

Sounds good. Should I leave the other tests that use the parameterize decorator with check_figures_equal as well?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, just for now please 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed (took me too long to realize there would be errors when I merged with GitHub)!

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2021

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added pygmt/tests/baseline/test_grdimage.png
added pygmt/tests/baseline/test_grdimage_file.png
added pygmt/tests/baseline/test_grdimage_over_dateline.png
added pygmt/tests/baseline/test_grdimage_slice.png

Image diff(s)

  • pygmt/tests/baseline/test_grdimage.png

  • pygmt/tests/baseline/test_grdimage_file.png

  • pygmt/tests/baseline/test_grdimage_over_dateline.png

  • pygmt/tests/baseline/test_grdimage_slice.png

Report last updated at commit 543c3b8

@willschlitzer willschlitzer changed the title WIP: Migrate fig.grdimage tests to use dvc Migrate fig.grdimage tests to use dvc Apr 4, 2021
@willschlitzer willschlitzer marked this pull request as ready for review April 4, 2021 08:06
@weiji14
Copy link
Member

weiji14 commented Apr 4, 2021

Let's hold on to this for a while @willschlitzer, there seems to be a bug at #1172 for both fig.grdimage and fig.grdview with plotting geographic grids. I'll re-mark it as draft for now.

@weiji14 weiji14 marked this pull request as draft April 4, 2021 21:17
@willschlitzer
Copy link
Contributor Author

Let's hold on to this for a while @willschlitzer, there seems to be a bug at #1172 for both fig.grdimage and fig.grdview with plotting geographic grids. I'll re-mark it as draft for now.

@weiji14 It looks like the upstream bug has been fixed, according to the comment from @seisman. Should I mark this as ready for review, or are we still waiting on additional changes?

@weiji14
Copy link
Member

weiji14 commented Apr 8, 2021

Let's hold on to this for a while @willschlitzer, there seems to be a bug at #1172 for both fig.grdimage and fig.grdview with plotting geographic grids. I'll re-mark it as draft for now.

@weiji14 It looks like the upstream bug has been fixed, according to the comment from @seisman. Should I mark this as ready for review, or are we still waiting on additional changes?

The question is, do we want to 1) store these 'incorrect' GMT 6.1.1 images now, or 2) wait for GMT 6.2.0rc1 to come out and use that to create the 'correct' grdimage test images.

@willschlitzer
Copy link
Contributor Author

willschlitzer commented Apr 9, 2021

Let's hold on to this for a while @willschlitzer, there seems to be a bug at #1172 for both fig.grdimage and fig.grdview with plotting geographic grids. I'll re-mark it as draft for now.

@weiji14 It looks like the upstream bug has been fixed, according to the comment from @seisman. Should I mark this as ready for review, or are we still waiting on additional changes?

The question is, do we want to 1) store these 'incorrect' GMT 6.1.1 images now, or 2) wait for GMT 6.2.0rc1 to come out and use that to create the 'correct' grdimage test images.

I'll defer to you on this one. In my opinion (which I don't feel strongly about), this test should be merged as the reference images are "wrong" because of a GMT problem, not a PyGMT one. Since, as I understand it, we'll have to update most of our reference images when we switch to GMT 6.2, I figure we can update the grdimage and grdview images then, along with the other tests that are affected by GMT themes.

Side note: How will testing using reference images work if we're still on PyGMT v0.3.1, as we'll want to be be testing our compatibility with both GMT 6.1.1 and GMT 6.2 that may produce different images from each other, but only have a single reference image per test?

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

The question is, do we want to 1) store these 'incorrect' GMT 6.1.1 images now, or 2) wait for GMT 6.2.0rc1 to come out and use that to create the 'correct' grdimage test images.

I'll defer to you on this one. In my opinion (which I don't feel strongly about), this test should be merged as the reference images are "wrong" because of a GMT problem, not a PyGMT one. Since, as I understand it, we'll have to update most of our reference images when we switch to GMT 6.2, I figure we can update the grdimage and grdview images then, along with the other tests that are affected by GMT themes.

Ok, let's merge this in then, and we can update the baseline images when GMT 6.2.0 is out (the GMT 6.2.0rc1 release should be close 🤞). The grdview test migration to dvc doesn't quite work but that's not relevant to this PR.

Side note: How will testing using reference images work if we're still on PyGMT v0.3.1, as we'll want to be be testing our compatibility with both GMT 6.1.1 and GMT 6.2 that may produce different images from each other, but only have a single reference image per test?

Well, I'd like to think that PyGMT v0.3.1 should work with GMT 6.2.0 for 99% of use cases, and if it doesn't, people should just upgrade to GMT 6.2.0 👿. By 'work', I mean run without crashing, not that the exact same figure is produced (a user won't typically care if their image is a few pixels different between versions). Yes, in a perfect world, we would have a matrix build with GMT 6.1.1 and GMT 6.2.0, and baseline images being pulled from the DVC remote matching these 2 versions, but that's a lot of work to maintain.

Anyways, LGTM!

@weiji14 weiji14 marked this pull request as ready for review April 10, 2021 03:24
@seisman
Copy link
Member

seisman commented Apr 10, 2021

The upstream bug #1172 should not affect these images, because these tests all explicitly specify geographic projections.

@willschlitzer
Copy link
Contributor Author

Anyways, LGTM!

Felt particularly old when I had to look up what "LGTM" means.

@weiji14
Copy link
Member

weiji14 commented Apr 10, 2021

Anyways, LGTM!

Felt particularly old when I had to look up what "LGTM" means.

I like to think of it as "Let's get this merged" 🔀 Wait until you try looking up GMT.

@willschlitzer
Copy link
Contributor Author

willschlitzer commented Apr 10, 2021

Anyways, LGTM!

Felt particularly old when I had to look up what "LGTM" means.

I like to think of it as "Let's get this merged" 🔀 Wait until you try looking up GMT.

The internet told me it was "looks good to me" which works too!

Definitely have typed in GMT to Google and realized it most certainly wasn't the GMT I was looking for 😂

@seisman seisman changed the title Migrate fig.grdimage tests to use dvc Migrate Figure.grdimage tests to use dvc Apr 10, 2021
@seisman seisman merged commit 82ebbbc into master Apr 10, 2021
@seisman seisman deleted the test-grdimage-dvc branch April 10, 2021 17:45
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants