-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic support for grdimage with file input (#183)
Enable grdimage for file input. Passing in `xarray.DataArray` isn't working because of some bugs in the GMT C API. This will require some work on the GMT side before we can use it. Implement basic support for grdinfo as well for testing. Starts to implement #124
- Loading branch information
Showing
9 changed files
with
134 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Test Figure.grdimage | ||
""" | ||
import pytest | ||
import numpy as np | ||
|
||
from .. import Figure | ||
from ..exceptions import GMTInvalidInput | ||
from ..datasets import load_earth_relief | ||
|
||
|
||
@pytest.mark.mpl_image_compare | ||
def test_grdimage_file(): | ||
"Plot an image using file input" | ||
fig = Figure() | ||
fig.grdimage("@earth_relief_60m", cmap='ocean', region='-180/180/-70/70', | ||
projection='W0/10i', shading=True) | ||
return fig | ||
|
||
|
||
def test_grdimage_fails(): | ||
"Should fail for unrecognized input" | ||
fig = Figure() | ||
with pytest.raises(GMTInvalidInput): | ||
fig.grdimage(np.arange(20).reshape((4, 5))) | ||
grid = load_earth_relief() | ||
with pytest.raises(NotImplementedError): | ||
fig.grdimage(grid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters