Created
October 22, 2020 18:00
-
-
Save ali-ramadhan/2e91bea54608a14769b8717efdb88bfa to your computer and use it in GitHub Desktop.
Serial plotting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Printf | |
using PyCall | |
using PyPlot | |
using NCDatasets | |
cmocean = pyimport("cmocean") | |
ioff() # Turn off interactive plotting | |
ds = NCDataset("dry_convection.nc") | |
frames = length(ds["time"]) | |
x, y, z = ds["xC"], ds["yC"], ds["zC"] | |
Nx, Ny, Nz = length(ds["xC"]), length(ds["yC"]), length(ds["zC"]) | |
for frame in 1:frames | |
@info "Frame $frame/$frames..." | |
ρe = ds["ρe"][:, Int(Ny/2), :, frame] |> Array | |
ρe₀ = ds["ρe₀"][:, Int(Ny/2), :] |> Array | |
ρe′ = transpose(ρe .- ρe₀) | |
PyPlot.contourf(x, z, ρe′, vmin=0, vmax=400, cmap=cmocean.cm.ice, levels=20) | |
PyPlot.savefig(@sprintf("dry_convection_%04d.png", frame), dpi=200) | |
PyPlot.close("all") | |
end | |
close(ds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment