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
I am attempting to draw a contour which encompasses the south pole using grdcontour. Everything works fine when passing a netcdf filename, but when passing an xarray DataArray, the points at the far left and right of the plot are connected by a straight line.
Here is the image using a DataArray
And here is the image using the netcdf file
I note that the second image generates a warning (as shown below), but it works nonetheless.
Minimal Complete Verifiable Example
# create a dummy datasetinterval=0.2lat=np.arange(90, -90-interval, -interval)
lon=np.arange(0, 360+interval, interval)
longrid, latgrid=np.meshgrid(lon, lat)
data=0.2*np.cos(np.deg2rad(longrid)) +np.sin(np.deg2rad(latgrid))
grid=xr.DataArray(data, coords=[("latitude", lat), ("longitude", lon)])
grid.gmt.registration=0grid.gmt.gtype=1grid.to_netcdf('grid.nc')
# plot and use grdcontour with the dataarrayfig=pygmt.Figure()
fig.grdimage(grid, projection='W0/10c')
fig.grdcontour(grid, levels='-0.9,')
fig.show()
fig.savefig('grid1.png')
# Do the same using the netcdf filefig2=pygmt.Figure()
fig2.grdimage('grid.nc', projection='W0/10c')
fig2.grdcontour('grid.nc', levels='-0.9,')
fig2.show()
fig2.savefig('grid2.png')
Full error message
grdimage [WARNING]: Guessing of registration in conflict between x and y, using gridline
grdcontour [WARNING]: Guessing of registration in conflict between x and y, using gridline
Description of the problem
I am attempting to draw a contour which encompasses the south pole using grdcontour. Everything works fine when passing a netcdf filename, but when passing an xarray DataArray, the points at the far left and right of the plot are connected by a straight line.
Here is the image using a DataArray
And here is the image using the netcdf file
I note that the second image generates a warning (as shown below), but it works nonetheless.
Minimal Complete Verifiable Example
Full error message
System information
The text was updated successfully, but these errors were encountered: