@@ -139,37 +139,35 @@ def load_earth_relief(
139
139
# resolutions of original land-only SRTM tiles from NASA
140
140
land_only_srtm_resolutions = ["03s" , "01s" ]
141
141
142
- earth_relief_sources = {
142
+ # Map data source to prefix
143
+ prefix = {
143
144
"igpp" : "earth_relief" ,
144
145
"gebco" : "earth_gebco" ,
145
146
"gebcosi" : "earth_gebcosi" ,
146
147
"synbath" : "earth_synbath" ,
147
- }
148
- if data_source not in earth_relief_sources :
148
+ }. get ( data_source )
149
+ if prefix is None :
149
150
raise GMTInvalidInput (
150
151
f"Invalid earth relief data source '{ data_source } '. "
151
- "Valid values are 'igpp', 'gebco', 'gebcosi' and 'synbath'."
152
+ "Valid values are 'igpp', 'gebco', 'gebcosi', and 'synbath'."
152
153
)
153
- # Choose earth relief data prefix
154
+ # Use SRTM or not.
154
155
if use_srtm and resolution in land_only_srtm_resolutions :
155
- if data_source == "igpp" :
156
- dataset_prefix = "srtm_relief"
157
- else :
156
+ if data_source != "igpp" :
158
157
raise GMTInvalidInput (
159
158
f"Option 'use_srtm=True' doesn't work with data source '{ data_source } '."
160
159
" Please set 'data_source' to 'igpp'."
161
160
)
162
- else :
163
- dataset_prefix = earth_relief_sources [data_source ]
161
+ prefix = "srtm_relief"
164
162
# Choose earth relief dataset
165
163
match data_source :
166
164
case "igpp" | "synbath" :
167
- dataset_name = "earth_igpp"
165
+ name = "earth_igpp"
168
166
case "gebco" | "gebcosi" :
169
- dataset_name = "earth_gebco"
167
+ name = "earth_gebco"
170
168
grid = _load_remote_dataset (
171
- name = dataset_name ,
172
- prefix = dataset_prefix ,
169
+ name = name ,
170
+ prefix = prefix ,
173
171
resolution = resolution ,
174
172
region = region ,
175
173
registration = registration ,
0 commit comments