clear all
close all
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
%    Workbook: /Volumes/Boss_SSD/Perseverance/raw/Filet CTD TORPEDO BOUEE RADIOMETRE.xlsx
%    Worksheet: Filet
%
% Auto-generated by MATLAB on 04-Mar-2026 11:40:14

%% Set up the Import Options and import the data
opts = spreadsheetImportOptions("NumVariables", 61);

% Specify sheet and range
opts.Sheet = "Filet";
opts.DataRange = "A6:BI38";

% Specify column names and types
opts.VariableNames = ["VarName1", "VarName2", "VarName3", "VarName4", "VarName5", "VarName6", "VarName7", "VarName8", "VarName9", "VarName10", "VarName11", "VarName12", "VarName13", "VarName14", "VarName15", "VarName16", "VarName17", "VarName18", "VarName19", "VarName20", "VarName21", "VarName22", "VarName23", "VarName24", "VarName25", "VarName26", "VarName27", "VarName28", "VarName29", "VarName30", "VarName31", "VarName32", "VarName33", "VarName34", "VarName35", "VarName36", "VarName37", "VarName38", "VarName39", "VarName40", "OrganismesObservs", "VarName42", "VarName43", "VarName44", "VarName45", "VarName46", "VarName47", "VarName48", "Vrifier", "VarName50", "VarName51", "VarName52", "VarName53", "VarName54", "VarName55", "VarName56", "VarName57", "VarName58", "VarName59", "VarName60", "VarName61"];
opts.VariableTypes = ["double", "datetime", "double", "string", "double", "string", "string", "double", "string", "double", "string", "string", "double", "double", "double", "double", "double", "string", "double", "double", "string", "double", "double", "double", "double", "categorical", "double", "double", "double", "double", "categorical", "double", "double", "double", "double", "categorical", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double"];

% Specify variable properties
opts = setvaropts(opts, ["VarName4", "VarName6", "VarName7", "VarName9", "VarName11", "VarName12", "VarName18", "VarName21", "VarName38", "VarName48", "VarName54"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["VarName4", "VarName6", "VarName7", "VarName9", "VarName11", "VarName12", "VarName18", "VarName21", "VarName26", "VarName31", "VarName36", "VarName38", "VarName48", "VarName54"], "EmptyFieldRule", "auto");

% Import the data
A = readtable("/Volumes/Boss_SSD/Perseverance/raw/Filet CTD TORPEDO BOUEE RADIOMETRE.xlsx", opts, "UseExcel", false);


%% Clear temporary variables
clear opts

%% Clear temporary variables
clear opts

 Lat=A.VarName5;
 Lon=A.VarName7;
 Lon=str2num(char(Lon));
 Lon=[NaN;Lon]
diversity=A.VarName40;
stn_number=A.VarName1;
I=find(isfinite(A.VarName5) & isfinite(A.VarName1))

%% input high/low map resolution  
%mresol=input('map/bathy resolution :high map & bathy =2, high bathy & low map =1, low all=0')
%if isempty(mresol)
    mresol=0;
%end

clf
  maxmap=[5 1 0.5]
  bg=1

 m_proj('Stereographic','longitude',160,'latitude',-60,'radius',20);
 sondes=[-5000 -3000 -2000 -1000 -500 -250 -0];
 if mresol== 0  % low map and low bathy resolution
     m_coast('patch',[.7 .7 .7],'edgecolor','k');
     m_elev('contour',sondes);
 elseif mresol== 1  % low map and high bathy resolution
     m_coast('patch',[.7 .7 .7],'edgecolor','k');
     m_tbase('contour',sondes','linecolor','k');
 elseif mresol== 2  % high map and high bathy resolution
     m_gshhs_h('save', 'gumby');
     m_usercoast('gumby','patch',[.7 .7 .7],'edgecolor','k');
     m_tbase('contour',sondes,'linecolor','k');
 end
 m_grid;
 II=isfinite(Lat);
[lon,lat]=m_ll2xy(Lon(II),Lat(II));
 hold on
 for i=1:length(diversity)-1
 if diversity(i)==1
scatter (lon(i),lat(i),40,stn_number(i+1),'filled')
 elseif diversity(i)==2
  scatter (lon(i),lat(i),80,stn_number(i+1),'filled')
 else 
 scatter (lon(i),lat(i),120,stn_number(i+1),'filled')
 end
 end
 hold on
 caxis([min(stn_number(II)) max(stn_number(II))])
 xlabel('lon');
 ylabel('lat');
 title(sprintf('HSN stations'));
 colorbar
 grid on

 print('stations.png','-dpng')