Plot data from Netcdf file with latitude, longitude

43 views (last 30 days)
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('','lat');
longitude = ncread('','lon');
variable1 = ncread('','var');
% Convert lat and lon into a grid 1800x3600
[X,Y]=meshgrid(longitude, latitude);
latitude = Y; longitude = X;

Answers (1)

CHIRANJIT DAS on 24 Jun 2022
Edited: CHIRANJIT DAS on 24 Jun 2022
hold on
load coast
axis([75 78 37 42])
Try this. Good luck


Find more on Coordinate Reference Systems in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!