How do I take the average SST over a specific region and date.
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
ANKUR KUMAR
2017-12-2
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 个评论
Amir Barkhordary
2018-11-7
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!