diff --git a/src/g_rect/g_res_field.m b/src/g_rect/g_res_field.m index 66950208890aa90a1eb2ccbe8d389575d2fa33df..51010f70be8c411828f7086e63b53246a8e26563 100644 --- a/src/g_rect/g_res_field.m +++ b/src/g_rect/g_res_field.m @@ -1,4 +1,34 @@ -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 dLATi = diff(LAT, 1, 2); @@ -17,6 +47,7 @@ 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; @@ -27,8 +58,13 @@ dyj = dLATj.*meterPerDegLat; deltai = sqrt(dxi.^2 + dyi.^2); deltaj = sqrt(dxj.^2 + dyj.^2); -% Overall distance -delta = sqrt(deltai.^2 + deltaj.^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 diff --git a/src/g_rect/g_viz_field.m b/src/g_rect/g_viz_field.m index 688870282dba1800b25b22c67ba189d8bf46f505..b1d3754dc224f88cb7144c7ae5a3b9fa1d6bbcb3 100644 --- a/src/g_rect/g_viz_field.m +++ b/src/g_rect/g_viz_field.m @@ -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 % image in the figure's title % 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 % map % @@ -72,8 +72,7 @@ int = 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]); hold on; @@ -84,9 +83,11 @@ h = pcolor(X,Y,int); 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 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) else m_gshhs_h('patch',land_color) @@ -117,8 +118,9 @@ end 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 h_figure = gcf; h_pcolor = h;