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: read_scope.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/rutgers/landmask
    
    the code of the file until where you have to start completion: function [spherical,x,y,bath,Rscope]=read_scope(Gname)

%
% READ_SCOPE:  Read ROMS Adjoint sensitivity scope mask
%
% [spherical,x,y,bath,Rscope]=read_scope(Gname)
%
% This routine reads in domain grid, bathymetry, and adjoint
% sensitivity scope mask from GRID NetCDF file.
%
% On Input:
%
%    Gname       GRID NetCDF file name (character string).
%
% On Output:
%
%    spherical   Grid type switch (logical):
%                  spherical=1, spherical grid set-up.
%                  spherical=0, Cartesian grid set-up.
%    x           X-location of RHO-points (real matrix).
%    y           Y-location of RHO-points (real matrix).
%    bath        Raw bathymetry at RHO-points (real matrix; meters).
%    Rscope      Adjoint sensitivity scope mask on RHO-points (real
%                  matrix): Rscope=0 inactive, Rscope=1 active.
%

% svn $Id: read_scope.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      %
%=========================================================================%

%-------------------------------------------------------------------------
% Inquire about spatial dimensions.
%-------------------------------------------------------------------------

Dname.xr='xi_rho';

    
function [spherical,x,y,bath,Rscope]=read_scope(Gname)

%
% READ_SCOPE:  Read ROMS Adjoint sensitivity scope mask
%
% [spherical,x,y,bath,Rscope]=read_scope(Gname)
%
% This routine reads in domain grid, bathymetry, and adjoint
% sensitivity scope mask from GRID NetCDF file.
%
% On Input:
%
%    Gname       GRID NetCDF file name (character string).
%
% On Output:
%
%    spherical   Grid type switch (logical):
%                  spherical=1, spherical grid set-up.
%                  spherical=0, Cartesian grid set-up.
%    x           X-location of RHO-points (real matrix).
%    y           Y-location of RHO-points (real matrix).
%    bath        Raw bathymetry at RHO-points (real matrix; meters).
%    Rscope      Adjoint sensitivity scope mask on RHO-points (real
%                  matrix): Rscope=0 inactive, Rscope=1 active.
%

% svn $Id: read_scope.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      %
%=========================================================================%

%-------------------------------------------------------------------------
% Inquire about spatial dimensions.
%-------------------------------------------------------------------------

Dname.xr='xi_rho';
Dname.yr='eta_rho';

D=nc_dinfo(Gname);
ndims=length(D);
for n=1:ndims,
  name=char(D(n).Name);
  switch name
    case {Dname.xr}
      Im=D(n).Length;
    case {Dname.yr}
      Jm=D(n).Length;
  end