Skip to content

Commit

Permalink
Merge branch 'main' into optional-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Aug 22, 2022
2 parents 0880d07 + 817b28a commit 4483e01
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 35 deletions.
2 changes: 1 addition & 1 deletion examples/gallery/symbols/custom_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
fig = pygmt.Figure()
fig.basemap(region=[0, 8, 0, 3], projection="X12c/4c", frame=True)

# define pen and fontstlye for annotations
# define pen and fontstyle for annotations
pen = "1p,black"
font = "15p,Helvetica-Bold"

Expand Down
36 changes: 19 additions & 17 deletions examples/get-started/first_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
This tutorial page covers the basics of creating a figure using PyGMT - a
Python wrapper for the Generic Mapping Tools (GMT). It will only use
the ``coast`` method for plotting. Later examples will address other PyGMT
methods.
the :meth:`pygmt.Figure.coast` method for plotting. Later examples will
address other PyGMT methods.
"""

###############################################################################
Expand All @@ -21,8 +21,8 @@
# Loading the library
# -------------------
#
# The first step is to import ``pygmt``. All methods and figure generation is
# accessible from the :mod:`pygmt` top level package.
# The first step is to import :mod:`pygmt`. All methods and figure generation
# are accessible from the :mod:`pygmt` top level package.

# sphinx_gallery_thumbnail_number = 4
import pygmt
Expand All @@ -38,10 +38,11 @@

###############################################################################
# To add to a plot object (``fig`` in this example), the PyGMT module is used
# as a method on the class. This example will use the ``coast`` method, which
# can be used to create a map without any other methods, modules or external
# data. The ``coast`` method plots the coastlines, borders, and bodies of water
# using a database that is included in GMT.
# as a method on the class. This example will use the
# :meth:`pygmt.Figure.coast` method, which can be used to create a map without
# any other methods, modules or external data. The :meth:`pygmt.Figure.coast`
# method plots the coastlines, borders, and bodies of water using a database
# that is included in GMT.
#
# First, a region for the figure must be selected. This example will plot some
# of the coast of Maine in the northeastern US. A Python list can be passed to
Expand All @@ -51,11 +52,12 @@
# right) coordinates are (N44.75, W68). Negative values can be passed for
# latitudes in the southern hemisphere or longitudes in the western hemisphere.
#
# In addition to the region, an argument needs to be passed to ``coast`` to
# tell it what to plot. In this example, ``coast`` will be told to plot the
# shorelines by passing the Boolean value ``True`` to the ``shorelines``
# parameter. The ``shorelines`` parameter has other options for finer control,
# but setting it to ``True`` uses the default values.
# In addition to the region, an argument needs to be passed to
# :meth:`pygmt.Figure.coast` to tell it what to plot. In this example,
# :meth:`pygmt.Figure.coast` will be told to plot the shorelines by passing the
# Boolean value ``True`` to the ``shorelines`` parameter. The ``shorelines``
# parameter has other options for finer control, but setting it to ``True``
# uses the default values.

fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True)

Expand All @@ -74,9 +76,9 @@
#
# When plotting colors in PyGMT, there are multiple
# :gmt-docs:`color codes <gmtcolors.html>`, that can be used. This includes
# standard GMT color names (like ``skyblue``), R/G/B levels (like ``0/0/255``),
# a hex value (like ``#333333``), or a graylevel (like ``50``). For this
# example, GMT color names are used.
# standard GMT color names (like ``"skyblue"``), R/G/B levels (like
# ``"0/0/255"``), a hex value (like ``"#333333"``), or a gray level (like
# ``"gray50"``). For this example, GMT color names are used.

fig = pygmt.Figure()
fig.coast(
Expand All @@ -102,7 +104,7 @@
# projections are explained in the :doc:`projection </projections/index>`
# gallery. For this example, the Mercator projection is set using ``"M"``.
# The width of the figure will be 10 centimeters, as set by ``"10c"``.
# The map size can also be set in inches using "i" (e.g. a 5 inch wide
# The map size can also be set in inches using "i" (e.g. a 5-inch wide
# Mercator projection would use ``"M5i"``).

fig = pygmt.Figure()
Expand Down
36 changes: 25 additions & 11 deletions examples/projections/cyl/cyl_universal_transverse_mercator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@
Universal Transverse Mercator
=============================
A particular subset of the transverse Mercator is the Universal Transverse
Mercator (UTM) which was adopted by the US Army for large-scale military maps.
Here, the globe is divided into 60 zones between 84°S and 84°N, most of which
are 6° (in longitude) wide. Each of these UTM zones have their unique central
meridian. Furthermore, each zone is divided into latitude bands but these are
not needed to specify the projection for most cases.
A particular subset of the
:doc:`transverse Merctor </projections/cyl/cyl_transverse_mercator>`
is the Universal Transverse Mercator (UTM) which was adopted by the US Army
for large-scale military maps. Here, the globe is divided into 60 zones
between 84°S and 84°N, most of which are 6° (in longitude) wide.
Each of these UTM zones have their unique central meridian.
Furthermore, each zone is divided into latitude bands but these are
not needed to specify the projection for most cases. See Figure
:ref:`Universal Transverse Mercator <GMT_utm_zones>` for all zone designations.
.. _GMT_utm_zones:
.. figure:: https://docs.generic-mapping-tools.org/latest/_images/GMT_utm_zones.png # noqa: W505
:width: 700 px
:align: center
Universal Transverse Mercator zone layout.
In order to minimize the distortion in any given zone, a scale factor of 0.9996
has been factored into the formulae. This makes the UTM projection a secant
projection and not a tangent projection like the transverse Mercator above. The
scale only varies by 1 part in 1,000 from true scale at equator. The
ellipsoidal projection expressions are accurate for map areas that extend less
than 10° away from the central meridian.
has been factored into the formulae (although a standard, you can change this
with :gmt-term:`PROJ_SCALE_FACTOR`). This makes the UTM projection a *secant*
projection and not a *tangent* projection like the
:doc:`transverse Merctor </projections/cyl/cyl_transverse_mercator>`.
The scale only varies by 1 part in 1,000 from true scale at equator. The
ellipsoidal projection expressions are accurate for map areas that extend
less than 10° away from the central meridian. For larger regions we use the
conformal latitude in the general spherical formulae instead.
**u**\ *zone/scale* or **U**\ *zone/width*
Expand Down
10 changes: 5 additions & 5 deletions examples/tutorials/advanced/contour_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Contour line settings
# ---------------------
#
# Use the ``annotation`` and ``interval`` arguments to adjust contour line
# Use the ``annotation`` and ``interval`` parameters to adjust contour line
# intervals. In the example below, there are contour intervals every 250 meters
# and annotated contour lines every 1,000 meters.

Expand All @@ -47,8 +47,8 @@
# Contour limits
# --------------
#
# The ``limit`` argument sets the minimum and maximum values for the contour
# lines. The argument takes the low and high values, and is either a list (as
# The ``limit`` parameter sets the minimum and maximum values for the contour
# lines. The parameter takes the low and high values, and is either a list (as
# below) or a string ``limit="-4000/-2000"``.

fig = pygmt.Figure()
Expand All @@ -64,7 +64,7 @@
# Map settings
# ------------
#
# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments,
# The :meth:`pygmt.Figure.grdcontour` method accepts additional parameters,
# including setting the projection and frame.

fig = pygmt.Figure()
Expand All @@ -85,7 +85,7 @@
# The :meth:`pygmt.Figure.grdimage` method can be used to add a
# colormap to the contour map. It must be called prior to
# :meth:`pygmt.Figure.grdcontour` to keep the contour lines visible on the
# final map. If the ``projection`` argument is specified in the
# final map. If the ``projection`` parameter is specified in the
# :meth:`pygmt.Figure.grdimage` method, it does not need to be repeated in the
# :meth:`pygmt.Figure.grdcontour` method.

Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/basics/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

###############################################################################
# To plot multiple lines, :meth:`pygmt.Figure.plot` needs to be used for each
# additional line. Arguments such as ``region``, ``projection``, and ``frame``
# additional line. Parameters such as ``region``, ``projection``, and ``frame``
# do not need to be repeated in subsequent uses.

fig = pygmt.Figure()
Expand Down

0 comments on commit 4483e01

Please sign in to comment.