NCEP and MODIS data map scales are not matching

4 views (last 30 days)
Hi,
I am trying to plot wind vector over modis sateelite data map using pcolor() and quiver(). The script is making a map, however, the scales of both maps are not overlapping. Does anyone have any idea what could be the problem and how to fix it? Thanks in advance!
*note: the script and result image is attched below.
% chlorophyll data
file='modis_mapped_monthly_4km.nc';
ncdisp(file);
var=ncread(file, 'var_name');
lat=ncread(file, 'lat');
lon=ncread(file, 'lon');
[lat1,lon1]=meshgrid(lat,lon);
var_map=pcolor(lon1,lat1,var)
var_map.EdgeAlpha = 0;
load coastlines
hold on
plot(coastlon,coastlat,'k')
colorbar
% wind vector
wnd_vec='uvwnd.10m.mon.mean.nc'
ncdisp(wnd_vec)
lat=ncread(wnd_vec, 'lat')
lon=ncread(wnd_vec, 'lon')
[lat1,lon1]=meshgrid(lat,lon)
u=ncread(wnd_vec, 'uwnd')
v=ncread(wnd_vec, 'vwnd')
hold on
quiver(lat1,lon1,u,v,'k')

Answers (1)

Shubham
Shubham on 15 Sep 2023
I understand that you are trying to plot the wind vector over the MODIS satellite data map however the two plots are not completely overlapping.
The arguments passed in the “pcolor()” and “quiver()” are not in the same order. This seems to be the reason which is causing mismatch in the dimensions of the wind vector data and the MODIS satellite data.
Here is a code snippet where wind vectors are plotted over a world map.
% Generate sample data
lon = -180:5:175;
lat = -90:5:85;
[lon1, lat1] = meshgrid(lon, lat);
u = sind(lon1); % Sample wind vector component u
v = cosd(lat1); % Sample wind vector component v
% Create figure
figure
% Set up world map
ax = axesm('MapProjection', 'eqdcylin');
axis off
% Plot world map
load coastlines
geoshow(coastlat, coastlon, 'Color', 'k', 'LineWidth', 1);
% Add boundary to the world map
framem
% Plot wind vectors
quiverm(lat1, lon1, u, v, 'k');
% Adjust figure
title('Wind Vectors over World Map')
It produced the following output figure:
You can also refer to the following:
Hope this helps!!

Categories

Find more on Vector Fields 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!