You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove the notes that high-resolution remote datasets don't support slice operations #2378
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.
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.
I think it makes more sense to remove the notes about "slice operation is not supported for high-resolution datasets", and add a note like:
The registration and coordinate system type of the returned grids can be accessed by the GMT accessors (i.e., DataArray.gmt.registration and DataArray.gmt.gtype respectively).
However, these properties may be lost after specific operations and need to be set manually before further passed to PyGMT functions. Refer to :class:pygmt.GMTDataArrayAccessor for detailed explanations and workarounds.
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:
1. After PR [GMTDataArrayAccessor: Fallback to default grid registration and gtype if the grid source file doesn't exist #2009](https://github.com/GenericMappingTools/pygmt/pull/2009) was merged, it's OK to do slice operation on high-resolution remote datasets, although the registration and gtype properties are lost
Just for context, that sentence was added originally added in #542 to the load_earth_relief function, and has been copied to other load_earth_* functions since then. The slicing issue for high-resolution (higher than 5 arc seconds) remote datasets in that sentence is referring to slicing by grids that have been grdcut, see also #524 for additional context.
I think we'll need to be more specific on which grids support slicing (grids loaded with pygmt.which and load_dataarray) and which don't (grids loaded with pygmt.grdcut):
Maybe reword the sentence to mention that setting a region and/or using high-resolution grids >5 arc minutes will cause slicing to lose the registration/gtype information due to there not being a NetCDF source for grdinfo to read from?
Maybe reword the sentence to mention that setting a region and/or using high-resolution grids >5 arc minutes will cause slicing to lose the registration/gtype information due to there not being a NetCDF source for grdinfo to read from?
My main point is, the registration and gtype properties will be lost after almost any grid operations and slicing is just one of them. So the note should be very general rather than focus on "slicing" only.
Maybe reword the sentence to mention that setting a region and/or using high-resolution grids >5 arc minutes will cause slicing to lose the registration/gtype information due to there not being a NetCDF source for grdinfo to read from?
My main point is, the registration and gtype properties will be lost after almost any grid operations and slicing is just one of them. So the note should be very general rather than focus on "slicing" only.
Mm, you're right. It's not just slicing that causes the registration and gtype properties to be lost, though slicing is one of the more common operations that could be mentioned as an example. Let me make an inline comment on #2384.
Activity
seisman commentedon Feb 26, 2023
I think it makes more sense to remove the notes about "slice operation is not supported for high-resolution datasets", and add a note like:
seisman commentedon Feb 26, 2023
Ping @GenericMappingTools/pygmt-maintainers for comments on it and review PR #2384.
weiji14 commentedon Feb 26, 2023
Just for context, that sentence was added originally added in #542 to the
load_earth_relieffunction, and has been copied to otherload_earth_*functions since then. The slicing issue for high-resolution (higher than 5 arc seconds) remote datasets in that sentence is referring to slicing by grids that have beengrdcut, see also #524 for additional context.I think we'll need to be more specific on which grids support slicing (grids loaded with
pygmt.whichandload_dataarray) and which don't (grids loaded withpygmt.grdcut):pygmt/pygmt/datasets/load_remote_dataset.py
Lines 302 to 313 in 8aec841
Maybe reword the sentence to mention that setting a
regionand/or using high-resolution grids >5 arc minutes will cause slicing to lose the registration/gtype information due to there not being a NetCDF source forgrdinfoto read from?seisman commentedon Feb 27, 2023
My main point is, the registration and gtype properties will be lost after almost any grid operations and slicing is just one of them. So the note should be very general rather than focus on "slicing" only.
weiji14 commentedon Mar 17, 2023
Mm, you're right. It's not just slicing that causes the registration and gtype properties to be lost, though slicing is one of the more common operations that could be mentioned as an example. Let me make an inline comment on #2384.