-
Notifications
You must be signed in to change notification settings - Fork 232
Complete documentation of grdimage #620
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 15 commits
b47ab35
4c352c0
b7029c5
14ba332
740c980
4584c32
4c1fcb2
d2b6997
42e2b28
8817749
581968a
a0771e6
8ad8d7c
3b14a0e
ccf6c1d
924e5a8
6f0c34a
6b6e63a
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -318,24 +318,59 @@ def grdcontour(self, grid, **kwargs): | |||||||||||||
|
||||||||||||||
@fmt_docstring | ||||||||||||||
@use_alias( | ||||||||||||||
R="region", | ||||||||||||||
J="projection", | ||||||||||||||
W="pen", | ||||||||||||||
A="img_out", | ||||||||||||||
B="frame", | ||||||||||||||
I="shading", | ||||||||||||||
C="cmap", | ||||||||||||||
D="img_in", | ||||||||||||||
E="dpi", | ||||||||||||||
G="bit_color", | ||||||||||||||
I="shading", | ||||||||||||||
J="projection", | ||||||||||||||
M="monochrome", | ||||||||||||||
N="no_clip", | ||||||||||||||
Q="nan_transparent", | ||||||||||||||
R="region", | ||||||||||||||
U="timestamp", | ||||||||||||||
V="verbose", | ||||||||||||||
X="xshift", | ||||||||||||||
Y="yshift", | ||||||||||||||
n="interpolation", | ||||||||||||||
p="perspective", | ||||||||||||||
t="transparency", | ||||||||||||||
x="cores", | ||||||||||||||
) | ||||||||||||||
@kwargs_to_strings(R="sequence", p="sequence") | ||||||||||||||
def grdimage(self, grid, **kwargs): | ||||||||||||||
""" | ||||||||||||||
Project grids or images and plot them on maps. | ||||||||||||||
|
||||||||||||||
Takes a grid file name or an xarray.DataArray object as input. | ||||||||||||||
Project and plot grids or images. | ||||||||||||||
|
||||||||||||||
Reads a 2-D grid file and produces a gray-shaded (or colored) map by | ||||||||||||||
building a rectangular image and assigning pixels a gray-shade (or | ||||||||||||||
color) based on the z-value and the CPT file. Optionally, illumination | ||||||||||||||
may be added by providing a file with intensities in the (-1,+1) range | ||||||||||||||
or instructions to derive intensities from the input data grid. Values | ||||||||||||||
outside this range will be clipped. Such intensity files can be created | ||||||||||||||
from the grid using `grdgradient` and, optionally, modified by | ||||||||||||||
`grdmath` or `grdhisteq`. A third alternative is available when GMT is | ||||||||||||||
build with GDAL support. Pass **image** which can be an image file | ||||||||||||||
(geo-referenced or not). In this case the image can optionally be | ||||||||||||||
|
`grdmath` or `grdhisteq`. A third alternative is available when GMT is | |
build with GDAL support. Pass **image** which can be an image file | |
(geo-referenced or not). In this case the image can optionally be | |
`grdmath` or `grdhisteq`. A third alternative is available when GMT is | |
build with GDAL support. Pass **image** which can be an image file | |
(geo-referenced or not). In this case the image can optionally be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that this could be worded better, currently it's just copied from upstream GMT at https://github.com/GenericMappingTools/gmt/blob/8c0b548e52938f91bfb15f47f27d023488003ef8/doc/rst/source/grdimage_common.rst_#L14-L16. Maybe we should take out the grdgradient
, grdmath
and grdhisteq
parts since they're not wrapped in PyGMT yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid we may forget to add them back when the wrappers are available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe keep them for now, better to over-document than not. Doubt we'll see grdmath
anytime soon (who uses Reverse Polish notation?!!), but grdgradient
would definitely come, and grdhisteq
will be a nice one for stretching colormaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about taking out this sentence about image, related to the change at https://github.com/GenericMappingTools/pygmt/pull/620/files#r492612750.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about taking out this sentence about image, related to the change at https://github.com/GenericMappingTools/pygmt/pull/620/files#r492612750.
The changes are big. It's unclear to me what you mean by "taking out this sentence about image"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, wrong link. Should be #620 (comment). The part where we took out grid | image
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to take out grid | image
is, it's a little unclear what grid | image
means, and for the grid
argument, we already mention that grid
could be a image:
The file name or a DataArray containing the input 2-D gridded data set or image to be plotted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, agree that taking grid | image
is ok. But would this lead to confusion about this sentence:
Pass **image** which can be an image file
(geo-referenced or not). In this case the image can optionally be
illuminated with the file provided via the *shading* option. Here, if
image has no coordinates then those of the intensity file will be used.
I suppose we could just keep it to keep it in line with upstream GMT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I said these sentences don't read well in #620 (comment).
Perhaps we can change:
A third alternative is available when GMT is build with GDAL support. Pass image which can be an image file (geo-referenced or not). In this case the image can optionally be illuminated with the file provided via the -I option. Here, if image has no coordinates then those of the intensity file will be used.
to
If GMT is built with GDAL support, grid can be an image file (geo-referenced or not). In this case the image can optionally be illuminated with the file provided via the -I option. Here, if image has no coordinates then those of the intensity file will be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough (mentioning that image can be used with GDAL support). I'll commit the change.
Uh oh!
There was an error while loading. Please reload this page.