pygmt.triangulate: Refactor to use codes consistent with other wrappers #3073
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
The
triangulate
module was first wrapped in PR #731. As mentioned in PR #731:So, in PR #731, a private function
_triangulate
was implemented and was internally called bytriangulate.delaunay_triples
/triangulate.regular_grid
.Such an implementation has some limitations:
_triangulate
function is complicated because it needs to deal with both table and grid outputs._triangulate
function doesn't have to have docstrings)triangulate.delaunay_triples
/triangulate.regular_grid
, we have to call the private function like:triangulate.delaunay_triples
/triangulate.regular_grid
documentation (as reported in No aliases lists given in docs for some functions or methods #2185)This PR refactors the
triangulate
wrapper by removing the private_triangulate
function. The most obvious benefits of the new implementation are that:triangulate.delaunay_triples
method have codes that look like any table-ouput wrappers (e.g.,filter1d
)triangulate.regular_grid
method has codes that look like any grid-output wrappers (e.g.,grd2xyz
)Thus, the new implementation is much easier to maintain and also make it easier to refactor in PR #2729.
Preview: