Commit 7738440a authored by Elie Dumas-Lefebvre's avatar Elie Dumas-Lefebvre

Ajout de documentation dans g_res_field et changements legers dans g_vis_field...

Ajout de documentation dans g_res_field et changements legers dans g_vis_field pour permettre son utilisation peu importe la version de matlab
parent e70023e3
function delta = g_res_field(LAT, LON) 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 % LAT and LON difference in the x-axis
dLATi = diff(LAT, 1, 2); dLATi = diff(LAT, 1, 2);
...@@ -17,6 +47,7 @@ meterPerDegLat = 1852*60.0; ...@@ -17,6 +47,7 @@ meterPerDegLat = 1852*60.0;
meterPerDegLoni = meterPerDegLat .* cosd(LAT_meani); meterPerDegLoni = meterPerDegLat .* cosd(LAT_meani);
meterPerDegLonj = meterPerDegLat .* cosd(LAT_meanj); meterPerDegLonj = meterPerDegLat .* cosd(LAT_meanj);
% Conversion from degrees to meters
dxi = dLONi.*meterPerDegLoni; dxi = dLONi.*meterPerDegLoni;
dxj = dLONj.*meterPerDegLonj; dxj = dLONj.*meterPerDegLonj;
...@@ -27,8 +58,13 @@ dyj = dLATj.*meterPerDegLat; ...@@ -27,8 +58,13 @@ dyj = dLATj.*meterPerDegLat;
deltai = sqrt(dxi.^2 + dyi.^2); deltai = sqrt(dxi.^2 + dyi.^2);
deltaj = sqrt(dxj.^2 + dyj.^2); deltaj = sqrt(dxj.^2 + dyj.^2);
% Overall distance % Adjusting the shape for plotting
delta = sqrt(deltai.^2 + deltaj.^2); deltai = deltai(1:end-1, :);
deltaj = deltaj(:, 1:end-1);
% field of resolution
res = sqrt(deltai.^2 + deltaj.^2);
end end
...@@ -9,7 +9,7 @@ function [h_figure,h_pcolor,h_datetext] = g_viz_field(imgFname,rectFile,varargin ...@@ -9,7 +9,7 @@ function [h_figure,h_pcolor,h_datetext] = g_viz_field(imgFname,rectFile,varargin
% showTime, Default 0, if 1, displays the timestamp of the % showTime, Default 0, if 1, displays the timestamp of the
% image in the figure's title % image in the figure's title
% showLand, Default 0, if 'f' or 'h', displays the land contour % showLand, Default 0, if 'f' or 'h', displays the land contour
% with m_gshhs_f or m_gshhs_f % with m_gshhs_f or m_gshhs_h
% landcolor, Default [241 235 144]/255, Color of the land on the % landcolor, Default [241 235 144]/255, Color of the land on the
% map % map
% %
...@@ -72,8 +72,7 @@ int = int'; ...@@ -72,8 +72,7 @@ int = int';
int = int - nanmean(nanmean(int)); int = int - nanmean(nanmean(int));
figure('Renderer', 'painters', 'Position', [100 100 900 700])
m_proj('mercator','longitudes',[lon_min lon_max],'latitudes',[lat_min lat_max]); m_proj('mercator','longitudes',[lon_min lon_max],'latitudes',[lat_min lat_max]);
hold on; hold on;
...@@ -84,9 +83,11 @@ h = pcolor(X,Y,int); ...@@ -84,9 +83,11 @@ h = pcolor(X,Y,int);
shading('interp'); shading('interp');
% Uncomment one of these lines if you want the coastline to be pltoted. % Uncomment one of these lines if you want the coastline to be plotted.
if show_land if show_land
if strcmpi(show_land,'f') if strcmpi(show_land,'fjord')
m_usercoast('fjord_coastlines.mat', 'patch', land_color)
elseif strcmpi(show_land, 'f')
m_gshhs_f('patch',land_color) m_gshhs_f('patch',land_color)
else else
m_gshhs_h('patch',land_color) m_gshhs_h('patch',land_color)
...@@ -117,8 +118,9 @@ end ...@@ -117,8 +118,9 @@ end
clear LON LAT X Y clear LON LAT X Y
m_grid('box','fancy','fontsize',fs); m_grid_old('box','fancy','fontsize',fs);
%m_gshhs('f','patch', 'gray');
%print('g_rect_drone_1', '-dpng')
if nargout > 1 if nargout > 1
h_figure = gcf; h_figure = gcf;
h_pcolor = h; h_pcolor = h;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment