You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'd like to help implement the surface function which "Grids table data using adjustable tension continuous curvature splines". There's a lot of plotting related functionality in gmt-python now, but there's more to GMT than that! Basically, this feature request aims to bring some data processing functionality into gmt-python.
The surface function is actually just one small part of the 'Gridding of Data Tables' family of functions in GMT (see module quickref), but I'd like to start with surface because 1) It appears to be a common gridding function (there's a tutorial for it) and 2) I'm using it.
Things to keep in mind:
Some future proofing necessary. The code will be eventually be shared with other grid functions like nearneighbor, sphinterpolate, etc.
Agree on some aliases first with Easier to read aliases in docstrings #79 (Easier to read aliases in docstrings) (see also List of GMT aliases #48). Minimum required argument for surface is -G output file name, -l grid spacing and -R region of interest.
Store the surface function in a Gridding class under gridding.py. Similar to how e.g. psconvert is in the Figure class under figure.py. This means we can store future gridding functions like nearneighbor in the same place.
# File at gmt/gridding.py"""Define the Gridding class that handles all gridding."""classGridding:
defsurface(x=None, y=None, z=None, data=None, **kwargs):
raiseNotImplementedError("GMT gridding surface")
This is my initial stab at a test case file. Loosely based on the following bash code used in the tutorial.
Initial commit for GenericMappingTools#243. Implement GMT surface function under gridding.py. Test cases checking file/matrix/vectors type inputs stored in test_surface.py. Sample dataset for tests uses newly created load_tut_ship function in datasets/tutorial.py.
Note that original GMT surface module https://gmt.soest.hawaii.edu/doc/latest/surface.html requires a -Goutputfile.nc parameter. Here, the implementation of surface does not respect this -G parameter properly. Instead, it stores the output file to a GMTTempFile and returns an xarray.Dataset in Python.
surface is a module for gridding using splines in tension.
Adds a `surface` function that does the gridding.
Add a `datasets.load_sample_bathymetry` function to get an example
data for testing.
Output is directed to a temporary file which is then loaded with xarray.
Fixes#243
Description of the desired feature
Hi there, I'd like to help implement the
surface
function which "Grids table data using adjustable tension continuous curvature splines". There's a lot of plotting related functionality in gmt-python now, but there's more to GMT than that! Basically, this feature request aims to bring some data processing functionality into gmt-python.The
surface
function is actually just one small part of the 'Gridding of Data Tables' family of functions in GMT (see module quickref), but I'd like to start withsurface
because 1) It appears to be a common gridding function (there's a tutorial for it) and 2) I'm using it.Things to keep in mind:
nearneighbor
,sphinterpolate
, etc.surface
is-G
output file name,-l
grid spacing and-R
region of interest.@tut_ship.xyz
used in the 'Gridding of arbitrarily spaced data' tutorial.Idea for structure:
Store the
surface
function in aGridding
class undergridding.py
. Similar to how e.g.psconvert
is in the Figure class underfigure.py
. This means we can store future gridding functions likenearneighbor
in the same place.This is my initial stab at a test case file. Loosely based on the following bash code used in the tutorial.
gmt blockmedian -R245/255/20/30 -I5m -V @tut_ship.xyz > ship_5m.xyz gmt surface ship_5m.xyz -R245/255/20/30 -I5m -Gship.nc -V
I've actually got some boilerplate code ready on my fork. Just wanting to get the green light and check if I've missed out on any important details.
Are you willing to help implement and maintain this feature? Yes!
The text was updated successfully, but these errors were encountered: