Skip to content

Commit 58dc53f

Browse files
committed
Store first tile as source encoding for tiled grids
So that GMT accessor info works with tiled grids too. Adapted from #3932.
1 parent 36b9b11 commit 58dc53f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pygmt/datasets/load_remote_dataset.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,10 @@ def _load_remote_dataset(
592592
kind=dataset.kind, outgrid=None, vfname=voutgrd
593593
)
594594

595-
# Full path to the grid if not tiled grids.
596-
source = which(fname, download="a") if not resinfo.tiled else None
595+
# Full path to the grid
596+
source: str | list = which(fname, download="a")
597+
if resinfo.tiled:
598+
source = source[0] # get first grid for tiled grids
597599
# Manually add source to xarray.DataArray encoding to make the GMT accessors work.
598600
if source:
599601
grid.encoding["source"] = source

0 commit comments

Comments
 (0)