Index: /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_ini.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_ini.F	(revision 314)
+++ /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_ini.F	(revision 315)
@@ -17,9 +17,9 @@
       tsoil(:,:)=wtsoil(:,:)
       PRINT*,'check: tsoil ',tsoil(1,1),tsoil(ngridmx,nsoilmx)
-     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-     !!!new physics
-      PRINT*,'no variable z0 field for the moment. use z0_default.'
-      z0(:) = z0_default
-      PRINT*, 'check z0 ', z0(1)
+c     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+c     !!!new physics
+c      PRINT*,'no variable z0 field for the moment. use z0_default.'
+c      z0(:) = z0_default
+c      PRINT*, 'check z0 ', z0(1)
       inertiedat(:,:)=wisoil(:,:)
       PRINT*,'check: inert ',inertiedat(1,1),inertiedat(ngridmx,nsoilmx)
Index: /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisini.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisini.F	(revision 314)
+++ /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisini.F	(revision 315)
@@ -83,4 +83,11 @@
         print*,volcapa 
 
+        !
+        ! in surfdat.h
+        !
+        z0(:) = wz0tab(:)
+        print*,"check: z0"
+        print*,z0(1),z0(ngrid)
+
 c*****************************************************
 c Since it comes from WRF settings, we have to
Index: /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisinvar.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisinvar.F	(revision 314)
+++ /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisinvar.F	(revision 315)
@@ -5,5 +5,5 @@
      $           ,wemissiv,wemissiceN,wemissiceS,walbediceN,walbediceS 
      $           ,wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS
-     $           ,walbedodat,wphisfi,wvolcapa 
+     $           ,walbedodat,wphisfi,wvolcapa,wz0tab 
      $           ,wzmea,wzstd,wzsig,wzgam,wzthe
      $           ,wtheta,wpsi
Index: /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisvar.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisvar.F	(revision 314)
+++ /trunk/LMDZ.MARS/libf/phymars/meso_inc/meso_inc_inifisvar.F	(revision 315)
@@ -13,2 +13,3 @@
       REAL wtheta(ngrid),wpsi(ngrid)
       REAL wvolcapa
+      REAL wz0tab(ngrid)
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/geogrid/GEOGRID.TBL.ARW_Mars
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/geogrid/GEOGRID.TBL.ARW_Mars	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/geogrid/GEOGRID.TBL.ARW_Mars	(revision 315)
@@ -121,4 +121,23 @@
         interp_option = gcm:four_pt
         rel_path =      gcm:albedo_GCM/
+===============================
+name = SURF_ROUGHNESS
+        priority = 1
+        dest_type = continuous
+        smooth_option = 1-2-1; smooth_passes=25
+        interp_option =         32ppd:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               32ppd:rough_GCM/
+        interp_option =         32ppd_HRalb:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               32ppd_HRalb:rough_GCM/
+        interp_option =         64ppd:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               64ppd:rough_GCM/
+        interp_option =         64ppd_noHRti:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               64ppd_noHRti:rough_GCM/
+        interp_option =         custom:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               custom:rough_GCM/
+        interp_option =         omega:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               omega:rough_GCM/
+        interp_option =         gcm:sixteen_pt+four_pt+average_4pt+average_16pt+search
+        rel_path=               gcm:rough_GCM/
 #===============================
 #name=LANDUSEF
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/namelist.wps_TEST
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/namelist.wps_TEST	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WPS/wps_mars/namelist.wps_TEST	(revision 315)
@@ -18,6 +18,6 @@
  e_sn              =  61,        !! number of latitude grid points
  geog_data_res     = 'gcm'       !! static data sources: '64ppd','32ppd',... cf.GEOGRID.TBL 
- dx = 20000,                     !! resolution (meters) in the x-dimension	
- dy = 20000,                     !! resolution (meters) in the y-dimension	
+ dx = 50000,                     !! resolution (meters) in the x-dimension	
+ dy = 50000,                     !! resolution (meters) in the y-dimension	
  map_proj = 'mercator',          !! map projection: 'mercator', 'lambert' or 'polar'
  ref_lat   =  -12.,              !! north latitude of the center of the domain 
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM	(revision 315)
@@ -110,5 +110,5 @@
 state  real  HFMAX_TH  ij   misc  1  -  rd   "HFMAX_TH"  "MAXIMUM TH HEAT FLUX"            "m.K/s"   #SAVEMARS2 hfmax_th
 state  real  WMAX_TH   ij   misc  1  -  rd   "WMAX_TH"   "MAXIMUM TH VERTICAL VELOCITY"    "m/s"     #SAVEMARS2 wmax_th
-
+state  real  Z0SET     ij   misc  1  -  rhd  "Z0SET"     "SET SURFACE ROUGHNESS"           "m"       #SAVEMARS2 z0
 
 ####
@@ -194,6 +194,8 @@
 #### variables dans real
 ####
+############# in module_initialize ################# in geo_em.d**.nc ############################################
 state  real   albedo_gcm_gc   ij   dyn_em  1  -  i1  "ALBEDO_GCM"       "albedo of naked ground"  "0 - 1 fraction"
 state  real   therm_inert_gc  ij   dyn_em  1  -  i1  "THERMAL_INERTIA"  "thermal inertia"         "J/m2/K/s0.5"
+state  real   z0_gc           ij   dyn_em  1  -  i1  "SURF_ROUGHNESS"   "surface roughness"       "cm"
 state  real   slpx_gc         ij   dyn_em  1  -  i1  "SLPX"             "slope x direction"       "rad"
 state  real   slpy_gc         ij   dyn_em  1  -  i1  "SLPY"             "slope y direction"       "rad"
@@ -208,6 +210,8 @@
 #### variables dans wrf
 ####
+############# in module_initialize ################## in solve_em and lmd_driver ############################### 
 state  real   albedo_gcm      ij   misc  1  -  i012rd  "MARS_ALB"    "albedo of naked ground"  "0 - 1 fraction"
 state  real   therm_inert     ij   misc  1  -  i012rd  "MARS_TI"     "thermal inertia"         "J/m2/K/s0.5"
+state  real   z0              ij   misc  1  -  i012rd  "MARS_Z0"     "surface roughness"       "cm"
 state  real   slpx            ij   misc  1  -  i012rd  "SLOPEX"      "slope x direction"       "rad"
 state  real   slpy            ij   misc  1  -  i012rd  "SLOPEY"      "slope y direction"       "rad"
@@ -1129,4 +1133,5 @@
 rconfig  real     init_TI   namelist,physics  max_domains  0        irh  "init_TI"   "thermal inertia"         ""
 rconfig  real     init_AL   namelist,physics  max_domains  0        irh  "init_AL"   "albedo"                  ""
+rconfig  real     init_Z0   namelist,physics  max_domains  0        irh  "init_Z0"   "surface roughness"       ""
 rconfig  real     init_U    namelist,physics  max_domains  0        irh  "init_U"    "zonal wind"              ""
 rconfig  real     init_V    namelist,physics  max_domains  0        irh  "init_V"    "meridional wind"         ""
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis1.inc
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis1.inc	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis1.inc	(revision 315)
@@ -16,5 +16,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis2.inc
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis2.inc	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis2.inc	(revision 315)
@@ -19,5 +19,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
@@ -39,5 +39,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis3.inc
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis3.inc	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/call_meso_inifis3.inc	(revision 315)
@@ -19,5 +19,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
@@ -38,5 +38,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
@@ -57,5 +57,5 @@
                wiceradiusN,wiceradiusS,wdtemisiceN,wdtemisiceS,        &
 #ifdef NEWPHYS
-               walbedodat, wphisfi, wvolcapa,                          &
+               walbedodat, wphisfi, wvolcapa, wz0tab,                  &
 #else
                walbedodat, winertiedat, wphisfi,                       &
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F	(revision 315)
@@ -289,4 +289,11 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #ifdef NEWPHYS
+
+              grid%mars_z0(i,j) = 0.
+              grid%mars_z0(i,j) = grid%em_z0_gc(i,j)*0.01  !! in cm in surface.nc but in m in physiq.F
+              !IF (config_flags%init_Z0 .ne. 0.) THEN 
+              !   grid%z0 = grid%z0*0. + config_flags%init_Z0
+              !ENDIF
+
               ! here, that bit is necessary for new soil model !          
               IF (config_flags%init_TI .ne. 0.) THEN
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F	(revision 315)
@@ -866,4 +866,6 @@
      &        ,MARS_ISOIL=grid%mars_isoil       &
      &        ,MARS_DSOIL=grid%mars_dsoil       &
+     &        ,MARS_Z0=grid%mars_z0             &
+     &        ,CST_Z0=config_flags%init_Z0      &
 #endif
      &        ,MARS_GW=grid%mars_gw  &  
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F	(revision 314)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F	(revision 315)
@@ -35,4 +35,6 @@
         MARS_ISOIL, &
         MARS_DSOIL, &
+        MARS_Z0, &
+        CST_Z0, &
 #endif
         MARS_GW, &
@@ -127,6 +129,9 @@
      MARS_TSOIL 
 #ifdef NEWPHYS
+REAL, INTENT(IN  ) :: CST_Z0
 REAL, DIMENSION( ims:ime, NUM_SOIL_LAYERS, jms:jme ), INTENT(IN   )  :: &
      MARS_ISOIL, MARS_DSOIL         
+REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN   )  :: &
+     MARS_Z0
 #endif
 REAL, DIMENSION( ims:ime, 5, jms:jme ), INTENT(IN   )  :: &
@@ -186,4 +191,5 @@
 #ifdef NEWPHYS
    REAL,DIMENSION(:),ALLOCATABLE :: isoil_val, dsoil_val
+   REAL :: z0_val
 #endif
    REAL,DIMENSION(:),ALLOCATABLE :: aire_vec,lat_vec,lon_vec
@@ -195,4 +201,5 @@
    REAL,DIMENSION(:,:),ALLOCATABLE :: wq2,wqsurf,wtsoil 
 #ifdef NEWPHYS
+   REAL,DIMENSION(:),ALLOCATABLE :: wz0tab
    REAL,DIMENSION(:,:),ALLOCATABLE :: wisoil,wdsoil
    CHARACTER*20,DIMENSION(:),ALLOCATABLE :: wtnom
@@ -568,24 +575,29 @@
 !----------!
 ! inputs ...
-ALLOCATE(aire_vec(ngrid))
-ALLOCATE(lon_vec(ngrid))
-ALLOCATE(lat_vec(ngrid))
-ALLOCATE(walbedodat(ngrid))
-ALLOCATE(winertiedat(ngrid))
-ALLOCATE(wphisfi(ngrid))
-ALLOCATE(wzmea(ngrid))
-ALLOCATE(wzstd(ngrid))
-ALLOCATE(wzsig(ngrid))
-ALLOCATE(wzgam(ngrid))
-ALLOCATE(wzthe(ngrid))
-ALLOCATE(wtheta(ngrid))
-ALLOCATE(wpsi(ngrid))
-ALLOCATE(wtsurf(ngrid))
+IF (firstcall .EQV. .true.) THEN
+  ALLOCATE(aire_vec(ngrid))!
+  ALLOCATE(lon_vec(ngrid))!
+  ALLOCATE(lat_vec(ngrid))!
+  ALLOCATE(walbedodat(ngrid))!
+  ALLOCATE(winertiedat(ngrid))!
+  ALLOCATE(wphisfi(ngrid))!
+  ALLOCATE(wzmea(ngrid))!
+  ALLOCATE(wzstd(ngrid))!
+  ALLOCATE(wzsig(ngrid))!
+  ALLOCATE(wzgam(ngrid))!
+  ALLOCATE(wzthe(ngrid))!
+  ALLOCATE(wtheta(ngrid))!
+  ALLOCATE(wpsi(ngrid))!
+#ifdef NEWPHYS
+  ALLOCATE(wz0tab(ngrid))!
+#endif
+ENDIF
+ALLOCATE(wtsurf(ngrid))          !!!!!
 #ifndef NOPHYS
 ALLOCATE(output_tab2d(ngrid,n2d))
 ALLOCATE(output_tab3d(ngrid,nlayer,n3d))
 #endif
-ALLOCATE(wco2ice(ngrid))
-ALLOCATE(wemis(ngrid))
+ALLOCATE(wco2ice(ngrid))         !!!!!
+ALLOCATE(wemis(ngrid))           !!!!!
 ALLOCATE(q2_val(nlayer+1))
 ALLOCATE(qsurf_val(nq))
@@ -595,19 +607,19 @@
 ALLOCATE(dsoil_val(nsoil))
 #endif
-ALLOCATE(wq2(ngrid,nlayer+1))
-ALLOCATE(wqsurf(ngrid,nq)) 
-ALLOCATE(wtsoil(ngrid,nsoil))
-#ifdef NEWPHYS
-ALLOCATE(wisoil(ngrid,nsoil))
-ALLOCATE(wdsoil(ngrid,nsoil))
-#endif
-ALLOCATE(pplev(ngrid,nlayer+1))
-ALLOCATE(pplay(ngrid,nlayer))
-ALLOCATE(pphi(ngrid,nlayer))
-ALLOCATE(pu(ngrid,nlayer))
-ALLOCATE(pv(ngrid,nlayer))
-ALLOCATE(pt(ngrid,nlayer))
-ALLOCATE(pw(ngrid,nlayer))
-ALLOCATE(pq(ngrid,nlayer,nq))
+ALLOCATE(wq2(ngrid,nlayer+1))    !!!!!
+ALLOCATE(wqsurf(ngrid,nq))       !!!!!
+ALLOCATE(wtsoil(ngrid,nsoil))    !!!!!
+#ifdef NEWPHYS
+ALLOCATE(wisoil(ngrid,nsoil))    !!!!!
+ALLOCATE(wdsoil(ngrid,nsoil))    !!!!!
+#endif
+ALLOCATE(pplev(ngrid,nlayer+1))  !!!!!
+ALLOCATE(pplay(ngrid,nlayer))    !!!!!
+ALLOCATE(pphi(ngrid,nlayer))     !!!!!
+ALLOCATE(pu(ngrid,nlayer))       !!!!!
+ALLOCATE(pv(ngrid,nlayer))       !!!!!
+ALLOCATE(pt(ngrid,nlayer))       !!!!!
+ALLOCATE(pw(ngrid,nlayer))       !!!!!
+ALLOCATE(pq(ngrid,nlayer,nq))    !!!!!
 ! interm
 ALLOCATE(dz8w_prof(nlayer))
@@ -624,9 +636,10 @@
 #ifdef NEWPHYS
 ALLOCATE(q_prof(nlayer,nq))
-ALLOCATE(wtnom(nq))
+ALLOCATE(wtnom(nq))              !!!!!
 #else
 ALLOCATE(water_vapor_prof(nlayer))
 ALLOCATE(water_ice_prof(nlayer))
 #endif
+
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -811,4 +824,26 @@
 ENDIF
 
+#ifdef NEWPHYS
+!----------------------------!
+! Variable surface roughness !
+!----------------------------!
+IF (JULYR .ne. 9999) THEN
+ IF (CST_Z0 == 0) THEN 
+   z0_val = MARS_Z0(i,j) 
+ ELSE 
+   z0_val = CST_Z0
+   IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** SET CONSTANT SURF ROUGHNESS (m) ',CST_Z0
+ ENDIF 
+ELSE
+ IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION z0 (m) ', CST_Z0
+ z0_val=CST_Z0
+ENDIF
+!!!! ADDITIONAL SECURITY. THIS MIGHT HAPPEN WITH OLD INIT FILES.
+IF (z0_val == 0.) THEN
+   PRINT *, 'WELL, z0 is 0, this is no good. Setting to old defaults value 0.01 m'
+   z0_val = 0.01
+ENDIF
+#endif
+
 !---------------------------------------------------------!
 ! Ground geopotential                                     !
@@ -935,4 +970,5 @@
 PRINT *,'dsoil ',dsoil_val
 PRINT *,'q_prof ',q_prof
+PRINT *,'z0 ',z0_val
 #endif
 ENDIF
@@ -968,4 +1004,5 @@
 wisoil(subs,:) = isoil_val(:)
 wdsoil(subs,:) = dsoil_val(:)
+wz0tab(subs) = z0_val
 #endif
 wtheta(subs) = theta_val
@@ -1083,4 +1120,7 @@
 DEALLOCATE(wtheta)
 DEALLOCATE(wpsi)
+#ifdef NEWPHYS
+DEALLOCATE(wz0tab)
+#endif
 ENDIF
 
Index: /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/extract.py
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/extract.py	(revision 315)
+++ /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/extract.py	(revision 315)
@@ -0,0 +1,74 @@
+#! /usr/bin/env python
+
+##file:///home/aymeric/Software/epd-7.0-2-rh5-x86/Doc/library/stdtypes.html?highlight=file#file.write
+##file:///home/aymeric/Software/epd-7.0-2-rh5-x86/Doc/library/struct.html?highlight=endian
+
+## marche pas probleme encodage...
+
+from myplot import getfield,definesubplot,smooth
+from netCDF4 import Dataset
+from matplotlib.pyplot import contourf,show,pcolor,subplot,figure
+from numpy import flipud,array,transpose
+from os import sys
+
+print sys.byteorder
+
+charvar = "albedo"
+charvar = "zMOL"
+#charvar = "thermal"
+charvar = "z0"
+
+nc = Dataset("surface.nc")
+
+var = getfield(nc,charvar)*1000.
+var = flipud(var)
+var = smooth(var,10) ##change le type!
+
+tile = 180  # resolution
+
+print var.shape
+
+# Eastern part
+epart = var[0:tile-1,tile:2*tile-1]
+epart = transpose(epart)
+fid = open('00181-00360.00001-00180','wb')
+#fid.write(str(part2))
+#pickle.dump(epart,fid)
+#epart = array(epart,'<h')
+epart = array(epart,dtype='h')
+epart.tofile(fid)
+fid.close()
+#### integer*2
+print epart.itemsize
+
+## Western part
+wpart = var[0:tile-1,0:tile-1]
+wpart = transpose(wpart)
+fid2 = open('00001-00180.00001-00180','wb')
+#fid2.write(str(part))
+#pickle.dump(wpart,fid2)
+#wpart = array(wpart,'<h')
+wpart = array(wpart,dtype='h')
+wpart.tofile(fid2)
+fid2.close()
+
+#fid = open('00181-00360.00001-00180','r')
+#epart = pickle.load(fid)
+#fid.close()
+#
+#fid2 = open('00001-00180.00001-00180','r')
+#wpart = pickle.load(fid2)
+#fid2.close()
+
+fig = figure()
+sub = definesubplot(2,fig)
+
+subplot(sub)
+contourf(epart)
+
+subplot(sub+1)
+contourf(wpart)
+
+show()
+
+
Index: /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/index
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/index	(revision 315)
+++ /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/index	(revision 315)
@@ -0,0 +1,17 @@
+type=continuous
+signed=yes
+projection=regular_ll
+dx=1.
+dy=1.
+known_x = 1.
+known_y = 1.
+known_lat = -90.
+known_lon = -179.5
+wordsize=2
+tile_x=180
+tile_y=180
+tile_z=1
+tile_bdr=0
+scale_factor=0.001
+units="units please"
+description="Surface roughness"
Index: /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/note
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/note	(revision 315)
+++ /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/note	(revision 315)
@@ -0,0 +1,3 @@
+3 albedo
+4 ti
+5 topo
Index: /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/rough_build.m
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/rough_build.m	(revision 315)
+++ /trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/rough_GCM/rough_build.m	(revision 315)
@@ -0,0 +1,53 @@
+#! /usr/bin/octave -qf
+
+# -----------------------------------------------
+# albedo_build.m					
+#   Script to be used with GNU-Octave
+#   > For NETCDF support, get 'octave-forge' pckg octcdf (install headers before)
+#   and install it in octave with 'pkg install octcdf-1.0.11.tar.gz'
+#   (you also need libnetcdf-dev)
+# -----------------------------------------------
+# Purpose:
+#   Surface albedo GCM NETCDF input
+#	>> WRF geogrid tiles
+# Author:
+#   A. Spiga - 03/2007
+# -----------------------------------------------
+
+# Locate NETCDF file
+filename = 'surface.nc';
+resolution = 180;
+
+# Open NETCDF file - read-only
+nc = netcdf('surface.nc','r')
+
+# Read ...
+# Surface albedo
+nv = ncvar(nc){6};
+albedo = nv(:);
+size(albedo)
+
+# Flip North/South 
+albedo = flipud(albedo);
+#albedo = fliplr(albedo);
+# Scale factor: 100
+albedo = 1000.*albedo;
+
+
+# Create 2 WRF data tiles for geogrid
+tile=resolution;
+	# Eastern part
+	part2 = albedo(1:1:tile,tile+1:1:2*tile)';
+	fid = fopen('00181-00360.00001-00180','wb','b');
+	fwrite(fid,part2,'integer*2');
+
+	# Western part
+	part = albedo(1:1:tile,1:1:tile)';
+	fid = fopen('00001-00180.00001-00180','wb','b');
+	fwrite(fid,part,'integer*2');
+
+# Check the resulting arrays
+yeah = part(1:1:tile,1:1:tile);
+yeah2 = part2(1:1:tile,1:1:tile);
+contour(yeah)
+#contour(yeah2)
Index: /trunk/MESOSCALE_DEV/MANUAL/SRC/advance.tex
===================================================================
--- /trunk/MESOSCALE_DEV/MANUAL/SRC/advance.tex	(revision 314)
+++ /trunk/MESOSCALE_DEV/MANUAL/SRC/advance.tex	(revision 315)
@@ -130,3 +130,6 @@
 %%[set to 18 for newphys]
 
+%% attention init_TI n'est plus sÃparable... il faut run real.exe a cause du modele sous surface
+%% il faut ajouter init_Z0 ! ou il n'y a pas besoin de re executer real.exe
+
 \clearemptydoublepage
Index: /trunk/MESOSCALE_DEV/MANUAL/SRC/guide.tex
===================================================================
--- /trunk/MESOSCALE_DEV/MANUAL/SRC/guide.tex	(revision 314)
+++ /trunk/MESOSCALE_DEV/MANUAL/SRC/guide.tex	(revision 315)
@@ -120,4 +120,6 @@
 \end{finger}
 
+%%%% FRESH START OPTION WITH runmeso
+
 %\mk
 %\section{Examples of parameter files}
Index: /trunk/MESOSCALE_DEV/MANUAL/SRC/postproc.tex
===================================================================
--- /trunk/MESOSCALE_DEV/MANUAL/SRC/postproc.tex	(revision 314)
+++ /trunk/MESOSCALE_DEV/MANUAL/SRC/postproc.tex	(revision 315)
@@ -31,4 +31,5 @@
 \sk
 Each change in \ttt{Registry.EM} must be followed by a complete recompilation because the model variables have changed. Whether you use \ttt{makemeso} or \ttt{runmeso}, use the option \ttt{-r} to force recompiling with a new/updated list of variables.
+%%%% now obsolete ! remove Registry and recompile, or use fresh start (-f).
 
 \sk
