
clear 

start

load auxmat.mat
sigue=1;eval(['save ',myresultsdir,'sigue.mat'])

while sigue==1
  clear,load auxmat.mat,eval(['load ',myresultsdir,'sigue.mat'])
 disp(' ')
disp('Now, more plots:')
disp(' ')
disp(['Do you want to plot prediction maps for a SPECIFIC DAY'])
disp('of Physalia Presence Probability & Encounter Risk?')
clear sigue,clear yesno
%sigue=yes_or_no(' ');
yesno= input('(yes or no)   ','s');
    if yesno(1:1)=='y',sigue=1;
    else,sigue=0;
    end
eval(['save ',myresultsdir,'sigue.mat'])
  
if sigue==0;
    disp(' ')
    disp('PhysaliaSIM finished. See you!'),
    disp(' ')
    return;
end %if

%--------
if sigue==1;
disp(' ') 
disp(['Write the day & month of :']),
disp(' ')
clear diafecha,clear mesfecha
diafecha=input('Day of month = ');
mesfecha=input('Month (in number) = ');

playa_lat=39.4; %Spiaggia Portu Tramatzu
playa_lon=9.7;



%disp(['load allmaps_',experiment,'_',int2str(yearini),'to',int2str(yearfin),'.mat'])
eval(['load allmaps_',experiment,'_',int2str(yearini),'to',int2str(yearfin),'.mat'])


 

namemonth={ 'Jan' ; 'Feb' ; 'Mar'; 'Apr' ; 'May' ; 'Jun'; 'Jul'; 'Aug' ; 'Sep'; 'Oct' ; 'Nov' ; 'Dec' } ;
%{}
clear miinidia,clear miinimes,[miinidia,miinimes]=quefecha_fun(inicio,2010); %myyear);
clear mifindia,clear mifinmes,[mifindia,mifinmes]=quefecha_fun(fin,2010); %myyear);
clear tit0,tit0=['Physalia entering the MedSea  from  ',int2str(miinidia),char(namemonth(miinimes)),'  to  ',...
int2str(mifindia),char(namemonth(mifinmes))];

titprob='\color{black}Physalia MAX Presence Probability: WHEN and WHERE';
titrisk='\color{blue}Physalia MAX Encounter Risk: WHEN and WHERE';
ytit=['Database includes   ',int2str(yearini),'  to  ',int2str(yearfin)];
micolor=[.5 0 0];
%--- Probability for an specific day







kk=1; %Residuo de un loop anterior
  clear quedia %sera el julianday
   quedia=julianday_fun(diafecha(kk),mesfecha(kk),2020);

clear tit1,
tit1=[int2str(diafecha(kk)),' ',char(namemonth(mesfecha(kk)))];



%Maps per days
[maxi,maxj]=size(boxid);

  %mat_certainty_free_fract=ones(size(mat_certainty_free_fract));

clear mimat,clear mival
mat_certainty_free_fract(mat_certainty_free_fract==0)=nan;
mat_encounter_risk(mat_encounter_risk==0)=nan;

mival=mat_certainty_free_fract(:,quedia); 
mivalencounter=mat_encounter_risk(:,quedia);
  for i=1:maxi
     for j=1:maxj
      mimat(boxi(i,j),boxj(i,j))=mival(boxid(i,j));
      mimatencounter(boxi(i,j),boxj(i,j))=mivalencounter(boxid(i,j));
     end %for j
    
  end %for i

  %-----
 
  figure,
  imagescnan(boxlon',boxlat',mimat'),clear b,b=colorbar;medcoast
colormap(flipud(hot(64))) %darkred=max to white=zero
set(b,'fontsize',16)

caxis([0 1])
title(['Physalia PRESENCE PROBABILITY on  ',tit1],'fontsize',20)
xlabel(tit0,'fontsize',19,'color',micolor)
ylabel(ytit,'fontsize',19,'color',micolor)

num0=8;
num=.5;
hold on,plot(playa_lon,playa_lat,'k+','markersize',num0,'linewidth',num)
phys_pose
%--check position pixels
%plot(mireg_lon,mireg_lat,'m','linewidth',2),hold on
  %%text((minlonreg+maxlonreg)/2,maxlatreg+maxlatreg/100,'PhysaliaSIM domain','fontsize',10,'color','m')
 
 
figure,
imagescnan(boxlon',boxlat',mimatencounter'),clear b,b=colorbar;medcoast
%colormap(flipud(hot)) %darkred=max to white=zero
 colormap(jet)
%colormap(jet(3))
colormap([0 1 0;1 1 0; 1 0 0])
caxis([0 10])

blabel={'Low';'Medium';'High'};

set(b,'ytick',[10/6:10/3:10])
set(b,'yticklabel',[blabel])
set(b,'fontsize',16)

title(['Physalia RELATIVE ENCOUNTER RISK on  ',tit1],'fontsize',20,'color','b')
xlabel(tit0,'fontsize',19,'color',micolor)
ylabel(ytit,'fontsize',19,'color',micolor)
hold on,plot(playa_lon,playa_lat,'k+','markersize',num0,'linewidth',num)
phys_posd
end %if sigue==1
  
end %if while
