Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
firstline1
titleMatlab sample script
linenumberstrue
collapsetrue
% Load portion of dataset from ONC ERDDAP server load(urlwrite('http://dap.onc.uvic.ca/erddap/tabledap/SaanichInlet_BPS_WLFLNTU2474.mat?timeseries_id,profile_id,time,latitude,longitude,chlorophyll,turbidity,depth&time>=2015-01-02T00:00:00Z&time<=2015-01-03T00:00:00Z', 'test.mat'));

% Load metadata for dataset from ONC ERDDAP server and review portions of the response
load(urlwrite('http://dap.onc.uvic.ca/erddap/info/SaanichInlet_BPS_WLFLNTU2474/index.mat', 'meta.mat'));

response.Attribute_Name

% Get the device name attribute from the response object
for i=1:length(response.Attribute_Name)
if strcmp(strtrim(response.Attribute_Name(i,: - ) ),'deviceName')
response.Value(i,: - )
end
end

% Get units attribute from the response object
j=1;
for i=1:length(response.Attribute_Name)
if strcmp(strtrim(response.Attribute_Name(i,: -) ),'units')
units(j,: - ) =response.Value(i,: -) ;
j=j+1;
end
end
units

% Investigate some of the dataset contents
length(SaanichInlet_BPS_WLFLNTU2474.chlorophyll)

SaanichInlet_BPS_WLFLNTU2474.chlorophyll(1:10)
max(SaanichInlet_BPS_WLFLNTU2474.turbidity)
min(SaanichInlet_BPS_WLFLNTU2474.turbidity)

% Chlorophyll plots - vs time, depth and turbidity

plot(SaanichInlet_BPS_WLFLNTU2474.time, SaanichInlet_BPS_WLFLNTU2474.chlorophyll)
datetick
xlabel('Time')
ylabel('Chlorophyll')

plot(SaanichInlet_BPS_WLFLNTU2474.chlorophyll,SaanichInlet_BPS_WLFLNTU2474.depth,'.')
ylabel('Depth')
xlabel('Chlorophyll')
axis ij

scatter(SaanichInlet_BPS_WLFLNTU2474.chlorophyll, SaanichInlet_BPS_WLFLNTU2474.turbidity)
xlabel('Chlorphyll')
ylabel('Turbidity')

...