API Reference¶
Plotting¶
All plotting is handled through the pygmt.Figure
class and its methods.
|
A GMT figure to handle all plotting. |
Plotting data and laying out the map:
|
Plot base maps and frames for the figure. |
|
Plot continents, shorelines, rivers, and borders on maps |
|
Plot a gray or color scale-bar on maps. |
|
Plot lines, polygons, and symbols in 2-D. |
|
Plot lines, polygons, and symbols in 3-D |
|
Contour table data by direct triangulation. |
|
Convert grids or images to contours and plot them on maps |
|
Project and plot grids or images. |
|
Create 3-D perspective image or surface mesh from a grid. |
|
Plot legends on maps. |
|
Plot the GMT logo. |
|
Place images or EPS files on maps. |
|
Shift plot origin in x and/or y directions. |
|
Plot or typeset text strings of variable size, font type, and orientation. |
|
Plot focal mechanisms. |
Color palette table generation:
|
Make GMT color palette tables. |
Saving and displaying the figure:
|
Save the figure to a file. |
|
Display a preview of the figure. |
|
Convert [E]PS file(s) to other formats. |
Data Processing¶
Operations on tabular data:
|
Block average (x,y,z) data tables by median estimation. |
|
Grids table data using adjustable tension continuous curvature splines. |
Operations on grids:
|
Extract subregion from a grid. |
|
Filter a grid in the space (or time) domain. |
|
Sample grids at specified (x,y) locations. |
Crossover analysis with x2sys:
|
Initialize a new x2sys track database. |
|
Calculate crossovers between track data files. |
Metadata¶
Getting metadata from tabular or grid data:
|
This is the GMT extension for |
|
Get information about data tables. |
|
Get information about a grid. |
Miscellaneous¶
|
Find the full path to specified files. |
|
Run the test suite. |
Print information about the GMT shared library that we can find. |
|
Prints various dependency versions useful when submitting bug reports. |
Datasets¶
PyGMT provides access to GMT’s datasets through the pygmt.datasets
package.
These functions will download the datasets automatically the first time they are used
and store them in the GMT cache folder.
|
Load Earth relief grids (topography and bathymetry) in various resolutions. |
Load a table of earthquakes around Japan as a pandas.Dataframe. |
|
Load a table of ocean ridge points for the entire world as a pandas.DataFrame. |
|
Load a table of ship observations of bathymetry off Baja California as a pandas.DataFrame. |
|
Load a table of global earthquakes form the USGS as a pandas.Dataframe. |
Exceptions¶
All custom exceptions are derived from pygmt.exceptions.GMTError
.
Base class for all GMT related errors. |
|
Raised when the input of a function/method is invalid. |
|
Raised when an incompatible version of GMT is being used. |
|
Unsupported operating system. |
|
Error encountered when running a function from the GMT shared library. |
|
Tried to access GMT API without a currently open GMT session. |
|
Could not find the GMT shared library. |
GMT C API¶
The pygmt.clib
package is a wrapper for the GMT C API built using ctypes
.
Most calls to the C API happen through the pygmt.clib.Session
class.
A GMT API session where most operations involving the C API happen. |
GMT modules are executed through
the call_module
method:
|
Call a GMT module with the given arguments. |
Passing memory blocks between Python variables (numpy.ndarray
,
pandas.Series
, and xarray.DataArray
) and GMT happens through virtual
files. These methods are context managers that automate the conversion of Python
variables to GMT virtual files:
Store a 2d array as a table inside a virtual file. |
|
|
Store 1d arrays as columns of a table inside a virtual file. |
Store a grid in a virtual file. |
Low level access (these are mostly used by the pygmt.clib
package):
|
Create a new GMT C API session. |
Destroy the currently open GMT API session. |
|
|
Get the value of a GMT constant (C enum) from gmt_resources.h |
Create a GMT API session and check the libgmt version. |
|
|
Destroy the currently open GMT API session. |
|
Get the value of a GMT default parameter (library version, paths, etc). |
|
Create an empty GMT data container. |
|
Attach a numpy 2D array to a GMT dataset. |
|
Attach a numpy 1D array as a column on a GMT dataset. |
|
Write a GMT data container to a file. |
|
Open a GMT Virtual File to pass data to and from a module. |
Extract the WESN bounding box of the currently active figure. |
|
|
Get a ctypes function from the libgmt shared library. |