Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1505)
+++ trunk/LMDZ.GENERIC/README	(revision 1507)
@@ -1109,2 +1109,7 @@
 == 13/11/2015 == MT
 - Spectral Snow Albebdo implemented in the code.
+
+== 13/01/2016 == EM
+- Fix/improvement on planetwide_min/max/sum for the 3D fields which assumed the vertical dimension to be klev.
+  Now works for any (klon,...) field (e.g. albedo).
+
Index: trunk/LMDZ.GENERIC/libf/phystd/planetwide_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/planetwide_mod.F90	(revision 1505)
+++ trunk/LMDZ.GENERIC/libf/phystd/planetwide_mod.F90	(revision 1507)
@@ -50,11 +50,11 @@
 
   subroutine planetwide_maxval_i2(values,values_max)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  integer,intent(in) :: values(:,:) ! local grid (klon,klev)
-  integer,intent(out) :: values_max
-#ifdef CPP_PARA
-  integer :: values_glo(klon_glo,klev) ! global grid
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  integer,intent(in) :: values(:,:) ! local grid (klon,...)
+  integer,intent(out) :: values_max
+#ifdef CPP_PARA
+  integer :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
@@ -94,11 +94,11 @@
 
   subroutine planetwide_maxval_r2(values,values_max)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  real,intent(in) :: values(:,:) ! local grid (klon,klev)
-  real,intent(out) :: values_max
-#ifdef CPP_PARA
-  real :: values_glo(klon_glo,klev) ! global grid
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  real,intent(in) :: values(:,:) ! local grid (klon,...)
+  real,intent(out) :: values_max
+#ifdef CPP_PARA
+  real :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
@@ -140,11 +140,11 @@
 
   subroutine planetwide_minval_i2(values,values_max)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  integer,intent(in) :: values(:,:) ! local grid (klon,klev)
-  integer,intent(out) :: values_max
-#ifdef CPP_PARA
-  integer :: values_glo(klon_glo,klev) ! global grid
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  integer,intent(in) :: values(:,:) ! local grid (klon,...)
+  integer,intent(out) :: values_max
+#ifdef CPP_PARA
+  integer :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
@@ -184,11 +184,11 @@
 
   subroutine planetwide_minval_r2(values,values_max)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  real,intent(in) :: values(:,:) ! local grid (klon,klev)
-  real,intent(out) :: values_max
-#ifdef CPP_PARA
-  real :: values_glo(klon_glo,klev) ! global grid
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  real,intent(in) :: values(:,:) ! local grid (klon,...)
+  real,intent(out) :: values_max
+#ifdef CPP_PARA
+  real :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
@@ -230,11 +230,11 @@
 
   subroutine planetwide_sumval_i2(values,values_sum)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  integer,intent(in) :: values(:,:) ! local grid (klon,klev)
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  integer,intent(in) :: values(:,:) ! local grid (klon,...)
   integer,intent(out) :: values_sum
 #ifdef CPP_PARA
-  integer :: values_glo(klon_glo,klev) ! global grid
+  integer :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
@@ -274,11 +274,11 @@
 
   subroutine planetwide_sumval_r2(values,values_sum)
-  use dimphy, only: klon, klev
-  use mod_grid_phy_lmdz, only : klon_glo
-  implicit none
-  real,intent(in) :: values(:,:) ! local grid (klon,klev)
+  use dimphy, only: klon
+  use mod_grid_phy_lmdz, only : klon_glo
+  implicit none
+  real,intent(in) :: values(:,:) ! local grid (klon,...)
   real,intent(out) :: values_sum
 #ifdef CPP_PARA
-  real :: values_glo(klon_glo,klev) ! global grid
+  real :: values_glo(klon_glo,size(values,2)) ! global grid
   
   ! gather field on master:
