load("GliderIndex_v1.mat")
%%
mosslat = 36.80594819607352;
mosslon = -121.786377002975;
M1Lat = 36.75901;
M1Lon = -122.02019;
ellipsoid = wgs84Ellipsoid('miles');
distM1 = abs(distance(mosslat, mosslon, M1Lat, M1Lon, ellipsoid));
dist = abs(distance(mosslat, mosslon, Glidex.latitude, Glidex.longitude, ellipsoid));
%%
idx = Glidex.("Max Depth") >= 140 & Glidex.("Max Depth") <= 200 & dist > distM1; % metric for diel cycle
% add more metric
Gdex = Glidex(idx,:);
%%
gs = groupsummary(Glidex,"DateTime UTC","year");
%%
bar(gs.("year_DateTime UTC"),gs.GroupCount)
%%
figure
geobasemap('satellite')
geoscatter(Gdex.latitude,Gdex.longitude)
%%
dieldays = groupsummary(Glidex,"DateTime UTC","day");
dielmonths = groupsummary(Glidex,"DateTime UTC","month");
%%
figure
clf
bar(dielmonths.("month_DateTime UTC"),dielmonths.GroupCount)
title('Diel Cycle profiles monthly')