# dimensions particles

lat = 15000
lon = 7500
depth = -50

nlat = 100
nlon = 100
ndepth = 5

depth_ml = -30

y = range(100, lat+100, nlat)
x = range(100, lon+100, nlon)
z = np.linspace(0, depth, ndepth)
[Xf,Yf,Zf] = myfun.meshgrid2(x,y,z)
Yf = np.reshape(Yf,np.size(Yf,))
Xf = np.reshape(Xf,np.size(Xf,))
Zf = np.reshape(Zf,np.size(Zf,))

# dimensions archives

xstep = 150
ystep = 150
zstep = -1

Xlist = np.arange(0.0,lon+xstep,xstep)# x co-ordinates of the desired array shape
Ylist = np.arange(0.0,lat+ystep,ystep)# y co-ordinates of the desired array shape
Zlist = np.arange(0.0,depth_ml+zstep,zstep)# y co-ordinates of the desired array shape
[X,Y,Z] = myfun.meshgrid2(Xlist,Ylist,Zlist)
Y = np.reshape(Y,(np.size(Y),))
# Xlist = np.linspace(0,10000,801)
# Ylist = np.linspace(0,4000,321)
Xlist = np.linspace(0, 8000, 641)
Ylist = np.linspace(0, 8000, 641)
dl = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]
Zlist = 1.0 * np.cumsum(dl)

maps = [Xlist, Ylist, Zlist]

lo = np.array([0, 0, 0])
hi = np.array([8000, 8000, 50])  # highest lat, highest lon
# lo = np.array([ 0, 0, 0])
# hi = np.array([ 10000, 4000, 50])   # highest lat, highest lon

[X, Y, Z] = myfun.meshgrid2(Xlist, Ylist, Zlist)
Y = np.reshape(Y, (np.size(Y),))
X = np.reshape(X, (np.size(X),))
Z = np.reshape(Z, (np.size(Z),))

xn = len(Xlist)
yn = len(Ylist)
zn = len(Zlist)

dx = np.gradient(Xlist)
dy = np.gradient(Ylist)
dz = np.gradient(Zlist)

# dt = 360
dt = 1440
time = np.asarray(range(dayi, dayf, days))
depthi = 0

latf = 0
lonf = 180000
depthf = -900

# dimensions archives

xstep = 5000
ystep = 1
zstep = -20

Xlist = np.arange(loni,lonf+xstep,xstep)# x co-ordinates of the desired array shape
Ylist = np.arange(lati,latf+ystep,ystep)# y co-ordinates of the desired array shape
Zlist = np.arange(depthi,depthf+zstep,zstep)# y co-ordinates of the desired array shape
[X,Y,Z] = myfun.meshgrid2(Xlist,Ylist,Zlist)
Y = np.reshape(Y,(np.size(Y),))
X = np.reshape(X,(np.size(X),))
Z = np.reshape(Z,(np.size(Z),))

pts = zip(X,Y,Z)
pts = vtktools.arr(pts)

# define flux

flux = []

flux_t = np.linspace(0,24,50)

for t in flux_t:
 tt = t%24/6.0