Skip to content

Commit 847814b

Browse files
committed
Merge branch 'master' into testing
2 parents 2bb82f4 + a3d6f84 commit 847814b

13 files changed

+32
-49
lines changed

.github/workflows/cache_data.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
# Install GMT
2424
- name: Install GMT
2525
shell: bash -l {0}
26-
run: conda install -c conda-forge gmt=6.1.0
26+
run: conda install -c conda-forge gmt=6.1.1
2727

2828
# Download remote files
2929
- name: Download remote data

.github/workflows/ci_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
requirements_file=full-conda-requirements.txt
7878
cat requirements.txt requirements-dev.txt > $requirements_file
7979
cat << EOF >> $requirements_file
80-
gmt=6.1.0
80+
gmt=6.1.1
8181
make
8282
codecov
8383
EOF

.travis.yml

+1-14
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,13 @@ env:
2626
# The file with the listed requirements to be installed by conda
2727
- CONDA_REQUIREMENTS=requirements.txt
2828
- CONDA_REQUIREMENTS_DEV=requirements-dev.txt
29-
- CONDA_INSTALL_EXTRA="codecov twine gmt=6.1.0"
29+
- CONDA_INSTALL_EXTRA="codecov twine gmt=6.1.1"
3030
# These variables control which actions are performed in a build
3131
- DEPLOY=false
3232

3333
jobs:
3434
# Build under the following configurations
3535
include:
36-
- name: "Linux - Python 3.8"
37-
os: linux
38-
env:
39-
- PYTHON=3.8
40-
- name: "Linux - Python 3.7"
41-
os: linux
42-
env:
43-
- PYTHON=3.7
4436
- name: "Linux - Python 3.6 (deploy)"
4537
os: linux
4638
env:
@@ -67,11 +59,6 @@ script:
6759
# Build the documentation
6860
- make -C doc all
6961

70-
# Things to do if the build is successful
71-
after_success:
72-
# Upload coverage information
73-
- codecov -e PYTHON
74-
7562
deploy:
7663
# Make a release on PyPI
7764
- provider: script

doc/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Which GMT?
3131
PyGMT requires Generic Mapping Tools (GMT) version 6 as a minimum, which is the latest
3232
released version that can be found at
3333
the `GMT official site <https://www.generic-mapping-tools.org>`__.
34-
We need the latest GMT (>=6.1.0) since there are many changes being made to GMT itself in
34+
We need the latest GMT (>=6.1.1) since there are many changes being made to GMT itself in
3535
response to the development of PyGMT, mainly the new
3636
`modern execution mode <https://docs.generic-mapping-tools.org/latest/cookbook/introduction.html#modern-and-classic-mode>`__.
3737

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
dependencies:
66
- python=3.7
77
- pip
8-
- gmt=6.1.0
8+
- gmt=6.1.1
99
- numpy
1010
- pandas
1111
- xarray

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"scripts": {
33
"build:miniconda": "curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash ~/miniconda.sh -b -p $HOME/miniconda",
4-
"build:pygmt": "conda env create -f environment.yml && source activate pygmt && conda install -c conda-forge -y gmt==6.1.0 && make install",
4+
"build:pygmt": "conda env create -f environment.yml && source activate pygmt && conda install -c conda-forge -y gmt==6.1.1 && make install",
55
"build:docs": "source activate pygmt && cd doc && make all && mv _build/html ../public",
66
"build": "export PATH=$HOME/miniconda/bin:$PATH && npm run build:miniconda && npm run build:pygmt && npm run build:docs"
77
}

pygmt/base_plotting.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def colorbar(self, **kwargs):
226226
S="resample",
227227
U="timestamp",
228228
W="pen",
229+
l="label",
229230
)
230231
@kwargs_to_strings(R="sequence", L="sequence", A="sequence_plus")
231232
def grdcontour(self, grid, **kwargs):
@@ -275,6 +276,13 @@ def grdcontour(self, grid, **kwargs):
275276
{G}
276277
{U}
277278
{W}
279+
label : str
280+
Add a legend entry for the contour being plotted. Normally, the
281+
annotated contour is selected for the legend. You can select the
282+
regular contour instead, or both of them, by considering the label
283+
to be of the format [*annotcontlabel*][/*contlabel*]. If either
284+
label contains a slash (/) character then use ``|`` as the
285+
separator for the two labels instead.
278286
"""
279287
kwargs = self._preprocess(**kwargs)
280288
kind = data_kind(grid, None, None)
@@ -568,6 +576,7 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
568576
W="pen",
569577
L="triangular_mesh_pen",
570578
i="columns",
579+
l="label",
571580
C="levels",
572581
)
573582
@kwargs_to_strings(R="sequence", i="sequence_comma")
@@ -619,6 +628,13 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
619628
skip : bool or str
620629
Skip input points outside region ``'[p|t]'``
621630
{W}
631+
label : str
632+
Add a legend entry for the contour being plotted. Normally, the
633+
annotated contour is selected for the legend. You can select the
634+
regular contour instead, or both of them, by considering the label
635+
to be of the format [*annotcontlabel*][/*contlabel*]. If either
636+
label contains a slash (/) character then use ``|`` as the
637+
separator for the two labels instead.
622638
623639
"""
624640
kwargs = self._preprocess(**kwargs)
@@ -997,7 +1013,7 @@ def text(
9971013

9981014
@fmt_docstring
9991015
@use_alias(R="region", J="projection", B="frame", C="offset")
1000-
@kwargs_to_strings(R="sequence",)
1016+
@kwargs_to_strings(R="sequence")
10011017
def meca(
10021018
self,
10031019
spec,

pygmt/clib/session.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Session:
119119
"""
120120

121121
# The minimum version of GMT required
122-
required_version = "6.1.0"
122+
required_version = "6.1.1"
123123

124124
@property
125125
def session_pointer(self):
@@ -725,10 +725,10 @@ def _check_dtype_and_dim(self, array, ndim):
725725
try:
726726
# Try to convert any unknown numpy data types to np.datetime64
727727
array = np.asarray(array, dtype=np.datetime64)
728-
except ValueError:
728+
except ValueError as e:
729729
raise GMTInvalidInput(
730-
"Unsupported numpy data type '{}'.".format(array.dtype.type)
731-
)
730+
f"Unsupported numpy data type '{array.dtype.type}'."
731+
) from e
732732
return self[DTYPES[array.dtype.type]]
733733

734734
def put_vector(self, dataset, column, vector):
@@ -1065,7 +1065,7 @@ def open_virtual_file(self, family, geometry, direction, data):
10651065
family_int = self._parse_constant(family, valid=FAMILIES, valid_modifiers=VIAS)
10661066
geometry_int = self._parse_constant(geometry, valid=GEOMETRIES)
10671067
direction_int = self._parse_constant(
1068-
direction, valid=["GMT_IN", "GMT_OUT"], valid_modifiers=METHODS,
1068+
direction, valid=["GMT_IN", "GMT_OUT"], valid_modifiers=METHODS
10691069
)
10701070

10711071
buff = ctp.create_string_buffer(self["GMT_VF_LEN"])

pygmt/figure.py

-8
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,6 @@ def shift_origin(self, xshift=None, yshift=None):
316316
Shift plot origin in x direction.
317317
yshift : str
318318
Shift plot origin in y direction.
319-
320-
Notes
321-
-----
322-
For GMT 6.1.0, this function can't be used as the first plotting
323-
function of :meth:`pygmt.Figure`, since it relies the *region* and
324-
*projection* settings from previous commands.
325-
326-
.. TODO: Remove the notes when PyGMT bumps to GMT>=6.1.1.
327319
"""
328320
self._preprocess()
329321
args = ["-T"]

pygmt/tests/test_clib.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ def test_virtualfile_from_vectors():
402402
assert output == expected
403403

404404

405-
@pytest.mark.xfail(
406-
condition=gmt_version < Version("6.1.1"),
407-
reason="GMT_Put_Strings only works for GMT 6.1.1 and above",
408-
)
409405
def test_virtualfile_from_vectors_one_string_column():
410406
"Test passing in one column with string dtype into virtual file dataset"
411407
size = 5
@@ -421,10 +417,6 @@ def test_virtualfile_from_vectors_one_string_column():
421417
assert output == expected
422418

423419

424-
@pytest.mark.xfail(
425-
condition=gmt_version < Version("6.1.1"),
426-
reason="GMT_Put_Strings only works for GMT 6.1.1 and above",
427-
)
428420
def test_virtualfile_from_vectors_two_string_columns():
429421
"Test passing in two columns of string dtype into virtual file dataset"
430422
size = 5
@@ -688,7 +680,7 @@ def test_get_default():
688680
with clib.Session() as lib:
689681
assert lib.get_default("API_GRID_LAYOUT") in ["rows", "columns"]
690682
assert int(lib.get_default("API_CORES")) >= 1
691-
assert Version(lib.get_default("API_VERSION")) >= Version("6.1.0")
683+
assert Version(lib.get_default("API_VERSION")) >= Version("6.1.1")
692684

693685

694686
def test_get_default_fails():

pygmt/tests/test_clib_put_strings.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
gmt_version = Version(_lib.info["version"])
1515

1616

17-
@pytest.mark.xfail(
18-
condition=gmt_version < Version("6.1.1"),
19-
reason="GMT_Put_Strings only works for GMT 6.1.1 and above",
20-
)
2117
def test_put_strings():
2218
"Check that assigning a numpy array of dtype str to a dataset works"
2319
with clib.Session() as lib:

pygmt/tests/test_grdtrack.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def fixture_dataarray():
2525
)
2626

2727

28-
@pytest.mark.xfail(reason="The reason why it fails is unclear now",)
28+
@pytest.mark.xfail(reason="The reason why it fails is unclear now")
2929
def test_grdtrack_input_dataframe_and_dataarray(dataarray):
3030
"""
3131
Run grdtrack by passing in a pandas.DataFrame and xarray.DataArray as
@@ -41,7 +41,7 @@ def test_grdtrack_input_dataframe_and_dataarray(dataarray):
4141
return output
4242

4343

44-
@pytest.mark.xfail(reason="The reason why it fails is unclear now",)
44+
@pytest.mark.xfail(reason="The reason why it fails is unclear now")
4545
def test_grdtrack_input_csvfile_and_dataarray(dataarray):
4646
"""
4747
Run grdtrack by passing in a csvfile and xarray.DataArray as inputs

pygmt/tests/test_session_management.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def test_begin_end():
11-
""""
11+
"""
1212
Run a command inside a begin-end modern mode block.
1313
First, end the global session. When finished, restart it.
1414
"""

0 commit comments

Comments
 (0)