How to colour contour temperature data over its lat and lon?

2 ビュー (過去 30 日間)
P3tra_
P3tra_ 2019 年 2 月 4 日
回答済み: P3tra_ 2019 年 2 月 5 日
Hi hope all is well,
I have a set of field measurements of temperuature, and the lat lon and depth of where the observation was made. I am trying to plot these data onto a map with temperature in colour contour, at its lat lon it was taken.
My collection contains a mighty 45,000 ish rows thus elimated a few approaches such as mesh, my variables are : lat , lon , temp . I also used geoshow for background map, thus I believe would also be a limiting factor of code choices.
So far, I have tried to use the contour function but I kept getting an error of Z must be at least 2 by 2 , (however, my Z , temp is a single column array).
Please let me know how to plot my temp contours, thanks in advance

回答 (2 件)

KSSV
KSSV 2019 年 2 月 4 日
Let lon,lat,Z be your data
M = 100 ; N = 100 ;
xi = linspace(min(lon),max(lon),M) ;
yi = linspace(min(lat),max(lat),N) ;
[Xi,Yi] = meshgrid(Xi,yi) ;
F = scatteredInterpolant(lon,lat,Z,'nearest','none') ;
Zi = F(Xi,Yi) ;
contourf(Xi,Yi,Zi)
  3 件のコメント
KSSV
KSSV 2019 年 2 月 4 日
Why dont you attach your data?
P3tra_
P3tra_ 2019 年 2 月 4 日
here you go KSSV

サインインしてコメントする。


P3tra_
P3tra_ 2019 年 2 月 5 日
Thanks to @KSSV's kind direction, I have successfully got me contour over me geoshow map. However, they do not agree with each other. I reckon it is the lack of projection on my contours, but I do not know for sure. Code as below (my variables are lat , lon , temp):
%2D 'Contour over map'
M = 100 ; N = 100 ;
loni = linspace(min(lon),max(lon), M )
lati = linspace(min(lat),max(lat), N )
[LONi,LATi] = meshgrid(loni,lati)
plot = scatteredInterpolant(lon,lat,temp,'nearest','nearest')
Zi = F (LONi,LATi)
figure
hold on
worldmap ([60 85],[-130 -45])
title ('filetitle')
geoshow('landareas.shp','FaceColor',[0.7 0.8 0.6])
contourm(LATi,LONi,Zi,'ShowText')
hold off
Thanks in advance

Community Treasure Hunt

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

Start Hunting!

Translated by