from __future__ import division from pycdf import * from numpy import * from matplotlib import * startY=01 endY=03 startM=01 endM=12 yvals=endY-startY+1 mvals=endM-startM+1 columns=-1 totalCloudFraction=zeros((yvals*mvals), float) for y in range(startY,endY+1): for m in range(startM,endM+1): if(m==1): month='January' elif(m==2): month='February' elif(m==3): month='March' elif(m==4): month='April' elif(m==5): month='May' elif(m==6): month='June' elif(m==7): month='July' elif(m==8): month='August' elif(m==9): month='September' elif(m==10): month='October' elif(m==11): month='November' elif(m==12): month='December' if(y<10 and m<10): filename='/home/csuplinski/netcdf_data/Trend_14_y0'+str(y)+'m0'+str(m)+'_'+month+'_9090.nc' elif(y>9 and m<10): filename='/home/csuplinski/netcdf_data/Trend_14_y'+str(y)+'m0'+str(m)+'_'+month+'_9090.nc' elif(y<10 and m>9): filename='/home/csuplinski/netcdf_data/Trend_14_y0'+str(y)+'m'+str(m)+'_'+month+'_9090.nc' else: filename='/home/csuplinski/netcdf_data/Trend_14_y'+str(y)+'m'+str(m)+'_'+month+'_9090.nc' columns=columns+1 file=CDF(filename) totalLandPoints=file.var('pts_ea_land') totalLandPoints=totalLandPoints.get() totalLandPoints=totalLandPoints[0] print(totalLandPoints) cloudPoints=file.var('cldpts_ea_land') cloudPoints=cloudPoints.get() cloudPoints=cloudPoints[0] print(cloudPoints) totalCloudFraction[columns]=cloudPoints/float(totalLandPoints) print(arange(size(totalCloudFraction))+1) print(totalCloudFraction) matplotlib.pyplot.plot(arange(size(totalCloudFraction))+1, totalCloudFraction) matplotlib.pyplot.title('Total Cloud Fraction Data') matplotlib.pyplot.xlabel('Time (in years - each year marker indicates January of that year)') matplotlib.pyplot.ylabel('Total Cloud Fraction') matplotlib.pyplot.xticks(12*arange(size(totalCloudFraction)/12)+1, arange(size(totalCloudFraction))+2001, rotation=17)