function [var_diff] = func_calc_diff(var)
% ========== Summary of this function goes here ==========
% ----  Origional data description var ----
%   1: no routing 
%   2: surface routing 
%   3: subsurface routing 
%   4: both routing 
%   5: both routing @ 100m  + channel + lake
%   6: both routing @ 250m  + channel + lake
%   7: both routing @ 500m  + channel + lake
%   8: both routing @ 1000m + channel + lake


% ----  Difference data description var ----
%   1: both routing    - no routing -> total routing impact 
%   2: surface routing - no routing -> merely surface routing impact 
%   3: subsurface routing - no routing -> merely subsurface routing impact 
%   4: both routing - subsurface routing -> surface routing impact 
%   5: both routing - surface routing    -> subsurface routing impact
%   6: routing_100m - routing_250m
%   7: routing_100m - routing_500m
%   8: routing_100m - routing_1000m
%   9:  routing_100m - routing_250m
%   10: routing_250m - routing_500m
%   11: routing_500m - routing_1000m


var_diff(:,:,1,:) = var(:,:,4,:) -  var(:,:,1,:);
var_diff(:,:,2,:) = var(:,:,2,:) -  var(:,:,1,:);
var_diff(:,:,3,:) = var(:,:,3,:) -  var(:,:,1,:);
var_diff(:,:,4,:) = var(:,:,4,:) -  var(:,:,3,:);
var_diff(:,:,5,:) = var(:,:,4,:) -  var(:,:,2,:);
var_diff(:,:,6,:) = var(:,:,5,:) -  var(:,:,6,:);
var_diff(:,:,7,:) = var(:,:,5,:) -  var(:,:,7,:);
var_diff(:,:,8,:) = var(:,:,5,:) -  var(:,:,8,:);

var_diff(:,:,9,:)  = var(:,:,5,:) -  var(:,:,6,:);
var_diff(:,:,10,:) = var(:,:,6,:) -  var(:,:,7,:);
var_diff(:,:,11,:) = var(:,:,7,:) -  var(:,:,8,:);

% ---- Calculate the surface/subsurface interactive effect
var_diff(:,:,12,:)  = var_diff(:,:,4,:)  -  var_diff(:,:,2,:);
var_diff(:,:,13,:)  = var_diff(:,:,5,:)  -  var_diff(:,:,3,:);
var_diff(:,:,14,:)  = var_diff(:,:,13,:) -  var_diff(:,:,12,:);



var_diff(:,:,:,5) = squeeze(mean(var_diff , 4)); % obtain the annual value

end

