%% Initialization for calling fit variogram window

%%  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 status >= 1			% data have been loaded
  h1=fitvariogramfig;
  %% remove the previous displayed data
  haxes=findobj(gcf,'Tag','variogramAxes1');
  hdata=get(haxes,'children');
  hline=findobj(hdata,'Type','line');
  if ~isempty(hline)
     set(hline,'XDATA',[],'YDATA',[]);
  end
  load default_coord
  range_max=sqrt((max(x)-min(x))^2+(max(y)-min(y))^2);
  max_lscl=range_max;
  max_osci=4*pi/range_max;
  range=0.5*range_max;
  res=range/30;
  hvrg=findobj(gcf,'Tag','range');
  hvres=findobj(gcf,'Tag','delx');
  set(hvrg,'String',num2str(range));
  set(hvres,'String',num2str(res));
  hvlscl=findobj(gcf,'Tag','txtlscl');
  set(hvlscl,'String','0.5');
  lag=[];gammah=[];nugt=[];sill=[];L=[];p=[];b=[];
  checksliderposition
  hvLSQ=findobj(gcf,'Tag','lsqfit');
  if OptimOption == 0
     set(hvLSQ,'enable','off')
  end
    %% File ID
  hvhdl=findobj(gcf,'Tag','VarioFileID');
  set(hvhdl,'string',FileIDstr);
  status=2;
else
  disp('Data have not been loaded!!')
end
