Skip to content

Commit cab82c6

Browse files
committed
Add a separate documentation for supported plot and distance units
1 parent 1a2d806 commit cab82c6

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

doc/techref/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ visit the {gmt-docs}`GMT Technical Reference <reference.html>`.
1010
1111
common_parameters.md
1212
projections.md
13+
units.md
1314
fonts.md
1415
text_formatting.md
1516
encodings.md

doc/techref/units.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Units
2+
3+
GMT uses two unit groups: **dimension units** (plot units) and **distance units** (Earth distances).
4+
5+
(plot-units)=
6+
## Dimension Units (Plot Units)
7+
8+
Use these for map widths, offsets, symbol sizes, pen widths, etc.
9+
10+
| Code | Unit | Notes |
11+
|------|------|-------|
12+
| `c` | Centimeter | Default for most dimensions |
13+
| `i` | Inch | 1 inch = 2.54 cm |
14+
| `p` | Point | 1 point = 1/72 inch |
15+
16+
**Defaults:** If no unit is given, GMT uses {gmt-term}`PROJ_LENGTH_UNIT` (default is `c`).
17+
Fonts and pen thicknesses default to `p`.
18+
19+
(distance-units)=
20+
## Distance Units
21+
22+
GMT supports various distance units for geographic calculations.
23+
24+
| Code | Unit | Notes |
25+
|------|------|-------|
26+
| `d` | Degree | Arc degree |
27+
| `m` | Minute of arc | 1/60 degree |
28+
| `s` | Second of arc | 1/3600 degree |
29+
| `e` | Meter | Default distance unit |
30+
| `k` | Kilometer | 1000 meters |
31+
| `f` | Foot | 0.3048 meters |
32+
| `u` | US Survey Foot | 1200/3937 meters |
33+
| `M` | Statute Mile | 1.60934 km |
34+
| `n` | Nautical Mile | 1.852 km |

pygmt/src/grdproject.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,15 @@ def grdproject( # noqa: PLR0913
8181
When set to ``True``, do the inverse transformation, from rectangular to
8282
geographical [Default is ``False``].
8383
unit
84-
Set the projected measure unit. Valid values are ``"c"`` (centimeters),
85-
``"i"`` (inches), and ``"p"`` (points) [Default is set by
86-
:gmt-term:`PROJ_LENGTH_UNIT`]. Cannot be used with ``scaling``.
84+
Set the projected measure unit. See :doc:`/techref/units#plot-units` for
85+
supported units [Default is set by :gmt-term:`PROJ_LENGTH_UNIT`]. Cannot be used
86+
with ``scaling``.
8787
scaling
8888
Force 1:1 scaling, i.e., output (or input, see ``inverse``) data are in actual
89-
projected meters. To specify other units, set it to ``"f"`` (feet),
90-
``"k"`` (kilometers), ``"M"`` (statute miles), ``"n"`` (nautical miles),
91-
``"u"`` (US survey feet), ``"i"`` (inches), ``"c"`` (centimeters), or
92-
``"p"`` (points). Without ``scaling``, the output (or input, see ``inverse``) is
93-
in the units specified by :gmt-term:`PROJ_LENGTH_UNIT` (but see ``unit``).
89+
projected meters. To specify other units, set it to
90+
a supported distance unit or plot unit (see :doc:`/techref/units`). Without
91+
``scaling``, the output (or input, see ``inverse``) is in the units specified
92+
by :gmt-term:`PROJ_LENGTH_UNIT` (but see ``unit``).
9493
$projection
9594
$region
9695
$verbose

0 commit comments

Comments
 (0)