<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki-pnb.eri.ucsb.edu/index.php?action=history&amp;feed=atom&amp;title=Conv2lcd_HS6.m</id>
	<title>Conv2lcd HS6.m - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki-pnb.eri.ucsb.edu/index.php?action=history&amp;feed=atom&amp;title=Conv2lcd_HS6.m"/>
	<link rel="alternate" type="text/html" href="https://wiki-pnb.eri.ucsb.edu/index.php?title=Conv2lcd_HS6.m&amp;action=history"/>
	<updated>2026-05-22T12:27:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://wiki-pnb.eri.ucsb.edu/index.php?title=Conv2lcd_HS6.m&amp;diff=178&amp;oldid=prev</id>
		<title>128.111.101.185 at 23:31, 2 August 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki-pnb.eri.ucsb.edu/index.php?title=Conv2lcd_HS6.m&amp;diff=178&amp;oldid=prev"/>
		<updated>2010-08-02T23:31:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 23:31, 2 August 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l187&quot; &gt;Line 187:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 187:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 end&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;big&amp;gt;[[conv2lcd_HS6]]&amp;lt;big&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>128.111.101.185</name></author>
		
	</entry>
	<entry>
		<id>https://wiki-pnb.eri.ucsb.edu/index.php?title=Conv2lcd_HS6.m&amp;diff=177&amp;oldid=prev</id>
		<title>128.111.101.185: Created page with '&lt;pre&gt; function conv2lcd_HS6(pb) %conv2lcd_HS6 %This is the first part of the Hydroscat processing once it passes through %Hydrosoft. %This function reads in the .dat file and spl…'</title>
		<link rel="alternate" type="text/html" href="https://wiki-pnb.eri.ucsb.edu/index.php?title=Conv2lcd_HS6.m&amp;diff=177&amp;oldid=prev"/>
		<updated>2010-08-02T23:30:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;pre&amp;gt; function conv2lcd_HS6(pb) %conv2lcd_HS6 %This is the first part of the Hydroscat processing once it passes through %Hydrosoft. %This function reads in the .dat file and spl…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
function conv2lcd_HS6(pb)&lt;br /&gt;
%conv2lcd_HS6&lt;br /&gt;
%This is the first part of the Hydroscat processing once it passes through&lt;br /&gt;
%Hydrosoft.&lt;br /&gt;
%This function reads in the .dat file and splits off the data into a&lt;br /&gt;
%sepparate file where is takes the cammas out.&lt;br /&gt;
%Section titles are inserted into the header section(&amp;lt;cruise_info&amp;gt;....) as&lt;br /&gt;
%well as instrument serial number at the top of the file&lt;br /&gt;
%the column titles are converted to rows and the &amp;quot;channels&amp;quot; section is&lt;br /&gt;
%removed.&lt;br /&gt;
%start it from directory that sees dat directory&lt;br /&gt;
&lt;br /&gt;
%this is run in the dat directory&lt;br /&gt;
direct = pwd;&lt;br /&gt;
cd('dat');&lt;br /&gt;
unix('cp *.dat ../'); %gets dat files and moves them out to processing dir&lt;br /&gt;
cd ..&lt;br /&gt;
&lt;br /&gt;
datprofile = fullfile(pwd,'*.dat')&lt;br /&gt;
datfiledir = dir(datprofile);&lt;br /&gt;
[s,x] = size(datfiledir);&lt;br /&gt;
&lt;br /&gt;
%===========call make_meta_hs6(pb)&lt;br /&gt;
make_meta_hs6(pb) %makes the meta file&lt;br /&gt;
%===========end call&lt;br /&gt;
&lt;br /&gt;
meta = fopen('metafile.txt','r');&lt;br /&gt;
title_ln = fgets(meta);&lt;br /&gt;
for i = 1:s&lt;br /&gt;
    info = textscan(meta,'%*s %*s %s %s %s %s',1);&lt;br /&gt;
%%%%%%%%%%stuff to open and/or create%%%%%%%    &lt;br /&gt;
&lt;br /&gt;
fid = fopen(datfiledir(i).name,'r');&lt;br /&gt;
%  %fid = fopen('h100428a.dat')&lt;br /&gt;
name = datfiledir(i).name&lt;br /&gt;
%name = 'h100428a.dat';&lt;br /&gt;
%fidtemp = fopen(strcat(num2str(i),'temphs6_lcd'),'w+');&lt;br /&gt;
lcdname = strrep(name,'.dat','.lcd');&lt;br /&gt;
fidlcd = fopen(strrep(name,'.dat','.lcd'),'w+');&lt;br /&gt;
datmatrix = strrep(name,'.dat','.datmat');&lt;br /&gt;
mat = fopen(datmatrix,'w+');&lt;br /&gt;
&lt;br /&gt;
%%%%%%%%%%%end stuff%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
%---------get parameters--------&lt;br /&gt;
&lt;br /&gt;
%#######loop to get params&lt;br /&gt;
date = info{1};&lt;br /&gt;
station = info{2};&lt;br /&gt;
lat = char(info{3});&lt;br /&gt;
lon = char(info{4});&lt;br /&gt;
linecount =1;&lt;br /&gt;
line =0;&lt;br /&gt;
&lt;br /&gt;
while strncmp(line,'[Channels]',10) ~= 1&lt;br /&gt;
      line = fgets(fid);&lt;br /&gt;
      if strncmp(line,'[Channels]',10) ==1&lt;br /&gt;
          break&lt;br /&gt;
      end&lt;br /&gt;
      if linecount ==1&lt;br /&gt;
          fprintf(fidlcd,'%s\n','&amp;lt;cruise_info&amp;gt;');&lt;br /&gt;
          %insert cruise_ID &amp;gt;pb# &lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','Cruise_ID ',pb);&lt;br /&gt;
          %serial number&lt;br /&gt;
          %insert date &amp;gt;080211&lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','Date ',date{1});&lt;br /&gt;
          %insert station &amp;gt; PnB#&lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','Station ',station{1});&lt;br /&gt;
          %insert latitude &amp;gt; 34.???&lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','Latitude ',lat);&lt;br /&gt;
          %insert longitude &amp;gt; 119.????&lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','Longitude ',lon);&lt;br /&gt;
          %insert metadata_name &amp;gt; metafile.txt&lt;br /&gt;
          fprintf(fidlcd,'%s %s\n','metadata_filename', 'metafile.txt');&lt;br /&gt;
          %insert '&amp;lt;sampled_parameters&amp;gt;')&lt;br /&gt;
          &lt;br /&gt;
      end&lt;br /&gt;
          if strncmp(line,'[Header]',8) ==1&lt;br /&gt;
              linecount = linecount +1;&lt;br /&gt;
              continue&lt;br /&gt;
          end&lt;br /&gt;
          if strncmp(line,'FileType',8) == 1&lt;br /&gt;
              continue&lt;br /&gt;
          end&lt;br /&gt;
          if strncmp(line,'CreationDate',12) == 1&lt;br /&gt;
              continue&lt;br /&gt;
          end&lt;br /&gt;
          fprintf(fidlcd,'%s',line);&lt;br /&gt;
    linecount = linecount +1;      &lt;br /&gt;
end&lt;br /&gt;
pline =1;&lt;br /&gt;
params =1;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%++++++ write data params in column&lt;br /&gt;
fprintf(fidlcd,'%s\n', '&amp;lt;sampled_parameters&amp;gt;');&lt;br /&gt;
fprintf(fidlcd,'%s\n','hydro_time');&lt;br /&gt;
fprintf(fidlcd,'%s\n','depth');&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%=====get rest of data params&lt;br /&gt;
while strncmp(params,'Time',4) ~= 1&lt;br /&gt;
    params = fgets(fid)&lt;br /&gt;
end&lt;br /&gt;
ind  = findstr(params,',')&lt;br /&gt;
for p = 2:length(ind) -1&lt;br /&gt;
    headr = params(ind(p)+1:ind(p+1) -1)&lt;br /&gt;
    &lt;br /&gt;
   % headr(p,:) = params(1:ind(p,:) -1)&lt;br /&gt;
fprintf(fidlcd,'%s\n',headr)&lt;br /&gt;
end&lt;br /&gt;
lengin = length(ind);&lt;br /&gt;
lastin = ind(lengin);&lt;br /&gt;
lengpar = length(params)&lt;br /&gt;
header_plus1 = params(lastin+1:lengpar)%assumes the last two parameters are same character length&lt;br /&gt;
fprintf(fidlcd,'%s',header_plus1)&lt;br /&gt;
%====end get data params&lt;br /&gt;
&lt;br /&gt;
%++++++end write data params&lt;br /&gt;
&lt;br /&gt;
% % % while strncmp(params,'[ColumnHeadings]',16) ~= 1&lt;br /&gt;
% % %     params = fgets(fid);&lt;br /&gt;
% % %     params = strrep(params,'&amp;quot;','');&lt;br /&gt;
% % %     if strncmp(params,'[ColumnHeadings]',16) == 1&lt;br /&gt;
% % %         break&lt;br /&gt;
% % %     end&lt;br /&gt;
% % %     %eval([strcat('par',num2str(pline)) '= params'])&lt;br /&gt;
% % %     par(pline,:) = params;&lt;br /&gt;
% % % &lt;br /&gt;
% % %     pline = pline +1;  &lt;br /&gt;
% % % end&lt;br /&gt;
% % % %======&lt;br /&gt;
% % % %++++++ write data params in column&lt;br /&gt;
% % % fprintf(fidlcd,'%s\n', '&amp;lt;sampled_parameters&amp;gt;');&lt;br /&gt;
% % % fprintf(fidlcd,'%s\n','hydro_time');&lt;br /&gt;
% % % fprintf(fidlcd,'%s\n','depth');&lt;br /&gt;
% % % for t = 1:pline -1&lt;br /&gt;
% % %     parline = strcat(par(t,:),'_corr');&lt;br /&gt;
% % %     fprintf(fidlcd,'%s\n', parline);&lt;br /&gt;
% % % end&lt;br /&gt;
% % % clear t;&lt;br /&gt;
% % % for t = 1:pline -1&lt;br /&gt;
% % %     %parline2 = strcat('par(,num2str(t))&lt;br /&gt;
% % %     par1 = par(t,:);&lt;br /&gt;
% % %     fprintf(fidlcd,'%s', par1);&lt;br /&gt;
% % % end&lt;br /&gt;
% % % &lt;br /&gt;
 fprintf(fidlcd,'%s\n','&amp;lt;derived_parameters&amp;gt;');&lt;br /&gt;
 fprintf(fidlcd,'%s\n','&amp;lt;data&amp;gt;');&lt;br /&gt;
% % % &lt;br /&gt;
tline = 0;&lt;br /&gt;
%++++++ end write data params in column&lt;br /&gt;
while strncmp(tline,'[Data]',6) ~= 1  &lt;br /&gt;
tline = fgets(fid);&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
%------- does correct and traditional formatting for data&lt;br /&gt;
while ~feof(fid)&lt;br /&gt;
    data = fgets(fid);&lt;br /&gt;
    %data = strrep(data,',',' ');&lt;br /&gt;
    data = strrep(data,',.',',0.');&lt;br /&gt;
    data = strrep(data,'E','e');&lt;br /&gt;
%--------converts time to seconds from julean days after 1970    &lt;br /&gt;
    k = strfind(data,',');&lt;br /&gt;
            time = str2num(data(1:k(1)-1));&lt;br /&gt;
            time = 86400*(time-25569);&lt;br /&gt;
            data(1:k(1)-1)=[];&lt;br /&gt;
            data = [num2str(time),data];&lt;br /&gt;
            data = strrep(data,',',' ');&lt;br /&gt;
    fprintf(fidlcd,data);&lt;br /&gt;
    fprintf(mat,data);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
fprintf(fidlcd,'%s\n','&amp;lt;filters_used&amp;gt;');&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%----to make list_hs6&lt;br /&gt;
newl(i,:) = lcdname;&lt;br /&gt;
end&lt;br /&gt;
dlmwrite('list_hs6',newl,'');&lt;br /&gt;
fclose all;&lt;br /&gt;
&lt;br /&gt;
                if pwd == direct&lt;br /&gt;
                    unix('rm *.dat')&lt;br /&gt;
                else&lt;br /&gt;
                    disp('change to pb dir and delete .dat files')&lt;br /&gt;
                end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>128.111.101.185</name></author>
		
	</entry>
</feed>