Skip to content

Change test_makecpt.py to use colorbar instead of grdimage #1748

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

Merged
merged 13 commits into from
Feb 26, 2022

Conversation

willschlitzer
Copy link
Contributor

This modifies test_makecpt.py to use load_static_earth_relief.

Addresses #1684

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 wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • 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

@willschlitzer willschlitzer added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog labels Feb 12, 2022
@willschlitzer willschlitzer added this to the 0.6.0 milestone Feb 12, 2022
@willschlitzer willschlitzer self-assigned this Feb 12, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2022

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_makecpt_plot_colorbar.png
added pygmt/tests/baseline/test_makecpt_plot_colorbar_scaled_with_series.png
deleted pygmt/tests/baseline/test_makecpt_plot_grid.png
deleted pygmt/tests/baseline/test_makecpt_plot_grid_scaled_with_series.png
modified pygmt/tests/baseline/test_makecpt_categorical.png
modified pygmt/tests/baseline/test_makecpt_continuous.png
modified pygmt/tests/baseline/test_makecpt_cyclic.png
modified pygmt/tests/baseline/test_makecpt_plot_points.png
modified pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png
modified pygmt/tests/baseline/test_makecpt_reverse_color_only.png
modified pygmt/tests/baseline/test_makecpt_truncated_zlow_zhigh.png

Image diff(s)

Added images

  • pygmt/tests/baseline/test_makecpt_plot_colorbar.png

  • pygmt/tests/baseline/test_makecpt_plot_colorbar_scaled_with_series.png

Modified images

Path Old New
test_makecpt_categorical.png
test_makecpt_continuous.png
test_makecpt_cyclic.png
test_makecpt_plot_points.png
test_makecpt_reverse_color_and_zsign.png
test_makecpt_reverse_color_only.png
test_makecpt_truncated_zlow_zhigh.png

Report last updated at commit 6394922

@seisman
Copy link
Member

seisman commented Feb 13, 2022

In most tests, we call makecpt to create a CPT file and call grdimage to plot the earth relief grid. I feel it's very difficult to verify if the grid image is correct or not.

Why not just call colorbar to plot the color bar instead? It's more intuitive to see if the plotted color bar matches the makecpt command.

@seisman
Copy link
Member

seisman commented Feb 13, 2022

BTW, please change the PR title to "Change test_xxxx.py to use static_earth_relief".

@willschlitzer willschlitzer changed the title Add static_earth_relief to makecpt tests Change test_makecpt.py to use static_earth_relief Feb 13, 2022
Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Looks good after removing the region pytest fixture.

@maxrjones
Copy link
Member

Looks good after removing the region pytest fixture.

Actually, I just noticed that this is used in test_makecpt_plot_points, but region does not need to be a fixture anymore because it is only used once. I recommend removing the fixture and just setting the region using a list in the region argument for plot.

@seisman
Copy link
Member

seisman commented Feb 23, 2022

@willschlitzer Still need to upload the new images to dvc, because names of these images have been changed in your last commit.

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Thanks for updating these tests. I still would prefer if fixture_region() were removed and test_makecpt_plot_points() used a list as the argument type for region, but it is only a suggestion.

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.

Recommend modifying the PR title to say something like "Change test_makecpt.py to use colorbar instead of grdimage", since static_earth_relief isn't actually being used. Oh, and I second Meghan's suggestion to remove fixture_region if possible.

@willschlitzer willschlitzer changed the title Change test_makecpt.py to use static_earth_relief Change test_makecpt.py to use colorbar instead of grdimage Feb 24, 2022
Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

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

Looks good to me after this minor fix.

@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Feb 25, 2022
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.

Nice work!

@seisman seisman merged commit ab23aa8 into main Feb 26, 2022
@seisman seisman deleted the static-earth-relief/makecpt branch February 26, 2022 07:11
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Feb 26, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
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.

4 participants