Skip to content

Commit bc84891

Browse files
Update a few tutorials to reduce building time (#871)
Use a lower-resolution earth relief grid to reduce the building time Co-authored-by: Dongdong Tian <[email protected]>
1 parent 5faf06c commit bc84891

File tree

3 files changed

+18
-62
lines changed

3 files changed

+18
-62
lines changed

examples/tutorials/3d-perspective-image.py

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
To save the figure, use ``fig.savefig("figname.pdf")`` where ``"figname.pdf"``
1515
is the desired name and file extension for the saved figure.
1616
"""
17-
# sphinx_gallery_thumbnail_number = 7
17+
# sphinx_gallery_thumbnail_number = 4
1818

1919
import pygmt
2020

2121
# Load sample earth relief data
22-
grid = pygmt.datasets.load_earth_relief(resolution="05m", region=[-108, -103, 35, 40])
22+
grid = pygmt.datasets.load_earth_relief(resolution="10m", region=[-108, -103, 35, 40])
2323

2424
########################################################################################
2525
# The :meth:`pygmt.Figure.grdview` method takes the ``grid`` input.
@@ -45,20 +45,6 @@
4545

4646
########################################################################################
4747
# The grid surface type can be set with the ``surftype`` parameter.
48-
49-
fig = pygmt.Figure()
50-
fig.grdview(
51-
grid=grid,
52-
perspective=[130, 30],
53-
frame=["xa", "ya", "WSnE"],
54-
projection="M15c",
55-
zsize="1.5c",
56-
# Set the surftype to "surface"
57-
surftype="s",
58-
)
59-
fig.show()
60-
61-
########################################################################################
6248
# The default CPT is *turbo* and can be customized with the ``cmap`` parameter.
6349

6450
fig = pygmt.Figure()
@@ -68,6 +54,7 @@
6854
frame=["xa", "yaf", "WSnE"],
6955
projection="M15c",
7056
zsize="1.5c",
57+
# Set the surftype to "surface"
7158
surftype="s",
7259
# Set the CPT to "geo"
7360
cmap="geo",
@@ -94,55 +81,23 @@
9481

9582
########################################################################################
9683
# The ``perspective`` azimuth can be changed to set the direction that is "up"
97-
# in the figure.
84+
# in the figure. The ``contourpen`` parameter sets the pen used to draw contour lines
85+
# on the surface. :meth:`pygmt.Figure.colorbar` can be used to add a color bar to the
86+
# figure. The ``cmap`` parameter does not need to be passed again. To keep the color
87+
# bar's alignment similar to the figure, use ``True`` as the ``perspective`` parameter.
9888

9989
fig = pygmt.Figure()
10090
fig.grdview(
10191
grid=grid,
10292
# Set the azimuth to -130 (230) degrees and the elevation to 30 degrees
10393
perspective=[-130, 30],
104-
frame=["xa", "yaf", "WSnE"],
105-
projection="M15c",
106-
zsize="1.5c",
107-
surftype="s",
108-
cmap="geo",
109-
plane="1000+ggrey",
110-
)
111-
fig.show()
112-
113-
########################################################################################
114-
# The ``contourpen`` parameter sets the pen used to draw contour lines on the surface.
115-
116-
fig = pygmt.Figure()
117-
fig.grdview(
118-
grid=grid,
119-
perspective=[-130, 30],
120-
frame=["xaf", "yaf", "WSnE"],
121-
projection="M15c",
122-
zsize="1.5c",
123-
surftype="s",
124-
cmap="geo",
125-
plane="1000+ggrey",
126-
# Set the contour pen thickness to "0.5p"
127-
contourpen="0.5p",
128-
)
129-
fig.show()
130-
131-
########################################################################################
132-
# :meth:`pygmt.Figure.colorbar` can be used to add a color bar to the figure. The
133-
# ``cmap`` argument does not need to be passed again. To keep the color bar's alignment
134-
# similar to the figure, use ``True`` as the ``perspective`` argument.
135-
136-
fig = pygmt.Figure()
137-
fig.grdview(
138-
grid=grid,
139-
perspective=[-130, 30],
14094
frame=["xaf", "yaf", "WSnE"],
14195
projection="M15c",
14296
zsize="1.5c",
14397
surftype="s",
14498
cmap="geo",
14599
plane="1000+ggrey",
100+
# Set the contour pen thickness to "0.1p"
146101
contourpen="0.1p",
147102
)
148103
fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])

examples/tutorials/earth-relief.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
import pygmt
2121

2222
########################################################################################
23-
# Load sample Earth relief data for the entire globe at a resolution of 30 arc minutes.
24-
# The other available resolutions are show at :gmt-docs:`datasets/remote-data.html#global-earth-relief-grids`.
25-
grid = pygmt.datasets.load_earth_relief(resolution="30m")
23+
# Load sample Earth relief data for the entire globe at a resolution of 1 arc degree.
24+
# The other available resolutions are show
25+
# at :gmt-docs:`datasets/remote-data.html#global-earth-relief-grids`.
26+
grid = pygmt.datasets.load_earth_relief(resolution="01d")
2627

2728
########################################################################################
2829
# Create a plot
@@ -95,15 +96,15 @@
9596
#
9697
# In addition to providing global data, the ``region`` argument for
9798
# :meth:`pygmt.datasets.load_earth_relief` can be used to provide data for a specific
98-
# area. The ``region`` argument is required for resolutions at 5 arc minutes or higher, and
99-
# accepts a list (as in the example below) or a string. The geographic ranges are
99+
# area. The ``region`` argument is required for resolutions at 5 arc minutes or higher,
100+
# and accepts a list (as in the example below) or a string. The geographic ranges are
100101
# passed as *xmin*/*xmax*/*ymin*/*ymax*.
101102
#
102-
# The example below uses data with a 5 arc minute resolution, and plots it on a
103+
# The example below uses data with a 10 arc minute resolution, and plots it on a
103104
# 15 centimeter figure with a Mercator projection and a CPT set to *geo*.
104105
# ``frame="a"`` is used to add a frame to the figure.
105106

106-
grid = pygmt.datasets.load_earth_relief(resolution="05m", region=[-14, 30, 35, 60])
107+
grid = pygmt.datasets.load_earth_relief(resolution="10m", region=[-14, 30, 35, 60])
107108
fig = pygmt.Figure()
108109
fig.grdimage(grid=grid, projection="M15c", frame="a", cmap="geo")
109110
fig.colorbar(frame=["a1000", "x+lElevation", "y+lm"])

examples/tutorials/regions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
fig.coast(
9797
region="d",
9898
projection="Cyl_stere/12c",
99-
land="lightgray",
99+
land="darkgray",
100100
water="white",
101101
borders="1/0.5p",
102102
shorelines="1/0.5p",
@@ -115,7 +115,7 @@
115115
fig.coast(
116116
region="g",
117117
projection="Cyl_stere/12c",
118-
land="lightgray",
118+
land="darkgray",
119119
water="white",
120120
borders="1/0.5p",
121121
shorelines="1/0.5p",

0 commit comments

Comments
 (0)