Index: /trunk/src/cm_tropflux.pro
===================================================================
--- /trunk/src/cm_tropflux.pro	(revision 40)
+++ /trunk/src/cm_tropflux.pro	(revision 40)
@@ -0,0 +1,29 @@
+;+
+;
+; .. _cm_tropflux.pro:
+;
+; ===============
+; cm_tropflux.pro
+; ===============
+;
+; DESCRIPTION
+; ===========
+;
+; define commons for TROPFLUX 
+;
+; SEE ALSO
+; ========
+;
+; :ref:`tropflux_init.pro`
+;
+; EVOLUTIONS
+; ==========
+;
+; $Id$
+;
+; - fplod 20110411T082258Z cratos.locean-ipsl.upmc.fr (Linux)
+;
+;   * creation
+;
+;-
+COMMON tropflux, tropflux_env, tropflux_id_env, tropflux_od_env
Index: /trunk/src/interp_erai_t2m_1989_2009.pro
===================================================================
--- /trunk/src/interp_erai_t2m_1989_2009.pro	(revision 39)
+++ /trunk/src/interp_erai_t2m_1989_2009.pro	(revision 40)
@@ -71,4 +71,5 @@
 ; ::
 ;
+;  IDL> @tropflux_init
 ;  IDL> .compile file_interp
 ;  IDL> interp_erai_t2m_1989_2009
@@ -161,10 +162,13 @@
 pro interp_erai_t2m_1989_2009
 ;
-@common
+@cm_4cal
+@cm_4data
+@cm_4mesh
+@cm_4data
+@cm_tropflux
 ;
 ; check for input directory
 ;
 ; test if ${TROPFLUX_ID} defined
-tropflux_id_env=GETENV('TROPFLUX_ID')
 CASE tropflux_id_env OF
     ''  :  BEGIN
@@ -211,5 +215,4 @@
 ;
 ; test if ${TROPFLUX_OD} defined
-tropflux_od_env=GETENV('TROPFLUX_OD')
 CASE tropflux_od_env OF
   '' : BEGIN
Index: unk/src/oaflux_mask_30N30S.pro
===================================================================
--- /trunk/src/oaflux_mask_30N30S.pro	(revision 39)
+++ 	(revision )
@@ -1,215 +1,0 @@
-;+
-;
-; .. _oaflux_mask_30N30S.pro:
-;
-; =================================================================
-; oaflux_mask_30N30S.pro -- OAFLUX mask over global tropical oceans
-; =================================================================
-;
-; Produce a NetCDF file with OAFLUX mask over global tropical oceans (30N-30S)
-;
-; .. note::
-;
-;    Longitude range [30.5,379.5] was choosen in order not to make any cut in
-;    the Atlantic Ocean.
-;    Otherwise if we choose longitude range to [0.5,359.5], Atlantic Ocean
-;    will be split to two and will appear on right and left sides of the map.
-;
-; .. graphviz::
-;
-;    digraph oaflux_mask_30N30S {
-;       graph [
-;       rankdir="LR",
-;       ]
-;       file_oaflux [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/lh_oaflux_2004.nc"];
-;       mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/mask_oaflux_30N30S.nc"];
-;
-;       oaflux_mask_30N30S [shape=box,
-;       fontname=Courier,
-;       color=blue,
-;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/oaflux_mask_30N30S.pro",
-;       label="${TROPFLUX}/src/oaflux_mask_30N30S.pro"];
-;
-;       {file_oaflux} -> {oaflux_mask_30N30S} -> {mask}
-;
-;      }
-;
-; SEE ALSO
-; ========
-;
-; :ref:`guide Gather data <gather_data>`
-;
-; :ref:`guide data OAFLUX <data_in_oaflux>`
-;
-; :ref:`tropflux_profile.sh`
-;
-; :ref:`get_oaflux.sh`
-;
-; :func:`report <saxo:report>`
-; :func:`initncdf <saxo:initncdf>`
-; :func:`ncdf_lec <saxo:ncdf_lec>`
-; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
-; :func:`isadirectory <saxo:isadirectory>`
-; :func:`isafile <saxo:isafile>`
-;
-; :ref:`TropFlux_19890101_20091231.pro`
-; :ref:`interp_erai_dewt_1989_2009.pro`
-; :ref:`interp_erai_lwr_1989_2009.pro`
-; :ref:`interp_erai_sst_1989_2009.pro`
-; :ref:`interp_erai_t2m_1989_2009.pro`
-; :ref:`interp_erai_ws_1989_2009.pro`
-; :ref:`interp_olr_30n30s_1989_2009.pro`
-;
-; EXAMPLES
-; ========
-;
-; ::
-;
-;  IDL> oaflux_mask_30N30S
-;
-; TODO
-; ====
-;
-; SAXO new (keep compatibility false)
-;
-; coding rules
-;
-; pro -> function
-;
-; NetCDF CF (may be area_type)
-;
-; global attributes corrections :
-;  - written now : OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N
-;  - while data latitude=[-29.5,+29.5] longitude=[30.5,379.5]
-;
-; KNOWN ISSUES
-; ============
-;
-; test of existence of fullfilename_in not very efficient because
-; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented
-;
-; EVOLUTIONS
-; ==========
-;
-; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin)
-;
-;   * remove hard coded directory - usage of ${TROPFLUX_ID} and ${TROPFLUX_OD}
-;   * add IO test
-;
-; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin)
-;
-;   * minimal header
-;
-; - jv 2010
-;
-;   * creation
-;
-;-
-;
-PRO oaflux_mask_30N30S
-;
-@common
-;
-; check for input file
-;
-; test if ${TROPFLUX_ID} defined
-tropflux_id_env=GETENV('TROPFLUX_ID')
-CASE tropflux_id_env OF
-    ''  :  BEGIN
-     msg = 'eee : ${TROPFLUX_ID} is not defined'
-     ras = report(msg)
-     STOP
-           END
- ELSE: BEGIN
-     msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env
-     ras = report(msg)
-       END
-ENDCASE
-;
-iodirin = isadirectory(tropflux_id_env)
-;
-; existence and protection of ${TROPFLUX_ID}
-IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN
-   msg = 'eee : the directory' + iodirin  + ' is not accessible.'
-   ras = report(msg)
-   STOP
-ENDIF
-;
-; build input filename
-yyyy=2004
-cy=string(yyyy,format='(i4.4)')
-filename_in='lh_oaflux_'+cy+'.nc'
-;
-; check if this file exists
-fullfilename_in = isafile(iodirin + filename_in, NEW=0, /MUST_EXIST)
-IF fullfilename_in[0] EQ '' THEN BEGIN
-   msg = 'eee : the file ' + fullfilename_in + ' was not found.'
-   ras = report(msg)
-   STOP
-ENDIF
-;
-; test if ${TROPFLUX_OD} defined
-tropflux_od_env=GETENV('TROPFLUX_OD')
-CASE tropflux_od_env OF
-  '' : BEGIN
-   msg = 'eee : ${TROPFLUX_OD} is not defined'
-   ras = report(msg)
-   STOP
-       END
-ELSE: BEGIN
-   msg = 'iii : ${TROPFLUX_OD} is ' + tropflux_od_env
-   ras = report(msg)
-        END
-ENDCASE
-;
-; check if output data will be possible
-iodirout = isadirectory(tropflux_od_env)
-;
-; existence and protection
-IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN
-   msg = 'eee : the directory' + iodirout  + ' was not found.'
-   ras = report(msg)
-   STOP
-ENDIF
-;
-fullfilename_out=iodirout+'mask_oaflux_30N30S.nc'
-; in order to avoid unexpected overwritten
-IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN
-   msg = 'eee : the file ' + fullfilename_out  + ' already exists.'
-   ras = report(msg)
-   STOP
-ENDIF
-;
-; Read oaflux grid and mask
-initncdf, fullfilename_in
-lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh)
-valmask=1.e20
-ind=where(lh ge 32000,compl=nind) & lh(ind)=valmask & lh(nind)=-0.1*lh(nind)
-mask_out=(lh ne valmask)
-domdef, 0.,360.,-30.,30.
-
-lon=reform(glamt(*,0))
-ind1=where(lon le 20.)
-ind2=where(lon ge 30.)
-
-lat_out=reform(gphit(0,firstyt:lastyt))
-
-lon_out=[reform(glamt(ind2,0)),reform(glamt(ind1,0))+360]
-
-mask_out=mask_out([ind2,ind1],firstyt:lastyt)*1.
-
-
-ncfile='!'+fullfilename_out
-lon_attr={units:'degrees_east',long_name:'Longitude'}
-lat_attr={units:'degrees_north',long_name:'Latitude'}
-msk_attr={long_name:'land sea mask',short_name:'msk',axis:'YX'}
-globattr={description:'OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N'}
-
-ncfields = 'msk[longitude,latitude]=mask_out:msk_attr; ' $
-                      + 'longitude[]=lon_out:lon_attr; ' $
-                      + 'latitude[]=lat_out:lat_attr; ' $
-                      + ' @ globattr'
-
-@ncdf_quickwrite
-
-END
Index: /trunk/src/oaflux_mask_30n30s.pro
===================================================================
--- /trunk/src/oaflux_mask_30n30s.pro	(revision 40)
+++ /trunk/src/oaflux_mask_30n30s.pro	(revision 40)
@@ -0,0 +1,181 @@
+;+
+;
+; .. _oaflux_mask_30n30s.pro:
+;
+; =================================================================
+; oaflux_mask_30n30s.pro -- OAFLUX mask over global tropical oceans
+; =================================================================
+;
+; Produce a NetCDF file with OAFLUX mask over global tropical oceans (30N-30S)
+;
+; .. note::
+;
+;    Longitude range [30.5,379.5] was choosen in order not to make any cut in
+;    the Atlantic Ocean.
+;    Otherwise if we choose longitude range to [0.5,359.5], Atlantic Ocean
+;    will be split to two and will appear on right and left sides of the map.
+;
+; .. graphviz::
+;
+;    digraph oaflux_mask_30n30s {
+;       graph [
+;       rankdir="LR",
+;       ]
+;       file_oaflux [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/lh_oaflux_2004.nc"];
+;       mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/mask_oaflux_30N30S.nc"];
+;
+;       oaflux_mask_30n30s [shape=box,
+;       fontname=Courier,
+;       color=blue,
+;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/oaflux_mask_30n30s.pro",
+;       label="${TROPFLUX}/src/oaflux_mask_30n30s.pro"];
+;
+;       {file_oaflux} -> {oaflux_mask_30n30s} -> {mask}
+;
+;      }
+;
+; SEE ALSO
+; ========
+;
+; :ref:`guide Gather data <gather_data>`
+;
+; :ref:`guide data OAFLUX <data_in_oaflux>`
+;
+; :ref:`tropflux_profile.sh`
+; :ref:`tropflux_init.pro`
+; :ref:`cm_tropflux.pro`
+;
+; :ref:`get_oaflux.sh`
+;
+; :func:`report <saxo:report>`
+; :func:`initncdf <saxo:initncdf>`
+; :func:`ncdf_lec <saxo:ncdf_lec>`
+; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
+; :func:`isadirectory <saxo:isadirectory>`
+; :func:`isafile <saxo:isafile>`
+;
+; :ref:`TropFlux_19890101_20091231.pro`
+; :ref:`interp_erai_dewt_1989_2009.pro`
+; :ref:`interp_erai_lwr_1989_2009.pro`
+; :ref:`interp_erai_sst_1989_2009.pro`
+; :ref:`interp_erai_t2m_1989_2009.pro`
+; :ref:`interp_erai_ws_1989_2009.pro`
+; :ref:`interp_olr_30n30s_1989_2009.pro`
+;
+; EXAMPLES
+; ========
+;
+; ::
+;
+;  IDL> @tropflux_init
+;  IDL> oaflux_mask_30n30s
+;
+; TODO
+; ====
+;
+; SAXO new (keep compatibility false)
+;
+; coding rules
+;
+; pro -> function
+;
+; NetCDF CF (may be area_type)
+;
+; global attributes corrections :
+;  - written now : OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N
+;  - while data latitude=[-29.5,+29.5] longitude=[30.5,379.5]
+;
+; KNOWN ISSUES
+; ============
+;
+; test of existence of fullfilename_in not very efficient because
+; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented
+;
+; EVOLUTIONS
+; ==========
+; 
+; $ID$
+;
+; - fplod 20110411T140133Z aedon.locean-ipsl.upmc.fr (Darwin)
+;
+;   * usage of tropflux_init and cm_tropflux
+;   * replace 30N30S by 30n30s
+; 
+; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin)
+;
+;   * remove hard coded directory - usage of ${TROPFLUX_ID} and ${TROPFLUX_OD}
+;   * add IO test
+;
+; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin)
+;
+;   * minimal header
+;
+; - jv 2010
+;
+;   * creation
+;
+;-
+;
+PRO oaflux_mask_30n30s
+;
+@cm_4cal
+@cm_4data
+@cm_4mesh
+@cm_4data
+@cm_tropflux
+
+; check for input file
+; build input filename
+yyyy=2004
+cy=string(yyyy,format='(i4.4)')
+filename_in='lh_oaflux_'+cy+'.nc'
+;
+; check if this file exists
+fullfilename_in = isafile(tropflux_id_env + filename_in, NEW=0, /MUST_EXIST)
+IF fullfilename_in[0] EQ '' THEN BEGIN
+   msg = 'eee : the file ' + fullfilename_in + ' was not found.'
+   ras = report(msg)
+   STOP
+ENDIF
+;
+;
+fullfilename_out=tropflux_od_env+'mask_oaflux_30N30S.nc'
+; in order to avoid unexpected overwritten
+IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN
+   msg = 'eee : the file ' + fullfilename_out  + ' already exists.'
+   ras = report(msg)
+   STOP
+ENDIF
+;
+; Read oaflux grid and mask
+initncdf, fullfilename_in
+lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh)
+valmask=1.e20
+ind=where(lh ge 32000,compl=nind) & lh(ind)=valmask & lh(nind)=-0.1*lh(nind)
+mask_out=(lh ne valmask)
+domdef, 0.,360.,-30.,30.
+
+lon=reform(glamt(*,0))
+ind1=where(lon le 20.)
+ind2=where(lon ge 30.)
+
+lat_out=reform(gphit(0,firstyt:lastyt))
+
+lon_out=[reform(glamt(ind2,0)),reform(glamt(ind1,0))+360]
+
+mask_out=mask_out([ind2,ind1],firstyt:lastyt)*1.
+
+ncfile='!'+fullfilename_out
+lon_attr={units:'degrees_east',long_name:'Longitude'}
+lat_attr={units:'degrees_north',long_name:'Latitude'}
+msk_attr={long_name:'land sea mask',short_name:'msk',axis:'YX'}
+globattr={description:'OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N'}
+
+ncfields = 'msk[longitude,latitude]=mask_out:msk_attr; ' $
+                      + 'longitude[]=lon_out:lon_attr; ' $
+                      + 'latitude[]=lat_out:lat_attr; ' $
+                      + ' @ globattr'
+
+@ncdf_quickwrite
+
+END
Index: /trunk/src/tropflux_init.pro
===================================================================
--- /trunk/src/tropflux_init.pro	(revision 39)
+++ /trunk/src/tropflux_init.pro	(revision 40)
@@ -1,3 +1,5 @@
 ;+
+;
+; .. _tropflux_init.pro:
 ;
 ; =================
@@ -11,7 +13,10 @@
 ; it defines the !path and the defaut values of some of the common variables
 ;
-; 
+;
 ; It ++::
 ;
+;   $ idl -startupfile tropflux_init.pro
+;
+; or::
 ;   $ idl -IDL_STARTUP tropflux_init.pro
 ;
@@ -22,21 +27,23 @@
 ;
 ;
+; SEE ALSO
+; ========
+;
+; :ref:`tropflux_profile.sh`
+;
 ; TODO
 ; ====
 ;
+; learn to write IF .. ELSE in a @file
+;
 ; check idl -IDL_STARTUP tropflux_init.pro not ok now on cratos
-;
-; remove fplod/cratos dependencies. use $TROPFLUX*
-;
-; why cannot by recalled ::
-;
-;   IDL> @tropflux_init
-;   IDL> retall
-;   IDL> @tropflux_init
-;   Error opening file. File: oldcm_used
-;   Error opening file. File: oldcm_used
 ;
 ; EVOLUTIONS
 ; ==========
+;
+; - fplod 20110411T074056Z aedon.locean-ipsl.upmc.fr (Darwin)
+;
+;   * remove fplod/cratos dependencies use $TROPFLUX*; use SAXO_SRC;
+;     add cm_tropflux
 ;
 ; - fplod 20110408T131625Z cratos.locean-ipsl.upmc.fr (Linux)
@@ -45,9 +52,17 @@
 ;
 ;-
-;
+; 
+; SAXO environment
+saxo_src_env=GETENV('SAXO_SRC')
+; tropflux environment
+@cm_tropflux
+tropflux_env=GETENV('TROPFLUX')
+tropflux_id_env=GETENV('TROPFLUX_ID')
+tropflux_od_env=GETENV('TROPFLUX_OD')
+
 ; path definition
 ;
-!path = expand_path('+' + '/usr/home/fplod/incas/tropflux/tropflux_ws/src') $
-      + path_sep(/search_path) + expand_path('+' + '/.autofs/home/smasson/SAXO_DIR/SRC') $
+!path = expand_path('+' + tropflux_env + '/src') $
+      + path_sep(/search_path) + expand_path('+' + saxo_src_env) $
       + path_sep(/search_path) + expand_path('+' + !dir)
 ;
@@ -58,13 +73,16 @@
 ; define all the commons
 ;
-@all_cm
+@cm_4cal
+@cm_4data
+@cm_4mesh
+@cm_4data
 ;
 ; define default directories
 ;
-homedir = isadirectory('/usr/home/fplod/incas/tropflux/tropflux_ws/src/', title = 'Select the default HOME directory')
-iodir = isadirectory('/usr/work/incas/fplod/tropflux_d/', title = 'Select the default IO directory')
-psdir = isadirectory('/usr/work/incas/fplod/tropflux_d/', title = 'Select the default postscripts directory')
-imagedir = isadirectory('/usr/work/incas/fplod/tropflux_d/', title = 'Select the default images directory')
-animdir = isadirectory('/usr/work/incas/fplod/tropflux_d/', title = 'Select the default animations directory')
+homedir = isadirectory(tropflux_env + '/src/', title = 'Select the default HOME directory')
+iodir = isadirectory(tropflux_id_env, title = 'Select the default IO directory')
+psdir = isadirectory(tropflux_od_env, title = 'Select the default postscripts directory')
+imagedir = isadirectory(tropflux_od_env, title = 'Select the default images directory')
+animdir = isadirectory(tropflux_od_env, title = 'Select the default animations directory')
 ;
 ; define printer parameters
Index: /trunk/src/tropflux_profile.sh
===================================================================
--- /trunk/src/tropflux_profile.sh	(revision 39)
+++ /trunk/src/tropflux_profile.sh	(revision 40)
@@ -15,9 +15,9 @@
 # Online usage::
 #
-#  $ . ./tropflux_profile.sh -d directory -i indir -o outdir -t tempdir
+#  $ . ./tropflux_profile.sh -d directory -i indir -o outdir -t tempdir -s saxo_src
 #
 # In ${HOME}/.profile, add the following line::
 #
-#  . tropflux_profile.sh -d directory  -i indir -o outdir -t tempdir
+#  . tropflux_profile.sh -d directory  -i indir -o outdir -t tempdir -s saxo_src
 #
 # DESCRIPTION
@@ -28,4 +28,5 @@
 # .. option:: -o  <outdir>
 # .. option:: -t  <tempdir>
+# .. option:: -s  <saxo_src>
 #
 # define TROPFLUX environment
@@ -38,4 +39,6 @@
 #
 # ${TROPFLUX_OD} is the directory where output files will be written.
+#
+# ${SAXO_SRC} is the base directory of SAXO tools
 #
 # PATH is completed with ${TROPFLUX}.
@@ -44,4 +47,5 @@
 # ========
 #
+# :ref:`troflux_init.pro`
 #
 # EXAMPLES
@@ -55,7 +59,8 @@
 #    -i /usr/temp/${LOGNAME}/tropflux_d/ \
 #    -o /usr/temp/${LOGNAME}/tropflux_d/ \
-#    -t /usr/temp/${LOGNAME}/log/
-#
-# For fplod on zeus.locean-ipsl.umpc.fr::
+#    -t /usr/temp/${LOGNAME}/log/ \
+#    -s /usr/home/fplod/SAXO_DIR/SRC/
+#
+# For fplod on cratos.locean-ipsl.umpc.fr::
 #
 #  $ cd ${HOME}/incas/tropflux/tropflux_ws/
@@ -64,5 +69,6 @@
 #    -i /usr/temp/${LOGNAME}/tropflux_d/ \
 #    -o /usr/temp/${LOGNAME}/tropflux_d/ \
-#    -t /usr/temp/${LOGNAME}/log/
+#    -t /usr/temp/${LOGNAME}/log/ \
+#    -s ${HOME}/SAXO_DIR/SRC/
 #
 # For pinsard on camelot.ipsl.polytechnique.fr or merlin15-c.climserv::
@@ -74,4 +80,5 @@
 #   -o /homedata/${LOGNAME}/tropflux_d/ \
 #   -t /homedata/${LOGNAME}/log/
+#   -s ${HOME}/SAXO_DIR/SRC/
 #
 # TODO
@@ -112,5 +119,5 @@
 command=tropflux_profile.sh
 #
-usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir"
+usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir -s saxo_src"
 #
 set +u
@@ -136,4 +143,9 @@
          # directory for temporary outputs choosen by user
          tempdir=${2}
+         shift
+      ;;
+      -s)
+         # directory for SAXO tools
+         saxo_src=${2}
          shift
       ;;
@@ -268,4 +280,8 @@
 fi
 #
+SAXO_SRC=${saxo_src}
+export SAXO_SRC
+unset saxo_src
+#
 # end
 unset command
