-
Notifications
You must be signed in to change notification settings - Fork 235
Ensure plotting xarray grids with different central meridians work on some projections #560
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
Changes from 17 commits
d4282d0
d6ce55e
a302be6
d1f7df6
1caaac4
840fe6b
0d702fd
b83ddbf
e7e51f3
af0cc0a
c26d7a2
4d7d545
ad432e5
0134272
f228e5c
406f847
b3e063a
8f14fe2
0516b06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,12 +114,40 @@ def test_grdimage_over_dateline(xrgrid): | |||||||
|
|
||||||||
|
|
||||||||
| @check_figures_equal() | ||||||||
| def test_grdimage_central_longitude(grid): | ||||||||
| @pytest.mark.parametrize("lon0", [0, 123, 180]) | ||||||||
| @pytest.mark.parametrize("proj_type", ["H", "W"]) | ||||||||
| def test_grdimage_central_meridians(grid, proj_type, lon0): | ||||||||
| """ | ||||||||
| Test that plotting a grid centred at different longitudes/meridians work. | ||||||||
| Test that plotting a grid with different central meridians (lon0) using | ||||||||
| Hammer (H) and Mollweide (W) projection systems work. | ||||||||
| """ | ||||||||
| fig_ref = Figure() | ||||||||
| fig_ref.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo") | ||||||||
| fig_ref.grdimage( | ||||||||
| "@earth_relief_01d_g", projection=f"{proj_type}{lon0}/15c", cmap="geo" | ||||||||
| ) | ||||||||
| fig_test = Figure() | ||||||||
| fig_test.grdimage(grid, projection=f"{proj_type}{lon0}/15c", cmap="geo") | ||||||||
| return fig_ref, fig_test | ||||||||
|
|
||||||||
|
|
||||||||
| # Cylindrical Equidistant (Q) projections plotted with xarray and NetCDF grids | ||||||||
| # are still slightly different with an RMS error of 25, see issue at | ||||||||
| # https://github.com/GenericMappingTools/pygmt/issues/390 | ||||||||
| # TO-DO remove tol=1.5 and pytest.mark.xfail once bug is solved in upstream GMT | ||||||||
| @check_figures_equal(tol=1.5) | ||||||||
| @pytest.mark.parametrize("lat0", [0, 30]) | ||||||||
| @pytest.mark.parametrize("lon0", [0, 123, 180]) | ||||||||
| @pytest.mark.parametrize("proj_type", [pytest.param("Q", marks=pytest.mark.xfail), "S"]) | ||||||||
| def test_grdimage_central_meridians_and_standard_parallels(grid, proj_type, lon0, lat0): | ||||||||
|
Comment on lines
+132
to
+140
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using Also, I've set the RMS tolerance to 1.5 to allow the General Stereographic (S) projection tests to pass, for reference, here are the plot diffs (along the Greenwich Meridian):
|
||||||||
| """ | ||||||||
| Test that plotting a grid with different central meridians (lon0) and | ||||||||
| standard_parallels (lat0) using Cylindrical Equidistant (Q) and General | ||||||||
| Stereographic (S) projection systems work. | ||||||||
| """ | ||||||||
| fig_ref = Figure() | ||||||||
| fig_ref.grdimage( | ||||||||
| "@earth_relief_01d_g", projection=f"{proj_type}{lon0}/{lat0}/15c", cmap="geo" | ||||||||
| ) | ||||||||
| fig_test = Figure() | ||||||||
seisman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| fig_test.grdimage(grid, projection="W120/15c", cmap="geo") | ||||||||
| fig_test.grdimage(grid, projection=f"{proj_type}{lon0}/{lat0}/15c", cmap="geo") | ||||||||
| return fig_ref, fig_test | ||||||||



Uh oh!
There was an error while loading. Please reload this page.