Coastal-Imaging-Research-Network / cBathy-Toolbox

Routines needed to run cBathy + demos
https://github.com/Coastal-Imaging-Research-Network/cBathy-toolbox/wiki/cBathy-User-Manual
GNU General Public License v3.0
25 stars 23 forks source link

Issues using CIRN Introduction to Quantitative Coastal Imaging Toolbox as cBathy input #60

Closed AthinaLange closed 4 years ago

AthinaLange commented 4 years ago

Hi all, I'm using the CIRN Introduction to Quantitative Coastal Imaging Toolbox to rectify images extracted from a 17min drone flight and now I'm trying to run them through cBathy.

I use their G2_pixelInstruments to get the pixInst variable on a grid (in world GPS coordinates) that does include all of the beach and some of the road with our stability/ground control points and extends out past the surfzone (see image).

To organize the pixInst variable into a cBathy input format, I use:

xyz=[pixInst(1).X(:) pixInst(1).Y(:) pixInst(1).Z(:)];
Igray = pixInst(1).Igray;
m = size(Igray,1);
n = size(Igray,2);
tt = size(t,2);
data=NaN(tt,m*n);

[xindgrid,yindgrid]=meshgrid(1:n,1:m);
rowIND=yindgrid(:); colIND=xindgrid(:);
for i=1:length(rowIND(:))
    data(:,i)=reshape(Igray(rowIND(i),colIND(i),:),tt,1);
end
for jj = 1:length(xyz)
    nz = nonzeros(data(:,jj));
    if length(nz) < round(tt*.5)
        data(:,jj) = 0;
    elseif length(nz) < tt
        id = find(data(:,jj)==0);
        data(id,jj) = NaN;
        data(id,jj)=nanmean(data(:,jj));
    end
    clear nz
end

There are some points along the boundary that occasionally have values due to the FOV moving slightly from the drone, that are set to 0. There are some values 'inside' the wavefield that are also zero that I've set to the mean value at that point.

I noticed in the demo cBathy, that the grid is only defined at the non-zero values, which I've also tried with no more success than the other ones.

I've been using the demo argus02a.m file for the settings file, only changing: params.xyMinMax = []; .

cBathy is able to run with no errors (a few Jacobian ill-conditioned warnings), however the output bathy.fDependent.k is almost completely filled with NaN's, and then fCombined is NaN's as well.

I've put our pixInst, data, t, xyz and the resulting bathy file in this dropbox link (https://www.dropbox.com/s/5ult5nms9ipf7aa/input_data.mat?dl=0)

Any help would be greatly appreciated. Thanks!

pixel_grid

AthinaLange commented 4 years ago

Turns out the issue was that we had left our coordinate system in GPS coordinates. The grid had to be flipped 180deg to work. Thanks to Brittany Bruder for figuring it out.

Here's the explanation from her: Kappa is a measure of enlarging the analysis as you go offshore, cBathy assumes the shoreline is on the left and offshore is on the right, which west coast beaches have the opposite. params.offshoreRadCCWFromx is a guess of the wave direction. Without rotating the system, a value of 0 indicates the waves are coming from the right. So on an unrotated west coast beach--the waves are coming from the land.