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
grdtrack/surface/others?, incompatible data types #407
Although the docs says pygmt.surface returns a xarray.DataArray, it actually returns an xarray.Dataset. This is incompatible to what grdtrack expects as input, making it not possible to sample an internally created grid unless you write it out to file, then reread it, or do some finagling.
import pygmt
bathy= pygmt.datasets.load_sample_bathymetry()
xmin = bathy['longitude'].min()
xmax = bathy['longitude'].max()
ymin = bathy['latitude'].min()
ymax = bathy['latitude'].max()
R = '/'.join([str(xmin),str(xmax),str(ymin),str(ymax)])
I='.02'
x = bathy['longitude']
y = bathy['latitude']
z = bathy['bathymetry']
DEPTH_SURF = pygmt.surface(x = x, y = y, z = z, R = R, I = I)
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
Activity
welcome commentedon Apr 9, 2020
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
weiji14 commentedon Apr 9, 2020
Oops, you're right, it should return an
xr.DataArrayinstead. I'll work on a fix for it now.In the meantime, you can use
DEPTH_SURF.zto access thexr.DataArrayinside thexr.Dataset.