From b1ce876e352fb6cb3d36e73d4f8fbca7832b66cc Mon Sep 17 00:00:00 2001 From: hetianyu Date: Tue, 27 Sep 2022 18:13:16 +0800 Subject: [PATCH] Update tec_to_vtk --- tools/tec_to_vtk.jl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/tec_to_vtk.jl b/tools/tec_to_vtk.jl index d4347c2f..03addb61 100644 --- a/tools/tec_to_vtk.jl +++ b/tools/tec_to_vtk.jl @@ -133,7 +133,7 @@ function tec_to_df(f,variables=0) #d = readdlm(fh) close(fh) - df = convert(DataFrame,d) + df = DataFrame(d,:auto) var_sym = Array{Symbol,length(variables)} variables = [replace(v,"/"=>"_") for v in variables] variables = [replace(v,"-"=>"_") for v in variables] @@ -141,27 +141,27 @@ function tec_to_df(f,variables=0) var_sym = [Symbol(v) for v in variables] rename!(df,var_sym) - if (in(:X_coordinate,names(df))) - delete!(df,:X_coordinate) + if (in("X_coordinate",names(df))) + select!(df, Not(:X_coordinate)) end - if (in(:Y_coordinate,names(df))) - delete!(df,:Y_coordinate) + if (in("Y_coordinate",names(df))) + select!(df, Not(:Y_coordinate)) end - if (in(:Z_coordinate,names(df))) - delete!(df,:Z_coordinate) + if (in("Z_coordinate",names(df))) + select!(df, Not(:Z_coordinate)) end - if (in(:X,names(df))) - delete!(df,:X) + if (in("X",names(df))) + select!(df, Not(:X)) end - if (in(:Y,names(df))) - delete!(df,:Y) + if (in("Y",names(df))) + select!(df, Not(:Y)) end - if (in(:Z,names(df))) - delete!(df,:Z) + if (in("Z",names(df))) + select!(df, Not(:Z)) end - if (in(:Zone,names(df))) - delete!(df,:Zone) + if (in("Zone",names(df))) + select!(df, Not(:Zone)) end return df @@ -211,7 +211,7 @@ function write_vtk(f,coords, elems; diff_df=DataFrame(), variables=0, fi=-1) end vtkfile = vtk_grid(fname, coords, elems) for v in names(df) - vtk_point_data(vtkfile, df[v], string(v)) + vtk_point_data(vtkfile, df[!,v], string(v)) if in(v,names(diff_df)) if length(var_diff)>0 if in(string(v),var_diff)