From 240ec758f4cd27feb7231aa4e0ed2eab91f8e2f2 Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Wed, 12 Sep 2018 13:57:38 +0000
Subject: [PATCH] shift half a grid point for climatology on map when using
 m_pcolor

---
 ReleaseNotes        | 1 +
 tsg_util/plot_map.m | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ReleaseNotes b/ReleaseNotes
index a6e3a7f..e6c3c13 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -10,6 +10,7 @@ v1.48.5rc4 (2018-09-12)
 + add print preview and print menu command on map
 + add hypertext link in Command Window to download climatology file when is missing
 + add print/saveas menu on map with jpeg, png and epsc format
++ shift half a grid point for climatology on map when using m_pcolor
 
 v1.48.5rc2 (2018-09-06)
 + regression on labview read file: the use of lat_dec and lon_dec by default 
diff --git a/tsg_util/plot_map.m b/tsg_util/plot_map.m
index aaae1b7..0395f18 100644
--- a/tsg_util/plot_map.m
+++ b/tsg_util/plot_map.m
@@ -129,7 +129,11 @@ if ~isempty( ind )
     
     % plot 2D climatogogy on map
     if strcmp(tsg.preference.map_climatology, 'on')
-      m_pcolor(lon, lat, climato(indLat, indLon));
+      % We shift half a grid point
+      dx = mean(diff(lon));
+      dy = mean(diff(lat)); 
+      m_pcolor(lon-dx/2,lat-dy/2, climato(indLat, indLon))
+      %m_pcolor(lon, lat, climato(indLat, indLon));
       shading flat;
       %colormap(m_colmap('jet','step',10));
       colorbar;
-- 
GitLab