function [apresd,mask,depth,latitude,yfrac]=load_MOC(name)
%name = STRESS, HEAT, WATER`
%function plot_OHC(num)
addpath /WSmounts/phodnet/share/mgoes/matlab2/Time_transform/       
addpath /data/mgoes/matlab/timeplt
addpath /data/mgoes/matlab/Seawater
addpath /data/mgoes/matlab/drtoolbox/

disp('Load Data')
%    suffix = 'MOCSTRESS_NA';
%    suffix = 'MOCHEAT_NA';
%    suffix = 'MOCWATER_NA';
   suffix = strcat('MOC',name,'_NA')
   A_apress = [];
for ii=1:3
   filename = sprintf('%s%s%i.nc',suffix,'_part',ii);%    _part1.nc
   moc      = ncread(filename,'MOC');
   A_apress = cat(3,A_apress,moc);
end
latitude  = double(ncread(filename,'YU_OCEAN122_245'));
depth     = double(ncread(filename,'ST_OCEAN'));
z_bnds    = double(ncread(filename,'ST_OCEAN_bnds'));
time      = double(ncread(filename,'TIME'));
time = 1:size(A_apress,1);
yfrac = 1:length(time);

disp('NORTH ATLANTIC')
ilat = find(latitude>-5);
A_apress = A_apress(ilat,:,:);
latitude = latitude(ilat);
[ny,nz,nt] = size(A_apress);

%ANOMALIES
apressa = A_apress;
if 0
disp('Calc Anomalies')
apresm = A_apress*nan;
for jj=1:12
    ii = jj:12:nt;
    aux = mean(A_apress(:,:,ii),3);
    apresm(:,:,ii) = aux(:,:,ones(1,length(ii)));
   
end 
apressa = A_apress-apresm;
clear apresm A_apress 
end %0

apressa = permute(apressa,[3 2 1]);
%PACIFIC AREA
%oo = std(apressa);
%apressa(:,oo==0)=nan;

%keyboard
disp('RESHAPE')
mask = ~isnan(squeeze(apressa(1,:,:)));
if 0
    dz=diff(z_bnds);
    dy_deg = gradient(latitude);
    dy = 4.e7*dy_deg/360;
    W = dy*dz;
    W = W'.*mask;
    W=W./max(W(:));
    W = shiftdim(W,-1);
    apressa=apressa.*W(ones(1,nt),:,:);
end
apresd = map2mat(mask,apressa);%*100;

%PREWHITEN
if 0
for ii = 1:size(apresd,2)
      aux = apresd(:,ii);
      if ~isnan(aux)
      apresd(:,ii) = prewhiten(aux);
      end
end
end

apresd(isnan(apresd))=0;

