-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Milestone
Description
In the documentation of all remote datasets (e.g., https://www.pygmt.org/v0.8.0/api/generated/pygmt.datasets.load_earth_age.html), we have notes like:
The xarray.DataArray grid doesn’t support slice operation, for Earth seafloor crustal age with resolutions of 5 arc-minutes or higher, which are stored as smaller tiles.
The notes are inaccurate:
- After PR GMTDataArrayAccessor: Fallback to default grid registration and gtype if the grid source file doesn't exist #2009 was merged, it's OK to do slice operation on high-resolution remote datasets, although the registration and gtype properties are lost (see Document limitations of GMT xarray accessors #2375 and Make a gmt xarray accessor to store metadata from grdinfo #499 for the reason).
>>> from pygmt.datasets import load_earth_relief
>>> grid = load_earth_relief(resolution="05m", region=[0, 5, 0, 5], registration="pixel")
>>> grid.gmt.registration, grid.gmt.gtype
(1, 1)
>>> grid2 = grid[0:2, 0:2]
>>> grid2.gmt.registration, grid2.gmt.gtype
(0, 0)
- The properties will also be lost for low-resolution datasets after some grid operations:
>>> from pygmt.datasets import load_earth_relief
>>> grid = load_earth_relief()
>>> grid.gmt.registration, grid.gmt.gtype
(0, 1)
>>> grid.encoding
{'zlib': True,
'szip': False,
'zstd': False,
'bzip2': False,
'blosc': False,
'shuffle': True,
'complevel': 9,
'fletcher32': False,
'contiguous': False,
'chunksizes': (181, 181),
'source': '/home/seisman/.gmt/server/earth/earth_relief/earth_relief_01d_g.grd',
'original_shape': (181, 361),
'dtype': dtype('int16'),
'_FillValue': -32768,
'scale_factor': 0.5}
>>> grid2 = grid * 2.0
>>> grid2.encoding
{}
>>> grid2.gmt.registration, grid2.gmt.gtype
(0, 0)
These are all caused by the limitations of the xarray accessors (#499), so it should be documented in a single place (as done in PR #2375). So, I think we should remove these notes for remote datasets, or have a note saying that "The grid registration and gtype information may lose after grid operations." and link to the GMT xarray accessor documentation (i.e., #2375) for reference and workarounds.
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation