Vous êtes ici : Accueil / Alexandre Ganachaud / xbt / cmpxbttsg / xbttsg_checkposplot.m

xbttsg_checkposplot.m

Par Webmaster Legos Dernière modification 03/07/2012 15:54

Objective-C source code icon xbttsg_checkposplot.m — Objective-C source code, 2 kB (2198 bytes)

Contenu du fichier

%Check that xbt and tsg are within 5 miles. if not replace xbt
%position with tsg position. write output file for each ship 

% Then filters out points out of standard deviation.
load Data2/thxbt
%iship=1;

%RAW PLOT BY SHIP; IDENTIFY WRONG XBT POSITIONS
% PUT THG POSITION INSTEAD OF XBT IF WRONG
ip=0;figure(1);clf
for iship =1: length(thxbt)
  ferrors=['XBT_badpos_' thxbt(iship).shipid '.txt'];
  fid=fopen(ferrors,'w');
  ip=ip+1;
  subplot(2,2,ip)
  thg=thxbt(iship).thg;
  xbt=thxbt(iship).xbt;
  nxbt=length(xbt);
  gixbadpos=[];
  for ix=1:nxbt
    a=[thg(ix).thlon xbt(ix).xlon];
    a(a>180)=a(a>180)-360;
    xthdist=sw_dist([thg(ix).thlat xbt(ix).xlat],a,'nm');
    plot(thg(ix).thsst-xbt(ix).xsst,xbt(ix).xdep,'.');hold on
    if xthdist<4 %4 miles = max theoretical distance
      % for 5-min-time shift. If larger, change xbt coordinates
    else
      str=sprintf(...
          'Deviation %s Drop \t%4i \t%5.0f nm \tt%4.2f x%4.2f t%4.2f x%4.2f \t%4i',...
                   thxbt(iship).shipid,ix,xthdist,...
                   thg(ix).thlon, xbt(ix).xlon,...
                   thg(ix).thlat, xbt(ix).xlat,...
                   xbt(ix).xtirid);
      fprintf(fid,'%s\n',str);
      disp(str)
      gixbadpos=[gixbadpos,ix];
      thxbt(iship).xbt(ix).xlat=thxbt(iship).thg(ix).thlat;
      thxbt(iship).xbt(ix).xlon=thxbt(iship).thg(ix).thlon;
      
    end
  end %ix
  str=sprintf('Total rate of bad XBT positions %2.0f%%',...
              100*length(gixbadpos)/nxbt);
  disp(str)
  fprintf(fid,'%s\n',str);  
  fclose(fid);
  disp(['Errors written in ' ferrors])
  xlabel('THG - XBT');
  set(gca,'ydir','rev');ylabel('depth(m)')
  title(sprintf('%s %s-%s',thxbt(iship).shipid,...
    datestr(thg(1).thdate,12),datestr(thg(nxbt).thdate,12)))
  if ip==4
    ip=0;
    drawnow;
    figure(gcf+1);clf
  end
end %on iship
close 
save Data2/thxbt_corrected.mat thxbt

if 0
  figure(1); print -djpeg90 XBT-TSG-results/cmpalldata1.jpg
  figure(2); print -djpeg90 XBT-TSG-results/cmpalldata2.jpg
  figure(3); print -djpeg90 XBT-TSG-results/cmpalldata3.jpg
  figure(4); print -djpeg90 XBT-TSG-results/cmpalldata4.jpg
end

Actions sur le document

logo cnes logo IRD Logo université de Toulouse Logo université Paul Sabatier Logo CNRS
Logo bibliothèque OBS Logo Observatoire Midi Pyrénées