@@ -140,7 +140,6 @@ class Session:
140140 ... ses.call_module("grdinfo", f"{fin} -C ->{fout.name}")
141141 ... # Read the contents of the temp file before it's deleted.
142142 ... print(fout.read().strip())
143- ...
144143 -55 -47 -24 -10 190 981 1 1 8 14 1 1
145144 """
146145
@@ -305,7 +304,6 @@ def get_libgmt_func(self, name, argtypes=None, restype=None):
305304 ... func = lib.get_libgmt_func(
306305 ... "GMT_Destroy_Session", argtypes=[c_void_p], restype=c_int
307306 ... )
308- ...
309307 >>> type(func)
310308 <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
311309 """
@@ -546,13 +544,11 @@ def get_common(self, option):
546544 ... lib.call_module("plot", "-T -Xw+1i -Yh-1i")
547545 ... xshift = lib.get_common("X") # xshift/yshift are in inches
548546 ... yshift = lib.get_common("Y")
549- ...
550547 >>> print(region, projection, timestamp, verbose, xshift, yshift)
551548 [ 0. 10. 10. 15.] True False 3 6.0 1.5
552549 >>> with Session() as lib:
553550 ... lib.call_module("basemap", "-R0/10/10/15 -JX5i/2.5i -Baf")
554551 ... lib.get_common("A")
555- ...
556552 Traceback (most recent call last):
557553 ...
558554 pygmt.exceptions.GMTInvalidInput: Unknown GMT common option flag 'A'.
@@ -816,13 +812,11 @@ def _check_dtype_and_dim(self, array, ndim):
816812 >>> with Session() as ses:
817813 ... gmttype = ses._check_dtype_and_dim(data, ndim=1)
818814 ... gmttype == ses["GMT_DOUBLE"]
819- ...
820815 True
821816 >>> data = np.ones((5, 2), dtype="float32")
822817 >>> with Session() as ses:
823818 ... gmttype = ses._check_dtype_and_dim(data, ndim=2)
824819 ... gmttype == ses["GMT_FLOAT"]
825- ...
826820 True
827821 """
828822 # Check that the array has the given number of dimensions
@@ -1150,7 +1144,6 @@ def open_virtual_file(self, family, geometry, direction, data):
11501144 ... args = f"{vfile} ->{ofile.name}"
11511145 ... lib.call_module("info", args)
11521146 ... print(ofile.read().strip())
1153- ...
11541147 <vector memory>: N = 5 <0/4> <5/9>
11551148 """
11561149 c_open_virtualfile = self .get_libgmt_func (
@@ -1241,7 +1234,6 @@ def virtualfile_from_vectors(self, *vectors):
12411234 ... with GMTTempFile() as fout:
12421235 ... ses.call_module("info", f"{fin} ->{fout.name}")
12431236 ... print(fout.read().strip())
1244- ...
12451237 <vector memory>: N = 3 <1/3> <4/6> <7/9>
12461238 """
12471239 # Conversion to a C-contiguous array needs to be done here and not in
@@ -1350,7 +1342,6 @@ def virtualfile_from_matrix(self, matrix):
13501342 ... with GMTTempFile() as fout:
13511343 ... ses.call_module("info", f"{fin} ->{fout.name}")
13521344 ... print(fout.read().strip())
1353- ...
13541345 <matrix memory>: N = 4 <0/9> <1/10> <2/11>
13551346 """
13561347 # Conversion to a C-contiguous array needs to be done here and not in
@@ -1432,7 +1423,6 @@ def virtualfile_from_grid(self, grid):
14321423 ... args = f"{fin} -L0 -Cn ->{fout.name}"
14331424 ... ses.call_module("grdinfo", args)
14341425 ... print(fout.read().strip())
1435- ...
14361426 -55 -47 -24 -10 190 981 1 1 8 14 1 1
14371427 >>> # The output is: w e s n z0 z1 dx dy n_columns n_rows reg gtype
14381428 """
@@ -1520,14 +1510,11 @@ def virtualfile_from_data( # noqa: PLR0912
15201510 ... ),
15211511 ... )
15221512 >>> with Session() as ses:
1523- ... with ses.virtualfile_from_data(
1524- ... check_kind="vector", data=data
1525- ... ) as fin:
1513+ ... with ses.virtualfile_from_data(check_kind="vector", data=data) as fin:
15261514 ... # Send the output to a file so that we can read it
15271515 ... with GMTTempFile() as fout:
15281516 ... ses.call_module("info", fin + " ->" + fout.name)
15291517 ... print(fout.read().strip())
1530- ...
15311518 <vector memory>: N = 3 <7/9> <4/6> <1/3>
15321519 """
15331520 kind = data_kind (
@@ -1623,20 +1610,16 @@ def extract_region(self):
16231610 ... )
16241611 >>> with Session() as lib:
16251612 ... wesn = lib.extract_region()
1626- ...
16271613 >>> print(", ".join([f"{x:.2f}" for x in wesn]))
16281614 0.00, 10.00, -20.00, -10.00
16291615
16301616 Using ISO country codes for the regions (for example ``"US.HI"`` for
16311617 Hawaiʻi):
16321618
16331619 >>> fig = pygmt.Figure()
1634- >>> fig.coast(
1635- ... region="US.HI", projection="M6i", frame=True, land="black"
1636- ... )
1620+ >>> fig.coast(region="US.HI", projection="M6i", frame=True, land="black")
16371621 >>> with Session() as lib:
16381622 ... wesn = lib.extract_region()
1639- ...
16401623 >>> print(", ".join([f"{x:.2f}" for x in wesn]))
16411624 -164.71, -154.81, 18.91, 23.58
16421625
@@ -1645,12 +1628,9 @@ def extract_region(self):
16451628 region to multiples of 5):
16461629
16471630 >>> fig = pygmt.Figure()
1648- >>> fig.coast(
1649- ... region="US.HI+r5", projection="M6i", frame=True, land="black"
1650- ... )
1631+ >>> fig.coast(region="US.HI+r5", projection="M6i", frame=True, land="black")
16511632 >>> with Session() as lib:
16521633 ... wesn = lib.extract_region()
1653- ...
16541634 >>> print(", ".join([f"{x:.2f}" for x in wesn]))
16551635 -165.00, -150.00, 15.00, 25.00
16561636 """ # noqa: RUF002
0 commit comments