In [1]:
from pivpy import io, pivpy, graphics
import numpy as np
import xarray as xr
import os
import pkg_resources as pkg
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
f1 = 'Run000001.T000.D000.P000.H001.L.vec'
f2 = 'Run000002.T000.D000.P000.H001.L.vec'
path = pkg.resource_filename('pivpy','data')
a = io.load_vec(os.path.join(path,f1))
b = io.load_vec(os.path.join(path,f2))
In [3]:
# select where t = 1 (explicit time)
fig, ax = graphics.quiver(a.sel(t=1),arrScale=10)
#increase figure size
fig.set_size_inches(11,8)
In [4]:
# select just the first frame whatever t is .
b['t'] += 10
# define size before the plot
plt.figure(figsize=(11,8))
# show less vectors using nthArr
fig, ax = graphics.quiver(b.isel(t=0),arrScale=10,nthArr=2)
In [5]:
c = a.piv.crop([5, 15,-5,-15])
a.u.shape, c.u.shape
Out[5]:
In [6]:
# define size before the plot
plt.figure(figsize=(11,8))
# show less vectors using nthArr
fig, ax = graphics.quiver(c.isel(t=0),arrScale=10,nthArr=2)
In [7]:
# want to play with some synthetic data?
c = io.create_sample_dataset()
print(c)
In [8]:
# want to slice it and not crop?
d = c.sel(x = slice(35,70),y=slice(30,90))
print(d)
In [9]:
# want to show an ensemble average of 10 frames?
data = io.create_sample_dataset(10)
# want to change the size of arrows and figure aspectratio?
fig,_=graphics.quiver(data.piv.average,arrScale=8,aspectratio=0.5)
fig.set_size_inches(11,8)
In [ ]: