1 |
gforget |
1.1 |
|
2 |
|
|
domaine_global_def; domaine; |
3 |
|
|
mask=squeeze(tmask3D(:,:,1)); recl=jpi*jpj*4; |
4 |
|
|
|
5 |
|
|
|
6 |
|
|
rep_out='./'; |
7 |
|
|
choice_plot=0; |
8 |
|
|
|
9 |
|
|
for choiceDataSet=1:2; |
10 |
|
|
%1->NCEP 2->ECMWF |
11 |
|
|
|
12 |
|
|
if choiceDataSet==1; data_cur='.ncep.'; ycur0=1992; ycurMax=2006; |
13 |
|
|
else choiceDataSet==2; data_cur='.ecmwf.'; ycur0=1992; ycurMax=2006; |
14 |
|
|
end;fprintf([data_cur ' flux \n']); |
15 |
|
|
|
16 |
|
|
fid_runoff=fopen('/net/ross/raid0/gforget/DATAbin/forcing/CORE/runoffannual1x1','r','b'); |
17 |
|
|
runoff=fread(fid_runoff,[jpi jpj],'float32').*mask; |
18 |
|
|
fclose(fid_runoff); |
19 |
|
|
|
20 |
|
|
%SST and ICE data: |
21 |
|
|
fid_sst=fopen('/net/ross/raid0/gforget/DATAbin/ICECONC/HADLEY/HadISST1_SST_9206_monthly','r','b'); |
22 |
|
|
field_sst=fread(fid_sst,jpi*jpj*12,'float32'); fclose(fid_sst); field_sst=reshape(field_sst,jpi,jpj,12); |
23 |
|
|
fid_ice=fopen('/net/ross/raid0/gforget/DATAbin/ICECONC/HADLEY/HadISST1_ICE_9206_monthly','r','b'); |
24 |
|
|
field_ice=fread(fid_ice,jpi*jpj*12,'float32'); fclose(fid_ice); field_ice=reshape(field_ice,jpi,jpj,12); |
25 |
|
|
|
26 |
|
|
%for interannual sst: |
27 |
|
|
rep_sst='/net/ross/raid2/king/data_1x1_92-03/obs/'; pref_sst='SST_monthly_r2_'; suff_sst=''; |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
for ycur=ycur0:ycurMax |
31 |
|
|
|
32 |
|
|
suff_out=[data_cur 'flux.' num2str(ycur) '.daily.bin']; list_tcur=[1:365]; |
33 |
|
|
doInitFiles=1; doWriteMean=0; |
34 |
|
|
|
35 |
|
|
for tcur=list_tcur |
36 |
|
|
|
37 |
|
|
for ttcur=1:4 |
38 |
|
|
|
39 |
|
|
hcur=(tcur-1)*4+ttcur; |
40 |
|
|
|
41 |
|
|
%part a: load fields |
42 |
|
|
if choiceDataSet==1; [dataFlds]=ncep_load_fluxes(ycur,hcur); |
43 |
|
|
else; [dataFlds]=ecmwf_load_fluxes(ycur,hcur); |
44 |
|
|
end; |
45 |
|
|
|
46 |
|
|
%part b: time interpolate sst and ice fields from monthly atlas |
47 |
|
|
[mcur,mcurW]=coeff_MonthlyAtlasInterp(tcur); |
48 |
|
|
ice=(1-mcurW)*field_ice(:,:,mcur(1))+mcurW*field_ice(:,:,mcur(2)); ice=ice.*mask; |
49 |
|
|
|
50 |
|
|
dataFlds=setfield(dataFlds,'ice',ice); |
51 |
|
|
dataFlds=setfield(dataFlds,'runoff',runoff); |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
%part 2: net fluxes |
55 |
|
|
qnet = (1-dataFlds.ice).*( dataFlds.turbflux + dataFlds.swflux ); |
56 |
|
|
empmr = (1-dataFlds.ice).*( dataFlds.emp ) - dataFlds.runoff; |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
%part 3: time average |
60 |
|
|
%writeFlds=struct('ustress',dataFlds.ustress,'vstress',dataFlds.vstress,'qnet',qnet,'empmr',empmr); |
61 |
|
|
turbflux=(1-dataFlds.ice).*dataFlds.turbflux; swflux=(1-dataFlds.ice).*dataFlds.swflux; |
62 |
|
|
writeFlds=struct('ustress',dataFlds.ustress,'vstress',dataFlds.vstress,'qnet',qnet,'empmr',empmr,'turbflux',turbflux,'swflux',swflux); |
63 |
|
|
|
64 |
|
|
averagesFields(doInitFiles,doWriteMean,rep_out,suff_out,writeFlds); |
65 |
|
|
doInitFiles=0; |
66 |
|
|
|
67 |
|
|
%part 4: plot results |
68 |
|
|
if choice_plot==1; fig0=6+(choiceDataSet-1)*1; |
69 |
|
|
%sign conventions are not the same in exf and largyeager ... I use largeyeager |
70 |
|
|
%convention for plot, positive=into the ocean |
71 |
|
|
figure(fig0+1); |
72 |
|
|
subplot(2,2,1); pcolor(lon2D_t,lat2D_t,dataFlds.ustress); shading flat; caxis([-1 1]*0.2); colorbar; |
73 |
|
|
subplot(2,2,2); pcolor(lon2D_t,lat2D_t,dataFlds.vstress); shading flat; caxis([-1 1]*0.1); colorbar; |
74 |
|
|
subplot(2,2,3); pcolor(lon2D_t,lat2D_t,-qnet); shading flat; caxis([-1 1]*200); colorbar; |
75 |
|
|
subplot(2,2,4); pcolor(lon2D_t,lat2D_t,-empmr); shading flat; caxis([-1 1]*1e-4); colorbar; |
76 |
|
|
return; |
77 |
|
|
end%if choice_plot==1 |
78 |
|
|
|
79 |
|
|
end%for ttcur=1:4 |
80 |
|
|
doWriteMean=1; |
81 |
|
|
averagesFields(doInitFiles,doWriteMean,rep_out,suff_out,writeFlds); |
82 |
|
|
doWriteMean=0; |
83 |
|
|
end%for tcur=1:365 |
84 |
|
|
|
85 |
|
|
doInitFiles=-1; doWriteMean=0; |
86 |
|
|
averagesFields(doInitFiles,doWriteMean,rep_out,suff_out,writeFlds); |
87 |
|
|
|
88 |
|
|
end%for ycur=ycur0:ycurMax |
89 |
|
|
end%for choiceDataSet=1:2; |
90 |
|
|
|
91 |
|
|
|