how to plot country borders in regional data
12 次查看(过去 30 天)
显示 更早的评论
I have a netCDF file in which I have a variable to plot at 12 Km grid spacing. The domain is regional and contains 3 countries i.e. Norway, Sweden, and Finland.
Is there a way to draw country borders?
Example plot is attached.
LST_JJActl = ncread('/Volumes/YKMac/EnsAvg_NSF12KP3CTL_JJA_DTM.nc','LST');
pft=ncread('/Volumes/YKMac/NetCDF_Inputdata_P3/NSF12KP3CTL_CLM45_surface.nc','pft_2d');
nt=pft(:,:,3); bt=pft(:,:,9);
NETx=nan(size(LST_JJActl,1),size(LST_JJActl,2)); BDTx=nan(size(LST_JJActl,1),size(LST_JJActl,2));
NETx(1:end,1:end)=nt(2:end-2,2:end-2); BDTx(1:end,1:end)=bt(2:end-2,2:end-2);
NET=NETx*0.01; BDT=BDTx*0.01;
PFTtot=(NET+BDT); % Sum of NET and BDT pft fraction to apply on variables of grid level
x0=10; y0=10; width=1200; height=600;
figure(1);
set(gcf,'units','points','position',[x0,y0,width,height]);
%$*********************** PFT fraction ***********************$%
subplot(1,2,1);
h11=imagesc(rot90(NETx));axis on;grid; set(h11,'alphadata',~isnan(rot90(NETx)));
set(gca,'color', [0.5 0.5 0.5]); caxis([0 100]); colormap(bluewhitered(256));
yticklabels({'69','67','65','63','61','59','57','55'});
xticklabels({'0','5','10','15','20','25','30','35'});
ylabel('Lat');xlabel('Lon'); title('NET','fontsize',14);
subplot(1,2,2);
h12=imagesc(rot90(BDTx));axis on;grid; set(h12,'alphadata',~isnan(rot90(BDTx)));
set(gca,'color', [0.5 0.5 0.5]); caxis([0 100]); colormap(bluewhitered(256));
yticklabels({'69','67','65','63','61','59','57','55'});
xticklabels({'0','5','10','15','20','25','30','35'});
ylabel('Lat');xlabel('Lon'); title('BDT','fontsize',14);
hp1 = get(subplot(1,2,2),'Position');
hc1 = colorbar('Location','Manual','Position', [hp1(1)-0.062 hp1(2)+0.024 hp1(3)-0.32 hp1(4)-0.06]);
title(hc1,'%');
sgtitle('Fraction of PFT in RegCM+CLM, NET and BDT','fontweight','bold','fontsize',16);
set(gcf,'inverthardcopy',false);
saveas(gcf,'/Volumes/YKMac/Figures_P3/FigP3_SI4_PFTfract.png');

Thanks.
0 个评论
回答(1 个)
KSSV
2022-3-8
You may download your required countries boundary shape file from this link: https://gadm.org/download_country.html
You can read the data using shaperead and then plot.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!