Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1469)
+++ trunk/LMDZ.GENERIC/README	(revision 1470)
@@ -1075,2 +1075,10 @@
 - Return to a previous interpolation scheme for pmid and tmid in callcorrk.
 
+== 16/09/2015 == EM
+- reorganizing the "datadir" structure: aerosol properties should now be in 
+  subdirectory 'aerosol_properties' of datadir, and surface.nc files should
+  be in subdirectory 'surface_data'. These subdirectory names are stored in
+  module datafile_mod.
+- Made things retro-compatible so that using an 'old' datadir structure (ie.
+  aerosol properties files and surface files in datadir) still works.
+
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/datareadnc.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/datareadnc.F	(revision 1469)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/datareadnc.F	(revision 1470)
@@ -42,5 +42,5 @@
 c=======================================================================
 
-      use datafile_mod, only: datadir
+      use datafile_mod, only: datadir, surfdir
 ! to use  'getin'
       USE ioipsl_getincom 
@@ -94,5 +94,4 @@
       CHARACTER*20 string
       DIMENSION string(4)
-
 !#include "fxyprim.h"
 
@@ -106,10 +105,19 @@
 c    Lecture NetCDF des donnees latitude et longitude
 c-----------------------------------------------------------------------
-      ierr = NF_OPEN (trim(datadir)//'/'//trim(adjustl(filename)),
-     &  NF_NOWRITE,unit)
+      ierr = NF_OPEN (trim(datadir)//'/'//trim(surfdir)//'/'//
+     &                trim(adjustl(filename)),
+     &                NF_NOWRITE,unit)
+      IF (ierr.NE.NF_NOERR) THEN
+        ! In ye old days this file was stored in datadir;
+        ! let's be retro-compatible
+        ierr = NF_OPEN (trim(datadir)//'/'//
+     &                trim(adjustl(filename)),
+     &                NF_NOWRITE,unit)
+        
+      ENDIF
       IF (ierr.NE.NF_NOERR) THEN
         write(*,*)'Error : cannot open file '//trim(filename)
         write(*,*)'(in phystd/datareadnc.F)'
-        write(*,*)'It should be in :',trim(datadir),'/'
+        write(*,*)'It should be in :',trim(datadir),'/',trim(surfdir)
         write(*,*)'Check that your path to datagcm:',trim(datadir)
         write(*,*)' is correct. You can change it in callphys.def with:'
@@ -117,5 +125,6 @@
         write(*,*)'If necessary surface.nc (and other datafiles)'
         write(*,*)' can be obtained online on:'
-        write(*,*)' http://www.lmd.jussieu.fr/~forget/datagcm/datafile'
+        write(*,*)' http://www.lmd.jussieu.fr/~lmdz/planets/'//
+     &             'LMDZ.GENERIC/datagcm/'
         STOP
       ENDIF
Index: trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/newstart.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/newstart.F	(revision 1469)
+++ trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/newstart.F	(revision 1470)
@@ -21,5 +21,5 @@
      &                     zmea, zstd, zsig, zgam, zthe
       USE comgeomfi_h, ONLY: lati, long, area
-      use datafile_mod, only: datadir
+      use datafile_mod, only: datadir, surfdir
 ! to use  'getin'
 !      USE ioipsl_getincom, only: getin
@@ -498,5 +498,10 @@
         call getin_p("datadir",datadir)
         write(*,*) 'Available surface data files are:'
-        filestring='ls '//trim(datadir)//' | grep .nc'
+        filestring='ls '//trim(datadir)//'/'//
+     &                    trim(surfdir)//' | grep .nc'
+        call system(filestring)
+        ! but in ye old days these files were in datadir, so scan it as well
+        ! for the sake of retro-compatibility
+        filestring='ls '//trim(datadir)//'/'//' | grep .nc'
         call system(filestring)
 
Index: trunk/LMDZ.GENERIC/libf/phystd/datafile_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/datafile_mod.F90	(revision 1469)
+++ trunk/LMDZ.GENERIC/libf/phystd/datafile_mod.F90	(revision 1470)
@@ -1,7 +1,8 @@
 !-----------------------------------------------------------------------
       module datafile_mod
-!  Address of the directory containing tables of data needed by the UCM
+!  Address of the directory containing tables of data needed by the GCM
       implicit none
 
+      ! Main directory: 'datadir':
       ! Default for Berserker @ UChicago:
 !      character(len=300) :: datadir='/home/rwordsworth/datagcm'
@@ -9,5 +10,13 @@
 !      character(len=300) :: datadir='/san/home/rdword/gcm/datagcm'
       ! Default for LMD machines:
-      character(len=300) :: datadir='/u/rwlmd/datagcm'
+      character(len=300) :: datadir='/u/lmdz/WWW/planets/LMDZ.GENERIC/datagcm'
+      
+      ! Subdirectories of 'datadir':
+      
+      ! surfdir stores planetary topography, albedo, etc. (surface.nc files)
+      character(len=12),parameter :: surfdir="surface_data"
+      
+      ! aerdir stores aerosol properties files (optprop_*dat files)
+      character(LEN=18),parameter :: aerdir="aerosol_properties" 
 
       end module datafile_mod
Index: trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 1469)
+++ trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 1470)
@@ -4,5 +4,5 @@
       use radinc_h,    only: L_NSPECTI,L_NSPECTV,nsizemax,iim,jjm,naerkind
       use radcommon_h, only: blamv,blami,lamrefir,lamrefvis
-      use datafile_mod, only: datadir
+      use datafile_mod, only: datadir, aerdir
 
       ! outputs
@@ -205,11 +205,29 @@
 
 !$OMP MASTER
-            INQUIRE(FILE=TRIM(datadir)//&
-         '/'//TRIM(file_id(iaer,idomain)),&
-            EXIST=file_ok)
+            INQUIRE(FILE=TRIM(datadir)//'/'//TRIM(aerdir)//&
+                    '/'//TRIM(file_id(iaer,idomain)),&
+                    EXIST=file_ok)
+            IF (file_ok) THEN
+              OPEN(UNIT=file_unit,&
+                   FILE=TRIM(datadir)//'/'//TRIM(aerdir)//&
+                        '/'//TRIM(file_id(iaer,idomain)),&
+                   FORM='formatted')
+            ELSE
+             ! In ye old days these files were stored in datadir;
+             ! let's be retro-compatible
+              INQUIRE(FILE=TRIM(datadir)//&
+                      '/'//TRIM(file_id(iaer,idomain)),&
+                      EXIST=file_ok)
+              IF (file_ok) THEN
+                OPEN(UNIT=file_unit,&
+                     FILE=TRIM(datadir)//&
+                          '/'//TRIM(file_id(iaer,idomain)),&
+                     FORM='formatted')
+              ENDIF              
+            ENDIF
             IF(.NOT.file_ok) THEN
                write(*,*)'suaer_corrk: Problem opening ',&
                TRIM(file_id(iaer,idomain))
-               write(*,*)'It should be in: ',TRIM(datadir)
+               write(*,*)'It should be in: ',TRIM(datadir)//'/'//TRIM(aerdir)
                write(*,*)'1) You can set this directory address ',&
                'in callphys.def with:'
@@ -220,11 +238,7 @@
                write(*,*)' can be obtained online at:'
                write(*,*)' http://www.lmd.jussieu.fr/',&
-               '~forget/datagcm/datafile'
+               '~lmdz/planets/LMDZ.GENERIC/datagcm/'
                CALL ABORT 
             ENDIF
-            OPEN(UNIT=file_unit,&
-            FILE=TRIM(datadir)//&
-         '/'//TRIM(file_id(iaer,idomain)),&
-            FORM='formatted')
 
 !     1.2 Allocate the optical property table
