- Location number 7 is in Antarctica! The sea surface temperature data is all NaN on land, so averaging the grid cell values around Location 7 will just give you NaN.
- The global_sst.mat dataset is a static average, not a time series. This means that even in the ocean where all SST values are valid, if you take the average SST in a given mask, you'll just end up with a single scalar value. If you would like to apply the local function to an example time series of SSTs, use the pacific_sst.mat dataset, which contains a cube where the first two dimensions are spatial, and the third dimension is time.
How to Plot Time Series Data of a Temperature Map
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Ziggs
el 23 de Mzo. de 2021
Comentada: John Ziggs
el 28 de Mzo. de 2021
Hi,
I am trying to plot a timeseries data of the SST at certain locations on the world but I keep getting a blank plot. This is my code:
load global_sst
figure
imagescn(lon,lat,mean(sst,3))
hold on
gomlon = [21.25 1.25 -18.75 111.25 -116.25 176.25 -91.25 136.25];
gomlat = [26.25 11.25 -13.75 61.25 16.25 31.25 -76.25 -23.75];
plot(gomlon,gomlat,'ro')
text(21.25 ,26.25,'1','color','red','horiz','center','vert','bot');
text(1.25 ,11.25,'2','color','red','horiz','center','vert','bot');
text(-18.75 ,-13.75,'3','color','red','horiz','center','vert','bot');
text(111.25 ,61.25,'4','color','red','horiz','center','vert','bot');
text(-116.25 ,16.25,'5','color','red','horiz','center','vert','bot');
text(176.25 ,31.25,'6','color','red','horiz','center','vert','bot');
text(-91.25 ,-76.25,'7','color','red','horiz','center','vert','bot');
text(136.25 ,-23.75,'8','color','red','horiz','center','vert','bot');
%% Location 1
gomlon1 = [18.75 18.75 23.75 23.75];
gomlat1 = [28.75 23.75 28.75 23.75];
[Lon,Lat] = meshgrid(lon,lat);
mask1 = geomask(Lat,Lon,gomlat1,gomlon1);
contour(Lon,Lat,double(mask1),[0.5 0.5],'b')
%% Location 2
gomlon2 = [3.75 3.75 -1.25 -1.25];
gomlat2 = [13.75 8.75 13.75 8.75];
[Lon,Lat] = meshgrid(lon,lat);
mask2 = geomask(Lat,Lon,gomlat2,gomlon2);
contour(Lon,Lat,double(mask2),[0.5 0.5],'b')
%% Location 3
gomlon3 = [-21.25 -21.25 -16.25 -16.25];
gomlat3 = [-16.25 -11.25 -16.25 -11.25];
[Lon,Lat] = meshgrid(lon,lat);
mask3 = geomask(Lat,Lon,gomlat3,gomlon3);
contour(Lon,Lat,double(mask3),[0.5 0.5],'b')
%% Location 4
gomlon4 = [113.75 113.75 108.75 108.75];
gomlat4 = [58.75 63.75 58.75 63.75];
[Lon,Lat] = meshgrid(lon,lat);
mask4 = geomask(Lat,Lon,gomlat4,gomlon4);
contour(Lon,Lat,double(mask4),[0.5 0.5],'b')
%% Location 5
gomlon5 = [-118.75 -118.75 -113.75 -113.75];
gomlat5 = [18.75 13.75 18.75 13.75];
[Lon,Lat] = meshgrid(lon,lat);
mask5 = geomask(Lat,Lon,gomlat5,gomlon5);
contour(Lon,Lat,double(mask5),[0.5 0.5],'b')
%% Location 6
gomlon6 = [178.75 173.75 178.75 173.75];
gomlat6 = [33.75 28.75 33.75 28.75];
[Lon,Lat] = meshgrid(lon,lat);
mask6 = geomask(Lat,Lon,gomlat6,gomlon6);
contour(Lon,Lat,double(mask6),[0.5 0.5],'b')
%% Location 7
gomlon7 = [-93.75 -93.75 -88.75 -88.75];
gomlat7 = [-78.75 -73.75 -78.75 -73.75];
[Lon,Lat] = meshgrid(lon,lat);
mask7 = geomask(Lat,Lon,gomlat7,gomlon7);
contour(Lon,Lat,double(mask7),[0.5 0.5],'b')
%% Location 8
gomlon8 = [138.75 138.75 133.75 133.75];
gomlat8 = [-26.25 -21.25 -26.25 -21.25];
[Lon,Lat] = meshgrid(lon,lat);
mask8 = geomask(Lat,Lon,gomlat8,gomlon8);
contour(Lon,Lat,double(mask8),[0.5 0.5],'b')
%%
figure
sst_gom = local(sst,mask7,'omitnan');
t=1:736;
figure(2)
plot(t,sst_gom)
axis tight
datetick('x','keeplimits')
ylabel 'y'
As an example, I tried plotting the time series plot of location 7. I did this by making a mask of the location, then tried plotting the data within this mask. However I get a blank plot. Any advice?
Also as a note, I am using the Climate Data Toolbox by Chad A. Greene and tried following his example.
Thanks.
0 comentarios
Respuesta aceptada
Chad Greene
el 25 de Mzo. de 2021
Hi John,
A couple of things:
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!