GenericMappingTools / GenericMappingTools/pygmt
Add a tutorial explaining the generally accepted input types
- Dominant language
- Python
- Stars
- 874
- Forks
- 255
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 40
Description
_Inspired by PR #1186._
For GMT CLI, there are mainly two types of input: a table or a grid. PyGMT is more powerful and can accept more input types.
For a table input, PyGMT functions generally accept the following input types:
- a file name to a ASCII table, e.g., `data="input.dat"`
- a 2d numpy array, pandas.DataFrame, e.g., `data=data`
- a single value of int or float or str type to `x`,`y`, e.g., `x=5.0, y=5.0`
- a list to `x` and `y`, e.g., `x=[1.0, 2.0], y=[3.0, 4.0]`
- a 1d numpy array to `x` and `y`, e.g., `x=np.array([1.0, 2.0]), y=np.array([3.0, 4.0])`
- a [`geopandas.GeoDataFrame`](https://geopandas.org/docs/reference/api/geopandas.GeoDataFrame.html#geopandas.GeoDataFrame) (see #608 & #1000)
- an [`xarray.Dataset`](https://xarray.pydata.org/en/v0.19.0/generated/xarray.load_dataarray.html)
- `io.StringIO` (once #576 is done)
- more?
For a grid input, PyGMT functions generally accept the following input types:
- a file name to a grid file, e.g., `grid="input_grid.nc"`
- xarray.DataArray, e.g., `grid=grid`
- more?
Although these various input data types are already used in different tutorials and examples, I think it would be better to have a standalone tutorial, explaining these input types.
Contributor guide
Assessment
This issue has not been assessed yet.