Home > ctdcal > old > load_bl.m

load_bl

PURPOSE ^

load_btl: Read and save the SeaBird ASCII .BL file format

SYNOPSIS ^

function varargout = load_bl(cruiseid)

DESCRIPTION ^

 load_btl: Read  and save the SeaBird ASCII .BL file format

 CTD Calibration toolbox.

 INPUT: cruiseid: Cruise identification name. 

 USAGE: 
 load_bl(cruiseid): read the SeaBird ASCII .BL files and save in
                     the database file of the cruise.This file will
                     be named "cruiseid"_db.mat 
                     
 bl=load_bl(cruiseid) : Additionally, it will save the  .BL files 
                          in the workspace
 AUTHORS:Carlos Fonseca 
         UM/CIMAS
         Derrick Snowden
         NOAA/AOML/PhOD
         Tue May 11 11:23:37 EDT 2004
 CHANGELOG: 
   23-Jul-2004, Version 1.0
        * Initial version.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout  = load_bl(cruiseid)
0002 % load_btl: Read  and save the SeaBird ASCII .BL file format
0003 %
0004 % CTD Calibration toolbox.
0005 %
0006 % INPUT: cruiseid: Cruise identification name.
0007 %
0008 % USAGE:
0009 % load_bl(cruiseid): read the SeaBird ASCII .BL files and save in
0010 %                     the database file of the cruise.This file will
0011 %                     be named "cruiseid"_db.mat
0012 %
0013 % bl=load_bl(cruiseid) : Additionally, it will save the  .BL files
0014 %                          in the workspace
0015 % AUTHORS:Carlos Fonseca
0016 %         UM/CIMAS
0017 %         Derrick Snowden
0018 %         NOAA/AOML/PhOD
0019 %         Tue May 11 11:23:37 EDT 2004
0020 % CHANGELOG:
0021 %   23-Jul-2004, Version 1.0
0022 %        * Initial version.
0023 %
0024 
0025 % TODO: Make this remember the root project directory somehow.
0026 cruise_dir=cruiseid;
0027 bl_dir=fullfile(cruise_dir,filesep,'raw_data');
0028 if exist(bl_dir)==0
0029     disp('Folder structure nonexistent')
0030     disp('Run create_cruise_dir')
0031     return
0032 end    
0033 sd=['cd ',bl_dir];
0034 eval(sd)
0035 lc_bl = dir('*.bl'); 
0036 uc_bl = dir('*.BL');
0037 
0038 if size(lc_bl)==size(uc_bl)
0039     bl_names = uc_bl;
0040 else
0041    if ~isempty(lc_bl) & ~isempty(uc_bl)
0042     error(['The *.bl files in ', bl_dir,' are named in both upper and lower case.  Pick one and rename before running ',mfilename]);
0043    elseif isempty(lc_bl) & ~isempty(uc_bl)
0044     bl_names = uc_bl;
0045    elseif ~isempty(lc_bl) & isempty(uc_bl)
0046     bl_names = lc_bl;
0047    else
0048     error(['No *.bl files were found in ', bottle_dir]);
0049    end
0050 end
0051 for i=1:length(bl_names)
0052     bl(i)=bl2mat(bl_names(i).name);
0053 end
0054 cd ..
0055 fname=[cruise_dir,'_db.mat'];
0056 if exist(fname)==2
0057     savefile=['save ',fname,' bl -append'];
0058     eval(savefile);
0059 else
0060    savefile=['save ',fname,' bl -mat'];
0061    eval(savefile);
0062 end
0063 if nargout==0
0064     return
0065 else
0066     varargout{1}=bl;
0067     return
0068 end

Generated on Fri 08-Oct-2004 11:57:17 by m2html © 2003