def saveSlice_CSV(self, outputFilename=outputFilename, xSlice=[], ySlice=[], zSlice=[]):
""" Take a slice and save it to csv """
outputFilename += '_slice.csv'
# # This defines how 'narrow' slice we want. Why am I writing this if ParaView will do it fark
# tol = 1e-2
#
# # Pre allocate empty DF here?
# slicedData = pd.DataFrame()
#
# if not xSlice:
# # We have some slices along x to make
# for point in xSlice:
# # we want to slice at all of these points
# > xSlice[point] - tol
# self.flowData.transpose().loc[(self.flowData.transpose()["x"] > 0.599 & self.flowData.transpose()["x"] < 0.601 & self.flowData.transpose()["z"] == 0), "cf"]
# elif not ySlice:
# # Slices along y to take
# elif not zSlice:
# # And slices aong z
flowData = self.flowData.apply(pd.to_numeric, errors='ignore')
slicedData_indices = (flowData["z"] > -0.01) & (flowData["z"] < 0.01)
slicedData = flowData.loc[slicedData_indices]
slicedData.to_csv(outputFilename, sep=',', index=0, index_label=0)
print "Slices saved in", outputFilename
评论列表
文章目录