fix if no subfield is returned

This commit is contained in:
Michael Krayer 2021-08-05 21:01:42 +02:00
parent 44bdf5865b
commit 6f027877e2
1 changed files with 2 additions and 0 deletions

View File

@ -154,6 +154,8 @@ class Particles:
idxlo = np.array(fld.nearest_gridpoint(pos-rp,lower=True)) idxlo = np.array(fld.nearest_gridpoint(pos-rp,lower=True))
sfdim = np.ceil(2*rp/fld.spacing+2).astype('int') sfdim = np.ceil(2*rp/fld.spacing+2).astype('int')
sf = fld.extract_subfield(idxlo,sfdim,deep=False,strict_bounds=False) sf = fld.extract_subfield(idxlo,sfdim,deep=False,strict_bounds=False)
if sf is None:
continue
xsf = sf.x().reshape((-1,1,1)) xsf = sf.x().reshape((-1,1,1))
ysf = sf.y().reshape((1,-1,1)) ysf = sf.y().reshape((1,-1,1))
zsf = sf.z().reshape((1,1,-1)) zsf = sf.z().reshape((1,1,-1))