Skip to content

Commit 0e3416f

Browse files
committed
Add more methods
1 parent 90690df commit 0e3416f

File tree

1 file changed

+40
-21
lines changed

1 file changed

+40
-21
lines changed

pygmt/src/clip.py

+40-21
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ def _clip_method(clip_type):
1010
"""
1111
Return the clip method for the given clip type.
1212
"""
13-
match clip_type:
14-
case "polygon":
15-
return "clip"
16-
case "land":
17-
return "coast"
18-
case "water":
19-
return "coast"
13+
return {
14+
"polygon": "clip",
15+
"solar": "solar",
16+
"mask": "mask",
17+
"land": "coast",
18+
"water": "coast",
19+
"dcw": "coast",
20+
}[clip_type]
2021

2122

2223
class ClipAccessor:
@@ -30,6 +31,32 @@ def __init__(self):
3031
self.args_enter = ""
3132
self.args_exit = ""
3233

34+
def land(self):
35+
"""
36+
Clip the data to the land.
37+
"""
38+
self.type = "land"
39+
self.data = None
40+
self.args_enter = build_arg_list({"G": True})
41+
self.args_exit = build_arg_list({"Q": True})
42+
return self
43+
44+
def water(self):
45+
"""
46+
Clip the data to the water.
47+
"""
48+
self.type = "water"
49+
self.data = None
50+
self.args_enter = build_arg_list({"S": True})
51+
self.args_exit = build_arg_list({"Q": True})
52+
return self
53+
54+
def dcw(self):
55+
"""
56+
Clip based on the Digital Chart of the World.
57+
"""
58+
raise NotImplementedError
59+
3360
def polygon(self, x, y):
3461
"""
3562
Clip the data to a polygon.
@@ -45,25 +72,17 @@ def polygon(self, x, y):
4572
self.args_exit = ["-C"]
4673
return self
4774

48-
def land(self):
75+
def solar(self):
4976
"""
50-
Clip the data to the land.
77+
Clip the data to the solar terminator.
5178
"""
52-
self.type = "land"
53-
self.data = None
54-
self.args_enter = build_arg_list({"G": True})
55-
self.args_exit = build_arg_list({"Q": True})
56-
return self
79+
raise NotImplementedError
5780

58-
def water(self):
81+
def mask(self):
5982
"""
60-
Clip the data to the water.
83+
Clip the data to a mask.
6184
"""
62-
self.type = "water"
63-
self.data = None
64-
self.args_enter = build_arg_list({"S": True})
65-
self.args_exit = build_arg_list({"Q": True})
66-
return self
85+
raise NotImplementedError
6786

6887
def __enter__(self):
6988
"""

0 commit comments

Comments
 (0)