[MITgcm-support] hfac function

Robert Nazarian rn2 at Princeton.EDU
Wed Jul 30 14:39:49 EDT 2014


Hi,

I'm trying to use the function hfac and am getting an error in Matlab. Specifically, I'm using hfac based on the online documentation  found at http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/mitgcm_tools/hfac.m?annotate=1.1.1.1&hideattic=1&sortby=file&sortdir=down. I'm using the following code in MATLAB:

fid=fopen('topog.canyon','r','b');
myD=fread(fid,'real*8');
fclose(fid);
myD=reshape(myD,nx,ny);

hfacmin=0.2;
hfacmindz=4;
[hfacC,ddz]=hfac(delZ',myD,hfacmin,hfacmindz);
ddzu=min(ddz,ddz([end 1:end-1],:,:));
mT=1+0*hfacC;
mT(find(hfacC==0))=0;
mU=mT.*mT([end 1:end-1],:,:);

% Vertical coordinate
zw=[0 -cumsum(squeeze(delZ)')]; % coordinate of W points
zc=(zw(1:end-1)+zw(2:end))/2;   % coordinate of T points
zw=zw(1:end-1);                 % truncate to N points for plotting

where size(delZ) is nz x 1, and size(myD) is nx x ny. I'm getting the error message:
"??? Undefined function or method 'hfac' for input arguments of type 'double'"
for the bolded line of code, where hfacC and ddz are being defined.

If anyone can suggest where I'm going wrong, I'd greatly appreciate it. Thanks so much!
Rob

Robert Nazarian
PhD Candidate
Program in Atmospheric and Oceanic Sciences
Princeton University
rn2 at princeton.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20140730/537b0ccf/attachment.htm>


More information about the MITgcm-support mailing list