We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
contourf breaks when called via the suntans accessor:
contourf
suntans
ds = xr.open_zarr(...) da = ds["eta"][1, ...] vmin, vmax = float(da.min()), float(da.max()) lvls = np.arange(vmin,vmax,.01) fig, ax, tri, cbar = ds.suntans.contourf(da, clevs=lvls, cmap="RdBu")
produces
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[8], line 6 4 lvls = np.arange(-1,1,.1) 5 lvls = np.arange(vmin,vmax,.01) ----> 6 fig, ax, tri, cbar = ds.suntans.contourf(da, clevs=lvls, cmap="RdBu") File ~/nwa/nwatools/uplot.py:143, in Plot.contourf(self, zdata, clevs, xlims, ylims, colorbar, filled, **kwargs) 137 def contourf(self, zdata, clevs=20, \ 138 xlims=None, ylims=None, colorbar=True, filled=True,\ 139 **kwargs): 140 """ 141 Filled contour plot 142 """ --> 143 self.build_tri_voronoi() 145 fig = plt.gcf() 146 ax = fig.gca() File ~/nwa/nwatools/uplot.py:294, in Plot.build_tri_voronoi(self) 292 print('Computing delaunay triangulation and computing mask...') 293 pts = np.vstack([self.xv,self.yv]).T --> 294 D = spatial.Delaunay(pts) 295 self._triv =tri.Triangulation(self.xv,self.yv,D.simplices) 297 # Compute a mask by removing triangles outside of the polygon File _qhull.pyx:1841, in scipy.spatial._qhull.Delaunay.__init__() File _qhull.pyx:280, in scipy.spatial._qhull._Qhull.__init__() ValueError: Points cannot contain NaN
Pocking around a bit indicates self.xv and self.yv are both None.
self.xv
self.yv
None
A quick fix seems to assign values in the suntans accessor instantiation, e.g.:
UPlot.__init__(self, self._obj['xp'].values, self._obj['yp'].values, self._obj['cells'].values, nfaces=self._obj['nfaces'].values, _FillValue=-999999) self.xv = self._obj['xv'].values self.yv = self._obj['yv'].values
The text was updated successfully, but these errors were encountered:
No branches or pull requests
contourf
breaks when called via thesuntans
accessor:produces
Pocking around a bit indicates
self.xv
andself.yv
are bothNone
.A quick fix seems to assign values in the
suntans
accessor instantiation, e.g.:The text was updated successfully, but these errors were encountered: