How do I take the average SST over a specific region and date.

5 Ansichten (letzte 30 Tage)
Lauren Arvai
Lauren Arvai am 1 Dez. 2017
I provided the code I have done so far, I have no experience coding. I'm trying to figure out how to take the average sst from 01-Jan-1984 and 01-Dec-2014 within Latitude: 60N to 30N and Longitude 150 to 240. This is for a time series. Please help.

Antworten (1)

ANKUR KUMAR
ANKUR KUMAR am 2 Dez. 2017
lat=ncread('sst.mnmean.nc','lat'); %for reading the lat variable from .nc file
lon=ncread('sst.mnmean.nc','lon');
sst=ncread('sst.mnmean.nc','sst');
id1=find(lat>30&lat<60); %find function finds the index in lats where the value lies between 30 and 60
id2=find(lon>150&lon<240);
lat1=lat(id1); %lat1 stores those lat values from id1, in which the specific indices are saved
lon1=lon(id2);
sst1=nanmean(sst(id2,id1,:),3); % sst accepts the indices from id1 and id2 and mean takes the mean alone the third dimension
contourf(lon1,lat1,sst1','linecolor','none') %contour plot of the required plot.
You can delete the comments, which are written after %
  1 Kommentar
Amir Barkhordary
Amir Barkhordary am 7 Nov. 2018
Thanks for the input. I have already seen your answer on a similar problem. However, I am not sure how to integrate your code to modify mine to create a mean plot.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Time Series finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by