Plot data from Netcdf file with latitude, longitude
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have a Netcdf file that has latitude, longitude and variable. The latitude is 1800x1 single, longitude 3600x1 single and the variable is 3600x1800 single. My objective is to plot the variable in the colorbar axis with the latitude as the y-axis and the longitude as the x-axis. I have used the following lines of code to extract the data and create a meshgrid as per some online instructions. However I am not sure, how to proceed with plotting the relevant data on a map with geographical limits from 37 N to 42 N and 78 W to 75 W.
% Read lat, lon, and variable from netcdf
latitude = ncread('v50.nc','lat');
longitude = ncread('v50.nc','lon');
variable1 = ncread('v50.nc','var');
% Convert lat and lon into a grid 1800x3600
[X,Y]=meshgrid(longitude, latitude);
latitude = Y; longitude = X;
0 comentarios
Respuestas (2)
CHIRANJIT DAS
el 24 de Jun. de 2022
Editada: CHIRANJIT DAS
el 24 de Jun. de 2022
contourf(longitude,latitude,variable1');
colorbar
hold on
load coast
plot(long,lat,'k','linewidth',1)
axis([75 78 37 42])
Try this. Good luck
0 comentarios
Paolo Volpe
el 16 de Dic. de 2022
Hello there,
I have the same question. I am trying to plot, through the "contourf" function, the visibility data of a specific region as function of latitude and longitude but the size of this latter is different from the size of data. My latitude and longitude are a vector 36x1 while my data are 8928x36(because they are visibility values for 372 days and 24 hours of sampling and 36 is the number of possible combination between my 6 values of Latitude and 6 of Longitude). How can I do it? I cannot find anything correlated to my case. Thank you!
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!