-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprocess_from_ncfiles_winter.m
58 lines (53 loc) · 2.04 KB
/
process_from_ncfiles_winter.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
% cd /scratch/Erbahim/Z500/
lat = ncread('b.e11.B20TRC5CNBDRD.f09_g16.002.cam.h1.Z500.19200101-20051231.nc','lat');
lon = ncread('b.e11.B20TRC5CNBDRD.f09_g16.002.cam.h1.Z500.19200101-20051231.nc','lon');
% date = ncread('b.e11.B20TRC5CNBDRD.f09_g16.002.cam.h1.Z500.19200101-20051231.nc','date');
SH_last_index=96;
NH_first_index=97; %Northern hemisphere first
latSH=lat(1:96);
latNH=lat(97:end);
%summer
SFD=152-15; %Summer First Day:SFD
SLD=243+15; %Summer Last Day:SLD
daysummer = 92+30; %all summer days
%winter
WFD=335-15; %Winter First Day:SFD
WLD=424+15; %Winter Last Day:SLD
daywinter = 90+30; %all winter days
member = 40;
year = 85;
YP=25;
year_start=1;
%North Pacific lon
lat_north_index2=96;
lat_south_index2=31;
lon_west_index2=157;
lon_east_index2=253;
lonNA=lon(lon_west_index2:lon_east_index2,1);
latNH=latNH(31:end);
% Zsummer_All_Member_NH=zeros(YP,length(lon),length(latNH),daywinter,'single');
Zwinter_NH=zeros(year,length(lonNA),length(latNH),daywinter,'single');
%stdd_Summer_NA=zeros(member,length(lonNA),length(latNH),daywinter,'single');
for m=1:member
if m==1
filename = sprintf('%s%.3d%s.nc','b.e11.B20TRC5CNBDRD.f09_g16.',m,'.cam.h1.Z500.18500101-20051231');
Z1 = ncread(filename,'Z500');
Z1=Z1(:,:,(1920-1850)*365:end);
elseif m<=35
filename = sprintf('%s%.3d%s.nc','b.e11.B20TRC5CNBDRD.f09_g16.',m,'.cam.h1.Z500.19200101-20051231');
Z1 = ncread(filename,'Z500');
else
filename = sprintf('%s%.3d%s.nc','b.e11.B20TRC5CNBDRD.f09_g16.',m+65,'.cam.h1.Z500.19200101-20051231');
Z1 = ncread(filename,'Z500');
end
filename = sprintf('%s%d.mat','Ashesh_USwinter',m);
for y=year_start:year
[m y]
% Zwinter_All_Member_NH(y,:,:,:)=squeeze(Zwinter_All_Member_NH(y,:,:,:))+squeeze(Z1(:,NH_first_index:end,WFD+365*(year-YP+y-1):WLD+365*(year-YP+y-1)));
Zwinter_NH(y,:,:,:)=squeeze(Z1(lon_west_index2:lon_east_index2,NH_first_index+30:end,WFD+365*(y-1):WLD+365*(y-1)));
end
save(filename,'Zwinter_NH')
end