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 Kommentare

KSSV
KSSV am 9 Dez. 2020
If lon is already matrix? why to use meshgrid?
Ana Romero
Ana Romero am 9 Dez. 2020
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 am 16 Dez. 2020
Have you tried using surf function to plot the data as discussed here?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Geographic Plots finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 9 Dez. 2020

Kommentiert:

am 16 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by