works also for arrays ...
This commit is contained in:
parent
2ad86e4202
commit
20a06840b0
|
@ -46,7 +46,7 @@ class Table:
|
||||||
|
|
||||||
|
|
||||||
def _add_comment(self,label,shape,info):
|
def _add_comment(self,label,shape,info):
|
||||||
if info:
|
if info is not None:
|
||||||
c = '{}{}: {}'.format(label,' '+str(shape) if np.prod(shape,dtype=int) > 1 else '',info)
|
c = '{}{}: {}'.format(label,' '+str(shape) if np.prod(shape,dtype=int) > 1 else '',info)
|
||||||
self.comments.append(c)
|
self.comments.append(c)
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ class Table:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.data.rename(columns={label_old:label_new},inplace=True)
|
self.data.rename(columns={label_old:label_new},inplace=True)
|
||||||
c = '{} => {}{}'.format(label_old,label_new,'' if not info else ': {}'.format(info))
|
c = '{} => {}{}'.format(label_old,label_new,'' if info is None else ': {}'.format(info))
|
||||||
self.comments.append(c)
|
self.comments.append(c)
|
||||||
self.shapes = {(label if label != label_old else label_new):self.shapes[label] for label in self.shapes}
|
self.shapes = {(label if label != label_old else label_new):self.shapes[label] for label in self.shapes}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ class VTK:
|
||||||
reader = vtk.vtkGenericDataObjectReader()
|
reader = vtk.vtkGenericDataObjectReader()
|
||||||
reader.SetFileName(fname)
|
reader.SetFileName(fname)
|
||||||
reader.Update()
|
reader.Update()
|
||||||
if not dataset_type:
|
if dataset_type is None:
|
||||||
raise TypeError('Dataset type for *.vtk file not given.')
|
raise TypeError('Dataset type for *.vtk file not given.')
|
||||||
elif dataset_type.lower().endswith('rectilineargrid'):
|
elif dataset_type.lower().endswith('rectilineargrid'):
|
||||||
geom = reader.GetRectilinearGridOutput()
|
geom = reader.GetRectilinearGridOutput()
|
||||||
|
@ -196,7 +196,7 @@ class VTK:
|
||||||
|
|
||||||
if isinstance(data,np.ndarray):
|
if isinstance(data,np.ndarray):
|
||||||
d = np_to_vtk(num_array=data.reshape(data.shape[0],-1),deep=True)
|
d = np_to_vtk(num_array=data.reshape(data.shape[0],-1),deep=True)
|
||||||
if not label:
|
if label is None:
|
||||||
raise ValueError('No label defined for numpy.ndarray')
|
raise ValueError('No label defined for numpy.ndarray')
|
||||||
d.SetName(label)
|
d.SetName(label)
|
||||||
if data.shape[0] == N_cells:
|
if data.shape[0] == N_cells:
|
||||||
|
|
Loading…
Reference in New Issue