From 780f16482c7e179abe67f3441f758a259eb9d724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 28 Sep 2024 09:07:35 +0200 Subject: [PATCH] Combine the Oblique Mercator projection pages into one page (#3451) --- doc/techref/projections.md | 6 +- .../projections/cyl/cyl_oblique_mercator.py | 70 +++++++++++++++++++ .../projections/cyl/cyl_oblique_mercator_1.py | 34 --------- .../projections/cyl/cyl_oblique_mercator_2.py | 34 --------- .../projections/cyl/cyl_oblique_mercator_3.py | 33 --------- 5 files changed, 73 insertions(+), 104 deletions(-) create mode 100644 examples/projections/cyl/cyl_oblique_mercator.py delete mode 100644 examples/projections/cyl/cyl_oblique_mercator_1.py delete mode 100644 examples/projections/cyl/cyl_oblique_mercator_2.py delete mode 100644 examples/projections/cyl/cyl_oblique_mercator_3.py diff --git a/doc/techref/projections.md b/doc/techref/projections.md index 16d659f5372..9ca2d9dcef1 100644 --- a/doc/techref/projections.md +++ b/doc/techref/projections.md @@ -33,9 +33,9 @@ The table below shows the projection codes for the 31 GMT map projections: | **L**{{ lon0 }}/{{ lat0 }}/{{ lat1 }}/{{ lat2 }}/*width* | {doc}`/projections/conic/conic_lambert` | | **M**[{{ lon0 }}/[{{ lat0 }}/]]*width* | {doc}`/projections/cyl/cyl_mercator` | | **N**[{{ lon0 }}/]*width* | {doc}`/projections/misc/misc_robinson` | -| **Oa**{{ lon0 }}/{{ lat0 }}/*azimuth*/*width*[**+v**] | {doc}`/projections/cyl/cyl_oblique_mercator_1` | -| **Ob**{{ lon0 }}/{{ lat0 }}/{{ lon1 }}/{{ lat1 }}/*width*[**+v**] | {doc}`/projections/cyl/cyl_oblique_mercator_2` | -| **Oc**{{ lon0 }}/{{ lat0 }}/{{ lonp }}/{{ latp }}/*width*[**+v**] | {doc}`/projections/cyl/cyl_oblique_mercator_3` | +| **Oa**{{ lon0 }}/{{ lat0 }}/*azimuth*/*width*[**+v**] | Oblique Mercator projection: {doc}`1. origin and azimuth ` | +| **Ob**{{ lon0 }}/{{ lat0 }}/{{ lon1 }}/{{ lat1 }}/*width*[**+v**] | Oblique Mercator projection: {doc}`2. two points ` | +| **Oc**{{ lon0 }}/{{ lat0 }}/{{ lonp }}/{{ latp }}/*width*[**+v**] | Oblique Mercator projection: {doc}`3. origin and projection pole ` | | **P***width*[**+a**][**+f**[**e**\|**p**\|*radius*]][**+r***offset*][**+t***origin*][**+z**[**p**\|*radius*]] | Polar {doc}`azimuthal ` ({math}`\theta, r`) or cylindrical | | **Poly**/[{{ lon0 }}/[{{ lat0 }}/]]*width* | {doc}`/projections/conic/polyconic` | | **Q**[{{ lon0 }}/[{{ lat0 }}/]]*width* | {doc}`/projections/cyl/cyl_equidistant` | diff --git a/examples/projections/cyl/cyl_oblique_mercator.py b/examples/projections/cyl/cyl_oblique_mercator.py new file mode 100644 index 00000000000..0942e5183eb --- /dev/null +++ b/examples/projections/cyl/cyl_oblique_mercator.py @@ -0,0 +1,70 @@ +r""" +Oblique Mercator projection +=========================== + +Oblique configurations of the cylinder give rise to the oblique Mercator projection. +It is particularly useful when mapping regions of large lateral extent in an oblique +direction. Both parallels and meridians are complex curves. The projection was +developed in the early 1900s by several workers. + +The projection is set with **o** or **O**. There are three different specification +ways (**a**\|\ **A**, **b**\|\ **B**, **c**\|\ **C**) available. For all three +definitions, the upper case letter mean the projection pole is set in the southern +hemisphere [Default is northern hemisphere]. Align the y-axis with the optional +modifier **+v**. The figure size is set with *scale* or *width*. +""" + +# %% +# 1. Using the origin and azimuth +# ------------------------------- +# +# **oa**\|\ **oA**\ *lon0/lat0/azimuth/scale*\[**+v**] or +# **Oa**\|\ **OA**\ *lon0/lat0/azimuth/width*\[**+v**] +# +# The central meridian is set by *lon0/lat0*. The oblique equator is set by *azimuth*. + +import pygmt + +fig = pygmt.Figure() +fig.coast( + projection="Oa-120/25/-30/3c+v", + # Set bottom left and top right coordinates of the figure with "+r" + region="-122/35/-107/22+r", + frame="afg", + land="gray", +) +fig.show() + + +# %% +# 2. Using two points +# ------------------- +# +# **ob**\|\ **oB**\ *lon0/lat0/lon1/lat1/scale*\ [**+v**] or +# **Ob**\|\ **OB**\ *lon0/lat0/lon1/lat1/width*\ [**+v**] +# +# The central meridian is set by *lon0/lat0*. The oblique equator is set by *lon1/lat1*. + +fig = pygmt.Figure() +fig.coast( + projection="Ob130/35/25/35/3c", region="130/35/145/40+r", frame="afg", land="gray" +) +fig.show() + + +# %% +# 3. Using the origin and projection pole +# --------------------------------------- +# +# **oc**\|\ **oC**\ *lon0/lat0/lonp/latp/scale*\ [**+v**] or +# **Oc**\|\ **OC**\ *lon0/lat0/lonp/latp/width*\ [**+v**] +# +# The central meridian is set by *lon0/lat0*. The projection pole is set by *lonp/latp*. + +fig = pygmt.Figure() +fig.coast( + projection="Oc280/25.5/22/69/4c", region="270/20/305/25+r", frame="afg", land="gray" +) +fig.show() + +# sphinx_gallery_thumbnail_number = 3 diff --git a/examples/projections/cyl/cyl_oblique_mercator_1.py b/examples/projections/cyl/cyl_oblique_mercator_1.py deleted file mode 100644 index 5d5973a51cf..00000000000 --- a/examples/projections/cyl/cyl_oblique_mercator_1.py +++ /dev/null @@ -1,34 +0,0 @@ -r""" -Oblique Mercator projection, 1: origin and azimuth -================================================== - -Oblique configurations of the cylinder give rise to the oblique Mercator -projection. It is particularly useful when mapping regions of large lateral -extent in an oblique direction. Both parallels and meridians are complex -curves. The projection was developed in the early 1900s by several workers. - -**oa**\|\ **oA**\ *lon0/lat0/azimuth/scale*\[**+v**] or -**Oa**\|\ **OA**\ *lon0/lat0/azimuth/width*\[**+v**] - -The projection is set with **o** or **O**. The pole is set in the -northern hemisphere with **a** or the southern hemisphere -with **A**. The central meridian is set by *lon0/lat0*. The oblique equator -is set by *azimuth*. Align the y-axis -with the optional **+v**. The figure size is set with *scale* or *width*. -""" - -# %% -import pygmt - -fig = pygmt.Figure() -# Using the origin and azimuth -fig.coast( - projection="Oa-120/25/-30/6c+v", - # Set bottom left and top right coordinates of the figure with "+r" - region="-122/35/-107/22+r", - frame="afg", - land="gray", - shorelines="1/thin", - water="lightblue", -) -fig.show() diff --git a/examples/projections/cyl/cyl_oblique_mercator_2.py b/examples/projections/cyl/cyl_oblique_mercator_2.py deleted file mode 100644 index bf4bb555691..00000000000 --- a/examples/projections/cyl/cyl_oblique_mercator_2.py +++ /dev/null @@ -1,34 +0,0 @@ -r""" -Oblique Mercator projection, 2: two points -========================================== - -Oblique configurations of the cylinder give rise to the oblique Mercator -projection. It is particularly useful when mapping regions of large lateral -extent in an oblique direction. Both parallels and meridians are complex -curves. The projection was developed in the early 1900s by several workers. - -**ob**\|\ **oB**\ *lon0/lat0/lon1/lat1/scale*\ [**+v**] or -**Ob**\|\ **OB**\ *lon0/lat0/lon1/lat1/width*\ [**+v**] - -The projection is set with **o** or **O**. The pole is set in the -northern hemisphere with **b** or the southern hemisphere -with **B**. The central meridian is set by *lon0/lat0*. The oblique -equator is set by *lon1/lat1*. Align the y-axis -with the optional **+v**. The figure size is set with *scale* or *width*. -""" - -# %% -import pygmt - -fig = pygmt.Figure() -# Using the origin and two points -fig.coast( - projection="Ob130/35/25/35/6c", - # Set bottom left and top right coordinates of the figure with "+r" - region="130/35/145/40+r", - frame="afg", - land="gray", - shorelines="1/thin", - water="lightblue", -) -fig.show() diff --git a/examples/projections/cyl/cyl_oblique_mercator_3.py b/examples/projections/cyl/cyl_oblique_mercator_3.py deleted file mode 100644 index af55e8f51e5..00000000000 --- a/examples/projections/cyl/cyl_oblique_mercator_3.py +++ /dev/null @@ -1,33 +0,0 @@ -r""" -Oblique Mercator projection, 3: origin and pole -=============================================== - -Oblique configurations of the cylinder give rise to the oblique Mercator -projection. It is particularly useful when mapping regions of large lateral -extent in an oblique direction. Both parallels and meridians are complex -curves. The projection was developed in the early 1900s by several workers. - -**oc**\|\ **oC**\ *lon0/lat0/lonp/latp/scale*\ [**+v**] or -**Oc**\|\ **OC**\ *lon0/lat0/lonp/latp/width*\ [**+v**] - -The projection is set with **o** or **O**. The central meridian is set -by *lon0/lat0*. The projection pole is set by *lonp/latp* in option three. -Align the y-axis with the optional **+v**. The figure size is set -with *scale* or *width*. -""" - -# %% -import pygmt - -fig = pygmt.Figure() -# Using the origin and projection pole -fig.coast( - projection="Oc280/25.5/22/69/12c", - # Set bottom left and top right coordinates of the figure with "+r" - region="270/20/305/25+r", - frame="afg", - land="gray", - shorelines="1/thin", - water="lightblue", -) -fig.show()