plotting rainfall data, having latitude and longitude, on map

조회 수: 7 (최근 30일)
Madan Kumar
Madan Kumar 2017년 5월 30일
댓글: Arnob Das 2021년 11월 27일
Hi, I have problem with plotting rainfall data (with latitude and longitude) on map. I googled it, there were many answers but couldn't do it. My data has latitude(1x86400),longitude(1x86400) and corresponding rainfall (1x86400). I have to plot rainfall data on map corresponding to latitude and longitude. My code is similar to below one but not working though not showing any error. Need help.Thank you.
A=importdata('new.dat');
lat=A(:,1);
lon=A(:,2);
lat1=meshgrid(lat,1:25);
lon1=meshgrid(lon,1:25);
z=A(:,3);
z1=meshgrid(z,1:25);
worldmap('world') % initializes map
contourm(lat1,lon1,z1) % plots contours
c = load('coast.mat'); % loads coastlines
plotm(c.lat,c.long) % plots coastlines
  댓글 수: 2
the cyclist
the cyclist 2017년 5월 30일
Can you be more specific about what is not working?
Is it possible for you to upload your file new.dat, or MAT file with the data, so that people can run your code? (I won't be able to, since I do not have the Mapping Toolbox.)
Madan Kumar
Madan Kumar 2017년 5월 31일
I have attached new.txt file since new.dat file was not supported. When I am running the program there is no error but the data are not plotted on map.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 5월 31일
Your data is a scattered data.....you cannot use meshgrid as the way you have used. You need to interpolate the data into a grid and then plot. Check the below code:
A=importdata('new.dat');
lat=A(:,1);
lon=A(:,2);
z=A(:,3);
lon0 = min(lon) ; lon1 = max(lon) ;
lat0 = min(lat) ; lat1 = max(lat) ;
N = 100 ;
x = linspace(lon0,lon1,N) ;
y = linspace(lon1,lat1,N) ;
[X,Y] = meshgrid(x,y) ;
F = scatteredInterpolant(lon,lat,z) ;
Z = F(X,Y) ;
worldmap('world') % initializes map
contourm(X,Y,Z) % plots contours
c = load('coast.mat'); % loads coastlines
plotm(c.lat,c.long) % plots coastlines
  댓글 수: 2
Madan Kumar
Madan Kumar 2017년 5월 31일
Thank you so much. It plots world map and data over it. But I need to plot only the region required for me and data over it. I tried using worldmap([-50 50],[160 -30]). Although it is showing the required map but not plotting data over it. Need help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by