Skip to content

Commit 1470473

Browse files
Merge branch 'master' into columns-plot3d
2 parents 73e21ac + 64a34d2 commit 1470473

File tree

128 files changed

+2220
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2220
-528
lines changed

.github/ISSUE_TEMPLATE/release_checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ assignees: ''
2929
- [ ] Edit the draft release notes with the finalized changelog
3030
- [ ] Set the tag version and release title to vX.Y.Z
3131
- [ ] Make a release by clicking the 'Publish Release' button, this will automatically create a tag too
32-
- [ ] Manually upload the pygmt-vX.Y.Z.zip file to https://zenodo.org/deposit, ensure that it is filed under the correct reserved DOI
32+
- [ ] Manually upload the pygmt-vX.Y.Z.zip and baseline-images.zip files to https://zenodo.org/deposit, ensure that it is filed under the correct reserved DOI
3333

3434
**After release**:
3535
- [ ] Update conda-forge [pygmt-feedstock](https://github.com/conda-forge/pygmt-feedstock) [Usually done automatically by conda-forge's bot]

.github/workflows/cache_data.yaml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,36 @@ jobs:
1717
shell: bash -l {0}
1818

1919
steps:
20+
# Checkout current git repository
21+
- name: Checkout
22+
uses: actions/checkout@v2.3.4
23+
with:
24+
# fecth all history so that setuptools-scm works
25+
fetch-depth: 0
26+
2027
# Setup Miniconda
2128
- name: Setup Miniconda
2229
uses: conda-incubator/setup-miniconda@v2.1.1
2330
with:
2431
channels: conda-forge
2532
miniconda-version: "latest"
2633

27-
# Install GMT
28-
- name: Install GMT
29-
run: conda install -c conda-forge gmt=6.1.1
34+
# Install GMT and other required dependencies from conda-forge
35+
- name: Install dependencies
36+
run: |
37+
conda install gmt=6.2.0 \
38+
numpy pandas xarray netCDF4 packaging matplotlib
39+
40+
# Install the package that we want to test
41+
- name: Install the package
42+
run: |
43+
python setup.py sdist --formats=zip
44+
pip install dist/*
3045
3146
# Download remote files
3247
- name: Download remote data
3348
run: |
34-
gmt which -Ga @earth_relief_10m_p @earth_relief_10m_g \
35-
@earth_relief_30m_p @earth_relief_30m_g \
36-
@earth_relief_01d_p @earth_relief_01d_g \
37-
@earth_relief_05m_p @earth_relief_05m_g
38-
# Download one tile of the 03s srtm data.
39-
# @N35E135.earth_relief_03s_g.nc is for internal use only.
40-
# The naming scheme may change.
41-
# DO NOT USE IT IN SCRIPTS.
42-
gmt which -Ga @N35E135.earth_relief_03s_g.nc
43-
# @srtm_tiles.nc is needed for 03s and 01s relief data
44-
gmt which -Ga @srtm_tiles.nc
45-
gmt which -Ga @ridge.txt @Table_5_11.txt @test.dat.nc \
46-
@tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz \
47-
@usgs_quakes_22.txt @fractures_06.txt
49+
python -c "from pygmt.helpers.testing import download_test_data; download_test_data()"
4850
4951
# Upload the downloaded files as artifacts to GitHub
5052
- name: Upload artifacts to GitHub

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ jobs:
6666
# Install GMT and other required dependencies from conda-forge
6767
- name: Install dependencies
6868
run: |
69-
conda install -c conda-forge/label/dev gmt=6.2.0rc1
70-
conda install numpy pandas xarray netCDF4 packaging \
69+
conda install gmt=6.2.0 numpy pandas xarray netCDF4 packaging \
7170
ipython make myst-parser \
7271
sphinx sphinx-copybutton sphinx-gallery sphinx_rtd_theme
7372

.github/workflows/ci_tests.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ jobs:
4545
# python-version: 3.7
4646
# isDraft: true
4747
# Pair Python 3.7 with NumPy 1.17 and Python 3.9 with NumPy 1.20
48+
# Only install optional packages on Python 3.9/NumPy 1.20
4849
include:
4950
- python-version: 3.7
5051
numpy-version: '1.17'
52+
optional-packages: ''
5153
- python-version: 3.9
5254
numpy-version: '1.20'
55+
optional-packages: '' # 'geopandas'
5356
defaults:
5457
run:
5558
shell: bash -l {0}
@@ -86,9 +89,9 @@ jobs:
8689
# Install GMT and other required dependencies from conda-forge
8790
- name: Install dependencies
8891
run: |
89-
conda install -c conda-forge/label/dev gmt=6.2.0rc1
90-
conda install numpy=${{ matrix.numpy-version }} \
92+
conda install gmt=6.2.0 numpy=${{ matrix.numpy-version }} \
9193
pandas xarray netCDF4 packaging \
94+
${{ matrix.optional-packages }} \
9295
codecov coverage[toml] dvc ipython make \
9396
pytest-cov pytest-mpl pytest>=6.0 \
9497
sphinx-gallery

.github/workflows/ci_tests_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
# Install dependencies from conda-forge
8484
- name: Install dependencies
8585
run: |
86-
conda install ninja cmake libblas libcblas liblapack fftw gdal \
86+
conda install ninja cmake libblas libcblas liblapack fftw gdal=3.2 geopandas \
8787
ghostscript libnetcdf hdf5 zlib curl pcre make dvc
8888
pip install --pre numpy pandas xarray netCDF4 packaging \
8989
ipython pytest-cov pytest-mpl pytest>=6.0 sphinx-gallery

.github/workflows/dvc-diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Setup data version control (DVC)
22-
uses: iterative/setup-dvc@v1.0.2
22+
uses: iterative/setup-dvc@v1.0.3
2323

2424
- name: Setup continuous machine learning (CML)
2525
uses: iterative/setup-cml@v1.0.0
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Upload the ZIP archive of baseline images as a release asset
2+
3+
name: Upload baseline images
4+
5+
# Only run for releases
6+
on:
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
upload-baseline:
13+
name: Upload baseline images
14+
runs-on: ubuntu-latest
15+
if: github.repository == 'GenericMappingTools/pygmt'
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2.3.4
20+
21+
- name: Setup data version control (DVC)
22+
uses: iterative/setup-dvc@v1.0.3
23+
24+
- name: Pull baseline image data from dvc remote
25+
run: |
26+
dvc pull
27+
ls -lhR pygmt/tests/baseline/
28+
29+
- name: Create the baseline image asset in zip format
30+
run: |
31+
mkdir baseline-images
32+
mv pygmt/tests/baseline/*.png baseline-images/
33+
zip -r baseline-images.zip baseline-images
34+
shasum -a 256 baseline-images.zip
35+
36+
- name: Upload baseline image as a release asset
37+
uses: shogo82148/actions-upload-release-asset@v1.3.0
38+
with:
39+
upload_url: ${{ github.event.release.upload_url }}
40+
asset_path: baseline-images.zip

CONTRIBUTING.md

Lines changed: 73 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ read it carefully.
4949
- [Testing your code](#testing-your-code)
5050
- [Testing plots](#testing-plots)
5151
- [Documentation](#documentation)
52-
- [Code Review](#code-review)
5352

5453

5554
## What Can I Do?
@@ -205,36 +204,73 @@ hesitate to [ask questions](#how-can-i-talk-to-you)):
205204

206205
### General guidelines
207206

208-
We follow the [git pull request workflow](http://www.asmeurer.com/git-workflow/) to
209-
make changes to our codebase.
207+
We follow the [git pull request workflow](http://www.asmeurer.com/git-workflow)
208+
to make changes to our codebase.
210209
Every change made goes through a pull request, even our own, so that our
211-
[continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) services
212-
have a change to check that the code is up to standards and passes all our tests.
210+
[continuous integration](https://en.wikipedia.org/wiki/Continuous_integration)
211+
services have a chance to check that the code is up to standards and passes all
212+
our tests.
213213
This way, the *master* branch is always stable.
214214

215-
General guidelines for pull requests (PRs):
216-
217-
* **Open an issue first** describing what you want to do. If there is already an issue
218-
that matches your PR, leave a comment there instead to let us know what you plan to
219-
do.
220-
* Each pull request should consist of a **small** and logical collection of changes.
221-
* Larger changes should be broken down into smaller components and integrated
222-
separately. For example, break the wrapping of aliases into multiple pull requests.
223-
* Bug fixes should be submitted in separate PRs.
224-
* Use underscores for all Python (*.py) files as per [PEP8](https://www.python.org/dev/peps/pep-0008/),
225-
not hyphens. Directory names should also use underscores instead of hyphens.
226-
* Describe what your PR changes and *why* this is a good thing. Be as specific as you
227-
can. The PR description is how we keep track of the changes made to the project over
228-
time.
229-
* Do not commit changes to files that are irrelevant to your feature or bugfix (eg:
230-
`.gitignore`, IDE project files, etc).
231-
* Write descriptive commit messages. Chris Beams has written a
232-
[guide](https://chris.beams.io/posts/git-commit/) on how to write good commit
233-
messages.
234-
* Be willing to accept criticism and work on improving your code; we don't want to break
235-
other users' code, so care must be taken not to introduce bugs.
236-
* Be aware that the pull request review process is not immediate, and is generally
237-
proportional to the size of the pull request.
215+
General guidelines for making a Pull Request (PR):
216+
217+
* What should be included in a PR
218+
- Have a quick look at the titles of all the existing issues first. If there
219+
is already an issue that matches your PR, leave a comment there to let us
220+
know what you plan to do. Otherwise, **open an issue** describing what you
221+
want to do.
222+
- Each pull request should consist of a **small** and logical collection of
223+
changes; larger changes should be broken down into smaller parts and
224+
integrated separately.
225+
- Bug fixes should be submitted in separate PRs.
226+
* How to write and submit a PR
227+
- Use underscores for all Python (*.py) files as per
228+
[PEP8](https://www.python.org/dev/peps/pep-0008/), not hyphens. Directory
229+
names should also use underscores instead of hyphens.
230+
- Describe what your PR changes and *why* this is a good thing. Be as
231+
specific as you can. The PR description is how we keep track of the changes
232+
made to the project over time.
233+
- Do not commit changes to files that are irrelevant to your feature or
234+
bugfix (e.g.: `.gitignore`, IDE project files, etc).
235+
- Write descriptive commit messages. Chris Beams has written a
236+
[guide](https://chris.beams.io/posts/git-commit/) on how to write good
237+
commit messages.
238+
* PR review
239+
- Be willing to accept criticism and work on improving your code; we don't
240+
want to break other users' code, so care must be taken not to introduce
241+
bugs.
242+
- Be aware that the pull request review process is not immediate, and is
243+
generally proportional to the size of the pull request.
244+
245+
#### Code Review
246+
247+
After you've submitted a pull request, you should expect to hear at least a
248+
comment within a couple of days. We may suggest some changes, improvements or
249+
alternative implementation details.
250+
251+
To increase the chances of getting your pull request accepted quickly, try to:
252+
253+
* Submit a friendly PR
254+
- Write a good and detailed description of what the PR does.
255+
- Write some documentation for your code (docstrings) and leave comments
256+
explaining the *reason* behind non-obvious things.
257+
- Write tests for the code you wrote/modified if needed.
258+
Please refer to [Testing your code](#testing-your-code) or
259+
[Testing plots](#testing-plots).
260+
- Include an example of new features in the gallery or tutorials.
261+
Please refer to [Gallery plots](#gallery-plots) or [Tutorials](#tutorials).
262+
* Have a good coding style
263+
- Use readable code, as it is better than clever code (even with comments).
264+
- Follow the [PEP8](http://pep8.org) style guide for code and the
265+
[numpy style guide](https://numpydoc.readthedocs.io/en/latest/format.html)
266+
for docstrings. Please refer to [Code style](#code-style).
267+
268+
Pull requests will automatically have tests run by GitHub Actions.
269+
This includes running both the unit tests as well as code linters.
270+
GitHub will show the status of these checks on the pull request.
271+
Try to get them all passing (green).
272+
If you have any trouble, leave a comment in the PR or
273+
[get in touch](#how-can-i-talk-to-you).
238274

239275
### Setting up your environment
240276

@@ -510,11 +546,17 @@ def test_my_plotting_case():
510546

511547
### Documentation
512548

549+
Most documentation sources are in Python `*.py` files under the `examples/`
550+
folder, and the code docstrings can be found e.g. under the `pygmt/src/` and
551+
`pygmt/datasets/` folders. The documentation are written in
552+
[reStructuredText](https://docutils.sourceforge.io/rst.html) and
553+
built by [Sphinx](http://www.sphinx-doc.org/). Please refer to
554+
[reStructuredText Cheatsheet](https://docs.generic-mapping-tools.org/latest/rst-cheatsheet.html)
555+
if you are new to reStructuredText.
556+
513557
#### Building the documentation
514558

515-
Most documentation sources are in the `doc` folder.
516-
We use [sphinx](http://www.sphinx-doc.org/) to build the web pages from these sources.
517-
To build the HTML files:
559+
To build the HTML files from sources:
518560

519561
```bash
520562
cd doc
@@ -560,33 +602,3 @@ https://docs.generic-mapping-tools.org/latest/gmt.conf.html#term-COLOR_FOREGROUN
560602

561603
Sphinx will create a link to the automatically generated page for that
562604
function/class/module.
563-
564-
**All docstrings** should follow the
565-
[numpy style guide](https://numpydoc.readthedocs.io/en/latest/format.html).
566-
All functions/classes/methods should have docstrings with a full description of all
567-
arguments and return values.
568-
569-
### Code Review
570-
571-
After you've submitted a pull request, you should expect to hear at least a comment
572-
within a couple of days.
573-
We may suggest some changes or improvements or alternatives.
574-
575-
Some things that will increase the chance that your pull request is accepted quickly:
576-
577-
* Write a good and detailed description of what the PR does.
578-
* Write tests for the code you wrote/modified.
579-
* Readable code is better than clever code (even with comments).
580-
* Write documentation for your code (docstrings) and leave comments explaining the
581-
*reason* behind non-obvious things.
582-
* Include an example of new features in the gallery or tutorials.
583-
* Follow the [PEP8](http://pep8.org) style guide for code and the
584-
[numpy guide](https://numpydoc.readthedocs.io/en/latest/format.html)
585-
for documentation.
586-
587-
Pull requests will automatically have tests run by GitHub Actions.
588-
This includes running both the unit tests as well as code linters.
589-
GitHub will show the status of these checks on the pull request.
590-
Try to get them all passing (green).
591-
If you have any trouble, leave a comment in the PR or
592-
[get in touch](#how-can-i-talk-to-you).

doc/api/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ Operations on grids:
8888
.. autosummary::
8989
:toctree: generated
9090

91+
grdclip
9192
grdcut
93+
grdfill
9294
grdfilter
95+
grdlandmask
96+
grdgradient
9397
grdtrack
9498

9599
Crossover analysis with x2sys:

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
# intersphinx configuration
4949
intersphinx_mapping = {
5050
"python": ("https://docs.python.org/3/", None),
51+
"geopandas": ("https://geopandas.org/", None),
5152
"numpy": ("https://numpy.org/doc/stable/", None),
5253
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
5354
"xarray": ("https://xarray.pydata.org/en/stable/", None),

0 commit comments

Comments
 (0)