Hi,
I am writing a function to read data from our simulation code output and plot with PyPlot. The data itself is mostly stored as an array with the 1st dimension as variable index and the rest as spatial indexes (1:nI,1:nJ, 1:nK). The output comes with a header, saving variable names as an array of strings:
filehead[1]
Dict{Symbol,Any} with 6 entries:
:time => 598.0
:eqpar => Float32[0.14, -1.0, 14.0, 1.0, 4.0e6, 2.634e6]
:ndim => 3
:it => 17939
:wnames => SubString{String}["qc", "divEc", "rhoS0", "rhoS1", "Bx", "By", "Bz", "Ex", "Ey", "Ez" ,…
:nx => Int32[45, 129, 142]
Then in the plotting wrapper function over PyPlot, my input arguments look like this:
plotdata(data[1],filehead[1],"rho",plotmode="contbar")
where the third argument of type string is used for searching in the header and find the correct variable to plot.
However, here comes the problem: if I want to plot a derived variable, say “rho/p” (density divided by pressure), how can I make it work using a generalized approach?