function res = g_res_field(LAT, LON, varargin) % g_res_field - Function calculating the loss of resolution with de distance % from the camera % % Inputs: % % LAT : Latitude matrix obtained from g_rect % % LON : Longitude matrix obtained from g_rect % % Outputs: % % res : The field of resolution which is degrading with distance from % the camera % % % Author: Daniel Bourgault % Institut des sciences de la mer de Rimouski % % email: daniel_bourgault@uqar.ca % Website: http://demeter.uqar.ca/g_rect/ % February 2013 % % Author: Elie Dumas-Lefebvre % Institut des Science de la Mer de Rimouski % % Note: Matricial formulation of the calculation for a faster execution % % email: elie.dumas-lefebvre@uqar.ca % March 2019 % % LAT and LON difference in the x-axis dLATi = diff(LAT, 1, 2); dLONi = diff(LON, 1, 2); % LAT and LON difference in the y-axis dLATj = diff(LAT, 1, 1); dLONj = diff(LON, 1, 1); % Mean LAT in both x and y axis LAT_meani = 0.5*(LAT(:, 2:end) + LAT(:, 1:end-1)); LAT_meanj = 0.5*(LAT(2:end, :) + LAT(1:end-1, :)); % Conversion from degree to meters meterPerDegLat = 1852*60.0; meterPerDegLoni = meterPerDegLat .* cosd(LAT_meani); meterPerDegLonj = meterPerDegLat .* cosd(LAT_meanj); % Conversion from degrees to meters dxi = dLONi.*meterPerDegLoni; dxj = dLONj.*meterPerDegLonj; dyi = dLATi.*meterPerDegLat; dyj = dLATj.*meterPerDegLat; % Distances in x and y axis deltai = sqrt(dxi.^2 + dyi.^2); deltaj = sqrt(dxj.^2 + dyj.^2); % Adjusting the shape for plotting deltai = deltai(1:end-1, :); deltaj = deltaj(:, 1:end-1); % field of resolution res = sqrt(deltai.^2 + deltaj.^2); end