clear all
close all
clc

opath = '/home/ganeshgopal/WAVE5_DATA/moved_data/OKMC_BIG/global_hycom/fleat_palau_finedomain/';

%% THIS IS FOR FLEAT CRUISE DOMAIN
%% x1 = 130;    x2 = 140;    y1 = 5;    y2 = 11;
%% DEPTH[0:1:32]
%% LON = [698:1:823];
%% LAT = [1567:1:1642];

xl = [698:1:823];
yl = [1567:1:1642];
zl = [0:1:32];

%% 2008-09-19 ??? 2009-05-06
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_90.6
%% time = [0:230];
%% saving from Jan 1, 2009
%% time = [105:1:230];nt = 126;

%% 2009-05-07 ??? 2011-01-02
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_90.8
%% time = [0:1:605];nt = 606;

%% 2011-01-03 ??? 2013-08-20
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_90.9
%% time = [0:1:960];nt = 961;

%% 2013-08-21 ??? 2014-04-04
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.0
%% time = [0:1:226];nt = 227;

%% 2014-04-05 ??? 2016-04-17
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.1
%% time = [0:1:743];nt = 744;

%% 2016-04-18 ??? Present
%% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.2
%% time = [0:1:238];nt = 238;

start_date = '20090101';
end_date = datestr(date,30);

%%  every 1 days
date_inc = 1;
br = 2665;

format = 'yyyymmdd';
time = [datenum(start_date,format):date_inc:datenum(end_date,format)];
nt = length(time);

for i = br:nt
    tl = datestr(time(i),format)
    ext_hycomglobal_dap_newmlab(opath,i,tl,zl,yl,xl);
end
