

startY=01;
endY=05;
startM=01;
endM=12;

yvals=endY-startY+1;
mvals=endM-startM+1;

columns=0;

% Initialize the matrices to store the information.
totalLandPoints = zeros(1,yvals*mvals);
cloudPoints = zeros(1,yvals*mvals);
totalCloudFraction = zeros(1,yvals*mvals);

for y=startY:endY
    for m=startM:endM
        
        % Get the correct month name for retrieval of the files.        
        if(m==1)
            month='January';
        elseif(m==2)
            month='February';
        elseif(m==3)
            month='March';
        elseif(m==4)
            month='April';
        elseif(m==5)
            month='May';
        elseif(m==6)
            month='June';
        elseif(m==7)
            month='July';
        elseif(m==8)
            month='August';
        elseif(m==9)
            month='September';
        elseif(m==10)v
            month='October';
        elseif(m==11)
            month='November';
        elseif(m==12)
            month='December';
        end
        
        % Gets the file names from the directory in which they are stored.
        if(y<10 && m<10)
                filename = ['/home/csuplinski/netcdf_data/Trend_14_y0',num2str(y),'m0',num2str(m),'_',month,'_9090.nc']
        elseif(y>9 && m<10)
                filename = ['/home/csuplinski/netcdf_data/Trend_14_y',num2str(y),'m0',num2str(m),'_',month,'_9090.nc']
        elseif(y<10 && m>9)
                filename = ['/home/csuplinski/netcdf_data/Trend_14_y0',num2str(y),'m',num2str(m),'_',month,'_9090.nc']
        else
                filename = ['/home/csuplinski/netcdf_data/Trend_14_y',num2str(y),'m',num2str(m),'_',month,'_9090.nc']
        end
        
columns = columns + 1; 

% Reads the netcdf file for its ID for use in retrieving variables.
ncid=netcdf.open(filename,'NC_NOWRITE');

% Gets the number of total observations over land.
varid = netcdf.inqVarID(ncid,'pts_ea_land');
totalLandPoints(1,columns)=netcdf.getVar(ncid, varid);

% Gets the number of cloudy observations.
varid = netcdf.inqVarID(ncid,'cldpts_ea_land');
cloudPoints(1,columns)=netcdf.getVar(ncid, varid);

totalCloudFraction(1,columns)= cloudPoints(1,columns)/totalLandPoints(1,columns) 
    end
end


plot(totalCloudFraction, '-');
title('Total Cloud Fraction Line Plot');
xlabel('Years (each tick mark denotes January)');
ylabel('Total Cloud Fraction Values');
set(gca, 'XTickLabel',{1:endY});
set(gca, 'XTick', 1:12:length(totalCloudFraction));
set(gca, 'XLim', [1, length(totalCloudFraction)]);



