#! /usr/bin/env python
#
# ===========================================================
#
# Alexander R Davies
#
# Ocean Exploration, Remote Sensing, and Biogeography Lab
# School of Marine Science and Policy
# College of Earth, Ocean, and Environment
# University of Delaware
# ardavies@udel.edu
#
# Latest Update: 10/09/13
#
# NOTES: 1) 
#
#			- Reads Processed Data, Linearly Interpolates each
#			for each profile to a known grid, writes the
#			linearly interpolated profiles (by variable)
#			to csv files
#
#			- First column in the Ygrid, across are the
#				individual profiles
#
#
# ===========================================================
# Import Modules
# ===========================================================
#
import numpy as np
import csv
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import glob
import os
from matplotlib.ticker import MaxNLocator
from matplotlib import rc, rcParams
from numpy.random import uniform, seed
from matplotlib.mlab import griddata
from numpy import arange,array,ones#,random,linalg
from pylab import plot,show
from scipy import interpolate
from matplotlib.colors import LogNorm
from matplotlib.backends.backend_pdf import PdfPages
#
# ===========================================================
# Function to read csv files
# ===========================================================
#
def csvread(filename):
	with open(filename, 'rb') as f:
	    reader = csv.reader(f, delimiter=',')
	    nrow = 0;
	    for row in reader:
	    	nrow = nrow +1
	    	ncol = len(row)
	array = np.zeros([ncol,nrow]) 
	with open(filename, 'rb') as f:
	    reader = csv.reader(f, delimiter=',')
	    counter = 0
	    for row in reader:
	    	for jj in range(0,ncol):
	    		array[jj,counter] = row[jj]
	    	counter = counter + 1
	return array, nrow, ncol   
#
# ===========================================================
# Function to Find the nearest value
# ===========================================================
#
def find_nearest(array,value):
    idx = (np.abs(array-value)).argmin()
    return array[idx], idx
#
# ===========================================================
# Sort Data and Descriptive Arrays
# ===========================================================
#
os.chdir('C:/Documents and Settings/Alex/Documents/Research/Delaware/MUSTACHE/Jan01_Jun04_2013/data/type')
fullnames = glob.glob('Full*')
gradnames = glob.glob('Grad*')
infonames = glob.glob('Text*')
arraylen =  len(fullnames)
floatdate = np.zeros(arraylen)
lat = [None]*arraylen
lon = [None]*arraylen
day = np.zeros(arraylen)
month=[None]*arraylen
year=[None]*arraylen
daystr=[None]*arraylen
#
# ===========================================================
# Build the Arrays as days past 1/1/13
# ===========================================================
#
for d in range(0,int(arraylen)):
	f = open(infonames[d], 'r')
	while 1:
		line = f.readline()
		if line[:4] == "Date":
			month[d] = str(line[5:7])
			day[d] = int(line[8:10])
			daystr[d] = str(line[8:10])
			year[d] = str(line[11:15])
			break
	f = open(infonames[d], 'r')
	while 1:
		line = f.readline()
		if line[:3] == "Lat":
			lat[d] = str(line[5:12])
			break
	f = open(infonames[d], 'r')
	while 1:
		line = f.readline()
		if line[:3] == "Lon":
			lon[d] = str(line[5:12])
			break
	
	if (year[d] == '2013'):
		yr = 0
	elif (year[d] == '2014'):
		yr = 365
	elif (year[d] == '2015'):
		yr = 365*2
	if(month[d] == '01'):
		mon = 0
	elif(month[d] == '02'):
		mon = 31
	elif(month[d] == '03'):
		mon = 31 + 28
	elif(month[d] == '04'):
		mon = (31 + 28 + 31)
	elif(month[d] == '05'):
		mon = (31 + 28 + 31 + 30)
	elif(month[d] == '06'):
		mon = (31 + 28 + 31 + 30 + 31)
	elif(month[d] == '07'):
		mon = (31 + 28 + 31 + 30 + 31 + 30)
	elif(month[d] == '08'):
		mon = (31 + 28 + 31 + 30 + 31 + 30 + 31)
	elif(month[d] == '09'):
		mon = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31)
	elif(month[d] == '10'):
		mon = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30)
	elif(month[d] == '11'):
		mon = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31)
	elif(month[d] == '12'):
		mon = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30)
	else:
		print 'invalid month'

	floatdate[d] = yr + mon + day[d]
#
# ===========================================================
# Read the Data and Interpolate for Gridding
# ===========================================================
#
Ygrid = np.linspace(-1800,-10,1791*2)
interplength = len(Ygrid)
GridData = np.zeros([interplength,7,arraylen])
ChlyDumby = np.zeros([interplength,arraylen])
for i in range(0,arraylen):
	dataout, rows, cols = csvread(fullnames[i])
	#
	TemInterp = interpolate.interp1d(dataout[0,:], dataout[1,:],kind='linear')
	DenInterp = interpolate.interp1d(dataout[0,:], dataout[2,:],kind='linear')
	SalInterp = interpolate.interp1d(dataout[0,:], dataout[3,:],kind='linear')
	PreInterp = interpolate.interp1d(dataout[0,:], dataout[4,:],kind='linear')
	OxyInterp = interpolate.interp1d(dataout[0,:], dataout[7,:],kind='linear')
	ChlInterp = interpolate.interp1d(dataout[0,:], dataout[11,:],kind='linear')
	BskInterp = interpolate.interp1d(dataout[0,:], dataout[12,:],kind='linear')
	CDMInterp = interpolate.interp1d(dataout[0,:], dataout[13,:],kind='linear')
	#
	for j in range(0,interplength):
		GridData[j,0,i] = TemInterp(Ygrid[j])
		GridData[j,1,i] = DenInterp(Ygrid[j])
		GridData[j,2,i] = SalInterp(Ygrid[j])
		GridData[j,3,i] = OxyInterp(Ygrid[j])			 
		ChlyDumby[j,i] = ChlInterp(Ygrid[j])	
		GridData[j,5,i] = BskInterp(Ygrid[j])	
		GridData[j,6,i] = CDMInterp(Ygrid[j])	
		if (ChlInterp(Ygrid[j]) < 0):
			GridData[j,4,i] = GridData[j-1,4,i]
		else: 
			GridData[j,4,i] = ChlyDumby[j,i]	
#
# ===========================================================
# Initial Data Contour Plotting
# ===========================================================
contoursdirpath ='C:/Documents and Settings/Alex/Documents/Research/Delaware/MUSTACHE/Jan01_Jun04_2013/plots/contours/'
#
#pp1 = PdfPages('LinearInterpolationGriddedContourDataPlots.pdf')
#
# Do you want to plot contours?  Yes: contplt = 1, No: else
contplt = 1
if contplt == 1:
	for k in range (0,7):
		#
		# Plotting correct data
		contourdat = np.zeros([interplength,arraylen])
		for ci in range(0,interplength):
			for cj in range(0,arraylen):
				#cjj = cj + 1
				contourdat[ci,cj] = GridData[ci,k,cj]
		#
		# Plot Set-up
		fig = plt.figure()
		ax = fig.add_subplot(1, 1, 1)
		#
		# Which Plotting Information?
		if k == 0: #temperature
			contlevels= np.linspace(-1.5,3,100)
			conticks = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
			figtit = 'Temperature (C)'
			savetit = "Temperature_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels = contlevels)
			plt.colorbar(cs, spacing='proportional', ticks = conticks)
		elif k == 1: # density
			contlevels= np.linspace(1026.75,1027.8,100)
			conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
			figtit = 'Density (kg/m^3)'
			savetit = "Density_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels = contlevels)
			plt.colorbar(cs, spacing='proportional', ticks = conticks)
		elif k == 2: # sal
			contlevels= np.linspace(33.5,34.75,100)
			conticks = [33.25, 33.50, 33.75, 34.00, 34.25, 34.50, 34.75, 35.00]
			figtit = 'Salinity (psu)'
			savetit = "Salinity_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels = contlevels)
			plt.colorbar(cs, spacing='proportional', ticks = conticks)
		elif k == 3: #oxygen
			contlevels= np.linspace(4,10,100)
			conticks = [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
			figtit = 'Oxygen Concentration (mg/l)'
			savetit = "Oxygen_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels = contlevels)
			plt.colorbar(cs, spacing='proportional', ticks = conticks)
		elif k == 4: # chl
			contlevels= np.logspace(-2.5,.65,100)
			conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
			figtit = 'Chlorophyll (micro gram/liter)'
			savetit = "Chlorophyll_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels= contlevels, norm = LogNorm())
			cbar = plt.colorbar(cs, spacing='proportional', norm = LogNorm())
			cbar.set_ticks(conticks)
			cbar.set_ticklabels(conticks)
		elif k == 5: #backscatter
			contlevels= np.logspace(-4,-3.3,100)
			conticks = [0.0001, 0.0002, 0.0002, 0.0003, 0.0004, 0.0004, 0.0005, 0.00075, 0.001, 0.0015]
			figtit = 'Backscatter Cross Section (m^-1 sr^-1)'
			savetit = "Backscatter_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels= contlevels, norm = LogNorm())
			cbar = plt.colorbar(cs, spacing='proportional', norm = LogNorm())
			cbar.set_ticks(conticks)
			cbar.set_ticklabels(conticks)
		elif k == 6: #CDOM
			contlevels= np.linspace(1,3,100)
			conticks = [1.5, 2.0, 2.5, 3.0]
			figtit = 'CDOM (ppb)'
			savetit = "CDOM_Contour"
			cs = plt.contourf(floatdate,Ygrid,contourdat, levels= contlevels)
			plt.colorbar(cs, spacing='proportional', ticks = conticks)
		#
		# Plotting
		ax = plt.gca()
		ax.set_xlabel("Days since 01/01/2013")
		ax.set_ylabel("Depth (m)")
		ax.set_ylim([-900,0])
		# plt.title(figtit)
		fig.suptitle(figtit) 
		plt.savefig(contoursdirpath + savetit+".png")
# #
# # ===========================================================
# # Find Gridded Change Velocities Based on Nearest Values
# # ===========================================================
# #
# GridWData = np.zeros([interplength,7,arraylen-1])
# GridWDepths = np.zeros([interplength,7,arraylen-1])
# GridWDates = np.zeros([interplength,7,arraylen-1])
# for k in range(0,7):
# 	for i in range (0,arraylen-1):
# 		for j in range(0,interplength):
# 			value, index = find_nearest(GridData[:,k,i+1], GridData[j,k,i])
# 			startdepth = Ygrid[j]
# 			newdepth = Ygrid[index]
# 			GridWDepths[j,k,i] = (newdepth + startdepth)/2
# 			dz = newdepth-startdepth
# 			GridWData[j,k,i] = dz/172800
# 			GridWDates[j,k,i] = (floatdate[i] + floatdate[i+1])/2
# #
# # ===========================================================
# # Find Avg Gridded Change Velocities Based on Nearest Values
# # ===========================================================
# #
# GridWDataAvg = np.zeros([interplength,7,arraylen-3])
# GridWDepthsAvg = np.zeros([interplength,7,arraylen-3])
# GridWDatesAvg = np.zeros([interplength,7,arraylen-3])
# for k in range(0,7):
# 	for i in range (0,arraylen-3):
# 		for j in range(0,interplength):
# 			GridWDataAvg[j,k,i] = (GridWData[j,k,i] + GridWData[j,k,i+1] + GridWData[j,k,i+2])/3
# 			GridWDepthsAvg[j,k,i] = (GridWDepths[j,k,i] + GridWDepths[j,k,i+1] + GridWDepths[j,k,i+2])/3
# 			GridWDatesAvg[j,k,i] = (GridWDates[j,k,i] + GridWDates[j,k,i+1] + GridWDates[j,k,i+2])/3
# #
# # ===========================================================
# # Find Avg Gridded Change Velocities Based on Nearest Values
# # ===========================================================
# #
# isobiolines = np.linspace(.1,.70,49)
# numbiolines = len(isobiolines)
# Biodepths = np.zeros([numbiolines,arraylen])
# for i in range(0,arraylen):
# 	#print i
# 	for j in range(0,numbiolines):
# 		#print j
# 		count = 0
# 		while (GridData[count,4,i] < isobiolines[j]):
# 				count = count + 1 
# 		Biodepths[j,i] = Ygrid[count]
# #
# # ===========================================================
# # Find Isoline Change Velocities
# # ===========================================================
# #
# IsoBioWData = np.zeros([numbiolines,arraylen-1])
# IsoBioWDepths = np.zeros([numbiolines,arraylen-1])
# IsoBioWDates = np.zeros([numbiolines,arraylen-1])
# IsoBioFake = np.zeros([numbiolines,arraylen-1])
# for i in range(0,arraylen-1):
# 	for k in range(0,numbiolines):
# 		j = i
# 		IsoBioWData[k,i] = (Biodepths[k,j+1] - Biodepths[k,j])/172800
# 		IsoBioFake[k,i] = 0
# 		IsoBioWDepths[k,i] = (Biodepths[k,j+1] + Biodepths[k,j])/2
# 		IsoBioWDates[k,i] = (floatdate[j+1] + floatdate[j])/2
# #
# # ===========================================================
# # Find Avg Isoline Change Velocities
# # ===========================================================
# #
# IsoBioWDataAvg = np.zeros([numbiolines,arraylen-3])
# IsoBioWDepthsAvg = np.zeros([numbiolines,arraylen-3])
# IsoBioWDatesAvg = np.zeros([numbiolines,arraylen-3])
# IsoBioFakeAvg = np.zeros([numbiolines,arraylen-3])
# for i in range (0,arraylen-3):
# 	for j in range(0,numbiolines):
# 			IsoBioWDataAvg[j,i] = (IsoBioWData[j,i] + IsoBioWData[j,i+1] + IsoBioWData[j,i+2])/3
# 			IsoBioWDepthsAvg[j,i] = (IsoBioWDepths[j,i] + IsoBioWDepths[j,i+1] + IsoBioWDepths[j,i+2])/3
# 			IsoBioWDatesAvg[j,i] = (IsoBioWDates[j,i] + IsoBioWDates[j,i+1] + IsoBioWDates[j,i+2])/3
# 			IsoBioFakeAvg[j,i] = (IsoBioFake[j,i] + IsoBioFake[j,i+1] + IsoBioFake[j,i+2])/3
# #
# # ===========================================================
# # Find Sink Vel
# # ===========================================================
# #
# SinkWData = np.zeros([numbiolines,arraylen-1])
# for i in range (0,arraylen-1):
# 	for k in range(0,numbiolines):
# 		value, index = find_nearest(GridWDepths[:,1,i], IsoBioWDepths[k,i])
# 		SinkWData[k,i] = IsoBioWData[k,i] - GridWData[index,1,i]
# #
# # ===========================================================
# # Find Avg Sink Vel
# # ===========================================================
# #
# SinkWDataAvg = np.zeros([numbiolines,arraylen-3])
# for i in range (0,arraylen-3):
# 	for k in range(0,numbiolines):
# 		value, index = find_nearest(GridWDepthsAvg[:,1,i], IsoBioWDepthsAvg[k,i])
# 		SinkWDataAvg[k,i] = IsoBioWDataAvg[k,i] - GridWDataAvg[index,1,i]
# #
# # ===========================================================
# # Chly Contour Map w/ Chly Isoline Ws
# # ===========================================================
# #
# contlevels= np.logspace(-2.5,.65,100)
# conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# figtit = 'Chlorophyll Contour (micro gram/liter) with Avg Isochlyline Ws'
# savetit = "Chlorophyll_Contour_Chlorophyll_IsolineW"
# fig = plt.figure()
# ax = fig.add_subplot(1, 1, 1)
# #
# # Plotting correct contour data
# contourdat = np.zeros([interplength,arraylen])
# for ci in range(0,interplength):
# 	for cj in range(0,arraylen):
# 		contourdat[ci,cj] = GridData[ci,4,cj]
# cs = plt.contourf(floatdate,Ygrid,contourdat, levels= contlevels, norm = LogNorm())
# cbar = plt.colorbar(cs, spacing='proportional', norm = LogNorm())
# cbar.set_ticks(conticks)
# cbar.set_ticklabels(conticks)

# from pylab import *
# Q = plt.quiver(IsoBioWDates[1::10], IsoBioWDepths[1::10], IsoBioFake[1::10], IsoBioWData[1::10])
# plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$5 \times 10^{-3} m/s$', labelpos='W',
#                fontproperties={'weight': 'bold'})

# ax.set_xlabel("Days since 01/01/2013")
# ax.set_ylabel("Depth (m)")
# ax.set_ylim([-900,0])
# fig.suptitle(figtit) 
# plt.savefig(savetit + ".png")
# #
# # ===========================================================
# # Chly Contour Map w/ Avg Chly Isoline Ws
# # ===========================================================
# #
# contlevels= np.logspace(-2.5,.65,100)
# conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# figtit = 'Chlorophyll Contour (micro gram/liter) with Avg Isochlyline Ws'
# savetit = "Chlorophyll_Contour_Chlorophyll_IsolineWAvg"
# fig = plt.figure()
# ax = fig.add_subplot(1, 1, 1)
# #
# # Plotting correct contour data
# contourdat = np.zeros([interplength,arraylen])
# for ci in range(0,interplength):
# 	for cj in range(0,arraylen):
# 		contourdat[ci,cj] = GridData[ci,4,cj]
# cs = plt.contourf(floatdate,Ygrid,contourdat, levels= contlevels, norm = LogNorm())
# cbar = plt.colorbar(cs, spacing='proportional', norm = LogNorm())
# cbar.set_ticks(conticks)
# cbar.set_ticklabels(conticks)

# from pylab import *
# Q = plt.quiver(IsoBioWDatesAvg[1::10], IsoBioWDepthsAvg[1::10], IsoBioFakeAvg[1::10], IsoBioWDataAvg[1::10])
# plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$5 \times 10^{-3} m/s$', labelpos='W',
#                fontproperties={'weight': 'bold'})

# ax.set_xlabel("Days since 01/01/2013")
# ax.set_ylabel("Depth (m)")
# ax.set_ylim([-900,0])
# fig.suptitle(figtit) 
# plt.savefig(savetit + ".png")
# #
# # ===========================================================
# # Contour Plotting Grided W Data
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWplt = 1, No: else
# gridWplt = 2
# if gridWplt == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)
# 	for k in range (0,7):
# 		#
# 		# Plotting correct W data
# 		wcontourdat = np.zeros([interplength,arraylen-1])
# 		wcontourdep = np.zeros([interplength,arraylen-1])
# 		wcontourtim = np.zeros([interplength,arraylen-1])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen-1):
# 				wcontourdat[ci,cj] = GridWData[ci,k,cj]
# 				wcontourdep[ci,cj] = GridWDepths[ci,k,cj]
# 				wcontourtim[ci,cj] = GridWDates[ci,k,cj]
# 		#
# 		# Plotting correct contour data
# 		contourdat = np.zeros([interplength,arraylen])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen):
# 				#cjj = cj + 1
# 				contourdat[ci,cj] = GridData[ci,k,cj]
# 		#
# 		# Plot Set-up
# 		fig = plt.figure()
# 		ax = fig.add_subplot(1, 1, 1)
# 		#
# 		# Which Plotting Information?
# 		if k == 0: #temperature
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(-1.5,3,100)
# 			conticks = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
# 			figtit = 'Isothermal Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Temperature_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 1: # density
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1026.75,1027.8,100)
# 			conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 			figtit = 'Isopycnal Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Density_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 2: # sal
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(33.5,34.75,100)
# 			conticks = [33.25, 33.50, 33.75, 34.00, 34.25, 34.50, 34.75, 35.00]
# 			figtit = 'Isosaline Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Salinity_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 3: #oxygen
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(4,10,100)
# 			conticks = [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
# 			figtit = 'Isooxy Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Oxygen_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 4: # chl
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-2.5,.65,100)
# 			conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# 			figtit = 'Isochly Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Chlorophyll_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 5: #backscatter
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-4,-3.3,100)
# 			conticks = [0.0001, 0.0002, 0.0002, 0.0003, 0.0004, 0.0004, 0.0005, 0.00075, 0.001, 0.0015]
# 			figtit = 'Isobackscatter Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Backscatter_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 6: #CDOM
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1,3,100)
# 			conticks = [1.5, 2.0, 2.5, 3.0]
# 			figtit = 'IsoCDOM Veritical Velocities x 10^4 (m/s)'
# 			savetit = "CDOM_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		#
# 		# Plotting
# 		ax = plt.gca()
# 		ax.set_xlabel("Days since 01/01/2013")
# 		ax.set_ylabel("Depth (m)")
# 		ax.set_ylim([-900,0])
# 		# plt.title(figtit)
# 		fig.suptitle(figtit) 
# 		plt.savefig(savetit+".png")
# #
# # ===========================================================
# # Contour Plotting Averaged Grided W Data
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWpltavg = 1, No: else
# gridWpltavg = 2
# if gridWpltavg == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)	
# 	for k in range (0,7):
# 		#
# 		# Plotting correct W data
# 		wcontourdat = np.zeros([interplength,arraylen-3])
# 		wcontourdep = np.zeros([interplength,arraylen-3])
# 		wcontourtim = np.zeros([interplength,arraylen-3])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen-3):
# 				wcontourdat[ci,cj] = GridWDataAvg[ci,k,cj]
# 				wcontourdep[ci,cj] = GridWDepthsAvg[ci,k,cj]
# 				wcontourtim[ci,cj] = GridWDatesAvg[ci,k,cj]
# 		#
# 		# Plotting correct contour data
# 		contourdat = np.zeros([interplength,arraylen])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen):
# 				#cjj = cj + 1
# 				contourdat[ci,cj] = GridData[ci,k,cj]
# 		#
# 		# Plot Set-up
# 		fig = plt.figure()
# 		ax = fig.add_subplot(1, 1, 1)
# 		#
# 		# Which Plotting Information?
# 		if k == 0: #temperature
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(-1.5,3,100)
# 			conticks = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
# 			figtit = 'Isothermal Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Temperature_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 1: # density
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1026.75,1027.8,100)
# 			conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 			figtit = 'Isopycnal Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Density_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 2: # sal
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(33.5,34.75,100)
# 			conticks = [33.25, 33.50, 33.75, 34.00, 34.25, 34.50, 34.75, 35.00]
# 			figtit = 'Isosaline Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Salinity_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 3: #oxygen
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(4,10,100)
# 			conticks = [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
# 			figtit = 'Isooxy Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Oxygen_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 4: # chl
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-2.5,.65,100)
# 			conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# 			figtit = 'Isochly Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Chlorophyll_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 5: #backscatter
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-4,-3.3,100)
# 			conticks = [0.0001, 0.0002, 0.0002, 0.0003, 0.0004, 0.0004, 0.0005, 0.00075, 0.001, 0.0015]
# 			figtit = 'Isobackscatter Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Backscatter_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 6: #CDOM
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1,3,100)
# 			conticks = [1.5, 2.0, 2.5, 3.0]
# 			figtit = 'IsoCDOM Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "CDOM_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		#
# 		# Plotting
# 		ax = plt.gca()
# 		ax.set_xlabel("Days since 01/01/2013")
# 		ax.set_ylabel("Depth (m)")
# 		ax.set_ylim([-900,0])
# 		# plt.title(figtit)
# 		fig.suptitle(figtit) 
# 		plt.savefig(savetit+".png")
# #
# # ===========================================================
# # Contour Plotting Averaged Grided W Data w/ Isoline avg Ws
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWpltIsoLineWavg = 1, No: else
# gridWpltIsoLineWavg = 2
# if gridWpltIsoLineWavg == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)
# 	for k in range (0,7):
# 		#
# 		# Plotting correct W data
# 		wcontourdat = np.zeros([interplength,arraylen-3])
# 		wcontourdep = np.zeros([interplength,arraylen-3])
# 		wcontourtim = np.zeros([interplength,arraylen-3])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen-3):
# 				wcontourdat[ci,cj] = GridWDataAvg[ci,k,cj]
# 				wcontourdep[ci,cj] = GridWDepthsAvg[ci,k,cj]
# 				wcontourtim[ci,cj] = GridWDatesAvg[ci,k,cj]
# 		#
# 		# Plotting correct contour data
# 		contourdat = np.zeros([interplength,arraylen])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen):
# 				#cjj = cj + 1
# 				contourdat[ci,cj] = GridData[ci,k,cj]
# 		#
# 		# Plot Set-up
# 		fig = plt.figure()
# 		ax = fig.add_subplot(1, 1, 1)
# 		#
# 		# Which Plotting Information?
# 		if k == 0: #temperature
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(-1.5,3,100)
# 			conticks = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
# 			figtit = 'Isothermal Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Temperature_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 1: # density
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1026.75,1027.8,100)
# 			conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 			figtit = 'Isopycnal Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Density_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 2: # sal
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(33.5,34.75,100)
# 			conticks = [33.25, 33.50, 33.75, 34.00, 34.25, 34.50, 34.75, 35.00]
# 			figtit = 'Isosaline Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Salinity_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 3: #oxygen
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(4,10,100)
# 			conticks = [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
# 			figtit = 'Isooxy Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Oxygen_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 4: # chl
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-2.5,.65,100)
# 			conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# 			figtit = 'Isochly Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Chlorophyll_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 5: #backscatter
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-4,-3.3,100)
# 			conticks = [0.0001, 0.0002, 0.0002, 0.0003, 0.0004, 0.0004, 0.0005, 0.00075, 0.001, 0.0015]
# 			figtit = 'Isobackscatter Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Backscatter_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 6: #CDOM
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1,3,100)
# 			conticks = [1.5, 2.0, 2.5, 3.0]
# 			figtit = 'IsoCDOM Averaged Veritical Velocities x 10^4 (m/s)'
# 			savetit = "CDOM_GriddedWAvg"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)


# 		figtit2 = 'Avg Isochlyline Ws (quivers)'
# 		savetit2 = "_Chlorophyll_IsolineWAvg"
# 		from pylab import *
# 		Q = plt.quiver(IsoBioWDatesAvg[1::10], IsoBioWDepthsAvg[1::10], IsoBioFakeAvg[1::10], IsoBioWDataAvg[1::10])
# 		plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$5 \times 10^{-3} m/s$', labelpos='W',
# 		               fontproperties={'weight': 'bold'})
# 		#
# 		# Plotting
# 		ax = plt.gca()
# 		ax.set_xlabel("Days since 01/01/2013")
# 		ax.set_ylabel("Depth (m)")
# 		ax.set_ylim([-900,0])
# 		# plt.title(figtit)
# 		fig.suptitle(figtit + " with " + figtit2 ) 
# 		plt.savefig(savetit+ savetit2 + ".png")

# #
# # ===========================================================
# # Contour Plotting Grided W Data w/ Isoline Ws
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWpltIsoLineW = 1, No: else
# gridWpltIsoLineW = 2
# if gridWpltIsoLineW == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)
# 	for k in range (0,7):
# 		#
# 		# Plotting correct W data
# 		wcontourdat = np.zeros([interplength,arraylen-1])
# 		wcontourdep = np.zeros([interplength,arraylen-1])
# 		wcontourtim = np.zeros([interplength,arraylen-1])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen-1):
# 				wcontourdat[ci,cj] = GridWData[ci,k,cj]
# 				wcontourdep[ci,cj] = GridWDepths[ci,k,cj]
# 				wcontourtim[ci,cj] = GridWDates[ci,k,cj]
# 		#
# 		# Plotting correct contour data
# 		contourdat = np.zeros([interplength,arraylen])
# 		for ci in range(0,interplength):
# 			for cj in range(0,arraylen):
# 				#cjj = cj + 1
# 				contourdat[ci,cj] = GridData[ci,k,cj]
# 		#
# 		# Plot Set-up
# 		fig = plt.figure()
# 		ax = fig.add_subplot(1, 1, 1)
# 		#
# 		# Which Plotting Information?
# 		if k == 0: #temperature
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(-1.5,3,100)
# 			conticks = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
# 			figtit = 'Isothermal Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Temperature_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 1: # density
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1026.75,1027.8,100)
# 			conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 			figtit = 'Isopycnal Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Density_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 2: # sal
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(33.5,34.75,100)
# 			conticks = [33.25, 33.50, 33.75, 34.00, 34.25, 34.50, 34.75, 35.00]
# 			figtit = 'Isosaline Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Salinity_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 3: #oxygen
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(4,10,100)
# 			conticks = [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
# 			figtit = 'Isooxy Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Oxygen_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 4: # chl
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-2.5,.65,100)
# 			conticks = [0.01,0.25,0.50, 1.00, 1.50, 2.00, 3.00]
# 			figtit = 'Isochly Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Chlorophyll_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 5: #backscatter
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.logspace(-4,-3.3,100)
# 			conticks = [0.0001, 0.0002, 0.0002, 0.0003, 0.0004, 0.0004, 0.0005, 0.00075, 0.001, 0.0015]
# 			figtit = 'Isobackscatter Veritical Velocities x 10^4 (m/s)'
# 			savetit = "Backscatter_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		elif k == 6: #CDOM
# 			Wcontlevels= np.linspace(-50,50,101)
# 			Wconticks = [-50, -25, 0, 25, 50]
# 			#contlevels= np.linspace(1,3,100)
# 			conticks = [1.5, 2.0, 2.5, 3.0]
# 			figtit = 'IsoCDOM Veritical Velocities x 10^4 (m/s)'
# 			savetit = "CDOM_GriddedW"
# 			cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 			plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 			plt.set_cmap('BlueRedAlpha')
# 			cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 			plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 		#
# 		# Plotting
# 		figtit2 = 'Isochlyline Ws (quivers)'
# 		savetit2 = "_Chlorophyll_IsolineW"
# 		from pylab import *
# 		Q = plt.quiver(IsoBioWDates[1::10], IsoBioWDepths[1::10], IsoBioFake[1::10], IsoBioWData[1::10])
# 		plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$5 \times 10^{-3} m/s$', labelpos='W',
# 		               fontproperties={'weight': 'bold'})

# 		ax = plt.gca()
# 		ax.set_xlabel("Days since 01/01/2013")
# 		ax.set_ylabel("Depth (m)")
# 		ax.set_ylim([-900,0])
# 		# plt.title(figtit)
# 		fig.suptitle(figtit + " with " + figtit2 ) 
# 		plt.savefig(savetit+ savetit2 + ".png")
# #
# # ===========================================================
# # Contour Plotting Grided W Data w/ Isoline Ws and Sink Ws
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWpltIsoLineW = 1, No: else
# gridWpltIsoLineSinkW = 1
# if gridWpltIsoLineSinkW == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)
# 	#
# 	# Plotting correct W data
# 	wcontourdat = np.zeros([interplength,arraylen-1])
# 	wcontourdep = np.zeros([interplength,arraylen-1])
# 	wcontourtim = np.zeros([interplength,arraylen-1])
# 	for ci in range(0,interplength):
# 		for cj in range(0,arraylen-1):
# 			wcontourdat[ci,cj] = GridWData[ci,1,cj]
# 			wcontourdep[ci,cj] = GridWDepths[ci,1,cj]
# 			wcontourtim[ci,cj] = GridWDates[ci,1,cj]
# 	#
# 	# Plotting correct contour data
# 	contourdat = np.zeros([interplength,arraylen])
# 	for ci in range(0,interplength):
# 		for cj in range(0,arraylen):
# 			#cjj = cj + 1
# 			contourdat[ci,cj] = GridData[ci,1,cj]
# 	#
# 	# Plot Set-up
# 	fig = plt.figure()
# 	ax = fig.add_subplot(1, 1, 1)
# 	#
# 	# Which Plotting Information?
# 	Wcontlevels= np.linspace(-50,50,101)
# 	Wconticks = [-50, -25, 0, 25, 50]
# 	#contlevels= np.linspace(1026.75,1027.8,100)
# 	conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 	figtit = 'Isopycnal Veritical Velocities x 10^4 (m/s)'
# 	savetit = "Density_GriddedW"
# 	cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 	plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 	plt.set_cmap('BlueRedAlpha')
# 	cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 	plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 	#
# 	# Plotting
# 	figtit2 = 'Isochlyline Ws (black) and Sink Ws (green)'
# 	savetit2 = "_Chlorophyll_IsolineW_SinkW"
# 	from pylab import *
# 	#Q = plt.quiver(IsoBioWDates[1::10], IsoBioWDepths[1::10], IsoBioFake[1::10], IsoBioWData[1::10])
# 	#plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$5 \times 10^{-3} m/s$', labelpos='W')

# 	Q2 = plt.quiver(IsoBioWDates[1::10], IsoBioWDepths[1::10], IsoBioFake[1::10], SinkWData[1::10], color='g')
# 	plt.quiverkey(Q2, 0.22, 0.96, 0.001, r'$ 5 \times 10^{-3} m/s$', labelpos='W')
# 	ax = plt.gca()
# 	ax.set_xlabel("Days since 01/01/2013")
# 	ax.set_ylabel("Depth (m)")
# 	ax.set_ylim([-900,0])
# 	# plt.title(figtit)
# 	fig.suptitle(figtit + " with " + figtit2 ) 
# 	plt.savefig(savetit+ savetit2 + "onlysink.png")
# #
# # ===========================================================
# # Contour Plotting Grided W Data w/ Isoline Ws
# # ===========================================================
# #
# # Do you want to plot Gridded Ws?  Yes: gridWpltIsoLineW = 1, No: else
# gridWpltIsoLineSinkWAvg = 1
# if gridWpltIsoLineSinkWAvg == 1:
# 	#
# 	# ===========================================================
# 	# Making Blue-Red Contour Map for Vertical Velocities
# 	# ===========================================================
# 	#
# 	# Make Blue-Red Color Scheme
# 	from matplotlib.colors import LinearSegmentedColormap
# 	cdict3 = {'red':  ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.8, 1.0),
# 	                   (0.75,1.0, 1.0),
# 	                   (1.0, 0.4, 1.0)),

# 	         'green': ((0.0, 0.0, 0.0),
# 	                   (0.25,0.0, 0.0),
# 	                   (0.5, 0.9, 0.9),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0)),

# 	         'blue':  ((0.0, 0.0, 0.4),
# 	                   (0.25,1.0, 1.0),
# 	                   (0.5, 1.0, 0.8),
# 	                   (0.75,0.0, 0.0),
# 	                   (1.0, 0.0, 0.0))
# 	        }
# 	#
# 	# Make a modified version of cdict3 with some transparency
# 	# in the middle of the range.
# 	cdict4 = cdict3.copy()
# 	cdict4['alpha'] = ((0.0, 1.0, 1.0),
# 	                #   (0.25,1.0, 1.0),
# 	                   (0.5, 0.3, 0.3),
# 	                #   (0.75,1.0, 1.0),
# 	                   (1.0, 1.0, 1.0))
# 	plt.register_cmap(name='BlueRedAlpha', data=cdict4)
# 	#
# 	# Plotting correct W data
# 	wcontourdat = np.zeros([interplength,arraylen-3])
# 	wcontourdep = np.zeros([interplength,arraylen-3])
# 	wcontourtim = np.zeros([interplength,arraylen-3])
# 	for ci in range(0,interplength):
# 		for cj in range(0,arraylen-3):
# 			wcontourdat[ci,cj] = GridWDataAvg[ci,1,cj]
# 			wcontourdep[ci,cj] = GridWDepthsAvg[ci,1,cj]
# 			wcontourtim[ci,cj] = GridWDatesAvg[ci,1,cj]
# 	#
# 	# Plot Set-up
# 	fig = plt.figure()
# 	ax = fig.add_subplot(1, 1, 1)
# 	#
# 	# Which Plotting Information?
# 	Wcontlevels= np.linspace(-50,50,101)
# 	Wconticks = [-50, -25, 0, 25, 50]
# 	#contlevels= np.linspace(1026.75,1027.8,100)
# 	conticks = [1026.50, 1026.75, 1027.00, 1027.25, 1027.50, 1027.75, 1028.00]
# 	figtit = 'Isopycnal Veritical Velocities x 10^4 (m/s)'
# 	savetit = "Density_GriddedW"
# 	cs = plt.contourf(wcontourtim,wcontourdep,wcontourdat*10**(4), levels = Wcontlevels)
# 	plt.colorbar(cs, spacing='proportional', ticks = Wconticks)
# 	plt.set_cmap('BlueRedAlpha')
# 	cs2 = plt.contour(floatdate,Ygrid,contourdat, colors='k',levels = conticks)
# 	plt.clabel(cs2, conticks[1::2], inline=1, fmt='%1.1f', fontsize=8)
# 	#
# 	# Plotting
# 	figtit2 = 'Avg Isochlyline Ws (black) and Sink Ws (green)'
# 	savetit2 = "_Chlorophyll_IsolineW_SinkWAvg"
# 	from pylab import *
# 	#Q = plt.quiver(IsoBioWDatesAvg[1::10], IsoBioWDepthsAvg[1::10], IsoBioFakeAvg[1::10], IsoBioWDataAvg[1::10], scale = 1)
# 	#plt.quiverkey(Q, 0.22, 0.95, 0.001, r'$1 \times 10^{-3} m/s$', labelpos='W')

# 	Q2 = plt.quiver(IsoBioWDatesAvg[1::10], IsoBioWDepthsAvg[1::10], IsoBioFakeAvg[1::10], SinkWDataAvg[1::10], color='g')
# 	plt.quiverkey(Q2, 0.22, 0.96, 0.001, r'$ 1 \times 10^{-3} m/s$', labelpos='W')
# 	ax = plt.gca()
# 	ax.set_xlabel("Days since 01/01/2013")
# 	ax.set_ylabel("Depth (m)")
# 	ax.set_ylim([-900,0])
# 	# plt.title(figtit)
# 	fig.suptitle(figtit + " with " + figtit2 ) 
# 	plt.savefig(savetit+ savetit2 + "onlysink.png")



# # #
# # #
# # # ===========================================================
# # # Find Isopycnal Depths
# # # ===========================================================
# # #

# # Dendepths = np.zeros([7,arraylen])
# # for i in range(0,arraylen):
# # 	count2 = 0
# # 	while (GridData[count2,1,i] >= 1027.2):
# # 		count2 = count2 + 1
# # 	Dendepths[0,i] = Ygrid[count2]
# # 	#
# # 	count3 = 0
# # 	while (GridData[count3,1,i] >= 1027.3):
# # 		count3 = count3 + 1
# # 	Dendepths[1,i] = Ygrid[count3]
# # 	#
# # 	count4 = 0
# # 	while (GridData[count4,1,i] >= 1027.4):
# # 		count4 = count4 + 1
# # 	Dendepths[2,i] = Ygrid[count4]
# # 	#
# # 	count5 = 0
# # 	while (GridData[count5,1,i] >= 1027.5):
# # 		count5 = count5 + 1
# # 	Dendepths[3,i] = Ygrid[count5]
# # 	#
# # 	count6 = 0
# # 	while (GridData[count6,1,i] >= 1027.6):
# # 		count6 = count6 + 1
# # 	Dendepths[4,i] = Ygrid[count6]
# # 	#
# # 	count7 = 0
# # 	while (GridData[count7,1,i] >= 1027.7):
# # 		count7 = count7 + 1
# # 	Dendepths[5,i] = Ygrid[count7]
# # 	#
# # 	count8 = 0
# # 	while (GridData[count8,1,i] >= 1027.8):
# # 		count8 = count8 + 1
# # 	Dendepths[6,i] = Ygrid[count8]
# # # ===========================================================
# # # Find Isopycnal Change Velocities
# # # ===========================================================
# # #
# # w = np.zeros([7,arraylen-1])
# # ufake = np.zeros([7,arraylen-1])
# # wdepths = np.zeros([7,arraylen-1])
# # wdates = np.zeros([7,arraylen-1])
# # for i in range(0,arraylen-1):
# # 	for k in range(0,7):
# # 		j = i
# # 		w[k,i] = (Dendepths[k,j+1] - Dendepths[k,j])/172800
# # 		ufake[k,i] = 0
# # 		wdepths[k,i] = (Dendepths[k,j+1] + Dendepths[k,j])/2
# # 		wdates[k,i] = (floatdate[j+1] + floatdate[j])/2
# # #
# # # ===========================================================
# # # Multi Average Isopycnal Change Velocities
# # # ===========================================================
# # #
# # vellen = len(w[1,:])
# # wavg3 = np.zeros([7,vellen-2])
# # ufakeavg3 = np.zeros([7,vellen-2])
# # wdatesavg3 = np.zeros([7,vellen-2])
# # wdepthsavg3 = np.zeros([7,vellen-2])
# # for k in range(0,7):
# # 	for i in range(0,len(wavg3[1,:])):	
# # 		j = i
# # 		jj = i + 1
# # 		jjj = i + 2
# # 		wavg3[k,i] = (w[k,j] + w[k,jj] + w[k,jjj])/3 
# # 		ufakeavg3[k,i] = 0
# # 		wdatesavg3[k,i] = wdates[k,jj]
# # 		wdepthsavg3[k,i] = wdepths[k,jj]
# # #
# # # ===========================================================
# # # Multi Average Isopycnal Change Velocities
# # # ===========================================================
# # #
# # vellen = len(w[1,:])
# # wavg5 = np.zeros([7,vellen-4])
# # ufakeavg5 = np.zeros([7,vellen-4])
# # wdatesavg5 = np.zeros([7,vellen-4])
# # wdepthsavg5 = np.zeros([7,vellen-4])
# # for k in range(0,7):
# # 	for i in range(0,len(wavg5[1,:])):	
# # 		j = i
# # 		jj = i + 1
# # 		jjj = i + 2
# # 		jjjj = i + 3
# # 		jjjjj = i + 4
# # 		wavg5[k,i] = (w[k,j] + w[k,jj] + w[k,jjj]+ w[k,jjjj] + w[k,jjjjj])/5
# # 		ufakeavg5[k,i] = 0
# # 		wdatesavg5[k,i] = wdates[k,jjj]
# # 		wdepthsavg5[k,i] = wdepths[k,jjj]

# # # os.chdir('../../..')

os.chdir('C:/Documents and Settings/Alex/Documents/Research/Delaware/MUSTACHE/Jan01_Jun04_2013/code/interpolate_profiles')