Home > utilities > interpolate_near_coast.m

interpolate_near_coast

PURPOSE ^

we should be using the law of the wall here s

SYNOPSIS ^

function [data]=interpolate_near_coast(distbc,tempzet,doExtrap)

DESCRIPTION ^

 we should be using the law of the wall here s
 to interpolate the velocitie

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [data]=interpolate_near_coast(distbc,tempzet,doExtrap)
0002 % we should be using the law of the wall here s
0003 % to interpolate the velocitie
0004         [~,imaxd]=max(distbc);
0005         tempzet1=tempzet(1:imaxd);
0006         distbc1=distbc(1:imaxd);
0007         % find nans and non nans
0008         ibadz=find(isnan(tempzet1));
0009         igoodz=find(~isnan(tempzet1));
0010         if doExtrap
0011         % Uses csaps as a smoothing spline interpolant
0012         pp=csaps(distbc1(igoodz),tempzet1(igoodz));
0013         % fnxtr allows usage of interpolan spline for extrapolation
0014         pp = fnxtr(pp);
0015         tempzet1(ibadz)=fnval(pp,distbc1(ibadz));
0016         else
0017             % use good point closest to coast
0018             [~,use_idx]=min(distbc1(igoodz));
0019            tempzet1(ibadz)= tempzet1(igoodz(use_idx));
0020         end
0021         % evaluate spline on nan points near the coast.
0022         % Repeat for the second stretch of boundary
0023         tempzet2=tempzet(imaxd+1:end);
0024         distbc2=distbc(imaxd+1:end);
0025         ibadz=find(isnan(tempzet2));
0026         igoodz=find(~isnan(tempzet2));
0027                 if doExtrap
0028 
0029         pp=csaps(distbc2(igoodz),tempzet2(igoodz));
0030         pp = fnxtr(pp);
0031         tempzet2(ibadz)=fnval(pp,distbc2(ibadz));
0032         else
0033             % use good point closest to coast
0034             [~,use_idx]=min(distbc2(igoodz));
0035            tempzet2(ibadz)= tempzet2(igoodz(use_idx));
0036         end
0037         data=[tempzet1(:);tempzet2(:)];
0038 return

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005