Skip to content

Commit ccd27c0

Browse files
Merge branch 'master' into wrap-grd2xyz
2 parents cd26ff2 + 7c29e60 commit ccd27c0

17 files changed

+356
-144
lines changed

.github/workflows/cache_data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
# Install GMT
2828
- name: Install GMT
29-
run: conda install -c conda-forge gmt=6.1.1
29+
run: conda install -c conda-forge/label/dev gmt=6.2.0rc2
3030

3131
# Download remote files
3232
- name: Download remote data

.github/workflows/ci_docs.yml

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

.github/workflows/ci_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
optional-packages: ''
5353
- python-version: 3.9
5454
numpy-version: '1.20'
55-
optional-packages: 'geopandas'
55+
optional-packages: '' # 'geopandas'
5656
defaults:
5757
run:
5858
shell: bash -l {0}
@@ -89,7 +89,7 @@ jobs:
8989
# Install GMT and other required dependencies from conda-forge
9090
- name: Install dependencies
9191
run: |
92-
conda install conda-forge/label/dev::gmt=6.2.0rc1 \
92+
conda install conda-forge/label/dev::gmt=6.2.0rc2 \
9393
numpy=${{ matrix.numpy-version }} \
9494
pandas xarray netCDF4 packaging \
9595
${{ matrix.optional-packages }} \

.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

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Operations on grids:
9393
grdcut
9494
grdfill
9595
grdfilter
96+
grdgradient
9697
grdtrack
9798

9899
Crossover analysis with x2sys:

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ channels:
66
dependencies:
77
# Required dependencies
88
- pip
9-
- gmt=6.2.0rc1
9+
- gmt=6.2.0rc2
1010
- numpy>=1.17
1111
- pandas
1212
- xarray

pygmt/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
grdcut,
3939
grdfill,
4040
grdfilter,
41+
grdgradient,
4142
grdinfo,
4243
grdtrack,
4344
info,

pygmt/helpers/decorators.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,37 @@
4040
color : str or 1d array
4141
Select color or pattern for filling of symbols or polygons. Default
4242
is no fill.""",
43+
"I": r"""
44+
spacing : str
45+
*xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]].
46+
*x_inc* [and optionally *y_inc*] is the grid spacing.
47+
48+
- **Geographical (degrees) coordinates**: Optionally, append an
49+
increment unit. Choose among **m** to indicate arc minutes or
50+
**s** to indicate arc seconds. If one of the units **e**, **f**,
51+
**k**, **M**, **n** or **u** is appended instead, the increment
52+
is assumed to be given in meter, foot, km, mile, nautical mile or
53+
US survey foot, respectively, and will be converted to the
54+
equivalent degrees longitude at the middle latitude of the region
55+
(the conversion depends on :gmt-term:`PROJ_ELLIPSOID`). If
56+
*y_inc* is given but set to 0 it will be reset equal to *x_inc*;
57+
otherwise it will be converted to degrees latitude.
58+
59+
- **All coordinates**: If **+e** is appended then the corresponding
60+
max *x* (*east*) or *y* (*north*) may be slightly adjusted to fit
61+
exactly the given increment [by default the increment may be
62+
adjusted slightly to fit the given domain]. Finally, instead of
63+
giving an increment you may specify the *number of nodes* desired
64+
by appending **+n** to the supplied integer argument; the
65+
increment is then recalculated from the number of nodes, the
66+
*registration*, and the domain. The resulting increment value
67+
depends on whether you have selected a gridline-registered or
68+
pixel-registered grid; see :gmt-docs:`GMT File Formats
69+
<cookbook/file-formats.html#gmt-file-formats>` for details.
70+
71+
**Note**: If ``region=grdfile`` is used then the grid spacing and
72+
the registration have already been initialized; use ``spacing`` and
73+
``registration`` to override these values.""",
4374
"V": """\
4475
verbose : bool or str
4576
Select verbosity level [Default is **w**], which modulates the messages

pygmt/src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from pygmt.src.grdcut import grdcut
1717
from pygmt.src.grdfill import grdfill
1818
from pygmt.src.grdfilter import grdfilter
19+
from pygmt.src.grdgradient import grdgradient
1920
from pygmt.src.grdimage import grdimage
2021
from pygmt.src.grdinfo import grdinfo
2122
from pygmt.src.grdtrack import grdtrack

0 commit comments

Comments
 (0)