From 3042331c158b0a691d5a46de3bf12dfebc8d56b4 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 5 Aug 2024 17:44:16 +0800 Subject: [PATCH 1/5] Link to the PyGMT projection table in the Earth relief tutorial and rephrase some sentences --- examples/tutorials/advanced/earth_relief.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/examples/tutorials/advanced/earth_relief.py b/examples/tutorials/advanced/earth_relief.py index 3994e96dfa5..62abaa1e65a 100644 --- a/examples/tutorials/advanced/earth_relief.py +++ b/examples/tutorials/advanced/earth_relief.py @@ -2,9 +2,9 @@ Plotting Earth relief ===================== -Plotting a map of Earth relief can use the data accessed by the -:func:`pygmt.datasets.load_earth_relief` function. The data can then be -plotted using the :meth:`pygmt.Figure.grdimage` method. +PyGMT provides the :func:`pygmt.datasets.load_earth_relief` function to download the +Earth relief data from the GMT remote server and load as an :class:`xarray.DataArray` +object. The data can then be plotted using the :meth:`pygmt.Figure.grdimage` method. """ # %% @@ -12,8 +12,7 @@ # %% # Load sample Earth relief data for the entire globe at a resolution of -# 1 arc-degree. The other available resolutions are shown at -# :gmt-datasets:`earth-relief.html`. +# 1 arc-degree. Refer to :func:`pygmt.datasets.load_earth_relief` for the other available resolutions. grid = pygmt.datasets.load_earth_relief(resolution="01d") @@ -34,7 +33,7 @@ # :meth:`pygmt.Figure.grdimage` can take the optional parameter ``projection`` # for the map. In the example below, ``projection`` is set to ``"R12c"`` for # a 12-centimeters-wide figure with a Winkel Tripel projection. For a list -# of available projections, see :gmt-docs:`reference/map-projections.html`. +# of available projections, see :doc:`/techref/projections`. fig = pygmt.Figure() fig.grdimage(grid=grid, projection="R12c") @@ -90,9 +89,7 @@ # In addition to providing global data, the ``region`` parameter for # :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a # specific area. The ``region`` parameter is required for resolutions at -# 5 arc-minutes or higher, and accepts a list (as in the example below) or a -# string. For the later, the geographic range is passed as -# "*xmin*/*xmax*/*ymin*/*ymax*". +# 5 arc-minutes or higher, and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*"]. # # The example below uses data with a 10 arc-minutes resolution, and plots it on # a 15-centimeters-wide figure with a Mercator projection and a CPT set to From 51e2a009701c4bd76ed5c16d4874b95ec5153600 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 5 Aug 2024 17:45:57 +0800 Subject: [PATCH 2/5] Rewrap to 88 characters --- examples/tutorials/advanced/earth_relief.py | 53 ++++++++++----------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/examples/tutorials/advanced/earth_relief.py b/examples/tutorials/advanced/earth_relief.py index 62abaa1e65a..9d6a9a5e194 100644 --- a/examples/tutorials/advanced/earth_relief.py +++ b/examples/tutorials/advanced/earth_relief.py @@ -11,8 +11,8 @@ import pygmt # %% -# Load sample Earth relief data for the entire globe at a resolution of -# 1 arc-degree. Refer to :func:`pygmt.datasets.load_earth_relief` for the other available resolutions. +# Load sample Earth relief data for the entire globe at a resolution of 1 arc-degree. +# Refer to :func:`pygmt.datasets.load_earth_relief` for the other available resolutions. grid = pygmt.datasets.load_earth_relief(resolution="01d") @@ -20,20 +20,20 @@ # Create a plot # ------------- # -# The :meth:`pygmt.Figure.grdimage` method takes the ``grid`` input to create a -# figure. It creates and applies a color palette to the figure based upon the -# z-values of the data. By default, it plots the map with the *turbo* CPT, an -# equidistant cylindrical projection, and with no frame. +# The :meth:`pygmt.Figure.grdimage` method takes the ``grid`` input to create a figure. +# It creates and applies a color palette to the figure based upon the z-values of the +# data. By default, it plots the map with the *turbo* CPT, an equidistant cylindrical +# projection, and with no frame. fig = pygmt.Figure() fig.grdimage(grid=grid) fig.show() # %% -# :meth:`pygmt.Figure.grdimage` can take the optional parameter ``projection`` -# for the map. In the example below, ``projection`` is set to ``"R12c"`` for -# a 12-centimeters-wide figure with a Winkel Tripel projection. For a list -# of available projections, see :doc:`/techref/projections`. +# :meth:`pygmt.Figure.grdimage` can take the optional parameter ``projection`` for the +# map. In the example below, ``projection`` is set to ``"R12c"`` for a +# 12-centimeters-wide figure with a Winkel Tripel projection. For a list of available +# projections, see :doc:`/techref/projections`. fig = pygmt.Figure() fig.grdimage(grid=grid, projection="R12c") @@ -44,9 +44,9 @@ # Set a color map # --------------- # -# :meth:`pygmt.Figure.grdimage` takes the ``cmap`` parameter to set the CPT of -# the figure. Examples of common CPTs for Earth relief are shown below. -# A full list of CPTs can be found at :gmt-docs:`reference/cpts.html`. +# :meth:`pygmt.Figure.grdimage` takes the ``cmap`` parameter to set the CPT of the +# figure. Examples of common CPTs for Earth relief are shown below. A full list of CPTs +# can be found at :gmt-docs:`reference/cpts.html`. # %% # Using the *geo* CPT: @@ -67,14 +67,13 @@ # Add a color bar # --------------- # -# The :meth:`pygmt.Figure.colorbar` method displays the CPT and the associated -# Z-values of the figure, and by default uses the same CPT set by the ``cmap`` -# parameter for :meth:`pygmt.Figure.grdimage`. The ``frame`` parameter for -# :meth:`pygmt.Figure.colorbar` can be used to set the axis intervals and -# labels. A list is used to pass multiple arguments to ``frame``. In the -# example below, ``"a2500"`` sets the axis interval to 2,500, -# ``"x+lElevation"`` sets the x-axis label, and ``"y+lm"`` sets the y-axis -# label. +# The :meth:`pygmt.Figure.colorbar` method displays the CPT and the associated Z-values +# of the figure, and by default uses the same CPT set by the ``cmap`` parameter for +# :meth:`pygmt.Figure.grdimage`. The ``frame`` parameter for +# :meth:`pygmt.Figure.colorbar` can be used to set the axis intervals and labels. A list +# is used to pass multiple arguments to ``frame``. In the example below, ``"a2500"`` +# sets the axis interval to 2,500, ``"x+lElevation"`` sets the x-axis label, and +# ``"y+lm"`` sets the y-axis label. fig = pygmt.Figure() fig.grdimage(grid=grid, projection="R12c", cmap="geo") @@ -87,13 +86,13 @@ # ------------------- # # In addition to providing global data, the ``region`` parameter for -# :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a -# specific area. The ``region`` parameter is required for resolutions at -# 5 arc-minutes or higher, and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*"]. +# :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a specific +# area. The ``region`` parameter is required for resolutions at 5 arc-minutes or higher, +# and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*"]. # -# The example below uses data with a 10 arc-minutes resolution, and plots it on -# a 15-centimeters-wide figure with a Mercator projection and a CPT set to -# *geo*. ``frame="a"`` is used to add a frame with annotations to the figure. +# The example below uses data with a 10 arc-minutes resolution, and plots it on a +# 15-centimeters-wide figure with a Mercator projection and a CPT set to *geo*. +# ``frame="a"`` is used to add a frame with annotations to the figure. grid = pygmt.datasets.load_earth_relief(resolution="10m", region=[-14, 30, 35, 60]) fig = pygmt.Figure() From 67c2ed161eaebe44ff5f079ec9ce7e014e1703dd Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 6 Aug 2024 06:40:10 +0800 Subject: [PATCH 3/5] typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/tutorials/advanced/earth_relief.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/advanced/earth_relief.py b/examples/tutorials/advanced/earth_relief.py index 9d6a9a5e194..9db6575c4b3 100644 --- a/examples/tutorials/advanced/earth_relief.py +++ b/examples/tutorials/advanced/earth_relief.py @@ -67,7 +67,7 @@ # Add a color bar # --------------- # -# The :meth:`pygmt.Figure.colorbar` method displays the CPT and the associated Z-values +# The :meth:`pygmt.Figure.colorbar` method displays the CPT and the associated z-values # of the figure, and by default uses the same CPT set by the ``cmap`` parameter for # :meth:`pygmt.Figure.grdimage`. The ``frame`` parameter for # :meth:`pygmt.Figure.colorbar` can be used to set the axis intervals and labels. A list @@ -88,7 +88,7 @@ # In addition to providing global data, the ``region`` parameter for # :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a specific # area. The ``region`` parameter is required for resolutions at 5 arc-minutes or higher, -# and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*"]. +# and accepts a list in the form of ``[*xmin*, *xmax*, *ymin*, *ymax*]``. # # The example below uses data with a 10 arc-minutes resolution, and plots it on a # 15-centimeters-wide figure with a Mercator projection and a CPT set to *geo*. From 047fbeb25fc9a91dfffe4e4b0a5c6b9743dde270 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 7 Aug 2024 10:57:23 +0800 Subject: [PATCH 4/5] Fix the formatting of the list --- examples/tutorials/advanced/earth_relief.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/earth_relief.py b/examples/tutorials/advanced/earth_relief.py index 9db6575c4b3..b1c4ac216c8 100644 --- a/examples/tutorials/advanced/earth_relief.py +++ b/examples/tutorials/advanced/earth_relief.py @@ -88,7 +88,7 @@ # In addition to providing global data, the ``region`` parameter for # :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a specific # area. The ``region`` parameter is required for resolutions at 5 arc-minutes or higher, -# and accepts a list in the form of ``[*xmin*, *xmax*, *ymin*, *ymax*]``. +# and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*]. # # The example below uses data with a 10 arc-minutes resolution, and plots it on a # 15-centimeters-wide figure with a Mercator projection and a CPT set to *geo*. From 5821242f7f1539cb81ede856a9fae0da04a65130 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 7 Aug 2024 17:17:39 +0800 Subject: [PATCH 5/5] Update examples/tutorials/advanced/earth_relief.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/tutorials/advanced/earth_relief.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/earth_relief.py b/examples/tutorials/advanced/earth_relief.py index b1c4ac216c8..8c195f5d0d8 100644 --- a/examples/tutorials/advanced/earth_relief.py +++ b/examples/tutorials/advanced/earth_relief.py @@ -85,7 +85,7 @@ # Create a region map # ------------------- # -# In addition to providing global data, the ``region`` parameter for +# In addition to providing global data, the ``region`` parameter of # :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a specific # area. The ``region`` parameter is required for resolutions at 5 arc-minutes or higher, # and accepts a list in the form of [*xmin*, *xmax*, *ymin*, *ymax*].