The Azimuth Project
Experiments in carbon cycle with Sage (Rev #9, changes)

Showing changes from revision #8 to #9: Added | Removed | Changed



Create some plots related to the Carbon cycle and do some simple analysis using Sage.


Mauna loa


The classic Keeling curve, plotted upto jan 2011 in Sage with default aspect ratio for Sage List_plot:

Here is a plot of the whole series but showing season corrected values : (also default aspect ratio)

I think it can be better with setting it default aspect ratio to one, so we’ll try that as well and add some major grid lines:

Trend - season corrected aslo with SAGE aspect ratio one:

Draft Code

Trying to see if the TimeSeries in Sage, can be used better instead, by eg using moving averages. The code below reflects the plotting with aspect ratio equal to one. one and also using Timeseries for months larger than two. I am just checking that it could also be used for one

  # based on made by Marshall Hampton CC 3.0  import urllib2 as U import time  current_year = time.localtime().tm_year co2data = U.urlopen('').readlines() datalines = [] for a_line in co2data:     if a_line.find('Creation:') != -1:         cdate = a_line     if a_line[0] != '#':         temp = a_line.replace('\n','').split(' ')         temp = [float(q) for q in temp if q != '']         datalines.append(temp) @interact def azimviewer(month azimco2viewer(month = [1,2,6,12,24],trend= True):      if trend:         sel_data co2_data = [[q[2],q[5]] [q[5] for q in datalines]     else:         sel_data co2_data = [[q[2],q[4]] [q[4] for q in datalines]     yr_data = [q[2] for q in datalines]         if month>2:         co2ts = finance.TimeSeries(co2_data)         co2ts = co2ts.simple_moving_average(month)         co2_data = co2ts.list()         lp = list_plot(sel_data, list_plot(zip(yr_data,co2_data), plotjoined=True, rgbcolor=(1,0,0)) = True, figsize = [7,5], [5,7], aspect_ratio=1.0,gridlines=True)