Back to home page

MITgcm

 
 

    


Warning, /verification/tutorial_global_oce_latlon/diags_matlab/mit_loadglobaldata.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 % m-file: mit_loadglobaldata.m
                0002 % read all the data files for the 4x4 global run and take time averages
                0003 % of it
                0004 precision = mit_getparm('data','readBinaryPrec');
                0005 if isempty(precision); precision = 32.; end
                0006 if precision == 32
                0007   acc = 'real*4';
                0008 elseif precision == 64;
                0009   acc = 'real*8';
                0010 else
                0011   error('readBinaryPrec contains unknown precision')
                0012 end
                0013 
                0014 nx = grd.nx;
                0015 ny = grd.ny;
                0016 nz = grd.nz;
                0017 
                0018 % load restoring fields and compute annual mean
                0019 thetaClimFile = mit_getparm('data','thetaClimFile');
                0020 if isempty(thetaClimFile) | thetaClimFile == ' ';
                0021   tdmean = repmat(NaN,size(grd.hfacc(:,:,1)));
                0022 else
                0023   tdmean = squeeze(mean(mit_readfield(thetaClimFile,[nx ny 12],acc),3));
                0024 end
                0025 saltClimFile = mit_getparm('data','saltClimFile');
                0026 if isempty(saltClimFile) | saltClimFile == ' ';
                0027   sdmean = repmat(NaN,size(grd.hfacc(:,:,1)));
                0028 else
                0029   sdmean = squeeze(mean(mit_readfield(saltClimFile,[nx ny 12],acc),3));
                0030 end
                0031 EmPmRFile = mit_getparm('data','EmPmRFile');
                0032 if isempty(EmPmRFile) | EmPmRFile == ' ';
                0033   empr = repmat(NaN,nx,ny);
                0034 else
                0035   empr = squeeze(mean(mit_readfield(EmPmRFile,[nx ny 12],acc),3));
                0036 end
                0037 empr = change(empr,'==',0,NaN);
                0038 surfQFile = mit_getparm('data','surfQFile');
                0039 if isempty(surfQFile) | surfQFile == ' ';
                0040   qnet = repmat(NaN,nx,ny);
                0041 else
                0042   qnet = squeeze(mean(mit_readfield(surfQFile,[nx ny 12],acc),3));
                0043 end
                0044 qnet = change(qnet,'==',0,NaN);
                0045 thetaFile = mit_getparm('data','hydrogThetaFile');
                0046 if isempty(thetaFile) | thetaFile == ' ';
                0047   tdatamean = repmat(NaN,size(grd.hfacc));
                0048 else
                0049   tdatamean = squeeze(mean(mit_readfield(thetaFile,[nx ny nz 12],acc),4));
                0050 end
                0051 msgbin = dir('sal.bin');
                0052 saltFile = mit_getparm('data','hydrogSaltFile');
                0053 if isempty(saltFile) | saltFile == ' ';
                0054   sdatamean = repmat(NaN,size(grd.hfacc));
                0055 else
                0056   sdatamean = squeeze(mean(mit_readfield(saltFile,[nx ny nz 12],acc),4));
                0057 end
                0058 
                0059 if ~strcmp(grd.buoyancy,'OCEANIC');
                0060   sdatamean = sdatamean(:,:,end:-1:1);
                0061   tdatamean = tdatamean(:,:,end:-1:1);
                0062 end