tfix pvpython script location and paths, try to merge PNGs with imagemagick - G… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c6ba5de8b5601deef12ce01767d8be3252e21ec6 | |
parent 88bb91c4a1fcf1969fc9cd789c0fa2668108eb16 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 1 Nov 2017 10:27:33 -0400 | |
fix pvpython script location and paths, try to merge PNGs with imagemagick | |
Diffstat: | |
M examples/logo.jl | 2 ++ | |
M src/io.jl | 20 ++++++++++++++++---- | |
2 files changed, 18 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/examples/logo.jl b/examples/logo.jl | |
t@@ -165,3 +165,5 @@ SeaIce.setOutputFileInterval!(sim, .1) | |
SeaIce.removeSimulationFiles(sim) | |
SeaIce.run!(sim, verbose=verbose) | |
+ | |
+SeaIce.render(sim, images=true, animation=false) | |
diff --git a/src/io.jl b/src/io.jl | |
t@@ -681,12 +681,11 @@ function writeParaviewPythonScript(simulation::Simulatio… | |
ice_floes_color_scheme::String="X Ray", | |
verbose::Bool=true) | |
if filename == "" | |
- folder = folder * "/" * simulation.id | |
mkpath(folder) | |
filename = string(folder, "/", simulation.id, ".py") | |
end | |
if vtk_folder == "" | |
- vtk_folder = "./" | |
+ vtk_folder = "." | |
end | |
open(filename, "w") do f | |
t@@ -927,9 +926,22 @@ function render(simulation::Simulation; pvpython::String=… | |
animation::Bool=false) | |
writeParaviewPythonScript(simulation, save_animation=animation, | |
- save_images=images) | |
+ save_images=images, verbose=false) | |
try | |
- run(`$(pvpython) $(simulation.id)/$(simulation.id).py`) | |
+ cd(simulation.id) | |
+ run(`$(pvpython) $(simulation.id).py`) | |
+ | |
+ # if available, use imagemagick to create gif from images | |
+ if images | |
+ try | |
+ run(`convert -trim +repage -delay 10 -transparent-color white | |
+ -loop 0 $(simulation.id)*.png $(simulation.id).gif`) | |
+ catch return_signal | |
+ if isa(return_signal, Base.UVError) | |
+ error("skipping gif merge since `convert` was not found.") | |
+ end | |
+ end | |
+ end | |
catch return_signal | |
if isa(return_signal, Base.UVError) | |
error("`pvpython` was not found.") |