Long-Term Temperature Trends for the Northeast Shelf Ecosystem
from ecoop.esaTemplate import simpleTemplate
from ecoop.uploadimage import uploadimg
from ecoop.esadict import ESA
from ecoop.esrpd import nbviewer
%pylab inline
Populating the interactive namespace from numpy and matplotlib
from ecoop.esr import ESR as D
D = D()
import numpy as np
from matplotlib.pyplot import *
import math
from matplotlib.ticker import MaxNLocator
from matplotlib.font_manager import FontProperties
new = np.genfromtxt('http://geofemengineering.it//data/temp_trend.csv',delimiter=',', dtype=[('Year','i8'),('Temp','f8')])
fig = figure(1, figsize=(12, 6))
low = new['Temp'].min()
high = new['Temp'].max()
#plt.ylim([math.ceil(low-0.5*(high-low)), math.ceil(high+0.5*(high-low))])
ax = fig.add_subplot(111)
plt.ylim([math.ceil(low-1), math.ceil(high+1)])
plot(new['Year'],new['Temp'],'o',color=[0,0,0])
plot(new['Year'],new['Temp'],'-',color=[0,0,0])
#ax.set_title('Long-Term Temperature Trends for the Northeast Shelf Ecosystem', fontsize=20, fontweight='demi')
#title('Long-Term Temperature Trends for the Northeast Shelf Ecosystem')
grid()
xlabel('Year')
ylabel(u'Sea Surface Temperature, C°')
hlines(new['Temp'].max(), new['Year'].min(), new['Year'].max(), colors='red', linestyles='-.',lw=2 )
#subplots_adjust(bottom=0.14)
fig.autofmt_xdate(bottom=0.2, rotation=75, ha='right')
#ax.yaxis.set_major_locator(MaxNLocator(15))
fig.savefig('test.png',dpi=600)
#uploadimg(inputfile='test.png',outputfile='/var/www/esr/rsst.png')
key = 'ERSST-NES'
ESA[key]['image'] = u'http://geofemengineering.it/data/test.png'
template = simpleTemplate(header_image = 'http://www.nefsc.noaa.gov/ecosys/advisory/current/images/advisory_01.gif',
title = ESA[key]['title'],
image = ESA[key]['image'],
descriptive_text = ESA[key]['descriptive_text'],
datasource_text = ESA[key]['datasource_text'])
f = open('workfile.ipynb', 'w')
f.write(template.encode('utf8'))
f.close()
lines = !/usr/local/bin/jist -p workfile.ipynb
print lines[0].replace("https://gist.github.com", "http://nbviewer.ipython.org")
http://nbviewer.ipython.org/6154465
#print nbviewer('Ecosystem_Advisory.ipynb')