You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: obc_mercator.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/rutgers/boundary
    
    the code of the file until where you have to start completion: function [Fout]=obc_mercator(Vname,S,Finp,lon,lat,mask,depth);

%
% OBC_MERCATOR:  Interpolates OBC data from Mercator to ROMS grid.
%
% [Fout]=obc_mercator(Vname,S,Finp,lon,lat,mask,depth)
%
% This function interpolates requested variable open boundary
% conditions form Mercator to ROMS grid boundary edges. All
% fields are interpolated on the RHO-points grid including
% velocity fields. This is done in the event the velocity
% vectors must be rotated into a ROMS curvilinear grid. Such
% processing is done elsewhere.
%
% On Input:
%
%    Vname       ROMS variable to process (string)
%    S           ROMS grid data (structure array):
%
%                  S.boundary(1)      Process western  boundary
%                  S.boundary(2)      Process eastern  boundary
%                  S.boundary(3)      Process southern boundary
%                  S.boundary(4)      Process northern boundary
%
%                  S.lon_rho          Longitude at RHO-points
%                  S.lat_rho          Latitude  at RHO-points
%                  S.z_r              3D depths at RHO-points
%                  S.mask_rho         land/sea mask on RHO-points, if any
%
%    Finp        Mercator data (2D or 3D array)
%    lon         Mercator data longitude (2D array)
%    lat         Mercator data latitude (2D array)
%    mask        Mercator data Land/Sea mask (2D array)
%    depth       Mercator data depth (1D array, only needed for 3D fields)
%
% On Output:
%
%    Fout        Interpolated data on ROMS grid (structure array)
%

    
function [Fout]=obc_mercator(Vname,S,Finp,lon,lat,mask,depth);

%
% OBC_MERCATOR:  Interpolates OBC data from Mercator to ROMS grid.
%
% [Fout]=obc_mercator(Vname,S,Finp,lon,lat,mask,depth)
%
% This function interpolates requested variable open boundary
% conditions form Mercator to ROMS grid boundary edges. All
% fields are interpolated on the RHO-points grid including
% velocity fields. This is done in the event the velocity
% vectors must be rotated into a ROMS curvilinear grid. Such
% processing is done elsewhere.
%
% On Input:
%
%    Vname       ROMS variable to process (string)
%    S           ROMS grid data (structure array):
%
%                  S.boundary(1)      Process western  boundary
%                  S.boundary(2)      Process eastern  boundary
%                  S.boundary(3)      Process southern boundary
%                  S.boundary(4)      Process northern boundary
%
%                  S.lon_rho          Longitude at RHO-points
%                  S.lat_rho          Latitude  at RHO-points
%                  S.z_r              3D depths at RHO-points
%                  S.mask_rho         land/sea mask on RHO-points, if any
%
%    Finp        Mercator data (2D or 3D array)
%    lon         Mercator data longitude (2D array)
%    lat         Mercator data latitude (2D array)
%    mask        Mercator data Land/Sea mask (2D array)
%    depth       Mercator data depth (1D array, only needed for 3D fields)
%
% On Output:
%
%    Fout        Interpolated data on ROMS grid (structure array)
%
%                  Fout.west          Western  boundary conditions
%                  Fout.east          Eastern  boundary conditions
%                  Fout.south         Southern boundary conditions
%                  Fout.north         Northern boundary conditions
%

% svn $Id: obc_mercator.m 938 2019-01-28 06:35:10Z arango $
%===========================================================================%
%  Copyright (c) 2002-2019 The ROMS/TOMS Group                              %
%    Licensed under a MIT/X style license                                   %
%    See License_ROMS.txt                           Hernan G. Arango        %
%===========================================================================%

% Set cheap nearest neighbor search.
  
CHEAP=0;

% Determine if processing a 2D or 3D field.

switch Vname
  case ('zeta')
    is2d=1;
  otherwise
    is2d=0;
end