Skip to content

Instantly share code, notes, and snippets.

@mathsam
Created July 7, 2013 15:04
Show Gist options
  • Save mathsam/5943739 to your computer and use it in GitHub Desktop.
Save mathsam/5943739 to your computer and use it in GitHub Desktop.
driver script for isentropic flux analysis
% driver script for callsenFlux
temp = ncread('Symmetric_HS=60K.nc','temp');
vcomp = ncread('Symmetric_HS=60K.nc','vcomp');
pfull = ncread('Symmetric_HS=60K.nc','pfull');
tStart = 1000;
tEnd = 1100;
isenCoord = 240:5:360;
deltaP = 10;
tmp = zeros(1,1,length(pfull));
tmp(1,1,:) = pfull(:);
ratio2PT = repmat( (1000./tmp).^(2/7),[size(vcomp,1),size(vcomp,2),1]);
flux2d = zeros(size(vcomp,2),length(isenCoord));
%%
for t = tStart:1:tEnd
vcomp3d = reshape(vcomp(:,:,:,t),...
size(vcomp,1),size(vcomp,2),size(vcomp,3));
PT3d = reshape(temp(:,:,:,t),...
size(vcomp,1),size(vcomp,2),size(vcomp,3)).*ratio2PT;
flux2d = flux2d + calIsenFlux(vcomp3d,PT3d,pfull,isenCoord,deltaP);
end
flux2d = flux2d/(tEnd-tStart+1);
%flux2d = zonalMean2d(flux2d);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment