Skip to content

Commit 4584c32

Browse files
committed
Alias img_out (A) and img_in (D) for grdimage
1 parent 740c980 commit 4584c32

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pygmt/base_plotting.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,10 @@ def grdcontour(self, grid, **kwargs):
303303

304304
@fmt_docstring
305305
@use_alias(
306+
A="img_out",
306307
B="frame",
307308
C="cmap",
309+
D="img_in",
308310
E="dpi",
309311
I="shading",
310312
J="projection",
@@ -360,8 +362,36 @@ def grdimage(self, grid, **kwargs):
360362
----------
361363
grid : str or xarray.DataArray
362364
The file name of the input grid or the grid loaded as a DataArray.
365+
img_out : str
366+
``out_img[=driver]``.
367+
Save an image in a raster format instead of PostScript. Use
368+
extension .ppm for a Portable Pixel Map format which is the only
369+
raster format GMT can natively write. For GMT installations
370+
configured with GDAL support there are more choices: Append
371+
*out_img* to select the image file name and extension. If the
372+
extension is one of .bmp, .gif, .jpg, .png, or .tif then no driver
373+
information is required. For other output formats you must append
374+
the required GDAL driver. The driver is the driver code name used
375+
by GDAL; see your GDAL installation's documentation for available
376+
drivers. Append a **+coptions** string where options is a list of
377+
one or more concatenated number of GDAL **-co** options. For
378+
example, to write a GeoPDF with the TerraGo format use
379+
``=PDF+cGEO_ENCODING=OGC_BP``. Notes: (1) If a tiff file (.tif) is
380+
selected then we will write a GeoTiff image if the GMT projection
381+
syntax translates into a PROJ syntax, otherwise a plain tiff file
382+
is produced. (2) Any vector elements will be lost.
363383
{B}
364384
{CPT}
385+
img_in : str
386+
``[r]``
387+
GMT will automatically detect standard image files (Geotiff, TIFF,
388+
JPG, PNG, GIF, etc.) and will read those via GDAL. For very obscure
389+
image formats you may need to explicitly set **img_in**, which
390+
specifies that the grid is in fact an image file to be read via
391+
GDAL. Append **r** to assign the region specified by **region**
392+
to the image. For example, if you have used ``region='d'`` then the
393+
image will be assigned a global domain. This mode allows you to
394+
project a raw image (an image without referencing coordinates).
365395
dpi : int
366396
``[i|dpi]``.
367397
Sets the resolution of the projected grid that will be created if a

0 commit comments

Comments
 (0)