85 |
|
|
86 |
if choiceStruct==3; |
if choiceStruct==3; |
87 |
|
|
88 |
budgName='budgHo'; |
%budgName='budgHo'; |
89 |
fldName='trU'; |
|
90 |
|
if budgName(end)=='o'; listFlds={'tend','trU','trV','trWtop'}; |
91 |
|
else; listFlds={'tend','trU','trV','trWtop','trWbot'}; |
92 |
|
end; |
93 |
|
|
94 |
|
for ii=1:length(listFlds); |
95 |
|
fldName=listFlds{ii}; |
96 |
|
%fldName='trWtop'; |
97 |
[budgName ' -- ' fldName] |
[budgName ' -- ' fldName] |
98 |
|
|
99 |
%directories |
%directories |
104 |
dirOut=fullfile(dirOut,budgName,filesep); |
dirOut=fullfile(dirOut,budgName,filesep); |
105 |
if ~isdir(dirOut); mkdir(dirOut); end; |
if ~isdir(dirOut); mkdir(dirOut); end; |
106 |
|
|
|
%time vectors |
|
|
[listTimes]=diags_list_times({[dirIn 'diags/BUDG/']},{'budg2d_hflux_set1'}); |
|
|
structIn.vars.t0=3600*listTimes(1:end-2); |
|
|
structIn.vars.t1=3600*listTimes(2:end-1); |
|
|
|
|
107 |
%load variable |
%load variable |
108 |
eval(['load ' dirIn dirMat 'diags_grid_parms.mat myparms;']); |
eval(['load ' dirIn dirMat 'diags_grid_parms.mat myparms;']); |
109 |
dirMat=[dirIn dirMat 'diags_set_' budgName '/']; |
dirMat=[dirIn dirMat 'diags_set_' budgName '/']; |
110 |
fileMat=[budgName '_*.mat']; |
fileMat=[budgName '_*.mat']; |
111 |
tic; structIn.vars=diags_read_from_mat(dirMat,fileMat,fldName); toc; |
tic; structIn.vars=diags_read_from_mat(dirMat,fileMat,fldName); toc; |
112 |
|
|
113 |
|
%time vectors |
114 |
|
[listTimes]=diags_list_times({[dirIn 'diags/BUDG/']},{'budg2d_hflux_set1'}); |
115 |
|
structIn.vars.t0=3600*listTimes(1:end-2); |
116 |
|
structIn.vars.t1=3600*listTimes(2:end-1); |
117 |
|
|
118 |
%rename trWtop as trW if adequate |
%rename trWtop as trW if adequate |
119 |
if strcmp(fldName,'trWtop'); |
if strcmp(fldName,'trWtop')&(budgName(end)=='o'); |
120 |
structIn.vars=setfield(structIn.vars,'trW',structIn.vars.trWtop); |
structIn.vars=setfield(structIn.vars,'trW',structIn.vars.trWtop); |
121 |
structIn.vars=rmfield(structIn.vars,'trWtop'); |
structIn.vars=rmfield(structIn.vars,'trWtop'); |
122 |
structIn.vars.listDiags={'trW'}; |
structIn.vars.listDiags={'trW'}; |
123 |
fldName='trW'; |
fldName='trW'; |
124 |
end; |
end; |
125 |
|
|
126 |
|
%switch back to upward convention |
127 |
|
if strcmp(fldName(1:3),'trW'); |
128 |
|
tmp1=getfield(structIn.vars,fldName); |
129 |
|
structIn.vars=setfield(structIn.vars,fldName,-tmp1); |
130 |
|
end; |
131 |
|
|
132 |
%general description |
%general description |
133 |
tmp1=diags_read_from_mat(dirMat,fileMat,'specs',1); |
tmp1=diags_read_from_mat(dirMat,fileMat,'specs',1); |
134 |
specs=tmp1.specs; |
specs=tmp1.specs; |
149 |
case 'tend'; vars(nv).longName='tendency term'; |
case 'tend'; vars(nv).longName='tendency term'; |
150 |
case 'trU'; vars(nv).longName='horizontal transport (U)'; |
case 'trU'; vars(nv).longName='horizontal transport (U)'; |
151 |
case 'trV'; vars(nv).longName='horizontal transport (V)'; |
case 'trV'; vars(nv).longName='horizontal transport (V)'; |
152 |
case 'trW'; vars(nv).longName='vertical transport (W)'; |
case 'trW'; vars(nv).longName='upward vertical transport (W)'; |
153 |
|
case 'trWtop'; vars(nv).longName='upward vertical transport (W)'; |
154 |
|
case 'trWbot'; vars(nv).longName='upward vertical transport (W)'; |
155 |
end; |
end; |
156 |
nv=length(vars)+1; |
nv=length(vars)+1; |
157 |
vars(nv).fldName='t0'; vars(nv).longName='initial time'; vars(nv).units='s'; nv=length(vars)+1; |
vars(nv).fldName='t0'; vars(nv).longName='initial time'; vars(nv).units='s'; nv=length(vars)+1; |
163 |
tic; struct2nctiles(dirIn,fldName,structIn,[90 90]); toc; |
tic; struct2nctiles(dirIn,fldName,structIn,[90 90]); toc; |
164 |
eval(['!mv ' pwd filesep dirIn filesep 'tmp_nctiles' filesep fldName ' ' pwd filesep dirOut]); |
eval(['!mv ' pwd filesep dirIn filesep 'tmp_nctiles' filesep fldName ' ' pwd filesep dirOut]); |
165 |
|
|
166 |
|
end;%for fldName=listFlds; |
167 |
|
|
168 |
end; |
end; |
169 |
|
|