@@ -39,7 +39,9 @@ class GMTRemoteDataset(NamedTuple):
39
39
Attributes
40
40
----------
41
41
description
42
- The name assigned as an attribute to the DataArray.
42
+ The name assigned as an attribute to the DataArray.
43
+ kind
44
+ The kind of the dataset source. Valid values are ``"grid"`` and ``"image"``.
43
45
units
44
46
The units of the values in the DataArray.
45
47
resolutions
@@ -49,6 +51,7 @@ class GMTRemoteDataset(NamedTuple):
49
51
"""
50
52
51
53
description : str
54
+ kind : Literal ["grid" , "image" ]
52
55
units : str | None
53
56
resolutions : dict [str , Resolution ]
54
57
extra_attributes : dict [str , Any ]
@@ -57,6 +60,7 @@ class GMTRemoteDataset(NamedTuple):
57
60
datasets = {
58
61
"earth_age" : GMTRemoteDataset (
59
62
description = "EarthByte Earth seafloor crustal age" ,
63
+ kind = "grid" ,
60
64
units = "Myr" ,
61
65
extra_attributes = {"horizontal_datum" : "WGS84" },
62
66
resolutions = {
@@ -75,6 +79,7 @@ class GMTRemoteDataset(NamedTuple):
75
79
),
76
80
"earth_day" : GMTRemoteDataset (
77
81
description = "NASA Day Images" ,
82
+ kind = "image" ,
78
83
units = None ,
79
84
extra_attributes = {"long_name" : "blue_marble" , "horizontal_datum" : "WGS84" },
80
85
resolutions = {
@@ -94,6 +99,7 @@ class GMTRemoteDataset(NamedTuple):
94
99
),
95
100
"earth_dist" : GMTRemoteDataset (
96
101
description = "GSHHG Earth distance to shoreline" ,
102
+ kind = "grid" ,
97
103
units = "kilometers" ,
98
104
extra_attributes = {"horizontal_datum" : "WGS84" },
99
105
resolutions = {
@@ -112,6 +118,7 @@ class GMTRemoteDataset(NamedTuple):
112
118
),
113
119
"earth_edefl" : GMTRemoteDataset (
114
120
description = "IGPP Earth east-west deflection" ,
121
+ kind = "grid" ,
115
122
units = "micro-radians" ,
116
123
extra_attributes = {"horizontal_datum" : "WGS84" },
117
124
resolutions = {
@@ -130,6 +137,7 @@ class GMTRemoteDataset(NamedTuple):
130
137
),
131
138
"earth_faa" : GMTRemoteDataset (
132
139
description = "IGPP Earth free-air anomaly" ,
140
+ kind = "grid" ,
133
141
units = "mGal" ,
134
142
extra_attributes = {"horizontal_datum" : "WGS84" },
135
143
resolutions = {
@@ -148,6 +156,7 @@ class GMTRemoteDataset(NamedTuple):
148
156
),
149
157
"earth_faaerror" : GMTRemoteDataset (
150
158
description = "IGPP Earth free-air anomaly errors" ,
159
+ kind = "grid" ,
151
160
units = "mGal" ,
152
161
extra_attributes = {"horizontal_datum" : "WGS84" },
153
162
resolutions = {
@@ -166,6 +175,7 @@ class GMTRemoteDataset(NamedTuple):
166
175
),
167
176
"earth_gebco" : GMTRemoteDataset (
168
177
description = "GEBCO Earth relief" ,
178
+ kind = "grid" ,
169
179
units = "meters" ,
170
180
extra_attributes = {"vertical_datum" : "EGM96" , "horizontal_datum" : "WGS84" },
171
181
resolutions = {
@@ -188,6 +198,7 @@ class GMTRemoteDataset(NamedTuple):
188
198
),
189
199
"earth_geoid" : GMTRemoteDataset (
190
200
description = "EGM2008 Earth geoid" ,
201
+ kind = "grid" ,
191
202
units = "meters" ,
192
203
extra_attributes = {"horizontal_datum" : "WGS84" },
193
204
resolutions = {
@@ -206,6 +217,7 @@ class GMTRemoteDataset(NamedTuple):
206
217
),
207
218
"earth_igpp" : GMTRemoteDataset (
208
219
description = "IGPP Earth relief" ,
220
+ kind = "grid" ,
209
221
units = "meters" ,
210
222
extra_attributes = {"vertical_datum" : "EGM96" , "horizontal_datum" : "WGS84" },
211
223
resolutions = {
@@ -228,6 +240,7 @@ class GMTRemoteDataset(NamedTuple):
228
240
),
229
241
"earth_mag" : GMTRemoteDataset (
230
242
description = "EMAG2 Earth Magnetic Anomaly Model" ,
243
+ kind = "grid" ,
231
244
units = "nT" ,
232
245
extra_attributes = {"horizontal_datum" : "WGS84" },
233
246
resolutions = {
@@ -245,6 +258,7 @@ class GMTRemoteDataset(NamedTuple):
245
258
),
246
259
"earth_mask" : GMTRemoteDataset (
247
260
description = "GSHHG Earth mask" ,
261
+ kind = "grid" ,
248
262
units = None ,
249
263
extra_attributes = {"horizontal_datum" : "WGS84" },
250
264
resolutions = {
@@ -265,6 +279,7 @@ class GMTRemoteDataset(NamedTuple):
265
279
),
266
280
"earth_mss" : GMTRemoteDataset (
267
281
description = "CNES Earth mean sea surface" ,
282
+ kind = "grid" ,
268
283
units = "meters" ,
269
284
extra_attributes = {"horizontal_datum" : "WGS84" },
270
285
resolutions = {
@@ -283,6 +298,7 @@ class GMTRemoteDataset(NamedTuple):
283
298
),
284
299
"earth_night" : GMTRemoteDataset (
285
300
description = "NASA Night Images" ,
301
+ kind = "image" ,
286
302
units = None ,
287
303
extra_attributes = {"long_name" : "black_marble" , "horizontal_datum" : "WGS84" },
288
304
resolutions = {
@@ -302,6 +318,7 @@ class GMTRemoteDataset(NamedTuple):
302
318
),
303
319
"earth_mdt" : GMTRemoteDataset (
304
320
description = "CNES Earth mean dynamic topography" ,
321
+ kind = "grid" ,
305
322
units = "meters" ,
306
323
extra_attributes = {"horizontal_datum" : "WGS84" },
307
324
resolutions = {
@@ -315,6 +332,7 @@ class GMTRemoteDataset(NamedTuple):
315
332
),
316
333
"earth_ndefl" : GMTRemoteDataset (
317
334
description = "IGPP Earth north-south deflection" ,
335
+ kind = "grid" ,
318
336
units = "micro-radians" ,
319
337
extra_attributes = {"horizontal_datum" : "WGS84" },
320
338
resolutions = {
@@ -333,6 +351,7 @@ class GMTRemoteDataset(NamedTuple):
333
351
),
334
352
"earth_vgg" : GMTRemoteDataset (
335
353
description = "IGPP Earth vertical gravity gradient" ,
354
+ kind = "grid" ,
336
355
units = "Eotvos" ,
337
356
extra_attributes = {"horizontal_datum" : "WGS84" },
338
357
resolutions = {
@@ -351,6 +370,7 @@ class GMTRemoteDataset(NamedTuple):
351
370
),
352
371
"earth_wdmam" : GMTRemoteDataset (
353
372
description = "WDMAM World Digital Magnetic Anomaly Map" ,
373
+ kind = "grid" ,
354
374
units = "nT" ,
355
375
extra_attributes = {"horizontal_datum" : "WGS84" },
356
376
resolutions = {
@@ -367,6 +387,7 @@ class GMTRemoteDataset(NamedTuple):
367
387
),
368
388
"mars_relief" : GMTRemoteDataset (
369
389
description = "NASA Mars (MOLA) relief" ,
390
+ kind = "grid" ,
370
391
units = "meters" ,
371
392
extra_attributes = {},
372
393
resolutions = {
@@ -388,6 +409,7 @@ class GMTRemoteDataset(NamedTuple):
388
409
),
389
410
"moon_relief" : GMTRemoteDataset (
390
411
description = "USGS Moon (LOLA) relief" ,
412
+ kind = "grid" ,
391
413
units = "meters" ,
392
414
extra_attributes = {},
393
415
resolutions = {
@@ -409,6 +431,7 @@ class GMTRemoteDataset(NamedTuple):
409
431
),
410
432
"mercury_relief" : GMTRemoteDataset (
411
433
description = "USGS Mercury relief" ,
434
+ kind = "grid" ,
412
435
units = "meters" ,
413
436
extra_attributes = {},
414
437
resolutions = {
@@ -428,6 +451,7 @@ class GMTRemoteDataset(NamedTuple):
428
451
),
429
452
"pluto_relief" : GMTRemoteDataset (
430
453
description = "USGS Pluto relief" ,
454
+ kind = "grid" ,
431
455
units = "meters" ,
432
456
extra_attributes = {},
433
457
resolutions = {
@@ -447,6 +471,7 @@ class GMTRemoteDataset(NamedTuple):
447
471
),
448
472
"venus_relief" : GMTRemoteDataset (
449
473
description = "NASA Magellan Venus relief" ,
474
+ kind = "grid" ,
450
475
units = "meters" ,
451
476
extra_attributes = {},
452
477
resolutions = {
@@ -545,15 +570,16 @@ def _load_remote_dataset(
545
570
raise GMTInvalidInput (msg )
546
571
547
572
fname = f"@{ prefix } _{ resolution } _{ reg } "
548
- kind = "image" if name in {"earth_day" , "earth_night" } else "grid"
549
- kwdict = {"R" : region , "T" : {"grid" : "g" , "image" : "i" }[kind ]}
573
+ kwdict = {"R" : region , "T" : {"grid" : "g" , "image" : "i" }[dataset .kind ]}
550
574
with Session () as lib :
551
- with lib .virtualfile_out (kind = kind ) as voutgrd :
575
+ with lib .virtualfile_out (kind = dataset . kind ) as voutgrd :
552
576
lib .call_module (
553
577
module = "read" ,
554
578
args = [fname , voutgrd , * build_arg_list (kwdict )],
555
579
)
556
- grid = lib .virtualfile_to_raster (kind = kind , outgrid = None , vfname = voutgrd )
580
+ grid = lib .virtualfile_to_raster (
581
+ kind = dataset .kind , outgrid = None , vfname = voutgrd
582
+ )
557
583
558
584
# Full path to the grid if not tiled grids.
559
585
source = which (fname , download = "a" ) if not resinfo .tiled else None
0 commit comments