Skip to content

Commit

Permalink
Wrap triangulate (#731)
Browse files Browse the repository at this point in the history
Wrapping the triangulate function which does
"Delaunay triangulation or Voronoi partitioning
and gridding of Cartesian data".
Original GMT documentation can be found at
https://docs.generic-mapping-tools.org/6.3/triangulate.html.

Aliased outgrid (G), spacing (I), projection (J),
region (R), verbose (V), registration (r).

* Refactor triangulate to use virtualfile_from_data
* Refactor triangulate implementation to use pygmt.io.load_dataarray
* Alias binary(b), nodata(d), find(e), coltypes(f), header(h), incols(i)

* Rename the parameter 'table' to 'data'

As per #1479.

* Refactor test_triangulate to use Table_5_11_mean.xyz instead of tut_ship
* Refactor test_triangulate_with_outgrid to use xr.testing.assert_allclose
* Refactor test_triangulate_input_xyz to use pd.testing.assert_frame_equal

* Implement regular_grid and delaunay_triples staticmethod for triangulate
* Let list inputs to spacing (I) and incols (i) work

Use  I="sequence" and i="sequence_comma".

* Ensure triangulate.delaunay_triples output_type is valid

Must be either one of numpy, pandas or file

* Autocorrect output_type to 'file' if outfile parameter is set
* Allow only str or None inputs to outgrid parameter

Xref #1807

* Use gmt get GMT_TRIANGULATE to check whether Watson or Shewchuk is used
* State that Shewchuk is the default triangulation algorithm

As per GenericMappingTools/gmt#6438

* Actually document the output_type parameter for delaunay_triples

Co-authored-by: Will Schlitzer <schlitzer90@gmail.com>
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
  • Loading branch information
4 people committed Mar 14, 2022
1 parent 0041492 commit ba51f80
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ Operations on tabular data
sphdistance
sphinterpolate
surface
triangulate
triangulate.regular_grid
triangulate.delaunay_triples
xyz2grd

Operations on raster data
Expand Down
1 change: 1 addition & 0 deletions pygmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
sphdistance,
sphinterpolate,
surface,
triangulate,
which,
x2sys_cross,
x2sys_init,
Expand Down
1 change: 1 addition & 0 deletions pygmt/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from pygmt.src.subplot import set_panel, subplot
from pygmt.src.surface import surface
from pygmt.src.text import text_ as text # "text" is an argument within "text_"
from pygmt.src.triangulate import triangulate
from pygmt.src.velo import velo
from pygmt.src.which import which
from pygmt.src.wiggle import wiggle
Expand Down
Loading

0 comments on commit ba51f80

Please sign in to comment.