GenericMappingTools / GenericMappingTools/pygmt
pygmt.sphdistance: data should be an optional parameter if voronoi is used
- Dominant language
- Python
- Stars
- 874
- Forks
- 255
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 40
Description
**Description of the problem**
pygmt.sphdistance will give a `GMTInvalidInput: No input data provided` error if `data`is not used. However, the purpose of the `voronoi` parameter is to allow precomputed Voronoi polygons to be provided instead of raw data. So, the `data` parameter should be made optional if `Voronoi` is set.
**Full code that generated the error**
precompute using gmt's sphtriangulate:
```bash
gmt sphtriangulate @gshhs_c.txt -Qv -D > tt.pol
```
```python
import pygmt
fig = pygmt.Figure()
grid = pygmt.sphdistance(voronoi="tt.pol", region="g", spacing=1, unit="k")
```
**Full error message**
```
67 """
68 if data is None and x is None and y is None:
---> 69 raise GMTInvalidInput("No input data provided.")
70 if data is not None and (x is not None or y is not None or z is not None):
71 raise GMTInvalidInput("Too much data. Use either data or x and y.")
GMTInvalidInput: No input data provided.
```
**System information**
Please paste the output of `python -c "import pygmt; pygmt.show_versions()"`:
```
pygmt: v0.5.0
gmt: 6.3.0
```
Contributor guide
Assessment
This issue has not been assessed yet.