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
KSSV 2020년 12월 9일
If lon is already matrix? why to use meshgrid?
Ana Romero
Ana Romero 2020년 12월 9일
Because it kept giving me an error when try to plot it as a matrix, said it didnt match, so i added it to see if i could actually plot something. :(
Nitin Kapgate
Nitin Kapgate 2020년 12월 16일
Have you tried using surf function to plot the data as discussed here?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Geographic Plots에 대해 자세히 알아보기

태그

질문:

2020년 12월 9일

댓글:

2020년 12월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by