%MAC USERS: COMMENT OUT LINE 43 AND COMMENT IN LINE 44
function[mean] = main_plotMeans(stationNum,year,month_or_season,cloud_option,neg_SNR_option)
    load stationDataCountry;
    stations = stationDataCountry(:,1);
    countries = stationDataCountry(:,2);
    country = countries(find(stations == stationNum));
    if country==1
        country='Norway';
    elseif country==2
        country='Sweden';
    elseif country==3
        country='United Kingdom';
    elseif country==4
        country='Netherlands';
    elseif country==5
        country='Switzerland';
    elseif country==6
        country='France';
    elseif country==7
        country='Spain';
    elseif country==8
        country='Germany';
    elseif country==9
        country='Austria';
    elseif country==10
        country='Czechia';
    elseif country==11
        country='Hungary';
    elseif country==12
        country='Italy';
    elseif country==13
        country='Japan';
    elseif country==14
        country='Reunion';
    elseif country==15
        country='Samoa';
    elseif country==16
        country='Australia';
    elseif country==17
        country='Tasmania';
    end
    
    filename=strcat('..\..\GRWP_PBLH_NetCDFs\GRWPPBLH_',int2str(stationNum),'.nc');
    %filename=strcat('../../GRWP_PBLH_NetCDFs/GRWPPBLH_',int2str(stationNum),'.nc');
    time0=ncread(filename,'time_local');
    time=squeeze(time0);
    
    pblh0=ncread(filename,'pblh');
    clouds0=ncread(filename,'cloud_fraction');
    qc_ind0=ncread(filename,'negativeSNR_indicator');
    vert_rez0=ncread(filename,'vert_resolution_2x');
    lat=ncread(filename,'lat');
    lon=ncread(filename,'lon');
    
    datetimes=NaT(size(time,1),1);
    for i = 1:size(time,1)
        newtime=strcat(int2str(time(i)),':00');
        D=duration(newtime,'Format','hh:mm');
        D2=datetime('2009-05-17 00:00')+D;
        datetimes(i)=D2;
    end
    ctr=1;
    [y0,m0,d0]=ymd(datetimes(1));
    for i=2:20
        [y,m,d]=ymd(datetimes(i));
        if y~=y0 || m~=m0 || d~=d0
            numcols=ctr;
            break
        end
        ctr=ctr+1;
    end
    numrows=size(time,1)/numcols;

    pblh=squeeze(pblh0);
    clouds1=squeeze(clouds0);
    qc_ind1=squeeze(qc_ind0);
    vert_rez1=squeeze(vert_rez0);

    diurnalCycles=NaN.*ones(numrows,numcols);
    dates=NaT(numrows,1);
    clouds=NaN.*ones(numrows,numcols);
    qc_inds=NaN.*ones(numrows,numcols);
    vert_rezs=NaN.*ones(numrows,numcols);
    
    for i=1:numrows
        diurnalCycles(i,:)=pblh((i-1)*numcols+1:i*numcols);
        clouds(i,:)=clouds1((i-1)*numcols+1:i*numcols);
        qc_inds(i,:)=qc_ind1((i-1)*numcols+1:i*numcols);
        vert_rezs(i,:)=vert_rez1((i-1)*numcols+1:i*numcols);
        date=datetimes((i-1)*numcols+1);
        date = dateshift(date, 'start', 'day');
        dates(i)=date;
    end
    
    cycleHours=NaN.*ones(numcols,1);
    for i=1:numcols
        cycleHours(i)=hour(datetimes(i));
    end
    
    months0=month(dates);
    
    
    [mean,~,error,ct] = seasonalMeanFigureSubroutine(month_or_season,cloud_option,neg_SNR_option,year,lat,months0,clouds,diurnalCycles,qc_inds,vert_rezs,dates,cycleHours);
    

    figure
    shadedplot(cycleHours,mean+error,mean-error,.9,[1,.5,.5],[.5,.2,.2]);
    hold on
    p1=plot(cycleHours,mean,'r','LineWidth',3);
    
    ylabel('Height (m)');
    
    
    xticks(cycleHours);
    xticklabels(cycleHours);
    ylim([0 3000]);
    for i = 1:size(cycleHours,1)
        text(cycleHours(i),50,int2str(ct(i)),'FontSize',8);
    end
    text(cycleHours(1),125,'Count','FontSize',8);
  
  
    %month_or_season,cloud_option,neg_SNR_option
    if neg_SNR_option==0
        negSNRtxt='only positive SNR below absolute max in signal';
    elseif neg_SNR_option==1
        negSNRtxt='contains negative SNR below absolute max in signal';
    else
        negSNRtxt='all retrievals';
    end
    if isa(month_or_season,'double')
        month_or_season=int2str(month_or_season);
    end   
    if isa(year,'double')
        year=int2str(year);
    end  
    title(strcat('Station',{' '},int2str(stationNum),{'  /  '}, country,{'  /  '},'Lat:', {' '},num2str(lat),{'  /  '},'Lon:',{' '},num2str(lon),{'  /  '},'Year(s):',{' '},year));
    subtitle(strcat('Season/Month:',{' '},month_or_season,{'  /  '},'Cloud Level:',{' '},cloud_option,{'  /  '},'SNR Signal Type:',{' '},negSNRtxt));
    xlabel('Local Time');
    legend(p1,{'Mean'},'Location','best');
   
    
    
end