Hi, I’ve been trying to make this code run but I don’t know how to fix a problem. I think the problem happens too deep in the stack call that I just cannot find where in particular is it occurring:
My goal is to have an animation. Each frame is formed by several contour plots stacked on top of one another in a 3d axis like this:
GLMakie crashes with a different error.
The animation has now 108 frames but I will increase this number.
Method
using CairoMakie, NCDatasets
ENV["HDF5_USE_FILE_LOCKING"]="FALSE"
RH_high,x,y,z_levels,t = Dataset(joinpath(ENV["HOME"],"reproduceError.nc")) do ds
RH_high = variable(ds,"RH")[:,:,:,:] :: Array{UInt8,4}
x = variable(ds,"x")[:] :: Array{Float32,1}
y = variable(ds,"y")[:] :: Array{Float32,1}
z_levels = variable(ds,"z")[:] :: Array{Float32,1}
t = variable(ds,"times")[:] :: Array{Float32,1}
Int.(RH_high),x,y,z_levels,t
end
### Let us create several observables. Each observable corresponds to a different contour plot.
time_idx = Node(1)
rhs = BitMatrix[]
for i in 1:length(z_levels)
push!(rhs,RH_high[:,:,i,1])
end
rh_observables = [Node(i) for i in rhs];
fig = Figure()
ax = Axis3(fig[1,1])
ax.limits[] = ((0,1024),(0,1024),(0,z_levels[end]))
for i in 1:length(z_levels)
contour!(ax,x,y,rh_observables[i], transformation = (:xy, z_levels[i]))
end
### Until here, the result is the image posted above.
### The problem: In the following section, I am trying to record my animation. This fails when i==45
record(fig, joinpath(".","3d_rh_contours.mp4"), 1:length(t); framerate = 10, compression = 0) do curr_t
@info curr_t
for i in 1:length(z_levels)
rhs[i][:] .= RH_high[:,:,i,curr_t][:]
end
[i[] = i[] for i in rh_observables]
time_idx[] = curr_t
end
The recording step breaks with the error:
AssertionError: length(positions) == length(colors)
Stacktrace:
[1] draw_multi(primitive::Lines{Tuple{Vector{Point{2, Float32}}}}, ctx::Cairo.CairoContext, positions::Vector{Vec{2, Float32}}, colors::Vector{ColorTypes.RGBA{Float32}}, linewidths::Vector{Float32}, dash::Nothing)
This breaks in step 45, but the particular number is not very important: if I start from 42 instead of 1, now it breaks around 90
What I am doing inside the record
block is: first, I modify in-place the contents of rhs. Then I trigger an update of the observables. I am doing this because I hoped the problem was being caused by two things updating out of sync, but that didn’t solve the problem.
I would immensely appreciate any help.
I saved the data to reproduce into a 4MB netcdf file that can be found here:
https://ucdavis.box.com/s/umiq6ce2gt3i4w5zj0sbu4rf5b5006z7
versioninfo():
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-2698 v3 @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, haswell)
Environment:
JULIA_REVISE_POLL = 1
JULIA_NUM_THREADS = 8]st CairoMakie:
[13f3f980] CairoMakie v0.4.2
GLMakie dies with a very different error.