Open maxrjones opened 2 years ago
This issue comes from data_kind
in utils.py
. I'm don't know how Voronoi polygons would be used in place of data, but would the easiest solution be to replace data
with the string passed to voronoi
? Otherwise, I would assume we would need to add a sphdistance-specific if
statement and pass voronoi
to build_arg_string
.
This issue comes from
data_kind
inutils.py
. I'm don't know how Voronoi polygons would be used in place of data, but would the easiest solution be to replacedata
with the string passed tovoronoi
? Otherwise, I would assume we would need to add a sphdistance-specificif
statement and passvoronoi
tobuild_arg_string
.
If tabular data is provided to sphdistance
, the module will first compute the Voronoi polygons which are used to compute distances for each node in a grid. If you want to do this for multiple grids, it can get quite slow. One can skip the compute polygons step (the most time consuming step) by instead providing the polygons to -Q in GMT (voronoi
in PyGMT). This is done by calling sphtriangulate before sphdistance to compute the polygons(e.g., example 2 versus example 3 in https://docs.generic-mapping-tools.org/dev/sphdistance.html#examples).
Since this feature is so closely tied to sphtriangulate, it might be worth drafting out the implementation of that module to make sure there are no unforeseen consequences of the bug fix for the voronoi parameter. I think your suggestion would work for passing file names, but eventually it would be nice to have sphtriangulate return an in-memory object which could be passed to sphdistance. I'm not sure whether it would work for that case.
Description of the problem
pygmt.sphdistance will give a
GMTInvalidInput: No input data provided
error ifdata
is not used. However, the purpose of thevoronoi
parameter is to allow precomputed Voronoi polygons to be provided instead of raw data. So, thedata
parameter should be made optional ifVoronoi
is set.Full code that generated the error
precompute using gmt's sphtriangulate:
Full error message
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
: