%% Import data from text file
% Script for importing data from the following text file:
%
%    filename: /Users/emmanuelboss/Desktop/OO2024_project/Valente-etal_2022_V3/datasets/insitudb_chla_V3.tab
%
% Auto-generated by MATLAB on 11-Jun-2024 07:06:21

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

% Specify range and delimiter
opts.DataLines = [30, Inf];
opts.Delimiter = "\t";

% Specify column names and types
opts.VariableNames = ["IDidx", "DateTime", "Latitude", "Longitude", "ChlAmgm3HighPerformanceLiquidChrom", "ChlAmgm3ChlorophyllAFluorometricO", "DepthWatermwaterDepthFromETOPO1If", "Commentchla_hplc_dataset", "Commentchla_hplc_subdataset", "Commentchla_hplc_contributor", "Commentchla_fluor_dataset", "Commentchla_fluor_subdataset", "Commentchla_fluor_contributor", "QFTime1IfObservationWithoutTime", "QFChl1IfObservationAsUnknownC"];
opts.VariableTypes = ["double", "string", "double", "double", "double", "double", "double", "string", "string", "string", "categorical", "categorical", "categorical", "double", "double"];

% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";

% Specify variable properties
opts = setvaropts(opts, ["DateTime", "Commentchla_hplc_dataset", "Commentchla_hplc_subdataset", "Commentchla_hplc_contributor"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["DateTime", "Commentchla_hplc_dataset", "Commentchla_hplc_subdataset", "Commentchla_hplc_contributor", "Commentchla_fluor_dataset", "Commentchla_fluor_subdataset", "Commentchla_fluor_contributor"], "EmptyFieldRule", "auto");
opts = setvaropts(opts, "QFChl1IfObservationAsUnknownC", "TrimNonNumeric", true);
opts = setvaropts(opts, "QFChl1IfObservationAsUnknownC", "ThousandsSeparator", ",");

% Import the data
AA = readtable("/Users/emmanuelboss/Desktop/OO2024_project/Valente-etal_2022_V3/datasets/insitudb_chla_V3.tab", opts);


%% Clear temporary variables
clear opts

A.id=AA.IDidx;
A.t=AA.DateTime;
A.Lon=AA.Longitude;
A.Lat=AA.Latitude;
A.HPLC=AA.ChlAmgm3HighPerformanceLiquidChrom;
A.F=AA.ChlAmgm3ChlorophyllAFluorometricO;
save ValenteV3_chl A
