From 52fae640f46008e6c2e9aaa35ff7b5919278d699 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 10 Aug 2021 21:17:27 +0100 Subject: [PATCH 01/20] wrap sph2grd --- pygmt/__init__.py | 1 + pygmt/src/__init__.py | 1 + pygmt/src/sph2grd.py | 69 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 pygmt/src/sph2grd.py diff --git a/pygmt/__init__.py b/pygmt/__init__.py index 25ad96a2127..c6c729df64d 100644 --- a/pygmt/__init__.py +++ b/pygmt/__init__.py @@ -44,6 +44,7 @@ grdtrack, info, makecpt, + sph2grd, surface, which, x2sys_cross, diff --git a/pygmt/src/__init__.py b/pygmt/src/__init__.py index 2e1f8b56186..ad730453ed1 100644 --- a/pygmt/src/__init__.py +++ b/pygmt/src/__init__.py @@ -33,6 +33,7 @@ from pygmt.src.plot import plot from pygmt.src.plot3d import plot3d from pygmt.src.rose import rose +from pygmt.src.sph2grd import sph2grd from pygmt.src.solar import solar from pygmt.src.subplot import set_panel, subplot from pygmt.src.surface import surface diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py new file mode 100644 index 00000000000..bc0c7ab0fda --- /dev/null +++ b/pygmt/src/sph2grd.py @@ -0,0 +1,69 @@ +""" +sph2grd - Compute grid from spherical harmonic coefficients +""" +import xarray as xr +from pygmt.clib import Session +from pygmt.exceptions import GMTInvalidInput +from pygmt.helpers import ( + GMTTempFile, + build_arg_string, + fmt_docstring, + kwargs_to_strings, + use_alias, +) + + +@fmt_docstring +@use_alias( + G="outgrid", + I="increment", + R="region", + V="verbose", +) +@kwargs_to_strings(I="sequence", R="sequence") +def sph2grd(table, **kwargs): + r""" + Create spherical grid files in tension of data. + + Reads a spherical harmonics coefficient table with records of L, M, + C[L,M], S[L,M] and evaluates the spherical harmonic model on the + specified grid. + + {aliases} + + Parameters + ---------- + outgrid : str or None + The name of the output netCDF file with extension .nc to store the grid + in. + {I} + {R} + {V} + + Returns + ------- + ret: xarray.DataArray or None + Return type depends on whether the ``outgrid`` parameter is set: + - :class:`xarray.DataArray` if ``outgrid`` is not set + - None if ``outgrid`` is set (grid output will be stored in file set by + ``outgrid``) + """ + with GMTTempFile(suffix=".nc") as tmpfile: + with Session() as lib: + file_context = lib.virtualfile_from_data(check_kind="vector", data=table) + with file_context as infile: + if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile + kwargs.update({"G": tmpfile.name}) + outgrid = kwargs["G"] + arg_str = build_arg_string(kwargs) + arg_str = " ".join([infile, arg_str]) + lib.call_module("sph2grd", arg_str) + + if outgrid == tmpfile.name: # if user did not set outgrid, return DataArray + with xr.open_dataarray(outgrid) as dataarray: + result = dataarray.load() + _ = result.gmt # load GMTDataArray accessor information + else: + result = None # if user sets an outgrid, return None + + return result From e87afc92da91f6d4c63c64893e8b3812d70dde38 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 10 Aug 2021 21:34:32 +0100 Subject: [PATCH 02/20] add test_sph2grd.py --- pygmt/tests/test_sph2grd.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 pygmt/tests/test_sph2grd.py diff --git a/pygmt/tests/test_sph2grd.py b/pygmt/tests/test_sph2grd.py new file mode 100644 index 00000000000..d06afa59be6 --- /dev/null +++ b/pygmt/tests/test_sph2grd.py @@ -0,0 +1,37 @@ +""" +Tests for sph2grd. +""" +import os + +import numpy.testing as npt +from pygmt import grdinfo, sph2grd +from pygmt.helpers import GMTTempFile + + +def test_sph2grd_outgrid(): + """ + Test sph2grd with a set outgrid. + """ + with GMTTempFile(suffix=".nc") as tmpfile: + result = sph2grd( + table="@EGM96_to_36.txt", outgrid=tmpfile.name, increment=1, region="g" + ) + assert result is None # return value is None + assert os.path.exists(path=tmpfile.name) # check that outgrid exists + result = grdinfo(tmpfile.name, per_column=True).strip().split() + assert int(result[0]) == 0 # x minimum + assert int(result[1]) == 360 # x maximum + assert int(result[2]) == -90 # y minimum + assert int(result[3]) == 90 # y maximum + npt.assert_approx_equal(float(result[4]), -0.00043260390521) # v minimum + npt.assert_approx_equal(float(result[5]), 0.000219614637899) # v maximum + + +def test_sph2grd_no_outgrid(): + """ + Test sph2grd with no set outgrid. + """ + temp_grid = sph2grd(table="@EGM96_to_36.txt", increment=1, region="g") + assert temp_grid.dims == ("y", "x") + assert temp_grid.gmt.gtype == 0 # Cartesian grid + assert temp_grid.gmt.registration == 0 # Gridline registration From aee5e2760dc93aa5206b2d1c753fcf3c5bd9ffab Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 10 Aug 2021 21:35:02 +0100 Subject: [PATCH 03/20] format fix --- pygmt/src/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/__init__.py b/pygmt/src/__init__.py index ad730453ed1..7ed82df9526 100644 --- a/pygmt/src/__init__.py +++ b/pygmt/src/__init__.py @@ -33,8 +33,8 @@ from pygmt.src.plot import plot from pygmt.src.plot3d import plot3d from pygmt.src.rose import rose -from pygmt.src.sph2grd import sph2grd from pygmt.src.solar import solar +from pygmt.src.sph2grd import sph2grd 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 1526f7f328dd634ca301094437eac95021911f1b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 1 Sep 2021 16:12:11 +0100 Subject: [PATCH 04/20] add sph2grd to index.rst --- doc/api/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/index.rst b/doc/api/index.rst index 3536e83f640..16688632b87 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -96,6 +96,7 @@ Operations on grids: grdgradient grdsample grdtrack + sph2grd xyz2grd Crossover analysis with x2sys: From f7a3e9bf27f85f3563519986ab8db4113635ac6b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 9 Sep 2021 07:30:01 -0400 Subject: [PATCH 05/20] Remove unused import Remove GMTInvalidInput import statement --- pygmt/src/sph2grd.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index bc0c7ab0fda..80a98d0a0b1 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -3,7 +3,6 @@ """ import xarray as xr from pygmt.clib import Session -from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import ( GMTTempFile, build_arg_string, From 50e0382b1f3b69001053a03917ebddbe36d70974 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 9 Sep 2021 07:58:47 -0400 Subject: [PATCH 06/20] Add xarray functions to test outgrid info Remove the use of grdinfo and use xarray min, max, median, and mean functions to test data in outgrid --- pygmt/tests/test_sph2grd.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pygmt/tests/test_sph2grd.py b/pygmt/tests/test_sph2grd.py index d06afa59be6..d9d3e46dcce 100644 --- a/pygmt/tests/test_sph2grd.py +++ b/pygmt/tests/test_sph2grd.py @@ -18,13 +18,6 @@ def test_sph2grd_outgrid(): ) assert result is None # return value is None assert os.path.exists(path=tmpfile.name) # check that outgrid exists - result = grdinfo(tmpfile.name, per_column=True).strip().split() - assert int(result[0]) == 0 # x minimum - assert int(result[1]) == 360 # x maximum - assert int(result[2]) == -90 # y minimum - assert int(result[3]) == 90 # y maximum - npt.assert_approx_equal(float(result[4]), -0.00043260390521) # v minimum - npt.assert_approx_equal(float(result[5]), 0.000219614637899) # v maximum def test_sph2grd_no_outgrid(): @@ -35,3 +28,7 @@ def test_sph2grd_no_outgrid(): assert temp_grid.dims == ("y", "x") assert temp_grid.gmt.gtype == 0 # Cartesian grid assert temp_grid.gmt.registration == 0 # Gridline registration + npt.assert_allclose(temp_grid.max(), 0.00021961) + npt.assert_allclose(temp_grid.min(), -0.0004326) + npt.assert_allclose(temp_grid.median(), -0.00010894) + npt.assert_allclose(temp_grid.mean(), -0.00010968) From b4f0284c4f6fb35184ac4849d088cb82d9e90bf4 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 9 Sep 2021 19:48:22 -0400 Subject: [PATCH 07/20] Add rtol parameter for npt assertions --- pygmt/tests/test_sph2grd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_sph2grd.py b/pygmt/tests/test_sph2grd.py index d9d3e46dcce..0c9848bf5a9 100644 --- a/pygmt/tests/test_sph2grd.py +++ b/pygmt/tests/test_sph2grd.py @@ -28,7 +28,7 @@ def test_sph2grd_no_outgrid(): assert temp_grid.dims == ("y", "x") assert temp_grid.gmt.gtype == 0 # Cartesian grid assert temp_grid.gmt.registration == 0 # Gridline registration - npt.assert_allclose(temp_grid.max(), 0.00021961) - npt.assert_allclose(temp_grid.min(), -0.0004326) - npt.assert_allclose(temp_grid.median(), -0.00010894) - npt.assert_allclose(temp_grid.mean(), -0.00010968) + npt.assert_allclose(temp_grid.max(), 0.00021961, rtol=1e-4) + npt.assert_allclose(temp_grid.min(), -0.0004326, rtol=1e-4) + npt.assert_allclose(temp_grid.median(), -0.00010894, rtol=1e-4) + npt.assert_allclose(temp_grid.mean(), -0.00010968, rtol=1e-4) From 0f1f7ad95136f35c1984ba9a20f6af7356bb8b70 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 9 Sep 2021 21:39:11 -0400 Subject: [PATCH 08/20] remove unused import in test_sph2grd.py --- pygmt/tests/test_sph2grd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_sph2grd.py b/pygmt/tests/test_sph2grd.py index 0c9848bf5a9..94f11d138ad 100644 --- a/pygmt/tests/test_sph2grd.py +++ b/pygmt/tests/test_sph2grd.py @@ -4,7 +4,7 @@ import os import numpy.testing as npt -from pygmt import grdinfo, sph2grd +from pygmt import sph2grd from pygmt.helpers import GMTTempFile From f98323c8ed39f269f01bed06fd14b292b9db7e67 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 10 Sep 2021 20:22:05 -0400 Subject: [PATCH 09/20] move sph2grd to tabular data section in index --- doc/api/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 16688632b87..842b79679fa 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -81,6 +81,7 @@ Operations on tabular data: blockmean blockmedian + sph2grd surface Operations on grids: @@ -96,7 +97,6 @@ Operations on grids: grdgradient grdsample grdtrack - sph2grd xyz2grd Crossover analysis with x2sys: From 974f9083b9f4c4fd110c870065eb81b5f1767c60 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 10 Sep 2021 20:22:20 -0400 Subject: [PATCH 10/20] add table description to docstring --- pygmt/src/sph2grd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 80a98d0a0b1..b5119f6192b 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -32,6 +32,10 @@ def sph2grd(table, **kwargs): Parameters ---------- + table : str or {table-like} + Pass in (x, y, z) or (longitude, latitude, elevation) values by + providing a file name to an ASCII data table, a 2D + {table-classes}. outgrid : str or None The name of the output netCDF file with extension .nc to store the grid in. From 41400f9d937f74e0b40d1630cc48e03f3fbde4c8 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 10 Sep 2021 20:54:10 -0400 Subject: [PATCH 11/20] Apply suggestions from code review Co-authored-by: Meghan Jones --- pygmt/src/sph2grd.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index b5119f6192b..4d62efe778a 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -62,11 +62,4 @@ def sph2grd(table, **kwargs): arg_str = " ".join([infile, arg_str]) lib.call_module("sph2grd", arg_str) - if outgrid == tmpfile.name: # if user did not set outgrid, return DataArray - with xr.open_dataarray(outgrid) as dataarray: - result = dataarray.load() - _ = result.gmt # load GMTDataArray accessor information - else: - result = None # if user sets an outgrid, return None - - return result + return load_dataarray(outgrid) if outgrid == tmpfile.name else None From 24f05651d3fbed537f4c39da7e9672118a3f0829 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 25 Sep 2021 08:00:11 +0100 Subject: [PATCH 12/20] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/sph2grd.py | 9 ++++++--- pygmt/tests/test_sph2grd.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 4d62efe778a..f7eddb673a8 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -15,7 +15,7 @@ @fmt_docstring @use_alias( G="outgrid", - I="increment", + I="spacing", R="region", V="verbose", ) @@ -28,11 +28,13 @@ def sph2grd(table, **kwargs): C[L,M], S[L,M] and evaluates the spherical harmonic model on the specified grid. + Full option list at :gmt-docs:`sph2grd.html` + {aliases} Parameters ---------- - table : str or {table-like} + data : str or {table-like} Pass in (x, y, z) or (longitude, latitude, elevation) values by providing a file name to an ASCII data table, a 2D {table-classes}. @@ -47,13 +49,14 @@ def sph2grd(table, **kwargs): ------- ret: xarray.DataArray or None Return type depends on whether the ``outgrid`` parameter is set: + - :class:`xarray.DataArray` if ``outgrid`` is not set - None if ``outgrid`` is set (grid output will be stored in file set by ``outgrid``) """ with GMTTempFile(suffix=".nc") as tmpfile: with Session() as lib: - file_context = lib.virtualfile_from_data(check_kind="vector", data=table) + file_context = lib.virtualfile_from_data(check_kind="vector", data=data) with file_context as infile: if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile kwargs.update({"G": tmpfile.name}) diff --git a/pygmt/tests/test_sph2grd.py b/pygmt/tests/test_sph2grd.py index 94f11d138ad..316e6d52408 100644 --- a/pygmt/tests/test_sph2grd.py +++ b/pygmt/tests/test_sph2grd.py @@ -14,7 +14,7 @@ def test_sph2grd_outgrid(): """ with GMTTempFile(suffix=".nc") as tmpfile: result = sph2grd( - table="@EGM96_to_36.txt", outgrid=tmpfile.name, increment=1, region="g" + data="@EGM96_to_36.txt", outgrid=tmpfile.name, spacing=1, region="g" ) assert result is None # return value is None assert os.path.exists(path=tmpfile.name) # check that outgrid exists @@ -24,7 +24,7 @@ def test_sph2grd_no_outgrid(): """ Test sph2grd with no set outgrid. """ - temp_grid = sph2grd(table="@EGM96_to_36.txt", increment=1, region="g") + temp_grid = sph2grd(data="@EGM96_to_36.txt", spacing=1, region="g") assert temp_grid.dims == ("y", "x") assert temp_grid.gmt.gtype == 0 # Cartesian grid assert temp_grid.gmt.registration == 0 # Gridline registration From ad9ad50b664864b666facef0872cc7b484f30568 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 11:26:38 +0100 Subject: [PATCH 13/20] fix indentation --- pygmt/src/sph2grd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index f7eddb673a8..c90f4fff97c 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -65,4 +65,4 @@ def sph2grd(table, **kwargs): arg_str = " ".join([infile, arg_str]) lib.call_module("sph2grd", arg_str) - return load_dataarray(outgrid) if outgrid == tmpfile.name else None + return load_dataarray(outgrid) if outgrid == tmpfile.name else None From 7180fc02060888d9720c0e1df1f96059fd193862 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 11:27:32 +0100 Subject: [PATCH 14/20] fix imports --- pygmt/src/sph2grd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index c90f4fff97c..4512b255185 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -10,6 +10,7 @@ kwargs_to_strings, use_alias, ) +from pygmt.io import load_dataarray @fmt_docstring @@ -20,7 +21,7 @@ V="verbose", ) @kwargs_to_strings(I="sequence", R="sequence") -def sph2grd(table, **kwargs): +def sph2grd(data, **kwargs): r""" Create spherical grid files in tension of data. From f84870141fc962b2afc4a785bcc3a49878a565ca Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 11:28:09 +0100 Subject: [PATCH 15/20] fix indentation again --- pygmt/src/sph2grd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 4512b255185..cd920efac20 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -66,4 +66,4 @@ def sph2grd(data, **kwargs): arg_str = " ".join([infile, arg_str]) lib.call_module("sph2grd", arg_str) - return load_dataarray(outgrid) if outgrid == tmpfile.name else None + return load_dataarray(outgrid) if outgrid == tmpfile.name else None From 1fda5b63576366e526becfd20dd8dbba4186fdfd Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 11:31:34 +0100 Subject: [PATCH 16/20] remove unused import --- pygmt/src/sph2grd.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index cd920efac20..6bbe842b066 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -1,7 +1,6 @@ """ sph2grd - Compute grid from spherical harmonic coefficients """ -import xarray as xr from pygmt.clib import Session from pygmt.helpers import ( GMTTempFile, From 25d15ddc56024419afdfabf6fce0fff2d80685ce Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 13:07:08 +0100 Subject: [PATCH 17/20] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/sph2grd.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 6bbe842b066..814bc52f297 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -18,8 +18,13 @@ I="spacing", R="region", V="verbose", + b="binary", + h="header", + i="incols", + r="registration", + x="cores", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") def sph2grd(data, **kwargs): r""" Create spherical grid files in tension of data. @@ -44,6 +49,11 @@ def sph2grd(data, **kwargs): {I} {R} {V} + {b} + {h} + {i} + {r} + {x} Returns ------- From f93b98c146d032c2fb79752f203ee88398c42309 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 26 Sep 2021 13:09:08 +0100 Subject: [PATCH 18/20] add file cache --- pygmt/helpers/testing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 1d4e5ec4159..98b866ae09a 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -165,6 +165,7 @@ def download_test_data(): "@N37W120.earth_relief_03s_g.nc", "@N00W090.earth_relief_03m_p.nc", # Other cache files + "@EGM96_to_36.txt", "@fractures_06.txt", "@hotspots.txt", "@ridge.txt", From 9315af02d7f51f67dd1a9444244cf7d95e0c7dbf Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 27 Sep 2021 07:22:54 +0100 Subject: [PATCH 19/20] Update pygmt/src/sph2grd.py Co-authored-by: Dongdong Tian --- pygmt/src/sph2grd.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 814bc52f297..68d542793fe 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -71,8 +71,7 @@ def sph2grd(data, **kwargs): if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile kwargs.update({"G": tmpfile.name}) outgrid = kwargs["G"] - arg_str = build_arg_string(kwargs) - arg_str = " ".join([infile, arg_str]) + arg_str = " ".join([infile, build_arg_string(kwargs)]) lib.call_module("sph2grd", arg_str) return load_dataarray(outgrid) if outgrid == tmpfile.name else None From 4f22a4e64b8adbd09ed5f43b1382431119735f59 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 27 Sep 2021 07:26:33 +0100 Subject: [PATCH 20/20] change data docstring to reflect sph2grd input data --- pygmt/src/sph2grd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 68d542793fe..7070b390a93 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -40,7 +40,7 @@ def sph2grd(data, **kwargs): Parameters ---------- data : str or {table-like} - Pass in (x, y, z) or (longitude, latitude, elevation) values by + Pass in data with L, M, C[L,M], S[L,M] values by providing a file name to an ASCII data table, a 2D {table-classes}. outgrid : str or None