#!/home/mduran/bin/ipython
# Filename: plot_eco_av.py
# This file serves to plot the variables contained in the files eco_av.YYYYMM.nc.
# 
# 
# Script written by Matias Duran Matute (matias.duran-matute@nioz.nl; m.duran.matute@tue.nl)
#
#'This script is made available in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'

import numpy as np
import matplotlib.pylab as plt

from netCDF4 import Dataset as ncdf

plt.close('all')

var_name = 'salt_bott'# To view the name of the available variables see the README file
month    = 1
year     = 2009 #available years are 2009, 2010, and 2011


#Define the file name and load the data
file_n   = "eco_av." + "%i%02i.nc" % (year,month, )
file_d   = ncdf(file_n, mode='r+',format='NETCDF4')
		
var = file_d.variables[var_name][:]
lon = file_d.variables['lon'][:]
lat = file_d.variables['lat'][:]


#Plot the data
F  = plt.figure(figsize=(7,4))
ax = F.add_subplot(111)
C1 = plt.contourf(lon,lat,var,12)
ax.set_aspect(1.66)
plt.colorbar(C1,format='%.02f')
plt.xlabel('longitude')
plt.ylabel('latitute')
plt.show()
