-
Notifications
You must be signed in to change notification settings - Fork 229
**BREAKING** pygmt.grdcut: Refactor to store output in virtualfiles for grids #3115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Minimal xarray.DataArray output with data and coordinates, no metadata yet.
d8f1160
to
d0517e0
Compare
d0517e0
to
4ba67df
Compare
Special case `earth_day` to be loaded as GMT_IMAGE rather than GMT_GRID. Need to use `GMT_OUT|GMT_IS_REFERENCE` in virtualfile_out to avoid segfault, xref #3115.
Extra metadata from the _GMT_GRID_HEADER struct.
Reorder the dimensions to follow Channel, Height, Width (CHW) convention. Also added doctest checking output DataArray object and the image's x and y coordinates.
Get the registration and gtype info from the grid header and apply it to the GMT accessor attributes.
Trying to match some of the doctests in _GMT_GRID.
I think it's better to not introduce last-minute breaking changes, so bump this PR to v0.15.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still think using the private gmt_raster_type
func as mentioned at #3115 (comment) would be the best solution to auto-detect the raster kind, but failing that, the logic here to explicitly have the user pass in the type works too.
Just one typo on the match-case statement, and should be ok to merge once all tests pass without coverage misses.
This PR applies virtualfiles in
pygmt.grdcut
, so that this function doesn't have to write to temporary files (#2730).grdcut
is on of the complicated module that it works for grid, image and cube. We have to know thekind
of the input before calling theSession.virtualfile_out
method.It turns out it's not trivial to determine the data
kind
of an input file. We have some options:.nc
is a grid,.tif
is a image)kind
parameter (default to"grid"
) and users should specify thekind
parameter.Option 1-2 may not always work; option 3 also dosn't always work (see #3115 (comment)).
This PR currently adopts option 4. Need to note option 4 meaning BREAKING:
grdcut("@earth_day_01d")
works; now must usegrdcut("@earth_day_01d", kind="image")