Please see this MWE. My data is available at that earlier post. What modifications should i do in my code so that i have to change variable(here Ψ) only at single place.
using GLMakie, Meshes
x = include("x.jl") # Matrix of x-coordinates
z = include("z.jl") # Matrix of z-coordinates
Ψ = include("psi.jl") # Data matrix
grd = StructuredGrid(x, z)
function m(s::Symbol, value)
println("The symbol is $s ")
end
macro m(variable::Symbol)
:(m($(QuoteNode(variable)), $(esc(variable))))
end
@m(Ψ)
safe_log(x::Float64) = x > 0 ? log(x) : 1.0
z_log = safe_log.(Ψ)
fig, ax, plt = Meshes.viz(grd, color=vec(z_log), colorscheme=:jet)
ax.title = "Ψ and Contour Plot (data.$file)"
cbar = Colorbar(fig[1, 2])
cbar.label = L"log(Ψ)"
# Save the plot
save("Demo_Meshes.png", fig)
display(fig)
I get this error on using $value.
julia> z_log = safe_log.($value)
ERROR: syntax: “$” expression outside quote around REPL[10]:1
Stacktrace:
[1] top-level scope
@ REPL[10]:1