%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
%    Workbook: /Volumes/Boss_SSD/Perseverance/raw/Curiosity/Prélèvements plancton_Persévérance_2026 janvier février mars.xlsx
%    Worksheet: Filet
%
% Auto-generated by MATLAB on 22-Feb-2026 19:23:25

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

% Specify sheet and range
opts.Sheet = "Filet";
opts.DataRange = "A4:AI29";

% Specify column names and types
opts.VariableNames = ["NStation03000", "Date", "DbutFilet", "VarName4", "VarName5", "VarName6", "VarName7", "FinFilet", "VarName9", "VarName10", "VarName11", "VarName12", "VolumeFiltr", "Vitesse", "Vitesse1", "Hauteur", "SeaSurface", "Couverture", "Commentaires", "ADN", "Filtration", "VarName22", "VarName23", "VarName24", "VarName25", "NanoP", "VarName27", "VarName28", "VarName29", "VarName30", "PicoP", "VarName32", "VarName33", "VarName34", "VarName35"];
opts.VariableTypes = ["double", "datetime", "double", "string", "double", "string", "double", "double", "string", "double", "string", "double", "double", "double", "double", "string", "double", "double", "string", "double", "double", "double", "double", "categorical", "double", "double", "double", "double", "categorical", "double", "double", "double", "double", "categorical", "double"];

% Specify variable properties
opts = setvaropts(opts, ["VarName4", "VarName6", "VarName9", "VarName11", "Hauteur", "Commentaires"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["VarName4", "VarName6", "VarName9", "VarName11", "Hauteur", "Commentaires", "VarName24", "VarName29", "VarName34"], "EmptyFieldRule", "auto");

% Import the data
A = readtable("/Volumes/Boss_SSD/Perseverance/raw/Curiosity/Prélèvements plancton_Persévérance_2026 janvier février mars.xlsx", opts, "UseExcel", false);


%% Clear temporary variables
clear opts

Lon=A.VarName12;
Lat=A.VarName10;
stn_number=A.NStation03000; 
I=find(isfinite(A.VarName22))

%% 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

%% plot SST map 
figure(5) 
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
scatter (lon,lat,40,stn_number(II),'filled')
 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')
