Skip to content

Commit a56a281

Browse files
authored
Add gallery example for grdlandmask
According to #1421 here's now the gallery example showcasing the use of ``grdlandmask``.
1 parent 8a6db70 commit a56a281

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
Create 'wet-dry' mask grid
3+
--------------------
4+
The :meth:`pygmt.grdlandmash` method allows to set
5+
all nodes on land or water to a specified value using
6+
the ``maskvalues`` parameter.
7+
"""
8+
9+
import pygmt
10+
11+
fig = pygmt.Figure()
12+
13+
# Assign a value of 0 for all water masses and a value of 1 for all land masses
14+
grid = pygmt.grdlandmask(region=[-65, -40, -40, -20], spacing = "5m", maskvalues = "0/1", resolution = "l")
15+
16+
# Plot clipped grid
17+
fig.basemap(
18+
region=region, projection="M12c", frame=True
19+
)
20+
21+
fig.grdimage(grid=grid, cmap="lajolla")
22+
fig.colorbar(position="JMR+o0.5c/0c+w8c")
23+
24+
fig.show()

0 commit comments

Comments
 (0)