@@ -270,8 +270,9 @@ def get_libgmt_func(self, name, argtypes=None, restype=None):
270270
271271 >>> from ctypes import c_void_p, c_int
272272 >>> with Session() as lib:
273- ... func = lib.get_libgmt_func('GMT_Destroy_Session',
274- ... argtypes=[c_void_p], restype=c_int)
273+ ... func = lib.get_libgmt_func(
274+ ... "GMT_Destroy_Session", argtypes=[c_void_p], restype=c_int
275+ ... )
275276 >>> type(func)
276277 <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
277278
@@ -702,15 +703,15 @@ def _check_dtype_and_dim(self, array, ndim):
702703 --------
703704
704705 >>> import numpy as np
705- >>> data = np.array([1, 2, 3], dtype=' float64' )
706+ >>> data = np.array([1, 2, 3], dtype=" float64" )
706707 >>> with Session() as ses:
707708 ... gmttype = ses._check_dtype_and_dim(data, ndim=1)
708709 ... gmttype == ses["GMT_DOUBLE"]
709710 True
710- >>> data = np.ones((5, 2), dtype=' float32' )
711+ >>> data = np.ones((5, 2), dtype=" float32" )
711712 >>> with Session() as ses:
712713 ... gmttype = ses._check_dtype_and_dim(data, ndim=2)
713- ... gmttype == ses[' GMT_FLOAT' ]
714+ ... gmttype == ses[" GMT_FLOAT" ]
714715 True
715716
716717 """
@@ -1022,23 +1023,23 @@ def open_virtual_file(self, family, geometry, direction, data):
10221023 >>> x = np.array([0, 1, 2, 3, 4])
10231024 >>> y = np.array([5, 6, 7, 8, 9])
10241025 >>> with Session() as lib:
1025- ... family = ' GMT_IS_DATASET|GMT_VIA_VECTOR'
1026- ... geometry = ' GMT_IS_POINT'
1026+ ... family = " GMT_IS_DATASET|GMT_VIA_VECTOR"
1027+ ... geometry = " GMT_IS_POINT"
10271028 ... dataset = lib.create_data(
10281029 ... family=family,
10291030 ... geometry=geometry,
1030- ... mode=' GMT_CONTAINER_ONLY' ,
1031+ ... mode=" GMT_CONTAINER_ONLY" ,
10311032 ... dim=[2, 5, 1, 0], # columns, lines, segments, type
10321033 ... )
10331034 ... lib.put_vector(dataset, column=0, vector=x)
10341035 ... lib.put_vector(dataset, column=1, vector=y)
10351036 ... # Add the dataset to a virtual file
1036- ... vfargs = (family, geometry, ' GMT_IN|GMT_IS_REFERENCE' , dataset)
1037+ ... vfargs = (family, geometry, " GMT_IN|GMT_IS_REFERENCE" , dataset)
10371038 ... with lib.open_virtual_file(*vfargs) as vfile:
10381039 ... # Send the output to a temp file so that we can read it
10391040 ... with GMTTempFile() as ofile:
1040- ... args = ' {} ->{}' .format(vfile, ofile.name)
1041- ... lib.call_module(' info' , args)
1041+ ... args = " {} ->{}" .format(vfile, ofile.name)
1042+ ... lib.call_module(" info" , args)
10421043 ... print(ofile.read().strip())
10431044 <vector memory>: N = 5 <0/4> <5/9>
10441045
@@ -1133,7 +1134,7 @@ def virtualfile_from_vectors(self, *vectors):
11331134 ... # Send the output to a file so that we can read it
11341135 ... with GMTTempFile() as fout:
11351136 ... ses.call_module(
1136- ... ' info', ' {} ->{}' .format(fin, fout.name)
1137+ ... " info", " {} ->{}" .format(fin, fout.name)
11371138 ... )
11381139 ... print(fout.read().strip())
11391140 <vector memory>: N = 3 <1/3> <4/6> <7/9>
@@ -1245,7 +1246,7 @@ def virtualfile_from_matrix(self, matrix):
12451246 ... # Send the output to a file so that we can read it
12461247 ... with GMTTempFile() as fout:
12471248 ... ses.call_module(
1248- ... ' info', ' {} ->{}' .format(fin, fout.name)
1249+ ... " info", " {} ->{}" .format(fin, fout.name)
12491250 ... )
12501251 ... print(fout.read().strip())
12511252 <matrix memory>: N = 4 <0/9> <1/10> <2/11>
@@ -1314,7 +1315,7 @@ def virtualfile_from_grid(self, grid):
13141315
13151316 >>> from pygmt.datasets import load_earth_relief
13161317 >>> from pygmt.helpers import GMTTempFile
1317- >>> data = load_earth_relief(resolution=' 01d' )
1318+ >>> data = load_earth_relief(resolution=" 01d" )
13181319 >>> print(data.shape)
13191320 (180, 360)
13201321 >>> print(data.lon.values.min(), data.lon.values.max())
@@ -1327,8 +1328,8 @@ def virtualfile_from_grid(self, grid):
13271328 ... with ses.virtualfile_from_grid(data) as fin:
13281329 ... # Send the output to a file so that we can read it
13291330 ... with GMTTempFile() as fout:
1330- ... args = ' {} -L0 -Cn ->{}' .format(fin, fout.name)
1331- ... ses.call_module(' grdinfo' , args)
1331+ ... args = " {} -L0 -Cn ->{}" .format(fin, fout.name)
1332+ ... ses.call_module(" grdinfo" , args)
13321333 ... print(fout.read().strip())
13331334 -180 180 -90 90 -8182 5651.5 1 1 360 180 1 1
13341335 >>> # The output is: w e s n z0 z1 dx dy n_columns n_rows reg gtype
@@ -1378,34 +1379,40 @@ def extract_region(self):
13781379
13791380 >>> import pygmt
13801381 >>> fig = pygmt.Figure()
1381- >>> fig.coast(region=[0, 10, -20, -10], projection="M6i", frame=True,
1382- ... land='black')
1382+ >>> fig.coast(
1383+ ... region=[0, 10, -20, -10],
1384+ ... projection="M6i",
1385+ ... frame=True,
1386+ ... land="black",
1387+ ... )
13831388 >>> with Session() as lib:
13841389 ... wesn = lib.extract_region()
1385- >>> print(', ' .join([' {:.2f}' .format(x) for x in wesn]))
1390+ >>> print(", " .join([" {:.2f}" .format(x) for x in wesn]))
13861391 0.00, 10.00, -20.00, -10.00
13871392
13881393 Using ISO country codes for the regions (for example ``'US.HI'`` for
13891394 Hawaii):
13901395
13911396 >>> fig = pygmt.Figure()
1392- >>> fig.coast(region='US.HI', projection="M6i", frame=True,
1393- ... land='black')
1397+ >>> fig.coast(
1398+ ... region="US.HI", projection="M6i", frame=True, land="black"
1399+ ... )
13941400 >>> with Session() as lib:
13951401 ... wesn = lib.extract_region()
1396- >>> print(', ' .join([' {:.2f}' .format(x) for x in wesn]))
1402+ >>> print(", " .join([" {:.2f}" .format(x) for x in wesn]))
13971403 -164.71, -154.81, 18.91, 23.58
13981404
13991405 The country codes can have an extra argument that rounds the region a
14001406 multiple of the argument (for example, ``'US.HI+r5'`` will round the
14011407 region to multiples of 5):
14021408
14031409 >>> fig = pygmt.Figure()
1404- >>> fig.coast(region='US.HI+r5', projection="M6i", frame=True,
1405- ... land='black')
1410+ >>> fig.coast(
1411+ ... region="US.HI+r5", projection="M6i", frame=True, land="black"
1412+ ... )
14061413 >>> with Session() as lib:
14071414 ... wesn = lib.extract_region()
1408- >>> print(', ' .join([' {:.2f}' .format(x) for x in wesn]))
1415+ >>> print(", " .join([" {:.2f}" .format(x) for x in wesn]))
14091416 -165.00, -150.00, 15.00, 25.00
14101417
14111418 """
0 commit comments