1 |
cnh |
1.1 |
% m-file: mit_loadglobaldata.m |
2 |
|
|
% read all the data files for the 4x4 global run and take time averages |
3 |
|
|
% of it |
4 |
|
|
precision = mit_getparm('data','readBinaryPrec'); |
5 |
|
|
if isempty(precision); precision = 32.; end |
6 |
|
|
if precision == 32 |
7 |
|
|
acc = 'real*4'; |
8 |
|
|
elseif precision == 64; |
9 |
|
|
acc = 'real*8'; |
10 |
|
|
else |
11 |
|
|
error('readBinaryPrec contains unknown precision') |
12 |
|
|
end |
13 |
|
|
|
14 |
|
|
nx = grd.nx; |
15 |
|
|
ny = grd.ny; |
16 |
|
|
nz = grd.nz; |
17 |
|
|
|
18 |
|
|
% load restoring fields and compute annual mean |
19 |
|
|
thetaClimFile = mit_getparm('data','thetaClimFile'); |
20 |
|
|
if isempty(thetaClimFile) | thetaClimFile == ' '; |
21 |
|
|
tdmean = repmat(NaN,size(grd.hfacc(:,:,1))); |
22 |
|
|
else |
23 |
|
|
tdmean = squeeze(mean(mit_readfield(thetaClimFile,[nx ny 12],acc),3)); |
24 |
|
|
end |
25 |
|
|
saltClimFile = mit_getparm('data','saltClimFile'); |
26 |
|
|
if isempty(saltClimFile) | saltClimFile == ' '; |
27 |
|
|
sdmean = repmat(NaN,size(grd.hfacc(:,:,1))); |
28 |
|
|
else |
29 |
|
|
sdmean = squeeze(mean(mit_readfield(saltClimFile,[nx ny 12],acc),3)); |
30 |
|
|
end |
31 |
|
|
EmPmRFile = mit_getparm('data','EmPmRFile'); |
32 |
|
|
if isempty(EmPmRFile) | EmPmRFile == ' '; |
33 |
|
|
empr = repmat(NaN,nx,ny); |
34 |
|
|
else |
35 |
|
|
empr = squeeze(mean(mit_readfield(EmPmRFile,[nx ny 12],acc),3)); |
36 |
|
|
end |
37 |
|
|
empr = change(empr,'==',0,NaN); |
38 |
|
|
surfQFile = mit_getparm('data','surfQFile'); |
39 |
|
|
if isempty(surfQFile) | surfQFile == ' '; |
40 |
|
|
qnet = repmat(NaN,nx,ny); |
41 |
|
|
else |
42 |
|
|
qnet = squeeze(mean(mit_readfield(surfQFile,[nx ny 12],acc),3)); |
43 |
|
|
end |
44 |
|
|
qnet = change(qnet,'==',0,NaN); |
45 |
|
|
thetaFile = mit_getparm('data','hydrogThetaFile'); |
46 |
|
|
if isempty(thetaFile) | thetaFile == ' '; |
47 |
|
|
tdatamean = repmat(NaN,size(grd.hfacc)); |
48 |
|
|
else |
49 |
|
|
tdatamean = squeeze(mean(mit_readfield(thetaFile,[nx ny nz 12],acc),4)); |
50 |
|
|
end |
51 |
|
|
msgbin = dir('sal.bin'); |
52 |
|
|
saltFile = mit_getparm('data','hydrogSaltFile'); |
53 |
|
|
if isempty(saltFile) | saltFile == ' '; |
54 |
|
|
sdatamean = repmat(NaN,size(grd.hfacc)); |
55 |
|
|
else |
56 |
|
|
sdatamean = squeeze(mean(mit_readfield(saltFile,[nx ny nz 12],acc),4)); |
57 |
|
|
end |
58 |
|
|
|
59 |
|
|
if ~strcmp(grd.buoyancy,'OCEANIC'); |
60 |
|
|
sdatamean = sdatamean(:,:,end:-1:1); |
61 |
|
|
tdatamean = tdatamean(:,:,end:-1:1); |
62 |
|
|
end |