Merged
Conversation
Initial commit for wrapping the grdview function raised at #328, to be implemented under base_plotting.py alongside the other mapping related stuff. Original GMT `grdview` documentation can be found at https://docs.generic-mapping-tools.org/latest/grdview.html. Storing sample test cases under test_grdview.py. Current implementation takes in a reliefgrid either as a filename or xarray.DataArray. Aliased the 'required' arguments 'Jz' to 'zscale' and 'JZ' to 'zsize' (similar to GMT julia wrappper). Also aliased 'p' to 'perspective' (as is standard in upstream GMT) so that we can have some 3D test plots to compare against, instead of just some flat (birds-eye view) maps.
Giving our grdview wrapper the ability to color plots! The cmap (C) parameter (which stands for colormap) should be straightforward, while the surftype (Q) parameter is a little bit more complicated. Some more tests added to check that we can indeed produce colored perspective-view plots.
Included test for setting a plain z-axis plane at a fixed height, and a test for colouring the frontal facade too.
afc56c2 to
78a6205
Compare
Included test to check that plotting a vertical z-axis frame works.
Plus add test examples ensuring the different pens work.
Included one test for a valid (xarray.DataArray) drapegrid input, and one test for an invalid input. Also using contextlib.ExitStack() as we have more than one file_context (one for reliefgrid, one for drapegrid) to enter and exit properly (see https://stackoverflow.com/questions/3024925/create-a-with-block-on-several-context-managers).
5 tasks
This was referenced Nov 8, 2019
Member
Author
|
Ready for review. I've updated the docstrings to conform to the new 79 char length standard and make it look nicer with napolean sphinx. Rendered docs at https://pygmt-38g8s97im.now.sh/api/generated/pygmt.Figure.grdview.html#pygmt.Figure.grdview. |
Refresh baseline plots to use SRTM15+V2.1 grids as per #401. Ran `pytest --mpl-generate-path=baseline pygmt/tests/test_grdview.py` to generate the png images.
leouieda
approved these changes
Mar 26, 2020
Member
leouieda
left a comment
There was a problem hiding this comment.
Many thanks for keeping this going! Looks good to me. Just one minor suggestion to be consistent with the other methods.
To be consistent with the other `grd...` functions.
Closed
26 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
Wrapping the
grdviewfunction!Also taking a cue from the Julia wrapper/implementation at https://www.generic-mapping-tools.org/GMT.jl/latest/#GMT.grdview and GenericMappingTools/GMT.jl#218.
Parameters/Aliases to wrap:
...
Fixes #328
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.