Global Index (short | long) | Local contents | Local Index (short | long)
[heat, lat, lon, depth, middepth] = getheat(lev, tim, ctlim);
[heat, lat, lon, depth, middepth] = getheat(lev, tim, ctlim); lev = level indices over which to get the heat content tim = time period ctlim = lat-lon frame
This function calls | |
---|---|
function [heat, lat, lon, depth, middepth] = getheat(lev, tim, ctlim); cdback = eval('cd'); cd /home/disk/hayes2/dvimont/csiro/data filin = ['temp_L1-10.nc']; nc = netcdf(filin, 'nowrite'); depth = nc{'depth'}(:); lat = nc{'latitude'}(:); lon = nc{'longitude'}(:); if nargin == 1; ctlim = [110 300 -75 65]; end [xk, yk] = keep_var3(ctlim, lon, lat); temp = nc{'temp'}(tim,lev,yk,xk); mv = nc{'temp'}.missing_value(:); nc = close(nc); [ntim, nlev, nlat, nlon] = size(temp); temp(find(temp == mv)) = NaN * ones(size(find(temp == mv))); lat = lat(yk); lon = lon(xk); d1 = depth(1); middepth = []; for i = 1:nlev; middepth = [middepth; depth(i)+d1]; d1 = depth(i+1) - depth(i) - d1; end wgt = diff([0; middepth]/100); temp = shiftdim(temp, 1); temp = reshape(temp, nlev, nlat*nlon*ntim); heat = wgt' * temp; heat = shiftdim(reshape(heat, nlat, nlon, ntim), 2); % Convert heat to units J / m^2 heat = heat * 1000 * 4.218e3; eval(['cd ' cdback]);