Skip to content

Commit 6936f59

Browse files
committed
Merge branch 'main' into clib/load-libgmt
2 parents 713b0e9 + 75e56e5 commit 6936f59

File tree

7 files changed

+40
-36
lines changed

7 files changed

+40
-36
lines changed

.github/workflows/ci_tests_dev.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
121121
env:
122122
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
123-
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
123+
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
124124
if: runner.os != 'Windows'
125125

126126
- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
@@ -139,13 +139,15 @@ jobs:
139139
-DGMT_USE_THREADS=TRUE
140140
cmake --build .
141141
cmake --build . --target install
142+
cd ..
143+
rm -rf gmt/
142144
env:
143145
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
144-
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
146+
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
145147
if: runner.os == 'Windows'
146148

147149
- name: Add GMT's bin to PATH
148-
run: echo '${{ github.workspace }}/gmt-install-dir/bin' >> $GITHUB_PATH
150+
run: echo '${{ runner.temp }}/gmt-install-dir/bin' >> $GITHUB_PATH
149151

150152
# Install dependencies from PyPI
151153
- name: Install dependencies
@@ -163,7 +165,7 @@ jobs:
163165

164166
# Pull baseline image data from dvc remote (DAGsHub)
165167
- name: Pull baseline image data from dvc remote
166-
run: dvc pull && ls -lhR pygmt/tests/baseline/
168+
run: dvc pull --verbose && ls -lhR pygmt/tests/baseline/
167169

168170
# Download cached remote files (artifacts) from GitHub
169171
- name: Download remote data from GitHub
@@ -191,7 +193,7 @@ jobs:
191193
- name: Test with pytest
192194
run: make test PYTEST_EXTRA="-r P"
193195
env:
194-
GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt-install-dir/lib
196+
GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib
195197

196198
# Upload diff images on test failure
197199
- name: Upload diff images if any test fails

doc/contributing.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -320,24 +320,24 @@ Open `doc/_build/html/index.html` in your browser to view the pages. Follow the
320320
Many of the PyGMT functions have example code in their documentation. To contribute an
321321
example, add an "Example" header and put the example code below it. Have all lines
322322
begin with `>>>`. To keep this example code from being run during testing, add the code
323-
`__doctest_skip__ = [function name]` to the top of the module.
323+
`__doctest_skip__ = ["function_name"]` to the top of the module.
324324

325325
**Inline code example**
326326

327327
Below the import statements at the top of the file
328328

329-
``
330-
__doctest_skip__ = ["module_name"]
331-
``
332-
333-
At the end of the function's docstring
329+
```python
330+
__doctest_skip__ = ["function_name"]
334331

335-
Example
336-
-------
337-
>>> import pygmt
338-
>>> # Comment describing what is happening
339-
>>> Code example
332+
At the end of the function's docstring:
340333

334+
```python
335+
Example
336+
-------
337+
>>> import pygmt
338+
>>> # Comment describing what is happening
339+
>>> Code example
340+
```
341341

342342
### Contributing Gallery Plots
343343

@@ -580,7 +580,9 @@ returning the `pygmt.Figure` object:
580580
```python
581581
@pytest.mark.mpl_image_compare
582582
def test_my_plotting_case():
583-
"Test that my plotting method works"
583+
"""
584+
Test that my plotting method works.
585+
"""
584586
fig = Figure()
585587
fig.basemap(region=[0, 360, -90, 90], projection="W15c", frame=True)
586588
return fig
@@ -675,20 +677,22 @@ summarized as follows:
675677
dvc push # Run before git push to enable automated testing with the new images
676678
git push
677679

678-
#### Using check_figures_equal
680+
#### Using `check_figures_equal`
679681

680682
This approach draws the same figure using two different methods (the reference
681683
method and the tested method), and checks that both of them are the same.
682-
It takes two `pygmt.Figure` objects ('fig_ref' and 'fig_test'), generates a png
684+
It takes two `pygmt.Figure` objects (`fig_ref` and `fig_test`), generates a png
683685
image, and checks for the Root Mean Square (RMS) error between the two.
684686
Here's an example:
685687

686688
```python
687689
@check_figures_equal()
688690
def test_my_plotting_case():
689-
"Test that my plotting method works"
690-
fig_ref, fig_test = Figure(), Figure()
691-
fig_ref.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo")
692-
fig_test.grdimage(grid, projection="W120/15c", cmap="geo")
693-
return fig_ref, fig_test
691+
"""
692+
Test that my plotting method works.
693+
"""
694+
fig_ref, fig_test = Figure(), Figure()
695+
fig_ref.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo")
696+
fig_test.grdimage(grid, projection="W120/15c", cmap="geo")
697+
return fig_ref, fig_test
694698
```

pygmt/datasets/samples.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _load_japan_quakes():
2626
return pd.read_csv(
2727
fname,
2828
header=1,
29-
delim_whitespace=True,
29+
sep=r"\s+",
3030
names=[
3131
"year",
3232
"month",
@@ -52,7 +52,7 @@ def _load_ocean_ridge_points():
5252
fname = which("@ridge.txt", download="c")
5353
return pd.read_csv(
5454
fname,
55-
delim_whitespace=True,
55+
sep=r"\s+",
5656
names=["longitude", "latitude"],
5757
skiprows=1,
5858
comment=">",
@@ -102,9 +102,7 @@ def _load_fractures_compilation():
102102
the fractures.
103103
"""
104104
fname = which("@fractures_06.txt", download="c")
105-
data = pd.read_csv(
106-
fname, header=None, delim_whitespace=True, names=["azimuth", "length"]
107-
)
105+
data = pd.read_csv(fname, header=None, sep=r"\s+", names=["azimuth", "length"])
108106
return data[["length", "azimuth"]]
109107

110108

@@ -167,7 +165,7 @@ def _load_rock_sample_compositions():
167165
fname = which("@ternary.txt", download="c")
168166
return pd.read_csv(
169167
fname,
170-
delim_whitespace=True,
168+
sep=r"\s+",
171169
header=None,
172170
names=["limestone", "water", "air", "permittivity"],
173171
)
@@ -183,7 +181,7 @@ def _load_notre_dame_topography():
183181
The data table with columns "x", "y", and "z".
184182
"""
185183
fname = which("@Table_5_11.txt", download="c")
186-
return pd.read_csv(fname, delim_whitespace=True, header=None, names=["x", "y", "z"])
184+
return pd.read_csv(fname, sep=r"\s+", header=None, names=["x", "y", "z"])
187185

188186

189187
def _load_maunaloa_co2():
@@ -197,7 +195,7 @@ def _load_maunaloa_co2():
197195
"""
198196
fname = which("@MaunaLoa_CO2.txt", download="c")
199197
return pd.read_csv(
200-
fname, header=None, skiprows=1, delim_whitespace=True, names=["date", "co2_ppm"]
198+
fname, header=None, skiprows=1, sep=r"\s+", names=["date", "co2_ppm"]
201199
)
202200

203201

pygmt/tests/test_contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def fixture_data():
1818
"""
1919
Load the point data from the test file.
2020
"""
21-
return pd.read_table(POINTS_DATA, header=None, delim_whitespace=True)
21+
return pd.read_table(POINTS_DATA, header=None, sep=r"\s+")
2222

2323

2424
@pytest.fixture(scope="module", name="region")

pygmt/tests/test_grdtrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def fixture_dataframe():
5151
Load a pandas DataFrame with points.
5252
"""
5353
return pd.read_csv(
54-
POINTS_DATA, delim_whitespace=True, header=None, names=["longitude", "latitude"]
54+
POINTS_DATA, sep=r"\s+", header=None, names=["longitude", "latitude"]
5555
)
5656

5757

pygmt/tests/test_surface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def fixture_data():
1818
"""
1919
fname = which("@Table_5_11_mean.xyz", download="c")
2020
return pd.read_csv(
21-
fname, delim_whitespace=True, header=None, names=["x", "y", "z"], skiprows=1
21+
fname, sep=r"\s+", header=None, names=["x", "y", "z"], skiprows=1
2222
)
2323

2424

pygmt/tests/test_triangulate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def fixture_dataframe():
1919
"""
2020
fname = which("@Table_5_11_mean.xyz", download="c")
2121
return pd.read_csv(
22-
fname, delim_whitespace=True, header=None, names=["x", "y", "z"], skiprows=1
22+
fname, sep=r"\s+", header=None, names=["x", "y", "z"], skiprows=1
2323
)[:10]
2424

2525

0 commit comments

Comments
 (0)