%%          The GLOBEC Kriging Software Package - EasyKrig

%% Copyright (c) 1998, property of Dezhang Chu and Woods Hole Oceanographic
%% Institution.  All Rights Reserved.

%% The kriging software described in this document was developed by Dezhang Chu
%% with funding from the National Science Foundation through the U.S. GLOBEC
%% Georges Bank Project's Program Service and Data Management Office.  It was
%% inspired by a MATLAB toolbox in MATLAB developed by Yves Gratton and
%% Caroline Lafleur (INRS-Océanologie, Rimouski, Qc, Canada) and Jeff Runge
%% (Institut Maurice-Lamontagne).  The original version of trans.m was written by D.
%% Marcotte and is used with permission.  Also, we are using, with permission, the
%% variogram model code from 'variogr2.m' written by Yves Gratton and Caroline
%% Lafleur.  This software may be reproduced for noncommercial purposes only.

%% This program is distributed in the hope that it will be useful, but WITHOUT ANY
%% WARRANTY.

%% Contact Dr. Chu at dchu@whoi.edu with enhancements or suggestions for changes.

clear all
global status max_nugt max_sill max_lscl max_powr max_osci lag DispScl PlatForm
global ndigits lag gammah

HDIR=pwd;
DirBackslash=length(find(HDIR == '\'));
DirColon=length(find(HDIR == ':'));
DirSlash=length(find(HDIR == '/'));
HDIRpath=['''' HDIR ''''];
cmd=['cd ' HDIRpath];
eval(cmd)

if DirBackslash >= 1			% PC
   DirMark='\';
   AddPathCmd=['addpath '  HDIRpath '\krig_lib ' HDIRpath '\gui_lib ' ...
               HDIRpath '\online_help ' HDIRpath '\binaryfile ' HDIRpath '\bin'];
   PlatForm=1;
   markersize=6;
elseif DirColon >= 1			% MAC
   DirMark=':';
   AddPathCmd=['addpath '  HDIRpath 'krig_lib ' HDIRpath 'gui_lib ' ...
               HDIRpath 'online_help ' HDIRpath 'binaryfile ' HDIRpath 'bin'];
   PlatForm=2;
   markersize=8;
elseif DirSlash >= 1			% UNIX
   DirMark='/';
   AddPathCmd=['addpath '  HDIRpath '/krig_lib ' HDIRpath '/gui_lib ' ...
              HDIRpath '/online_help ' HDIRpath '/binaryfile ' HDIRpath '/bin'];
   PlatForm=3;  
   markersize=8;
end
eval(AddPathCmd)

%% Optimization Toolbox
OptimOption=0;
pp=path;
pindx=find(pp == DirMark);
if pindx+5 <= length(pp)
   ppl=length(pindx);
else
   ppl=length(pindx)-1;
end
for i=1:ppl
   StrIndx=pindx(i)+1:pindx(i)+5;
   DirStr=pp(StrIndx);
   if DirStr == 'optim'
      OptimOption=1;
   end
end
close
status=0;
max_sill=1.5;
max_powr=4;
max_nugt=1;
filename='';
get(0,'screensize');
set(0,'units','normalized');
h0=navigatorfig;

axes('position',[0.65 0.5 0.2 0.2])
[imgdat,cc1]=imread('whoi_logo.tif','tif');
imgdat1=double(imgdat)+1;
himg1=image(imgdat1);
colormap(cc1)
cc1=colormap;
axis off

axes('position',[0.65 0.25 0.2 0.2])
imgdat=imread('sample.tif','tif');
himg=image(imgdat);
axis([180 1080 90 800])
cc2=colormap;
axis off

if 0
axes('position',[0.5 0.1 0.2 0.2])
[imgdat,cc2]=imread('globec1.tif','tif');
imgdat2=double(imgdat)+1;
himg2=image(imgdat2);
%cc2=colormap;
colormap(cc2)

axis off
end

lag=[];gammah=[];
ndigits=4;