-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsstclim_HB.m
58 lines (42 loc) · 1.13 KB
/
sstclim_HB.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
clear all
close all
clc
%%
path0='F:\hot_blob';
fn='SST_2020.nc';
fns=fullfile(path0,fn);
lon=double(ncread(fns,'longitude'));
lat=double(ncread(fns,'latitude'));
time=double(ncread(fns,'time'))./24;
[loni,lati]=meshgrid(lon,lat);
[yr,mo,da,hr,mi,se]=datevec(time+datenum(1950,1,1,1,0,0));
figure
for i=1:1:12
disp(['Month: ' num2str(i)])
indx01=find(mo==i);
numrec=length(indx01);
for irec=1:1:numrec
sst1=ncread(fn,'to',[1 1 1 indx01(irec)],...
[length(lon) length(lat) 1 1],[1 1 1 1]);
sst1=sst1';
masknan=double(~isnan(sst1));
sst1(isnan(sst1))=0;
if irec==1
sstm=zeros(size(sst1));
numnonnan=zeros(size(sst1));
end
sstm=sstm+sst1;
numnonnan=numnonnan+masknan;
end
sstm=sstm./numnonnan;
ssts(:,:,i)=sstm;
months(i,1)=i;
pcolor(lon,lat,ssts(:,:,i));
colorbar; caxis('auto');
shading flat
colormap jet
title(num2str(i))
pause(0.1)
clf
end
%save('SST1993_2019dic','ssts','loni','lati','months');