crossposting from Makie discord
Hi all!
Warning, no MWE for the moment due to the nature of the problem.
This is a question about strategy. How to animate this multi-heatmap figure? I am using CairoMakie as I do this on a remote server in which I haven’t been able to run GLMakie. Furthermore, I think the main bottleneck is reading the 110 files every time step.
My current strategy is:
I have a funcion that opens the netcdf file and reads one timestep:
function read_frame(file, var,tindex)
NetCDF.open(file) do ds
ds[var][:,:,1,tindex]
end
end
I also have a function that creates the figure:
function plot_files(df,tind; var)
fig = Figure(resolution=(2*1920,2*1080))
axes_list = []
ncols = 16
for (i,j) in enumerate(df.filename)
to_plot = @lift read_frame(j,var,$tind)
newax = Axis(fig[fld1(i,ncols) + 2,mod1(i,ncols)])
push!(axes_list,newax)
heatmap!(newax,to_plot)
end
fig
end
When provided with a list of files, a time index, and a variable name, this function produces the array of heatmap that I am showing you. It returns a fig.
Now, we can do:
tind[] = 1
fig = plot_files(df,tind;var = "ω")
And then I animate here.
record(fig, plotsdir("time_animation.mp4"), 1:2:1501;
framerate = 30) do t
tind[] = t
end
Now, every time the index tind
changes, the figure takes a good 30-40 seconds updating because it needs to open and read slices from 110
NetCDF files. So the animation is not created in human-bearable timeframes. Would there be a better strategy to do this? I know it is difficult to mix the observable paradigm with paralelization, but could it work in here for the reading part?