From 8aedf8aae4da4ea44feefb1f876542f7e3771ef6 Mon Sep 17 00:00:00 2001 From: Gael Alory <gael.alory@legos.obs-mip.fr> Date: Thu, 8 Oct 2009 14:44:16 +0000 Subject: [PATCH] gestion de la carte pour les tours du monde --- tsg_util/plot_map.m | 20 ++++++++++++++------ tsg_util/updateTsgStruct.m | 5 ++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tsg_util/plot_map.m b/tsg_util/plot_map.m index 33922e4..cd7ec46 100644 --- a/tsg_util/plot_map.m +++ b/tsg_util/plot_map.m @@ -31,20 +31,28 @@ ind = find( tsg.DAYD >= dateLim(1) & tsg.DAYD <= dateLim(2)); if ~isempty( ind ) - latMin = min( tsg.LATX(ind) ) - 2; + latMin = min( tsg.LATX(ind) ); if latMin < -90 latMin = -90; end - latMax = max( tsg.LATX(ind) ) + 2; + latMax = max( tsg.LATX(ind) ); if latMax > 90 latMax = 90; end - lonMin = min( tsg.LONX(ind) ) - 2; - lonMax = max( tsg.LONX(ind) ) + 2; + lonMin = min( tsg.LONX(ind) ); + lonMax = max( tsg.LONX(ind) ); + + %oversize window due to the large frame + %-------------------------------------- + latRange = (latMax-latMin); + latMin = max(latMin - 0.05*latRange, -90); + latMax = min(latMax + 0.05*latRange, 90); if lonMax > (lonMin+360) - lonMin = 0; - lonMax = 360; + lonMax = lonMin+360; end + lonRange = (lonMax-lonMin); + lonMin = lonMin - 0.03*lonRange; + lonMax = lonMax + 0.03*lonRange; % Positionning the right axes % ---------------------------- diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m index c104410..0bad867 100644 --- a/tsg_util/updateTsgStruct.m +++ b/tsg_util/updateTsgStruct.m @@ -32,8 +32,7 @@ NO_CONTROL = s.code; % Suppress longitude discontinuity at -180 or 180 crossing % -------------------------------------------------------- deflon=find(isfinite(tsg.LONX)); -dlon=circshift(tsg.LONX(deflon),-1)-tsg.LONX(deflon); -dlon=dlon(1:end-1); +dlon=diff(tsg.LONX(deflon)); tsg.indcross=find(abs(dlon)>180); if ~isempty(tsg.indcross) tsg.loncross=sign(dlon(tsg.indcross))*360; @@ -47,7 +46,7 @@ end % ----------------------------------------------------------------- tsg.SOUTH_LATX = min(tsg.LATX); tsg.NORTH_LATX = max(tsg.LATX); -if max(tsg.LONX)>(min(tsg.LONX)+360) +if (max(tsg.LONX)-min(tsg.LONX))>360 tsg.WEST_LONX = -180; tsg.EAST_LONX = 180; else -- GitLab