In [1]:
from netCDF4 import Dataset

from bokeh.plotting import figure, output_notebook, show
from postladim import ParticleFile

# output to static HTML file
# output_file("line.html")

output_notebook()


Loading BokehJS ...

In [2]:
p = figure(plot_width=400, plot_height=400)

pf = ParticleFile('line.nc')
X, Y = pf.position(80)

# add a circle renderer with a size, color, and alpha
p.circle(X, Y, size=2, color="red", alpha=0.5)

# show the results
show(p)



In [75]:
f = Dataset('../data/ocean_avg_0014.nc')

M = f.variables['mask_rho'][:, :]
jmax, imax = M.shape

scale = 2
p = figure(plot_width=scale*imax, plot_height=scale*jmax,
           x_range=(-0.5, imax-0.5), y_range=(-0.5, jmax-0.5))

p.image(image=[M], x=[-0.5], y=[-0.5], dw=[imax], dh=[jmax], palette=['forestgreen', 'lightblue'])

p.circle(X, Y, size=2, color="red", alpha=0.5)

show(p)



In [71]:
import numpy as np
with Dataset('../data/ocean_avg_0014.nc') as f:
    H = f.variables['h'][:, :]
    M = f.variables['mask_rho'][:, :]
jmax, imax = M.shape
H[M < 1] = np.nan

scale = 2
p = figure(plot_width=scale*imax, plot_height=scale*jmax,
           x_range=(-0.5, imax-0.5), y_range=(-0.5, jmax-0.5))

p.image(image=[-np.log(H)], x=[-0.5], y=[-0.5], dw=[imax], dh=[jmax], 
        palette='Blues8', alpha=0.7)

p.circle(X, Y, size=2, color="red", alpha=0.5)

show(p)



In [ ]: