tmp = max(eps, birdAtRisk(:))./energy(:);
figure('position',[0 0 1200 800]); hold on; box on; grid on
tmp_e = cumsum(energy(id),'omitnan')./nansum(energy(:));
plot(tmp_e,'linewidth',2)
tmp_b = cumsum(birdAtRisk(id))./nansum(birdAtRisk(:));
plot(tmp_b,'linewidth',2)
yline(energy_day,'-k','Energy produced during the day')
yline(energy_safe,'-k','Energy produced without any bird at risk')
xline(find(tmp_b>.5,1),'-k','50% of birds at risk reduced')
yline(tmp_e(find(tmp_b>.5,1)))
xline(find(tmp_b>.1,1),'-k','90% of birds at risk reduced')
yline(tmp_e(find(tmp_b>.1,1)))
xline(find(tmp_b>.01,1),'-k','99% of birds at risk reduced')
yline(tmp_e(find(tmp_b>.01,1)))
legend('Energy produced','Number of bird at risk','Location','northwest')
xlabel('Datapoint (grid cells x time) sorted by increasing impact (birds@risk / energey produced)')
figure('position',[0 0 1300 500]); hold on; grid on;
plot((1-tmp_e),tmp_b,'k','linewidth',2);
ylabel('Percentage of bird saved')
xlabel('Percentage of Energy lost')
[G,t_day] = findgroups(dateshift(time,'start','day','nearest'));
tmp_b = splitapply( @sum, reshape(sum(sum(birdAtRisk),2),1,[]), G);
tmp_e = splitapply( @nansum, reshape(nansum(nansum(tmp_e),2),1,[]), G);
plot(t_day,tmp_b./sum(birdAtRisk(:)))
plot(t_day,tmp_e./nansum(energy(:)))
y=cumsum(sort(tmp_b))./sum(tmp_b);
xline(tmp,'-',['50% of bird at risk in ' num2str(numel(t_day)-tmp) ' days'])
t_week = datetime('1-Jan-2018'):7:datetime('31-Dec-2018');
tmp_col = nan(4,numel(t_week)-1);
for i_t=1:numel(t_week)-1
it = time>t_week(i_t)&time<t_week(i_t+1);
tmp_b = birdAtRisk(:,:,it);
tmp_n = ~daynight(:,:,it);
tmp_col(:,i_t) = [nansum(tmp_b(:)) nansum(tmp_b(tmp_n)) nansum(tmp_e(:)) nansum(tmp_e(tmp_n))];
figure('position',[0 0 1300 1000]);
subplot(2,1,1); hold on;box on
bar(t_week(1:end-1),tmp_col(1,:))
bar(t_week(1:end-1),tmp_col(2,:))
ylim([0 18e6]); ylabel('Bird at Risk [nb of bird]')
yyaxis 'right'; ax = gca; ax.YAxis(2).Color = 'k'; box on
ylim([0 18e6]/sum(tmp_col(2,:))); ylabel('Bird ar Risk. ratio of total')
subplot(2,1,2); hold on; box on
bar(t_week(1:end-1),tmp_col(3,:))
bar(t_week(1:end-1),tmp_col(4,:))
ylim([0 3e16]); ylabel('Power potential [-]')
yyaxis 'right'; ax = gca; ax.YAxis(2).Color = 'k'; box on
ylim([0 3e16]/sum(tmp_col(3,:))); ylabel('Power Potential. Normalized with total Produced')
legend('Day+Night','Night');
'1-Mar-2018','1-May-2018','15-Aug-2018','15-Nov-2018';...
'1-Mar-2018','1-Apr-2018','1-Oct-2018','1-Nov-2018';...
figure('position',[0 0 1300 500]); hold on
fill([thr_date(1,1) thr_date(1,2) thr_date(1,2) thr_date(1,1)],[0 0 10^6 10^6],'y','EdgeAlpha',0,'FaceAlpha',.5)
fill([thr_date(1,3) thr_date(1,4) thr_date(1,4) thr_date(1,3)],[0 0 10^6 10^6],'y','EdgeAlpha',0,'FaceAlpha',.5)
fill([thr_date(2,1) thr_date(2,2) thr_date(2,2) thr_date(2,1)],[0 0 10^6 10^6],'g','EdgeAlpha',0,'FaceAlpha',.5)
fill([thr_date(2,3) thr_date(2,4) thr_date(2,4) thr_date(2,3)],[0 0 10^6 10^6],'g','EdgeAlpha',0,'FaceAlpha',.5)
plot(time,reshape(sum(sum(birdAtRisk),2),1,[]),'k')
tmp_col(1,:) = [nansum(birdAtRisk(:)) nansum(energy(:)) nansum(energy(:).*daynight(:)) nansum(energy(:).*~daynight(:))];
for i_t=1:size(thr_date,1)
it = ~( (time>thr_date(i_t,1)&time<thr_date(i_t,2)) | (time>thr_date(i_t,3)&time<thr_date(i_t,4)) );
tmp_col(i_t+1,:) = [nansum(birdAtRisk(:,:,it),'all') nansum(energy(:,:,it),'all') nansum(energy(:,:,it).*daynight(:,:,it),'all') nansum(energy(:,:,it).*~daynight(:,:,it),'all') ];
t=table({'No cut','yellow','green'}',tmp_col(:,1),tmp_col(:,2),tmp_col(:,3),tmp_col(:,4),'VariableNames',{'Mitigation','Bird at risk','Energy','Energy day','Energy night'})
t = 3×5 table
| Mitigation | Bird at risk | Energy | Energy day | Energy night |
---|
1 | 'No cut' | 1.1408e+08 | 7.1863e+17 | 3.1147e+17 | 4.0716e+17 |
---|
2 | 'yellow' | 5.4235e+06 | 4.1937e+17 | 1.7443e+17 | 2.4495e+17 |
---|
3 | 'green' | 4.2219e+07 | 5.7910e+17 | 2.5086e+17 | 3.2824e+17 |
---|
tperc{:,2:end}=t{:,2:end}./t{1,2:end}*100
tperc = 3×5 table
| Mitigation | Bird at risk | Energy | Energy day | Energy night |
---|
1 | 'No cut' | 100 | 100 | 100 | 100 |
---|
2 | 'yellow' | 4.7540 | 58.3573 | 56.0011 | 60.1597 |
---|
3 | 'green' | 37.0071 | 80.5841 | 80.5412 | 80.6169 |
---|
plot(dcoast(:), tmp_e(:)./tmp_b(:),'.k'); lsline;
[G,dcoast_bin] = findgroups(round(dcoast(:),-1));
plot(dcoast_bin, splitapply(@nanmean,tmp_e(:)./tmp_b(:),G),'-r','linewidth',2)
xlabel('distance to coast [km]');
ylabel('Energy lost per bird saved')
tmp_bdd=nan(size(ddd)); tmp_edd=nan(size(ddd));
tmp_bdd(i_d)=nansum(tmp_b(dcoast>ddd(i_d)))/nansum(birdAtRisk(:));
tmp_edd(i_d)=nansum(tmp_e(dcoast>ddd(i_d)))/nansum(energy(:));
yline(tmp_bdd((ddd==50)))
yline(tmp_edd((ddd==50)))
xlabel('Distance to coast from which WT are turned-off [km]');
ylabel('Percentage of ... ')
legend('Bird saved','Energy lost')
figure('position',[0 0 1400 700]);
ax1=subplot(size(thr_date,1),3,(i_t-1)*3+1); hold on;
h = worldmap([g.lat(1)-2 g.lat(end)+2], [g.lon(1)-2 g.lon(end)+2]);
setm(h,'frame','on','grid','off'); set(findall(h,'Tag','MLabel'),'visible','off'); set(findall(h,'Tag','PLabel'),'visible','off')
bordersm('countries','facecolor',[228 238 243]./255);
c=colorbar('south'); title('Birds saved [birds]');
colormap(ax1,brewermap([],'OrRd'))
ax2=subplot(size(thr_date,1),3,(i_t-1)*3+2); hold on;
h = worldmap([g.lat(1)-2 g.lat(end)+2], [g.lon(1)-2 g.lon(end)+2]);
setm(h,'frame','on','grid','off'); set(findall(h,'Tag','MLabel'),'visible','off'); set(findall(h,'Tag','PLabel'),'visible','off')
bordersm('countries','facecolor',[228 238 243]./255);
surfm(g.lat,g.lon,tmp2/1e12)
%scatterm(tim.Latitude,tim.Longitude,'.k');
c=colorbar('south'); title('Energy lost [TJ]');
ax3=subplot(size(thr_date,1),3,(i_t-1)*3+3); hold on;
h = worldmap([g.lat(1)-2 g.lat(end)+2], [g.lon(1)-2 g.lon(end)+2]);
setm(h,'frame','on','grid','off'); set(findall(h,'Tag','MLabel'),'visible','off'); set(findall(h,'Tag','PLabel'),'visible','off')
bordersm('countries','facecolor',[228 238 243]./255);
surfm(g.lat,g.lon,tmp2./tmp)
%scatterm(tim.Latitude,tim.Longitude,'.k');
c=colorbar('south'); title('Energy lost per Bird saved [TJ/birds]');
% tmp = birdFlow(:,:,it1).*exp(1i*birdDir(:,:,it1));
% wdir_mean(1) = atan2(imag(mid),real(mid));
% tmp = birdFlow(:,:,it2).*exp(1i*birdDir(:,:,it2));
% wdir_mean(2) = atan2(imag(mid),real(mid));
d = abs(mod(wdir(:,:,it1)-wdir_mean(1)+pi, 2*pi) - pi);
diffit1 = abs(mod(wdir(:,:,it1)-wdir_mean(1)+pi, 2*pi) - pi);
diffit2 = abs(mod(wdir(:,:,it2)-wdir_mean(2)+pi, 2*pi) - pi);
diffit=cat(3,diffit1,diffit2);
tmp_b = birdAtRisk(:,:,it1|it2);
tmp_e = energy(:,:,it1|it2);
tmp_n = ~daynight(:,:,it1|it2);
% only consider night time
tmp_bdd=nan(size(dd)); tmp_edd=nan(size(dd));
tmp_bdd(i_d) = nansum(tmp_b(diffit < dd(i_d)));
tmp_edd(i_d) = nansum(tmp_e(diffit < dd(i_d)));
plot(rad2deg(dd),tmp_bdd); ylabel('Number of bird saved')
plot(rad2deg(dd),tmp_edd);ylabel('Energy lost')
xlabel('Wind direction difference below which WT are turned off [°]');
plot(rad2deg(dd),tmp_bdd./sum(tmp_b(:))); ylabel('Number of bird saved')
%yline(tmp_bdd((dd==.8)))
plot(rad2deg(dd),tmp_edd./nansum(tmp_e(:)));ylabel('Energy lost')
%yline(tmp_edd((dd==.8)))
xlabel('Wind direction difference below which WT are turned off [°]');