Gname='ias40_grid.nc';

rlon=nc_read(Gname,'lon_rho');
rlat=nc_read(Gname,'lat_rho');

[Im,Jm]=size(rlon);

Xbox=[squeeze(rlon(:,1)); ...
      squeeze(rlon(Im,2:Jm))'; ...
      squeeze(flipud(rlon(1:Im-1,Jm))); ...
      squeeze(fliplr(rlon(1,1:Jm-1)))'];

Ybox=[squeeze(rlat(:,1)); ...
      squeeze(rlat(Im,2:Jm))'; ...
      squeeze(flipud(rlat(1:Im-1,Jm))); ...
      squeeze(fliplr(rlat(1,1:Jm-1)))'];

Zbox=complex(Xbox,Ybox);


