Skip to content
3 changes: 2 additions & 1 deletion doc/techref/projections.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ myst:

# GMT Map Projections

The table below shows the projection codes for the 31 GMT map projections:
The table below shows the projection codes for the 32 GMT map projections:

| PyGMT Projection Argument | Projection Name |
| --- | --- |
Expand Down Expand Up @@ -47,3 +47,4 @@ The table below shows the projection codes for the 31 GMT map projections:
| **W**[{{ lon0 }}/]*width* | [](/projections/misc/misc_mollweide.rst) |
| **X***width*[**l**\|**p***exp*\|**T**\|**t**][/*height*[**l**\|**p***exp*\|**T**\|**t**]][**d**] | Cartesian [linear](/projections/nongeo/cartesian_linear.rst), [logarithmic](/projections/nongeo/cartesian_logarithmic.rst), [power](/projections/nongeo/cartesian_power.rst), and time |
| **Y**{{ lon0 }}/{{ lat0 }}/*width* | [](/projections/cyl/cyl_equal_area.rst) |
| **+proj=spilhaus+width=**_width_ | [](/projections/misc/misc_spilhaus.rst) |
32 changes: 32 additions & 0 deletions examples/projections/misc/misc_spilhaus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
r"""
Spilhaus projection
===================

The Spilhaus projection is a world map projection that presents the world's
oceans as one contiguous body of water, with Antarctica at the top. It was
developed by Athelstan Spilhaus and is useful for oceanographic studies.

**+proj=spilhaus+width=**\ *width*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propably more a GMT related question: But still wondering why the synthax for this projection is different comparted to the other projections (see also the text at https://pygmt-dev--4657.org.readthedocs.build/en/4657/projections/index.html#projections). Why we do not use something like Sp/width ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because GMT is running out of single-letter codes for map projections. -JS is for already used by General stereographic projection. Using -JSp may be more confusing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we also have

  • Kf and Ks
  • P and Poly
  • C and Cyl_stere

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be some historical reasons. BTW, the +proj=spilhaus+width=width syntax comes fro PROJ4, which is supported by GMT but not well documented.


The projection is set as a PROJ string with ``+proj=spilhaus`` and the figure
size is set with *width*.

.. note::

This projection works well for coastlines but currently has issues for filling
land and water masses.
"""

# %%
import pygmt
from pygmt.params import Axis

fig = pygmt.Figure()
# Use the PROJ string to set the Spilhaus projection
fig.coast(
region="d",
projection="+proj=spilhaus+width=12c",
frame=Axis(annot=True, tick=True, grid=True),
shorelines=True,
)
fig.show()
Comment thread
Chuan1937 marked this conversation as resolved.
Loading