%Border file should be used 
%https://www.mathworks.com/matlabcentral/fileexchange/50390-borders
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Enter Directory
fname='Directory';
%%%%%%%%%%%%%%  A  %%%%%%%%%%%%
filename='spring.nc';
ncdisp(fullfile(fname,filename));
harvest_start_spring=ncread(fullfile(fname,filename),'harvest.start');
harvest_end_spring=ncread(fullfile(fname,filename),'harvest.end');
plant_start_spring=ncread(fullfile(fname,filename),'plant.start');
plant_end_spring=ncread(fullfile(fname,filename),'plant.end');
%%%%%%%%%%%%%%  B  %%%%%%%%%%%%
filename='winter.nc';
ncdisp(fullfile(fname,filename));
harvest_start_winter=ncread(fullfile(fname,filename),'harvest.start');
harvest_end_winter=ncread(fullfile(fname,filename),'harvest.end');
plant_start_winter=ncread(fullfile(fname,filename),'plant.start');
plant_end_winter=ncread(fullfile(fname,filename),'plant.end');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
harvest_start_spring(isnan(harvest_start_spring))=0;
harvest_start_winter(isnan(harvest_start_winter))=0;

Var=harvest_start_spring+harvest_start_winter;
Var=Var';
Var(Var==0)=nan;
Var(abs(Var)>0)=1;
Var=flipud(Var);

%Map the variables of part A and B
h1=imagesc(linspace(-180,180,720),linspace(-90,90,360),Var);
set(h1,'alphadata',~isnan(Var))
colormap(gca,'jet')
set(gca,'YDir','normal')
ylabel('Latitude','fontsize',15)
xlabel('Longitude','fontsize',15)
hold on
h=colorbar('location','Eastoutside');
hold on
borders('countries','nomap','color','black','LineWidth', 1.5)

