|
2 | 2 | Create 'wet-dry' mask grid |
3 | 3 | ========================== |
4 | 4 |
|
5 | | -The :func:`pygmt.grdlandmask` function allows setting all nodes on land |
6 | | -or water to a specified value using the ``mask_values`` parameter. |
| 5 | +The :func:`pygmt.grdlandmask` function allows setting all nodes on land or water to a |
| 6 | +specified value using the ``mask_values`` parameter. |
7 | 7 | """ |
8 | 8 |
|
9 | 9 | # %% |
|
15 | 15 | # Define region of interest |
16 | 16 | region = [-65, -40, -40, -20] |
17 | 17 |
|
18 | | -# Assign a value of 0 for all water masses and a value of 1 for all land |
19 | | -# masses. |
20 | | -# Use shoreline data with (l)ow resolution and set the grid spacing to |
21 | | -# 5 arc-minutes in x- and y-directions. |
| 18 | +# Assign a value of 0 for all water masses and a value of 1 for all land masses. Use |
| 19 | +# shoreline data with low resolution and set the grid spacing to 5 arc-minutes in x- |
| 20 | +# and y-directions. |
22 | 21 | grid = pygmt.grdlandmask( |
23 | | - region=region, spacing="5m", mask_values=[0, 1], resolution="l" |
| 22 | + region=region, spacing="5m", mask_values=[0, 1], resolution="low" |
24 | 23 | ) |
25 | 24 |
|
26 | 25 | # Plot clipped grid |
27 | 26 | fig.basemap(region=region, projection="M12c", frame=True) |
28 | 27 |
|
29 | | -# Define a colormap to be used for two categories, define the range of the |
30 | | -# new discrete CPT using series=(lowest_value, highest_value, interval), |
31 | | -# use color_model="+cwater,land" to write the discrete color palette |
32 | | -# "batlow" in categorical format and add water/land as annotations for the |
33 | | -# colorbar. |
| 28 | +# Define a colormap to be used for two categories, define the range of the new discrete |
| 29 | +# CPT using series=(low, high, interval), use color_model="+cwater,land" to write the |
| 30 | +# discrete color palette "SCM/batlow" in categorical format and add water/land as |
| 31 | +# annotations for the colorbar. |
34 | 32 | pygmt.makecpt(cmap="SCM/batlow", series=(0, 1, 1), color_model="+cwater,land") |
35 | 33 |
|
36 | 34 | fig.grdimage(grid=grid, cmap=True) |
|
0 commit comments