Documentation of getheat


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

[heat, lat, lon, depth, middepth] = getheat(lims, lev, tim, varn);

Help text


 [heat, lat, lon, depth, middepth] = getheat(lims, lev, tim, varn);

 lev = level indices over which to get the heat content 
 tim = time period
 lims = lat-lon frame
 varn = variable to be averaged


Cross-Reference Information

This function calls This function is called by

Listing of function getheat

function [heat, lat, lon, depth, middepth] = getheat(lims, lev, tim, varn);

cdback = eval('cd');
cd /home/disk/hayes2/dvimont/csiro/data

if nargin < 4;  varn = 'temp';  end;
varn
temp = getnc(varn, lims, lev, tim);
[lat, lon, depth] = getll(varn, lims);

[ntim, nlev, nlat, nlon] = size(temp);

d1 = depth(1);
middepth = [0];
for i = 1:(length(depth)-1);
  middepth = [middepth; depth(i)+d1];
  d1 = depth(i+1) - depth(i) - d1;
end
middepth = [middepth; depth(length(depth))+d1];
wgt = diff(middepth);

temp = shiftdim(temp, 1);
temp = reshape(temp, nlev, nlat*nlon*ntim);

heat = wgt(lev)' * temp;
heat = shiftdim(reshape(heat, nlat, nlon, ntim), 2);

%  If necessary, Convert heat to units J / m^2
if strcmp(varn, 'temp');
  heat = heat * 1000 * 4.218e3;
else
  heat = heat ./ sum(wgt(lev));
end

eval(['cd ' cdback]);