Skip to content

Commit 20b0730

Browse files
authored
Merge branch 'master' into reffig_by_call_module
2 parents c41602b + 7bedf48 commit 20b0730

File tree

19 files changed

+565
-120
lines changed

19 files changed

+565
-120
lines changed

.github/ISSUE_TEMPLATE/release_checklist.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,19 @@ assignees: ''
1313
**Before release**:
1414
- [ ] Reserve a DOI on [Zenodo](https://zenodo.org) by clicking on "New Version"
1515
- [ ] Update Changelog
16+
- [ ] Add a new entry in `doc/_static/version_switch.js` for documentation switcher
1617

1718
**Release**:
18-
- [ ] Make a tag and push it to Github
19-
```
20-
git tag vX.Y.Z
21-
git push --tags
22-
```
23-
- [ ] Go to [GitHub Release](https://github.com/GenericMappingTools/pygmt/releases) and make a release
19+
- [ ] Go to [GitHub Release](https://github.com/GenericMappingTools/pygmt/releases) and make a release, this will automatically create a tag too
2420
- [ ] Manually upload the pygmt-vX.Y.Z.zip file to https://zenodo.org/deposit, make sure you file it under the correct reserved DOI
25-
- [ ] Announce the releases on the GMT [forum](https://forum.generic-mapping-tools.org/c/news/), [website](https://github.com/GenericMappingTools/website) (News) and [ResearchGate](https://www.researchgate.net/project/PyGMT-A-Python-interface-for-the-Generic-Mapping-Tools)
2621

2722
**After release**:
28-
- [ ] Create branch 0.x for bug-fixes if this is a minor release (i.e. create branch 0.1 after 0.1.0 is released)
29-
- [ ] Commit changes to Github
30-
31-
**3rd party update**:
3223
- [ ] Update conda-forge [pygmt-feedstock](https://github.com/conda-forge/pygmt-feedstock) [Usually done automatically by conda-forge's bot]
24+
- [ ] Bump PyGMT version on https://github.com/GenericMappingTools/try-gmt
25+
- [ ] Announce the release on:
26+
- [ ] GMT [forum](https://forum.generic-mapping-tools.org/c/news/)
27+
- [ ] [Major/Minor releases only] GMT [website](https://github.com/GenericMappingTools/website) (News)
28+
- [ ] [ResearchGate](https://www.researchgate.net/project/PyGMT-A-Python-interface-for-the-Generic-Mapping-Tools)
3329

3430
---
3531

MAINTENANCE.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,13 @@ Open `index.html` and check for any flaws or error messages.
154154
155155
### Pushing to PyPI and updating the documentation
156156
157-
After the changelog is updated, making a release should be as simple as creating a new
158-
git tag and pushing it to Github:
157+
After the changelog is updated, making a release can be done by going to
158+
https://github.com/GenericMappingTools/pygmt/releases, editing the draft release,
159+
and clicking on publish. A git tag will also be created, make sure that this
160+
tag is a proper version number (following [Semantic Versioning](https://semver.org/))
161+
with a leading `v`. E.g. `v0.2.1`.
159162
160-
```bash
161-
git tag v0.2.0
162-
git push --tags
163-
```
164-
165-
The tag should be version number (following [Semantic Versioning](https://semver.org/))
166-
with a leading `v`.
167-
This should trigger Travis to do all the work for us.
163+
Once the release/tag is created, this should trigger Travis to do all the work for us.
168164
A new source distribution will be uploaded to PyPI, a new folder with the documentation
169165
HTML will be pushed to *gh-pages*, and the `latest` link will be updated to point to
170166
this new folder.

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../.coveragerc \
66
--doctest-modules -v --mpl --mpl-results-path=results \
77
--pyargs ${PYTEST_EXTRA}
88
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
9-
FLAKE8_FILES=$(PROJECT) setup.py
10-
LINT_FILES=$(PROJECT) setup.py
9+
FLAKE8_FILES=$(PROJECT) setup.py doc/conf.py
10+
LINT_FILES=$(PROJECT) setup.py doc/conf.py
1111

1212
help:
1313
@echo "Commands:"
@@ -47,7 +47,8 @@ lint:
4747
clean:
4848
find . -name "*.pyc" -exec rm -v {} \;
4949
find . -name "*~" -exec rm -v {} \;
50-
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache htmlcov coverage.xml
50+
find . -type d -name "__pycache__" -exec rm -rv {} +
51+
rm -rvf build dist MANIFEST *.egg-info .coverage .cache htmlcov coverage.xml
5152
rm -rvf $(TESTDIR)
5253
rm -rvf baseline
5354
rm -rvf result_images

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Project goals
7373
* Build a Pythonic API for GMT.
7474
* Interface with the GMT C API directly using ctypes (no system calls).
7575
* Support for rich display in the Jupyter notebook.
76-
* Integration with the Scipy stack: numpy.ndarray or pandas.DataFrame for data tables
76+
* Integration with the PyData Ecosystem: numpy.ndarray or pandas.DataFrame for data tables
7777
and xarray.DataArray for grids.
7878

7979

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ help:
2121
@echo " doctest run all doctests embedded in the documentation (if enabled)"
2222

2323
clean:
24-
rm -rf $(BUILDDIR)/html/*
24+
rm -rf $(BUILDDIR)/html
2525
rm -rf $(BUILDDIR)/doctrees
2626
rm -rf $(BUILDDIR)/linkcheck
2727
rm -rf modules

doc/_static/version_switch.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright 2013 PSF. Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
2+
// File originates from the cpython source found in Doc/tools/sphinxext/static/version_switch.js
3+
4+
(function() {
5+
'use strict';
6+
7+
var doc_url = "www.pygmt.org";
8+
//var doc_url = "0.0.0.0:8000"; // for local testing only
9+
var url_re = new RegExp(doc_url + "\\/(dev|latest|(v\\d+\\.\\d+\\.\\d+))\\/");
10+
// List all versions.
11+
// Add one entry "version: title" for any minor releases
12+
var all_versions = {
13+
'latest': 'latest',
14+
'dev': 'dev',
15+
'v0.2.0': 'v0.2.0',
16+
'v0.1.2': 'v0.1.2',
17+
'v0.1.1': 'v0.1.1',
18+
'v0.1.0': 'v0.1.0',
19+
'0.0.1a0': 'v0.0.1a0',
20+
};
21+
22+
function build_select(current_version, current_release) {
23+
var buf = ['<select>'];
24+
25+
$.each(all_versions, function(version, title) {
26+
buf.push('<option value="' + version + '"');
27+
if (version == current_version) {
28+
buf.push(' selected="selected">');
29+
if (version == "latest" || version == "dev") {
30+
buf.push(title + ' (' + current_release + ')');
31+
} else {
32+
buf.push(current_version);
33+
}
34+
} else {
35+
buf.push('>' + title);
36+
}
37+
buf.push('</option>');
38+
});
39+
40+
buf.push('</select>');
41+
return buf.join('');
42+
}
43+
44+
function patch_url(url, new_version) {
45+
return url.replace(url_re, doc_url + '/' + new_version + '/');
46+
}
47+
48+
function on_switch() {
49+
var selected = $(this).children('option:selected').attr('value');
50+
51+
var url = window.location.href,
52+
new_url = patch_url(url, selected);
53+
54+
if (new_url != url) {
55+
// check beforehand if url exists, else redirect to version's start page
56+
$.ajax({
57+
url: new_url,
58+
success: function() {
59+
window.location.href = new_url;
60+
},
61+
error: function() {
62+
window.location.href = 'http://' + doc_url + '/' + selected;
63+
}
64+
});
65+
}
66+
}
67+
68+
$(document).ready(function() {
69+
var match = url_re.exec(window.location.href);
70+
if (match) {
71+
var release = DOCUMENTATION_OPTIONS.VERSION;
72+
var version = match[1];
73+
var select = build_select(version, release);
74+
$('.version_switch_note').html('Or, select a version from the drop-down menu above.');
75+
$('.version').html(select);
76+
$('.version select').bind('change', on_switch);
77+
}
78+
});
79+
})();

doc/_templates/layout.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
ga('set', 'anonymizeIp', true);
1616
ga('send', 'pageview');
1717
</script>
18+
19+
<!-- Documentation switcher -->
20+
<!-- Point to the *dev* version switcher. This will allow the latest versions to appear on older documentation. -->
21+
<script type="text/javascript" src="/dev/_static/version_switch.js"></script>
1822
{% endblock %}
1923

2024

doc/conf.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# -*- coding: utf-8 -*-
2-
import sys
3-
import os
4-
import glob
5-
import shutil
2+
"""
3+
Sphinx documentation configuration file.
4+
"""
5+
# pylint: disable=invalid-name
6+
67
import datetime
7-
import sphinx_rtd_theme
8-
import sphinx_gallery
9-
from sphinx_gallery.sorting import FileNameSortKey, ExplicitOrder
8+
from sphinx_gallery.sorting import ( # pylint: disable=no-name-in-module
9+
FileNameSortKey,
10+
ExplicitOrder,
11+
)
1012
from pygmt import __version__, __commit__
1113
from pygmt.sphinx_gallery import PyGMTScraper
1214

@@ -60,6 +62,7 @@
6062
"gallery_dirs": ["gallery", "tutorials", "projections"],
6163
"subsection_order": ExplicitOrder(
6264
[
65+
"../examples/gallery/line",
6366
"../examples/gallery/coast",
6467
"../examples/gallery/plot",
6568
"../examples/gallery/grid",
@@ -90,18 +93,20 @@
9093
templates_path = ["_templates"]
9194
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
9295
source_suffix = ".rst"
96+
needs_sphinx = "1.8"
9397
# The encoding of source files.
9498
source_encoding = "utf-8-sig"
9599
master_doc = "index"
96100

97101
# General information about the project
98102
year = datetime.date.today().year
99103
project = "PyGMT"
100-
copyright = "2017-{}, The PyGMT Developers.".format(year)
104+
copyright = f"2017-{year}, The PyGMT Developers." # pylint: disable=redefined-builtin
101105
if len(__version__.split("+")) > 1 or __version__ == "unknown":
102106
version = "dev"
103107
else:
104108
version = __version__
109+
release = __version__
105110

106111
# These enable substitutions using |variable| in the rst files
107112
rst_epilog = """
@@ -116,6 +121,7 @@
116121
html_logo = ""
117122
html_favicon = "_static/favicon.png"
118123
html_static_path = ["_static"]
124+
html_css_files = ["style.css"]
119125
html_extra_path = []
120126
pygments_style = "default"
121127
add_function_parentheses = False
@@ -127,28 +133,29 @@
127133
html_theme = "sphinx_rtd_theme"
128134
html_theme_options = {}
129135
repository = "GenericMappingTools/pygmt"
130-
commit_link = f'<a href="https://github.com/GenericMappingTools/pygmt/commit/{ __commit__ }">{ __commit__[:7] }</a>'
136+
repository_url = "https://github.com/GenericMappingTools/pygmt"
137+
commit_link = f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:7] }</a>'
131138
html_context = {
132139
"menu_links": [
133140
(
134141
'<i class="fa fa-users fa-fw"></i> Contributing',
135-
"https://github.com/GenericMappingTools/pygmt/blob/master/CONTRIBUTING.md",
142+
f"{repository_url}/blob/master/CONTRIBUTING.md",
136143
),
137144
(
138145
'<i class="fa fa-gavel fa-fw"></i> Code of Conduct',
139-
"https://github.com/GenericMappingTools/pygmt/blob/master/CODE_OF_CONDUCT.md",
146+
f"{repository_url}/blob/master/CODE_OF_CONDUCT.md",
140147
),
141148
(
142149
'<i class="fa fa-book fa-fw"></i> License',
143-
"https://github.com/GenericMappingTools/pygmt/blob/master/LICENSE.txt",
150+
f"{repository_url}/blob/master/LICENSE.txt",
144151
),
145152
(
146153
'<i class="fa fa-comment fa-fw"></i> Contact',
147154
"https://forum.generic-mapping-tools.org",
148155
),
149156
(
150157
'<i class="fa fa-github fa-fw"></i> Source Code',
151-
"https://github.com/GenericMappingTools/pygmt",
158+
repository_url,
152159
),
153160
],
154161
# Custom variables to enable "Improve this page"" and "Download notebook"
@@ -162,8 +169,3 @@
162169
"github_version": "master",
163170
"commit": commit_link,
164171
}
165-
166-
167-
# Load the custom CSS files (needs sphinx >= 1.6 for this to work)
168-
def setup(app):
169-
app.add_stylesheet("style.css")

doc/overview.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ These are conference presentations about the development of PyGMT (previously
4949
* "Building an object-oriented Python interface for the Generic Mapping Tools".
5050
2018.
5151
Leonardo Uieda and Paul Wessel.
52-
Presented at *Scipy 2018*.
52+
Presented at *SciPy 2018*.
5353
doi:`10.6084/m9.figshare.6814052 <https://doi.org/10.6084/m9.figshare.6814052>`__
5454

5555
.. figure:: _static/scipy2018-youtube-thumbnail.png
5656
:target: https://www.youtube.com/watch?v=6wMtfZXfTRM
5757
:align: center
58-
:alt: Scipy youtube video
58+
:alt: SciPy youtube video
5959

6060
* "Integrating the Generic Mapping Tools with the Scientific Python Ecosystem".
6161
2018.
@@ -71,13 +71,13 @@ These are conference presentations about the development of PyGMT (previously
7171
* "Bringing the Generic Mapping Tools to Python".
7272
2017.
7373
Leonardo Uieda and Paul Wessel.
74-
Presented at *Scipy 2017*.
74+
Presented at *SciPy 2017*.
7575
doi:`10.6084/m9.figshare.7635833 <https://doi.org/10.6084/m9.figshare.7635833>`__
7676

7777
.. figure:: _static/scipy2017-youtube-thumbnail.png
7878
:target: https://www.youtube.com/watch?v=93M4How7R24
7979
:align: center
80-
:alt: Scipy youtube video
80+
:alt: SciPy youtube video
8181

8282
* "A modern Python interface for the Generic Mapping Tools".
8383
2017.

examples/gallery/line/README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Lines
2+
-----

examples/gallery/line/linestyles.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""
2+
Line styles
3+
-----------
4+
5+
The :meth:`pygmt.Figure.plot` method can plot lines in different styles.
6+
The default line style is a 0.25-point wide, black, solid line, and can be
7+
customized via the ``pen`` argument.
8+
9+
A *pen* in GMT has three attributes: *width*, *color*, and *style*.
10+
The *style* attribute controls the appearance of the line.
11+
Giving “dotted” or “.” yields a dotted line, whereas a dashed pen is requested
12+
with “dashed” or “-”. Also combinations of dots and dashes, like “.-” for a
13+
dot-dashed line, are allowed.
14+
15+
For more advanced *pen* attributes, see the GMT cookbook
16+
:gmt-docs:`cookbook/features.html#wpen-attrib`.
17+
18+
"""
19+
20+
import numpy as np
21+
import pygmt
22+
23+
# Generate a sample line for plotting
24+
x = np.linspace(0, 10, 500)
25+
y = np.sin(x)
26+
27+
fig = pygmt.Figure()
28+
fig.basemap(region=[0, 10, -3, 3], projection="X15c/8c", frame=["xaf", "yaf", "WSrt"])
29+
30+
# Plot the line using the default line style
31+
fig.plot(x=x, y=y)
32+
33+
# Plot the lines using different line styles
34+
fig.plot(x=x, y=y + 1.5, pen="1p,red,-")
35+
fig.plot(x=x, y=y + 1.0, pen="2p,blue,.")
36+
fig.plot(x=x, y=y + 0.5, pen="1p,red,-.")
37+
38+
fig.plot(x=x, y=y - 0.5, pen="2p,blue,..-")
39+
fig.plot(x=x, y=y - 1.0, pen="3p,tomato,--.")
40+
fig.plot(x=x, y=y - 1.5, pen="3p,tomato,4_2:2p")
41+
42+
fig.show()

0 commit comments

Comments
 (0)