Home > robbins > bt_plt1.m

bt_plt1

PURPOSE ^

BT_PLT1 A front end program for bot_gui

SYNOPSIS ^

function bt_plt1(botfile,sumfile,stations);

DESCRIPTION ^

 BT_PLT1  A front end program for bot_gui 
          which allows user to specify
          a matching sum file to include geographic information.

 USAGE:  bt_plt1(botfile,sumfile,stations);

 INPUTS
   botfile: name of WOCE format bottle file
   sumfile: name of WOCE format sum file
   stations (opt):  vector of stations to use

 Copywrite 1995  Paul E Robbins

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bt_plt1(botfile,sumfile,stations);
0002 
0003 % BT_PLT1  A front end program for bot_gui
0004 %          which allows user to specify
0005 %          a matching sum file to include geographic information.
0006 %
0007 % USAGE:  bt_plt1(botfile,sumfile,stations);
0008 %
0009 % INPUTS
0010 %   botfile: name of WOCE format bottle file
0011 %   sumfile: name of WOCE format sum file
0012 %   stations (opt):  vector of stations to use
0013 %
0014 % Copywrite 1995  Paul E Robbins
0015 
0016 disp(['Loading WHP sum file ',sumfile])
0017 [lat,lon,station,time] = whp_sum(sumfile);
0018 
0019 disp(['Loading WHP bottle file ',botfile])
0020 [bot,props,units] = whp_bot(botfile,2);
0021 
0022 %find index of station number
0023 js = findstrline(props,'STNNBR');
0024 if nargin > 2
0025 
0026  ok = 0*station;
0027  for i = 1:length(station)
0028    if any(station(i) == stations)
0029      ok(i) = 1;
0030    end
0031  end
0032  lat = lat(ok); lon = lon(ok); station = station(ok); time = time(ok);
0033  ok = 0*bot(:,1);
0034  for i = 1:length(stations)
0035   if any(bot(:,js) == stations(i));
0036     ok(bot(:,js) == stations(i)) = ok(bot(:,js) == stations(i))+1;
0037   end
0038  end
0039  bot = bot(ok,:);
0040 else
0041  stations=sort(bot(:,js));stations(find(diff(stations)==0))=[];
0042 
0043 end
0044 
0045 bad = bot == -9;
0046 bot(bad) = nan*(bot(bad));
0047 disp(['Merging in station info....'])
0048 props = str2mat(props,'LONGIT','LATITU');
0049 units = str2mat(units,' ',' ');
0050 ncol = size(bot,2);
0051 for i = 1:length(stations)
0052   if any(bot(:,js) == stations(i));
0053     nmat = sum(bot(:,js) == stations(i));
0054     bot(bot(:,js) == stations(i),ncol+1) = lon(i)*ones(nmat,1);
0055     bot(bot(:,js) == stations(i),ncol+2) = lat(i)*ones(nmat,1);
0056   end
0057 end
0058     
0059 disp(['Calculating derived variables....'])
0060 
0061 %find indexes of salinity and temp
0062 jsalt = findstrline(props,'SALNTY');
0063 jtemp = findstrline(props,'CTDTMP');
0064 jpres = findstrline(props,'CTDPRS');
0065 
0066 ncol = size(bot,2);
0067 props = str2mat(props,'SIGMA0');
0068 units = str2mat(units,' KG/M^3');
0069 bot(:,ncol+1) = sw_pden(bot(:,jsalt),bot(:,jtemp),bot(:,jpres),0);
0070 
0071 % if you have the gamma-routines for neutral density you can uncomment this
0072 %props = str2mat(props,'GAMMAN');
0073 %units = str2mat(units,' KG/M^3');
0074 %bot(:,ncol+2) = gamma_n(bot(:,jsalt),bot(:,jtemp),bot(:,jpres),...
0075 %    bot(:,ncol-1),bot(:,ncol));
0076 
0077 bot_gui(bot,props,units)
0078

Generated on Wed 30-Nov-2005 15:40:09 by m2html © 2003