Create movies

We have two routines to help create movies from the results. The first one takes *.png images generated with the Save Animation option in paraview and puts them together in compressed movies (either mp4 or mov):

GeophysicalModelGenerator.movie_from_imagesFunction
movie_from_images(; dir=pwd(), file=nothing, outfile=nothing, framerate=10, copy_to_current_dir=true, type=:mp4_default, collect=true)

The typical way to create animations with Paraview is to use the Save Animation option to save a series of *.png images.

This function combines these images to an *.mp4 movie.

Optional options

  • dir: directory where the images are stored.
  • file: filename of the image series without extension and numbers. Required if >1 image series is stored in the same directory. By default we reconstruct this name from the available files.
  • outfile: filename of the resulting movie without extension; if not specified, file is used.
  • framerate: number of frames/second.
  • copy_to_current_dir: copies the final movie to the current directory if true (default); otherwise it will be stored in dir.
  • type: type of movie that is created; possible options are:
    • :mp4_default: Default option that saves a well-compressed mp4 movie that works well for us on ipad and embedded in a powerpoint presentation.
    • :mov_hires: Higher-resolution quicktime movie (larger filesize & not compatible with windows)
  • collect: suppresses output of FFMPEG if true (default).
source

The other one creates *.pvd files that can be saved with the pvd=... optional option in write_paraview, such that you can animate temporal data in paraview (yif you're happy you can save the result as images and use movies_from_pics). See the corresponding tutorial on how to generate *.pvd files.

GeophysicalModelGenerator.write_paraviewFunction
pvd = 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   =   lonlatdepth_grid(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  =   lonlatdepth_grid(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    =   lonlatdepth_grid(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  =   lonlatdepth_grid(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  =   lonlatdepth_grid(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  =   lonlatdepth_grid(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)
source
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.

source
write_paraview(DataSet::CartData, filename::Any; PointsData=false, pvd=nothing, time=nothing, directory=nothing, verbose=true)

Writes a CartData structure to paraview.

source
write_paraview(DataSet::Q1Data, filename="test"; directory=nothing, pvd=nothing, time=nothing, verbose=true)

Writes a Q1Data dataset to disk, which has cell and vertex field

source
write_paraview(DataSet::FEData, filename="test"; directory=nothing, pvd=nothing, time=nothing, verbose=true)

Writes a FEData dataset (general finite element) to disk, which has cell and vertex field

source