Skip to content

Commit 4bbc37e

Browse files
authored
Reorganize GMTDataArrayAccessor to the pygmt.xarray module (#3928)
1 parent 0348fad commit 4bbc37e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

doc/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ Getting metadata from tabular or grid data:
191191
.. autosummary::
192192
:toctree: generated
193193

194-
GMTDataArrayAccessor
195194
info
196195
grdinfo
197196

@@ -202,6 +201,7 @@ Xarray Integration
202201
:toctree: generated
203202

204203
GMTBackendEntrypoint
204+
GMTDataArrayAccessor
205205

206206
Enums
207207
-----

pygmt/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
# Import modules to make the high-level GMT Python API
2424
from pygmt import datasets
2525
from pygmt._show_versions import __commit__, __version__, show_versions
26-
from pygmt.accessors import GMTDataArrayAccessor
2726
from pygmt.figure import Figure, set_display
2827
from pygmt.io import load_dataarray
2928
from pygmt.session_management import begin as _begin
@@ -65,7 +64,7 @@
6564
x2sys_init,
6665
xyz2grd,
6766
)
68-
from pygmt.xarray import GMTBackendEntrypoint
67+
from pygmt.xarray import GMTBackendEntrypoint, GMTDataArrayAccessor
6968

7069
# Start our global modern mode session
7170
_begin()

pygmt/tests/test_accessor.py renamed to pygmt/tests/test_xarray_accessor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from pygmt.exceptions import GMTInvalidInput
1616

1717

18-
def test_accessor_gridline_cartesian():
18+
def test_xarray_accessor_gridline_cartesian():
1919
"""
2020
Check that the accessor returns the correct registration and gtype values for a
2121
Cartesian, gridline-registered grid.
@@ -26,7 +26,7 @@ def test_accessor_gridline_cartesian():
2626
assert grid.gmt.gtype == GridType.CARTESIAN
2727

2828

29-
def test_accessor_pixel_geographic():
29+
def test_xarray_accessor_pixel_geographic():
3030
"""
3131
Check that the accessor returns the correct registration and gtype values for a
3232
geographic, pixel-registered grid.
@@ -37,7 +37,7 @@ def test_accessor_pixel_geographic():
3737
assert grid.gmt.gtype == GridType.GEOGRAPHIC
3838

3939

40-
def test_accessor_set_registration():
40+
def test_xarray_accessor_set_registration():
4141
"""
4242
Check that we can set the registration of a grid.
4343
"""
@@ -63,7 +63,7 @@ def test_accessor_set_registration():
6363

6464

6565
@pytest.mark.benchmark
66-
def test_accessor_set_gtype():
66+
def test_xarray_accessor_set_gtype():
6767
"""
6868
Check that we can set the gtype of a grid.
6969
"""
@@ -87,7 +87,7 @@ def test_accessor_set_gtype():
8787
assert grid.gmt.gtype == GridType.CARTESIAN == 0
8888

8989

90-
def test_accessor_set_invalid_registration_and_gtype():
90+
def test_xarray_accessor_set_invalid_registration_and_gtype():
9191
"""
9292
Check that setting invalid values on registration and gtype do not work.
9393
"""
@@ -108,7 +108,7 @@ def test_accessor_set_invalid_registration_and_gtype():
108108
condition=sys.platform == "win32" and Version(__gmt_version__) < Version("6.5.0"),
109109
reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/7573",
110110
)
111-
def test_accessor_sliced_datacube():
111+
def test_xarray_accessor_sliced_datacube():
112112
"""
113113
Check that a 2-D grid which is sliced from an n-dimensional datacube works with
114114
accessor methods.
@@ -130,7 +130,7 @@ def test_accessor_sliced_datacube():
130130
Path(fname).unlink()
131131

132132

133-
def test_accessor_grid_source_file_not_exist():
133+
def test_xarray_accessor_grid_source_file_not_exist():
134134
"""
135135
Check that the accessor fallbacks to the default registration and gtype when the
136136
grid source file (i.e., grid.encoding["source"]) doesn't exist.

pygmt/xarray/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
PyGMT integration with Xarray accessors and backends.
33
"""
44

5+
from pygmt.xarray.accessor import GMTDataArrayAccessor
56
from pygmt.xarray.backend import GMTBackendEntrypoint
File renamed without changes.

0 commit comments

Comments
 (0)