function    yout=datatransform(trans_flag,trans_type,yin)
%%% Data Transformation/Inverse Data Transformation
%%			trans_flag = 1  Forward Transform
%%                  = 2  Inverse Transform
%%       trans_type = index of listed transform
%%              yin = original data
%%             yout = transformed data

%%  Kriging Software Package  version 1.0 beta,   October 29, 1998
%%  Copyright (c) 1998, property of Dezhang Chu and Woods Hole Oceanographic
%%  Institution.  All Rights Reserved.


if trans_flag == 1  % Data Transformation with specified type
   switch trans_type
     case 1
        yout=yin;
     case 2
        yout=log10(yin+1);
     case 3
        yout=log10(yin);
     case 4
        yout=log(yin+1);
     case 5
        yout=log(yin);
     case 6
        yout=10*log10(yin);
    end
  else					%% Inverse Data Transformation
    switch trans_type
     case 1
        yout=yin;
     case 2
        yout=10.^yin-1;
     case 3
        yout=10.^yin;
     case 4
        yout=exp(yin)-1;
     case 5
        yout=exp(yin);
     case 6
        yout=10.^(0.1*yin);
    end
  end