Skip to content

Commit 897444a

Browse files
authored
pygmt.datasets.load_*: Add autocompletion support for the 'resolution' parameter (#3260)
1 parent a13fc5e commit 897444a

12 files changed

+141
-67
lines changed

pygmt/datasets/earth_age.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_earth_age(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m"
20+
] = "01d",
1921
region=None,
2022
registration: Literal["gridline", "pixel"] = "gridline",
2123
):
@@ -51,11 +53,9 @@ def load_earth_age(
5153
5254
Parameters
5355
----------
54-
resolution : str
55-
The grid resolution. The suffix ``d`` and ``m`` stand for
56-
arc-degrees and arc-minutes. It can be ``"01d"``, ``"30m"``,
57-
``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``,
58-
``"03m"``, ``"02m"``, or ``"01m"``.
56+
resolution
57+
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
58+
arc-minutes.
5959
6060
region : str or list
6161
The subregion of the grid to load, in the form of a list

pygmt/datasets/earth_free_air_anomaly.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_earth_free_air_anomaly(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m"
20+
] = "01d",
1921
region=None,
2022
registration: Literal["gridline", "pixel", None] = None,
2123
):
@@ -51,11 +53,9 @@ def load_earth_free_air_anomaly(
5153
5254
Parameters
5355
----------
54-
resolution : str
55-
The grid resolution. The suffix ``d`` and ``m`` stand for
56-
arc-degrees and arc-minutes. It can be ``"01d"``, ``"30m"``,
57-
``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``,
58-
``"03m"``, ``"02m"``, or ``"01m"``.
56+
resolution
57+
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
58+
arc-minutes.
5959
6060
region : str or list
6161
The subregion of the grid to load, in the form of a list

pygmt/datasets/earth_geoid.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_earth_geoid(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m"
20+
] = "01d",
1921
region=None,
2022
registration: Literal["gridline", "pixel"] = "gridline",
2123
):
@@ -44,11 +46,9 @@ def load_earth_geoid(
4446
4547
Parameters
4648
----------
47-
resolution : str
48-
The grid resolution. The suffix ``d`` and ``m`` stand for
49-
arc-degrees and arc-minutes. It can be ``"01d"``, ``"30m"``,
50-
``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``,
51-
``"03m"``, ``"02m"``, or ``"01m"``.
49+
resolution
50+
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
51+
arc-minutes.
5252
5353
region : str or list
5454
The subregion of the grid to load, in the form of a list

pygmt/datasets/earth_magnetic_anomaly.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
@kwargs_to_strings(region="sequence")
1818
def load_earth_magnetic_anomaly(
19-
resolution="01d",
19+
resolution: Literal[
20+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m"
21+
] = "01d",
2022
region=None,
2123
registration: Literal["gridline", "pixel", None] = None,
2224
data_source: Literal["emag2", "emag2_4km", "wdmam"] = "emag2",
@@ -64,11 +66,9 @@ def load_earth_magnetic_anomaly(
6466
6567
Parameters
6668
----------
67-
resolution : str
68-
The grid resolution. The suffix ``d`` and ``m`` stand for
69-
arc-degrees and arc-minutes. It can be ``"01d"``, ``"30m"``,
70-
``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``,
71-
``"03m"``, or ``"02m"``. The ``"02m"`` resolution is not available for
69+
resolution
70+
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
71+
arc-minutes. The resolution ``"02m"`` is not available for
7272
``data_source="wdmam"``.
7373
7474
region : str or list

pygmt/datasets/earth_mask.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_earth_mask(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d",
20+
"30m",
21+
"20m",
22+
"15m",
23+
"10m",
24+
"06m",
25+
"05m",
26+
"04m",
27+
"03m",
28+
"02m",
29+
"01m",
30+
"30s",
31+
"15s",
32+
] = "01d",
1933
region=None,
2034
registration: Literal["gridline", "pixel"] = "gridline",
2135
):
@@ -44,11 +58,9 @@ def load_earth_mask(
4458
4559
Parameters
4660
----------
47-
resolution : str
48-
The grid resolution. The suffix ``d``, ``m``, and ``s`` stand for
49-
arc-degrees, arc-minutes, and arc-seconds. It can be ``"01d"``,
50-
``"30m"``, ``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``,
51-
``"04m"``, ``"03m"``, ``"02m"``, ``"01m"``, ``"30s"``, or ``"15s"``.
61+
resolution
62+
The grid resolution. The suffix ``d``, ``m``, and ``s`` stand for arc-degrees,
63+
arc-minutes, and arc-seconds.
5264
5365
region : str or list
5466
The subregion of the grid to load, in the form of a list

pygmt/datasets/earth_relief.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,23 @@
1616

1717
@kwargs_to_strings(region="sequence")
1818
def load_earth_relief(
19-
resolution="01d",
19+
resolution: Literal[
20+
"01d",
21+
"30m",
22+
"20m",
23+
"15m",
24+
"10m",
25+
"06m",
26+
"05m",
27+
"04m",
28+
"03m",
29+
"02m",
30+
"01m",
31+
"30s",
32+
"15s",
33+
"03s",
34+
"01s",
35+
] = "01d",
2036
region=None,
2137
registration: Literal["gridline", "pixel", None] = None,
2238
data_source: Literal["igpp", "gebco", "gebcosi", "synbath"] = "igpp",
@@ -58,12 +74,9 @@ def load_earth_relief(
5874
5975
Parameters
6076
----------
61-
resolution : str
62-
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for
63-
arc-degrees, arc-minutes, and arc-seconds. It can be ``"01d"``,
64-
``"30m"``, ``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``,
65-
``"04m"``, ``"03m"``, ``"02m"``, ``"01m"``, ``"30s"``, ``"15s"``,
66-
``"03s"``, or ``"01s"``.
77+
resolution
78+
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for arc-degrees,
79+
arc-minutes, and arc-seconds.
6780
6881
region : str or list
6982
The subregion of the grid to load, in the form of a list

pygmt/datasets/earth_vertical_gravity_gradient.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_earth_vertical_gravity_gradient(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m"
20+
] = "01d",
1921
region=None,
2022
registration: Literal["gridline", "pixel", None] = None,
2123
):
@@ -51,11 +53,9 @@ def load_earth_vertical_gravity_gradient(
5153
5254
Parameters
5355
----------
54-
resolution : str
55-
The grid resolution. The suffix ``d`` and ``m`` stand for
56-
arc-degrees and arc-minutes. It can be ``"01d"``, ``"30m"``,
57-
``"20m"``, ``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``,
58-
``"03m"``, ``"02m"``, or ``"01m"``.
56+
resolution
57+
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
58+
arc-minutes.
5959
6060
region : str or list
6161
The subregion of the grid to load, in the form of a list

pygmt/datasets/mars_relief.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_mars_relief(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d",
20+
"30m",
21+
"20m",
22+
"15m",
23+
"10m",
24+
"06m",
25+
"05m",
26+
"04m",
27+
"03m",
28+
"02m",
29+
"01m",
30+
"30s",
31+
"15s",
32+
"12s",
33+
] = "01d",
1934
region=None,
2035
registration: Literal["gridline", "pixel", None] = None,
2136
):
@@ -50,11 +65,9 @@ def load_mars_relief(
5065
5166
Parameters
5267
----------
53-
resolution : str
68+
resolution
5469
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for arc-degrees,
55-
arc-minutes and arc-seconds. It can be ``"01d"``, ``"30m"``, ``"20m"``,
56-
``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``,
57-
``"01m"``, ``"30s"``, ``"15s"``, and ``"12s"``.
70+
arc-minutes and arc-seconds.
5871
region : str or list
5972
The subregion of the grid to load, in the form of a list
6073
[*xmin*, *xmax*, *ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*. Required for

pygmt/datasets/mercury_relief.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_mercury_relief(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d",
20+
"30m",
21+
"20m",
22+
"15m",
23+
"10m",
24+
"06m",
25+
"05m",
26+
"04m",
27+
"03m",
28+
"02m",
29+
"01m",
30+
"56s",
31+
] = "01d",
1932
region=None,
2033
registration: Literal["gridline", "pixel", None] = None,
2134
):
@@ -50,11 +63,9 @@ def load_mercury_relief(
5063
5164
Parameters
5265
----------
53-
resolution : str
66+
resolution
5467
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for arc-degrees,
55-
arc-minutes and arc-seconds. It can be ``"01d"``, ``"30m"``, ``"20m"``,
56-
``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``,
57-
``"01m"``, and ``"56s"``.
68+
arc-minutes and arc-seconds.
5869
region : str or list
5970
The subregion of the grid to load, in the form of a list
6071
[*xmin*, *xmax*, *ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*. Required for

pygmt/datasets/moon_relief.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_moon_relief(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d",
20+
"30m",
21+
"20m",
22+
"15m",
23+
"10m",
24+
"06m",
25+
"05m",
26+
"04m",
27+
"03m",
28+
"02m",
29+
"01m",
30+
"30s",
31+
"15s",
32+
"14s",
33+
] = "01d",
1934
region=None,
2035
registration: Literal["gridline", "pixel", None] = None,
2136
):
@@ -50,11 +65,9 @@ def load_moon_relief(
5065
5166
Parameters
5267
----------
53-
resolution : str
68+
resolution
5469
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for arc-degrees,
55-
arc-minutes and arc-seconds. It can be ``"01d"``, ``"30m"``, ``"20m"``,
56-
``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``,
57-
``"01m"``, ``"30s"``, ``"15s"``, and ``"14s"``.
70+
arc-minutes and arc-seconds.
5871
region : str or list
5972
The subregion of the grid to load, in the form of a list
6073
[*xmin*, *xmax*, *ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*. Required for

pygmt/datasets/pluto_relief.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_pluto_relief(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d",
20+
"30m",
21+
"20m",
22+
"15m",
23+
"10m",
24+
"06m",
25+
"05m",
26+
"04m",
27+
"03m",
28+
"02m",
29+
"01m",
30+
"52s",
31+
] = "01d",
1932
region=None,
2033
registration: Literal["gridline", "pixel", None] = None,
2134
):
@@ -50,11 +63,9 @@ def load_pluto_relief(
5063
5164
Parameters
5265
----------
53-
resolution : str
66+
resolution
5467
The grid resolution. The suffix ``d``, ``m`` and ``s`` stand for arc-degrees,
55-
arc-minutes and arc-seconds. It can be ``"01d"``, ``"30m"``, ``"20m"``,
56-
``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``,
57-
``"01m"``, and ``"52s"``.
68+
arc-minutes and arc-seconds.
5869
region : str or list
5970
The subregion of the grid to load, in the form of a list
6071
[*xmin*, *xmax*, *ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*. Required for

pygmt/datasets/venus_relief.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
@kwargs_to_strings(region="sequence")
1717
def load_venus_relief(
18-
resolution="01d",
18+
resolution: Literal[
19+
"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m"
20+
] = "01d",
1921
region=None,
2022
registration: Literal["gridline", "pixel"] = "gridline",
2123
):
@@ -50,10 +52,9 @@ def load_venus_relief(
5052
5153
Parameters
5254
----------
53-
resolution : str
55+
resolution
5456
The grid resolution. The suffix ``d`` and ``m`` stand for arc-degrees and
55-
arc-minutes. It can be ``"01d"``, ``"30m"``, ``"20m"``, ``"15m"``, ``"10m"``,
56-
``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``, and ``"01m"``.
57+
arc-minutes.
5758
region : str or list
5859
The subregion of the grid to load, in the form of a list
5960
[*xmin*, *xmax*, *ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*.

0 commit comments

Comments
 (0)