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 comentarios

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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Geographic Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Dic. de 2020

Comentada:

el 16 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by