function [uc,vc]=centering_uv_aste(u_aste,v_aste,nfx,nfy)
%---
%function [uc,vc]=centering_uv_aste(u_aste,v_aste,nfx,nfy)
%
%function to center the ASTE velocity (to bee at thee same locations as the C-grid TRACER points)
%input:
%  [u,v]_aste: the compact size of original ASTE velocities at their respective C-grid VECTOR locations
%              size [270 1350 nz nt]
%  nfx: [270 0 270 180 450] , the x-dimension of the 5 faces of ASTE
%  nfy: [450 0 270 270 270] , the y-dimension of the 5 faces of ASTE
%output:
%  a structure field, with 5 faces
%  uc{1} 270 x 450 x nz x nt
%    {2}   0 x   0 x nz x nt
%    {3} 270 x 270 x nz x nt
%    {4} 180 x 270 x nz x nt
%    {5} 450 x 270 x nz x nt
%  vc: same size as uc
%
% need to call padding
%
% atn 02.Nov.2020
%----


%get dimensions:
sz=size(u_aste);
if(length(sz)==2);sz=[sz 1 1];elseif(length(sz==3));sz=[sz 1];end;

nt=sz(4);
nz=sz(3);
nx=sz(1);

%first, split the compact format fields into 5 faces with added padding 
up=[];vp=[];
[up,vp]=aste_uv_addpadding(u_aste,v_aste,nfx,nfy);

%now centering:                                                                                     
uc=[];vc=[];
for iface=1:5;                                                                                    
  if((nfx(iface)+nfy(iface))==0);
    uc{iface}=[];vc{iface}=[];
  else;
    uc{iface}=(up{iface}(1:nfx(iface),1:nfy(iface),1:nz,1:nt)+up{iface}(2:nfx(iface)+1,1:nfy(iface),1:nz,1:nt))./2;    
    vc{iface}=(vp{iface}(1:nfx(iface),1:nfy(iface),1:nz,1:nt)+vp{iface}(1:nfx(iface),2:nfy(iface)+1,1:nz,1:nt))./2;    
  end;
end;
