How I can plot the india map by using netcdf file
Show older comments
% wetPrf
clear;
clc;
File='wetPrf_C004.2006.112.01.10.G29_2013.3520_nc';
ncid = netcdf.open(File,'NC_NOWRITE');
% Get name of global attribute
% gattname = netcdf.inqAttName(ncid,netcdf.getConstant('NC_GLOBAL'),12);
% Get value of global attribute.
% gattval = netcdf.getAtt(ncid,netcdf.getConstant('NC_GLOBAL'),gattname);
TPLat=netcdf.getAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'lat');
TPLon=netcdf.getAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'lon');
YearDay=File(13:20);
Time=[File(22:23),File(25:26),'UT'];
Alt=netcdf.getVar(ncid,0,'double');
Temp=netcdf.getVar(ncid,1,'double');Temp(Temp==-999)=NaN;
VapPress=netcdf.getVar(ncid,2,'double');VapPress(VapPress==-999)=NaN;
Press=netcdf.getVar(ncid,3,'double');Press(Press==-999)=NaN;
Ref=netcdf.getVar(ncid,4,'double');Ref(Ref==-999)=NaN;
Lat=netcdf.getVar(ncid,5,'double');Lat(Lat==-999)=NaN;
Lon=netcdf.getVar(ncid,6,'double');Lon(Lon==-999)=NaN;
Ref_Obs=netcdf.getVar(ncid,7,'double');Ref_Obs(Ref_Obs==-999)=NaN;
%figure(1)
plot(Temp,Alt);
xlabel('Temperature (\circC)','fontsize',12);
ylabel('Altitude (km)','fontsize',12);
title('Temperature Profile');
set(gca,'xtick',-100:10:40);
set(gca,'Position',[0.10 0.10 0.87 0.85]);
set(gca,'XLim',[-85,35]);
set(gca,'YLim',[0,40]);
% text(0,38,['Filename: ',File],'FontSize',12);
text(5,38,['Day: ',YearDay],'FontSize',12);
text(5,36,['Time: ',Time],'FontSize',12);
text(5,34,['Latitude: ',num2str(TPLat,'%.1f'),'\circ'],'FontSize',12);
text(5,32,['Longitude: ',num2str(TPLon,'%.1f'),'\circ'],'FontSize',12);
print('-dpng','-r300',[File,'.png']);
netcdf.close(ncid)
Answers (1)
Sai Bhargav Avula
on 5 Dec 2019
0 votes
Hi,
This following link can help you in creating the map from netcdf file that you have.
Hope this helps!
Categories
Find more on NetCDF Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!