%%program to plot OCEANUS data ftp'ed to Boulder


clear all
close all
fclose('all');

if ~exist('yyyy','var'); yyyy=input('Input year to evaluate.... ','s'); end;
% if ~exist('ddd','var'); ddd=input('Input yearday to evaluate.... '); end;
% [m,d]=yd2md(str2num(yyyy), ddd);
% Vdate=[str2num(yyyy) m d];
    
%%%%%%%%%%%  Read parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
currentMname='OCEANUS_2010';   %Gets the name of currently running M-file to pick 
Fluxroot='C:\Data\CRUISES\OCEANUS_2010\OCEANUS\Scientific_analysis\programs\';  % name of the path where the 'flux' folder + read_parameters file are installed.
% Fluxroot='D:\OCEANUS_2010\OCEANUS\Scientific_analysis\programs\'; 

cd([Fluxroot, 'flux'])         %Changes current directory to fluxroot/flux
addpath(genpath(Fluxroot))     %adds flux folder and all of its subdirectories to the top of the MATLAB search path. 

%Gets the last uploaded parameter file from Fluxroot directory
read_parameters_OCEANUS_2010;

%%%%%%%%%%%  Defines some options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
plotit=true; % for making plots. 
prtit=true;  % for printing plots--ineffective unless plotit is also true going to a temp directory
graphformat='.png';  %select graphics format files
graphdevice='-dpng'; %select graphic device
saveit=true; % for saving data files going to a temp directory
clearit=true;% for clearing data sometimes to save memory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%fpr doy 222 to 235, SCS data ascii file were saved at 0.869min
%(1252lines). Pb fixed later on, but ascii files received via ftp cannot be
%modified. Thus will extrapolate for now.
interpol=0;

for ddd=262:265 %234:235
    [m,d]=yd2md(str2num(yyyy), ddd);
    Vdate=[str2num(yyyy) m d];
    eval([ 'timatch_5_', currentMname])
    eval([ 'timatch_30_',currentMname])
    close all
end

% e(1,1)=e(1,2)-(e(1,3)-e(1,2));