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 ExchangeGeographic 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