Paraview output
We have one main routine to generate Paraview output for data that is either stored in a GeoData
structure (that has lat/lon info), or ParaviewData
(Cartesian). If GeoData
is supplied it is internally automatically converted to the right format. Vectors, such as velocity, are also converted accordingly. You can also visualize time-dependent data.
GeophysicalModelGenerator.Write_Paraview
— Functionpvd = Write_Paraview(DataSet::ParaviewData, filename="test"; PointsData=false, pvd=nothing, time=nothing, directory=nothing, verbose=true)
Writes a structure with Geodata
to a paraview (or VTK) file. If you have unstructured points (e.g., earthquake data), set PointsData=true
. In case you want to create a movie in Paraview, and this is a timestep of that movie you also have to pass time
and pvd
Example 1: Write a 3D volume
julia> Lon,Lat,Depth = LonLatDepthGrid(10:20,30:40,(-300:25:0)km);
julia> Data_set = GeoData(Lat,Lon,Depth,(Depthdata=Depth,LonData=Lon))
julia> Write_Paraview(Data_set, "test_depth3D")
Example 2: Horizontal slice @ given depth
julia> Lon,Lat,Depth = LonLatDepthGrid(10:20,30:40,10km);
julia> Data_set = GeoData(Lat,Lon,Depth,(Topography=Depth,))
julia> Write_Paraview(Data_set, "test")
Example 3: Case with topography
julia> Lon,Lat,Depth = LonLatDepthGrid(10:20,30:40,10km);
julia> Depth[2:4,2:4,1] .= 25km
julia> Data_set = GeoData(Lat,Lon,Depth,(Topography=Depth,))
julia> Write_Paraview(Data_set, "test2")
Example 4: Profile
julia> Lon,Lat,Depth = LonLatDepthGrid(10:20,35,(-300:25:0)km);
julia> Data_set = GeoData(Lat,Lon,Depth,(DataSet=Depth,Depth=Depth))
julia> Write_Paraview(Data_set, "test")
Example 5: Velocity vectors
julia> Lon,Lat,Depth = LonLatDepthGrid(10:20,30:40,10km);
julia> Ve, Vn, Vz = ones(size(Depth)), ones(size(Depth))*0.5, zeros(size(Depth));
julia> Data_set = GeoData(Lat,Lon,Depth,(DataSet=Depth, Velocity=(Ve,Vn,Vz)))
GeoData
size : (11, 11, 1)
lon ϵ [ 30.0 - 40.0]
lat ϵ [ 10.0 - 20.0]
depth ϵ [ 10.0 km - 10.0 km]
fields: (:DataSet, :Velocity)
julia> Write_Paraview(Data_set, "test_Velocity")
Example 6: Unconnected points (e.g., earthquake locations)
Note that these points should be 1D vectors.
julia> Lon,Lat,Depth = LonLatDepthGrid(10:5:20,35:2:40,(-300:50:0)km);
julia> Lon=Lon[:]; Lat=Lat[:]; Depth=Depth[:];
julia> Data_set = GeoData(Lat,Lon,Depth,(DataSet=Depth[:],Depth=Depth*10));
julia> Write_Paraview(Data_set, "test_Points", PointsData=true)
Write_Paraview(DataSet::UTMData, filename::Any; PointsData=false, pvd=nothing, time=nothing, directory=nothing, verbose=true)
Writes a UTMData
structure to paraview. Note that this data is not transformed into an Earth-like framework, but remains cartesian instead.
Write_Paraview(DataSet::CartData, filename::Any; PointsData=false, pvd=nothing, time=nothing, directory=nothing, verbose=true)
Writes a CartData
structure to paraview.
GeophysicalModelGenerator.Movie_Paraview
— Functionpvd = Movie_Paraview(; name="Movie", pvd=pvd, Finalize::Bool=false, Initialize::Bool=true)
If you want to make a movie of your data set, you can use this routine to initialize and to finalize the movie-file. It will create a *.pvd
file, which you can open in Paraview
Individual timesteps are added to the movie by passing pvd
and the time of the timestep to the Write_Paraview
routine.
Example
Usually this is used inside a *.jl
script, as in this pseudo-example:
movie = Movie_Paraview(name="Movie", Initialize=true)
for itime=1:10
name = "test"*string(itime)
movie = Write_Paraview(Data, name, pvd=movie, time=itime)
end
Movie_Paraview(pvd=movie, Finalize=true)