Skip to content
Snippets Groups Projects
Commit 3a7dd49b authored by Yves Gouriou's avatar Yves Gouriou
Browse files

Importation initiale de la nouvelle version Y. Gouriou

parent 046eb1ee
No related branches found
No related tags found
No related merge requests found
Showing
with 12493 additions and 0 deletions
past0601
yyyy mm dd hh mm Latitude Longitude sssb
2006 01 14 12 00 42.683 3.833 34.997
2006 01 16 12 05 50.183 -1.833 35.375
2006 01 17 13 04 45.050 -8.783 35.704
2006 01 18 12 59 38.617 -9.383 35.391
2006 01 19 13 01 37.617 -9.933 36.395
2006 01 20 14 02 29.983 -13.333 36.579
2006 01 21 14 04 23.517 -18.100 36.540
2006 01 22 16 58 16.850 -23.017 35.992
2006 01 23 15 02 10.950 -26.000 35.260
2006 01 24 15 01 4.800 -28.750 35.558
2006 01 25 16 04 -1.750 -31.583 36.315
2006 01 26 16 00 -7.733 -34.333 36.788
2006 01 27 16 02 -9.217 -34.283 37.034
2006 01 28 15 03 -16.117 -37.433 37.337
2006 01 29 16 47 -23.100 -42.133 35.920
2006 01 31 17 20 -24.617 -46.650 35.392
2006 02 03 15 03 -24.167 -46.300 35.017
2006 02 06 15 01 -22.367 -40.967 36.522
2006 02 07 16 04 -15.750 -38.350 37.297
2006 02 08 17 26 -12.083 -37.283 36.775
2006 02 09 16 04 -6.167 -33.483 36.455
2006 02 10 15 02 0.400 -30.633 35.725
2006 02 11 15 01 6.950 -27.767 35.850
2006 02 12 17 49 14.283 -24.500 35.693
2006 02 13 14 00 19.467 -21.500 36.492
2006 02 14 14 02 25.633 -18.000 36.911
2006 02 15 13 56 31.833 -13.967 36.684
2006 02 16 13 00 38.033 -9.850 36.269
This diff is collapsed.
File added
File added
File added
File added
File added
File added
File added
File added
File added
function [x,y]=gpos(h_axes)
%GPOS Get current position of cusor and return its coordinates in axes with handle h_axes
% h_axes - handle of specified axes
% [x,y] - cursor coordinates in axes h_aexs
%
% -------------------------------------------------------------------------
% Note:
% 1. This function should be called in the figure callback WindowButtonMotionFcn.
% 2. It works like GINPUT provided by Matlab,but it traces the position
% of cursor without click and is designed for 2-D axes.
% 3. It can also work even the units of figure and axes are inconsistent,
% or the direction of axes is reversed.
% -------------------------------------------------------------------------
% Written by Kang Zhao,DLUT,Dalian,CHINA. 2003-11-19
% E-mail:kangzhao@student.dlut.edu.cn
h_figure=gcf;
units_figure = get(h_figure,'units');
units_axes = get(h_axes,'units');
if_units_consistent = 1;
if ~strcmp(units_figure,units_axes)
if_units_consistent=0;
set(h_axes,'units',units_figure); % To be sure that units of figure and axes are consistent
end
% Position of origin in figure [left bottom]
pos_axes_unitfig = get(h_axes,'position');
width_axes_unitfig = pos_axes_unitfig(3);
height_axes_unitfig = pos_axes_unitfig(4);
xDir_axes=get(h_axes,'XDir');
yDir_axes=get(h_axes,'YDir');
% Cursor position in figure
pos_cursor_unitfig = get( h_figure, 'currentpoint'); % [left bottom]
if strcmp(xDir_axes,'normal')
left_origin_unitfig = pos_axes_unitfig(1);
x_cursor2origin_unitfig = pos_cursor_unitfig(1) - left_origin_unitfig;
else
left_origin = pos_axes_unitfig(1) + width_axes_unitfig;
x_cursor2origin_unitfig = -( pos_cursor_unitfig(1) - left_origin_unitfig );
end
if strcmp(yDir_axes,'normal')
bottom_origin_unitfig = pos_axes_unitfig(2);
y_cursor2origin_unitfig = pos_cursor_unitfig(2) - bottom_origin_unitfig;
else
bottom_origin_unitfig = pos_axes_unitfig(2) + height_axes_unitfig;
y_cursor2origin_unitfig = -( pos_cursor_unitfig(2) - bottom_origin_unitfig );
end
xlim_axes=get(h_axes,'XLim');
width_axes_unitaxes=xlim_axes(2)-xlim_axes(1);
ylim_axes=get(h_axes,'YLim');
height_axes_unitaxes=ylim_axes(2)-ylim_axes(1);
x = xlim_axes(1) + x_cursor2origin_unitfig / width_axes_unitfig * width_axes_unitaxes;
y = ylim_axes(1) + y_cursor2origin_unitfig / height_axes_unitfig * height_axes_unitaxes;
% Recover units of axes,if original units of figure and axes are not consistent.
if ~if_units_consistent
set(h_axes,'units',units_axes);
end
\ No newline at end of file
function cdata = iconRead(filename,guessalpha)
% ICONREAD read an image file and convert it to CData for a HG icon.
%
% CDATA=ICONREAD(FILENAME)
% Read an image file and convert it to CData with automatic transparency
% handling. If the image has transparency data, PNG files sometimes do,
% the transparency data is used. If the image has no CData, the top left
% pixel is treated as the transparent color.
%
% CDATA=ICONREAD(FILENAME, FALSE)
% Same as above but supress the usage of the top left pixel for images
% with no transparency data. This may require the caller to handle the
% transparency explicitly. View the contents of this m-file for an
% example of how to handle transparency.
%
% Example:
%
% icon = fullfile(matlabroot,'toolbox','matlab','icons','matlabicon.gif');
% uitoggletool('CData',iconread(icon));
%
% See also IMREAD.
% Copyright 1984-2006 The MathWorks, Inc.
if nargin < 2
guessalpha = true;
end
[p,f,ext] = fileparts(filename);
% if this is a mat-file, look for the varible cdata (or something like it)
if isequal(lower(ext),'.mat')
cdata = [];
s = whos('-file',filename);
for i=1:length(s)
if ~isempty(strfind(lower(s(i).name), 'cdata'))
data = load(filename,s(i).name);
cdata = data.(s(i).name);
end
end
return
end
[cdata,map,alpha] = imread(filename);
if isempty(cdata)
return;
end
if isempty(map)
% need to use doubles cuz nan's only work as doubles
cdata = double(cdata);
cdata = cdata/255;
else
cdata = ind2rgb(cdata,map);
end
if isempty(alpha)
if ~guessalpha
return;
end
% guess the alpha pixel by using the top left pixel in the icon
ap1 = cdata(1,1,1);
ap2 = cdata(1,1,2);
ap3 = cdata(1,1,3);
alpha = cdata(:,:,1) == ap1 & cdata(:,:,2) == ap2 & cdata(:,:,3) == ap3;
alpha = ~alpha;
end
% process alpha data
r = cdata(:,:,1);
r(alpha == 0) = NaN;
g = cdata(:,:,2);
g(alpha == 0) = NaN;
b = cdata(:,:,3);
b(alpha == 0) = NaN;
cdata = cat(3,r,g,b);
function panAdaptiveDateTicks(varargin)
% PANADAPTIVEDATETICKS - Make date ticks adapt to zooming
%
% panAdaptiveDateTicks('on')
% Turns on the automatic adaptation of date ticks
% to user zooming for the current figure window
%
% panAdaptiveDateTicks('off')
% Turns off the automatic adaptation of date ticks
% to user zooming for the current figure window
%
% panAdaptiveDateTicks('demo')
% Opens a demo figure window to play with
if (nargin>0)
switch varargin{1}
case 'demo'
% Create demo values
% dates = floor(now) - linspace(1169,0,15000)';
% values= randn(15000,1);
% Show data with date ticks
% figure
% plot(dates,values)
% datetick('x')
% panAdaptiveDateTicks('on')
case 'on'
% Define a post zoom callback
set(pan(gcf),'ActionPostCallback', @adaptiveDateTicks);
case 'off'
% Delete the post zoom callback
set(pan(gcf),'ActionPostCallback', '');
otherwise
figure(gcf)
end
end
function adaptiveDateTicks(figureHandle,eventObjectHandle)
% Resetting x axis to automatic tick mark generation
set(eventObjectHandle.Axes,'XTickMode','auto')
% using automaticallly generate date ticks
datetick(eventObjectHandle.Axes,'x','keeplimits')
\ No newline at end of file
function tsg_initialisation(hTsgGUI, hQcCmenu)
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% hQcCmenu ........... Handel to the QC code context menu
% Output
% ------
%
% Quality Code and color
qc.Color.NO_CONTROL = 'k';
qc.Color.GOOD = 'b';
qc.Color.PROBABLY_GOOD = 'g';
qc.Color.PROBABLY_BAD = 'm';
qc.Color.BAD = 'r';
qc.Code.NO_CONTROL = 1;
qc.Code.GOOD = 2;
qc.Code.PROBABLY_GOOD = 3;
qc.Code.PROBABLY_BAD = 4;
qc.Code.BAD = 5;
quality.Code = qc.Code.GOOD;
quality.Color = qc.Color.GOOD;
set( hQcCmenu, 'UserData', quality );
% Set named application data
% -------------------------------
setappdata( hTsgGUI, 'qcColor', qc);
end
function tsg_plot_SalTempVel( hTsgGUI, hAxes )
% Function to plot the Salinity, Temperature TSG data as well as the
% ship velocity
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% hPlotAxes .......... Handels to the 3 graphic axes
%
% Output
% ------
%
% Retrieve named application data
% -------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');
qc = getappdata( hTsgGUI, 'qcColor');
% Plot the Salinity with the right color code
% -------------------------------------------
axes( hAxes(1));
ind = find(tsg.PSAL_QC <= qc.Code.NO_CONTROL );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
strcat('.',qc.Color.NO_CONTROL));
hold on;
ind = find(tsg.PSAL_QC == qc.Code.GOOD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
strcat('.',qc.Color.GOOD));
ind = find(tsg.PSAL_QC == qc.Code.PROBABLY_GOOD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
strcat('.',qc.Color.PROBABLY_GOOD));
ind = find(tsg.PSAL_QC == qc.Code.PROBABLY_BAD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
strcat('.',qc.Color.PROBABLY_BAD));
ind = find(tsg.PSAL_QC == qc.Code.BAD );
plot(hAxes(1), tsg.TIME(ind), tsg.PSAL(ind), ...
strcat('.',qc.Color.BAD));
% Plot Temperature and ship velocity with no qc color code
% ---------------------------------------------------------
plot(hAxes(2), tsg.TIME, tsg.TEMP_TSG, '.');
plot(hAxes(3), tsg.TIME, tsg.TEMP_TSG, '.');
% Formatted x-TIME axes
% ---------------------
datetick(hAxes(1), 'x');
datetick(hAxes(2), 'x');
datetick(hAxes(3), 'x');
% Write some 'Y' label
% ------------------
set(get(hAxes(1), 'Ylabel'), 'String', 'Salinity');
set(get(hAxes(2), 'Ylabel'), 'String', 'Temperature (°C)');
set(get(hAxes(3), 'Ylabel'), 'String', 'Ship Velocity');
% Make the axes visible
% ---------------------
set(hAxes(1), 'Visible', 'on' );
set(hAxes(2), 'Visible', 'on' );
set(hAxes(3), 'Visible', 'on' );
% The 3 axes will behave identically when zoomed and panned
% ---------------------------------------------------------
linkaxes([hAxes(1),hAxes(2),hAxes(3)], 'x');
end
\ No newline at end of file
function tsg_plotmap(hTsgGUI, hAxes)
% Function to plot the earth map and ship trackline
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% hPlotAxes .......... Handels to the graphic axes
%
% Output
% ------
%
% Library : 'M_MAP'
%
% PROBLEM NOT YET RESOLVED
% Does M_MAP use 0-360° or -180°-180° covention ?
%
% Retrieve named application data
% -------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');
% Positionning the right axes
% ----------------------------
axes(hAxes(4));
% Use of Mercator projection
% --------------------------
m_proj('Mercator','lat',[-70 70],'long',[-180 180]);
% detailed coast lines
% m_gshhs_i('patch',[.7 .7 .7]);
% Less detailed coast lines
% m_gshhs_l('patch',[.7 .7 .7]);
% Lesser detailed coast lines
% ----------------------------
m_coast('patch',[.7 .7 .7]);
m_grid('box','fancy','tickdir','in', ...
'ytick', [-70:20:70],...
'xtick', [-180:40:180],...
'Fontsize', [10]);
% Plot the ship track - Check if LAT-LON in deg-decimal
% -----------------------------------------------------
m_line(tsg.LONGITUDE,tsg.LATITUDE,'marker','.','markersize',3,'color','b');
end
function [error] = tsg_readTsgData( hTsgGUI, filename)
% Function to read the Bucket data. Should be in a NetCDF file
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% filename ........... Data filename
%
% Output
% ------
% error .............. 1: OK - -1 : an error occured
%
% The data are store using setappdata - Variable name : 'bucket_data'
%
% Function to be rewritten when the NetCDF format will be in use
% Caution : replace the fill-value with NaN
%
% Open the file
% -------------
fid = fopen( filename, 'r' );
error = -1;
if fid ~= -1
% Read the file - skip 2 lines
% ----------------------------
fgetl( fid ); fgetl( fid );
bucketData = fscanf(fid,'%d %d %d %d %d %d %f %f %f', [9 Inf])';
% Every variable are put in a structure
% -------------------------------------
bucket.TIME_WS = datenum(bucketData(:,1), bucketData(:,2), ...
bucketData(:,3), bucketData(:,4), ...
bucketData(:,5), bucketData(:,6));
bucket.LATITUDE_WS = bucketData(:,7);
bucket.LONGITUDE_WS = bucketData(:,8);
bucket.PSAL_WS = bucketData(:,9);
bucket.PSAL_QC_WS = size(bucket.PSAL_WS);
% Save the data in the application GUI
% ------------------------------------
setappdata( hTsgGUI, 'bucket_data', bucket );
% Clear the Workspace
% -------------------
clear bucketData
% Close the file
% --------------
fclose( fid );
% Everything OK
% -------------
error = 1;
end
function [error] = tsg_readTsgData( hTsgGUI, filename)
% Function to read the TSG data. Should be a NetCDF file
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% filename ........... Data filename
%
% Output
% ------
% error .............. 1: OK - -1 : an error occured
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% Function to be rewritten when the NetCDF format will be in use
% Caution : replace the fill-value with NaN
%
% Open the file
% -------------
fid = fopen( filename, 'r' );
error = -1;
if fid ~= -1
% Read the file
% -------------
tsgData = fscanf(fid, '%d/%d/%d %d:%d:%d %f %f %f %f %d %f %f', ...
[13 Inf])';
% Every variable are put in a structure
% -------------------------------------
tsg.TIME = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ...
tsgData(:,4),tsgData(:,5),tsgData(:,6));
tsg.LATITUDE = tsgData(:,7);
tsg.LONGITUDE = tsgData(:,8);
tsg.TEMP_TSG = tsgData(:,9);
tsg.PSAL = tsgData(:,10);
tsg.PSAL_QC = tsgData(:,11);
tsg.PSAL_ADJ = tsgData(:,12);
tsg.PSAL_ERR = tsgData(:,13);
% Save the data in the application GUI
% ------------------------------------
setappdata( hTsgGUI, 'tsg_data', tsg );
% Clear the Workspace
% -------------------
clear tsgdata
% Close the file
% --------------
fclose( fid );
% Everything OK
% -------------
error = 1;
end
function [error] = tsg_writeTsgData( hTsgGUI, filename)
% Function to write the TSG data. Should be a NetCDF file
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% filename ........... Data filename
%
% Output
% ------
% error .............. 1: OK - -1 : an error occured
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% Function to be rewritten when the NetCDF format will be in use
% Caution : replace the fill-value with NaN
%
% Open the file
% -------------
fid = fopen( filename, 'w' );
error = -1;
if fid ~= -1
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');
[year, month, day, hour, min, sec] = datevec( tsg.TIME );
tsg_data = [day month year hour min fix(sec) tsg.LATITUDE ...
tsg.LONGITUDE tsg.TEMP_TSG ...
tsg.PSAL tsg.PSAL_QC ...
tsg.PSAL_ADJ tsg.PSAL_ERR ...
];
% Write the file
% -------------
fprintf(fid,...
'%02d/%02d/%04d %02d:%02d:%02d %11.6f %11.6f %6.3f %6.3f %1d %6.3f %6.3f\n',...
tsg_data');
% Clear the Workspace
% -------------------
clear tsgdata
% Close the file
% --------------
fclose( fid );
% Everything OK
% -------------
error = 1;
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment