How can I plot temperature with nc file
이전 댓글 표시
Hello, I have an nc file with the temperature ('tas'), and the langitude and longitude, among other things. And I want to plot it to be able to visualize how the data changes over the year. But it keeps giving me errors, I tried visualizing it with pcolor, plot, and similar.
Also, my latitude and longitude are 51x31 and 31x51 matrix, and if i try any type of geoplot it gives me an error with the matrix dimensions or asks for a vector, and the only one that seems to work is geoshow, but it gives me a warning that says Array is in wrong form?
this is my code, if anyone would be able to help me it would be greatly appreciated.
filename='tas_EUR-11_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_1971.nc'
ncdisp(filename) %See if file works
lon = ncread(filename,'lon') ;
nx = length(lon)
lat = ncread(filename,'lat') ;
ny = length(lat)
[X,Y] = meshgrid(lon,lat); %Make it so that I can actually plot something
time = ncread(filename,'time') ;
for i = 1:length(time)
geoshow(X,Y,temp(:,:,i)') ;
shading interp ;
drawnow
end
댓글 수: 3
KSSV
2020년 12월 9일
If lon is already matrix? why to use meshgrid?
Ana Romero
2020년 12월 9일
Nitin Kapgate
2020년 12월 16일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Geographic Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!