Here we apply simple & standard classifiers to ocean color data
over a wide region.
Credit: sample data file was provided by T. Jackson from Plymouth Marine Lab
using OceanColorData, Plots, NCDatasets
Currently, the OC-CCI
satellite data set provides remotely sensed reflectance at 6 wavelengths (wv_cci
in nm
)
wv_cci=[412, 443, 490, 510, 555, 670];
Fuzzy logic
classifiers defined in Moore et al 2009 and Jackson et al 2017 can be used to assign optical class memberships from an Rrs
vector. While Moore et al define n=8
classes using an in-situ database, Jackson et al instead define n=14
classes using a satellite database. The latter benefits from better data coverage across all of the ecological provinces of the global ocean and is used in OC-CCI
.
In both cases the classifier is encoded in a mean reflectance spectra (M[i][1:6]
) and a covariance matrix (S[i][1:6,1:6]
) provided for each optical class (i
in 1:n
). Class memberships are then derived by computing the squared Mahalanobis distance to each M[i]
and passing the result to cumulative chi-squared distribution function (Equations 11 and 12 in Moore et al 2011).
(M,Sinv)=Jackson2017();
Credit: sample data file was provided by T. Jackson from Plymouth Marine Lab
dir0="../samples/";
fil=dir0*"ESACCI-OC-RRS-sample-fv4.0.nc"
ds = Dataset(fil)
Rrs_412=ds["Rrs_412"]; Rrs_443=ds["Rrs_443"]; Rrs_490=ds["Rrs_490"];
Rrs_510=ds["Rrs_510"]; Rrs_555=ds["Rrs_555"]; Rrs_670=ds["Rrs_670"];
lon=ds["lon"]; lat=ds["lat"];
Plot one of the wave bands as an example.
c=transpose(reverse(ds["Rrs_490"][:,:,1],dims=2))
heatmap(lon,reverse(lat),c,title="Rrs at 490nm")
Apply Classification to our 2D data sample and plot out a map.
#Find points that have a full set of input
tmp=fill(false,size(Rrs_412))
for ii in eachindex(Rrs_412)
!ismissing(Rrs_412[ii]) ? tmp[ii]=!ismissing(Rrs_443[ii].*Rrs_490[ii].*Rrs_510[ii].*Rrs_555[ii].*Rrs_670[ii]) : nothing
end
ii=findall(tmp);
#Apply classifier
mbrshp=fill(NaN,(1440,960,14))
for jj=1:length(ii);
kk=ii[jj]
Rrs_tmp=[Rrs_412[kk] Rrs_443[kk] Rrs_490[kk] Rrs_510[kk] Rrs_555[kk] Rrs_670[kk]]
mbrshp[kk[1],kk[2],:]=FuzzyClassification(M,Sinv,vec(Rrs_tmp))
end
c=transpose(reverse(mbrshp[:,:,10],dims=2))
heatmap(lon,reverse(lat),c,title="Membership for class 10")