@@ -139,37 +139,35 @@ def load_earth_relief(
139139 # resolutions of original land-only SRTM tiles from NASA
140140 land_only_srtm_resolutions = ["03s" , "01s" ]
141141
142- earth_relief_sources = {
142+ # Map data source to prefix
143+ prefix = {
143144 "igpp" : "earth_relief" ,
144145 "gebco" : "earth_gebco" ,
145146 "gebcosi" : "earth_gebcosi" ,
146147 "synbath" : "earth_synbath" ,
147- }
148- if data_source not in earth_relief_sources :
148+ }. get ( data_source )
149+ if prefix is None :
149150 raise GMTInvalidInput (
150151 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'."
152153 )
153- # Choose earth relief data prefix
154+ # Use SRTM or not.
154155 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" :
158157 raise GMTInvalidInput (
159158 f"Option 'use_srtm=True' doesn't work with data source '{ data_source } '."
160159 " Please set 'data_source' to 'igpp'."
161160 )
162- else :
163- dataset_prefix = earth_relief_sources [data_source ]
161+ prefix = "srtm_relief"
164162 # Choose earth relief dataset
165163 match data_source :
166164 case "igpp" | "synbath" :
167- dataset_name = "earth_igpp"
165+ name = "earth_igpp"
168166 case "gebco" | "gebcosi" :
169- dataset_name = "earth_gebco"
167+ name = "earth_gebco"
170168 grid = _load_remote_dataset (
171- name = dataset_name ,
172- prefix = dataset_prefix ,
169+ name = name ,
170+ prefix = prefix ,
173171 resolution = resolution ,
174172 region = region ,
175173 registration = registration ,
0 commit comments