Index: /trunk/src/plot_tropflux.pro
===================================================================
--- /trunk/src/plot_tropflux.pro	(revision 39)
+++ /trunk/src/plot_tropflux.pro	(revision 39)
@@ -0,0 +1,281 @@
+;+
+;
+; =======================================
+; plot_tropflux.pro -- Plot TropFlux data
+; =======================================
+;
+; .. function:: plot_tropflux(tropflux_varname)
+;
+; Produce +todo+ figures with TROPFLUX data
+;
+; .. graphviz::
+;
+;    digraph plot_tropflux {
+;       graph [
+;       rankdir="LR",
+;       ]
+;       file_tropflux_q2m [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/TropFlux_q2m_19890101-20091231.nc"];
+;       file_tropflux_t2m [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/tropFlux_t2m_19890101-20091231.nc"];
+;       file_tropflux_ws [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/TropFlux_ws_19890101-20091231.nc"];
+;       file_tropflux_sst [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/TropFlux_sst_19890101-20091231.nc"];
+;       file_tropflux [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/TropFlux_19890101-20091231.nc"];
+;       figure_++_tropflux_++ [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/plot_tropflux_++_year.png"];
+;
+;       plot_tropflux [shape=box,
+;       fontname=Courier,
+;       color=blue,
+;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/plot_tropflux.pro",
+;       label="${TROPFLUX}/src/plot_tropflux.pro"];
+;
+;       {file_tropflux_q2m file_tropflux_t2m file_tropflux_sst file_tropflux_ws file_tropflux} -> {plot_tropflux} -> {figure_++_tropflux_++}
+;
+;      }
+;
+; EXAMPLES
+; ========
+;
+; To plot ++ of q2m ::
+;
+;    IDL> @tropflux_init
+;    IDL> status = plot_tropflux('q2m')
+;
+; **status** is 0 if everything is ok, -1 otherwise
+;
+; :file:`${TROPFLUX_OD}/plot_tropflux_q2m_year.png` and
+; :file:`${TROPFLUX_OD}/plot_tropflux_q2m_month.png` have been created.
+;
+; SEE ALSO
+; ========
+;
+; :ref:`data_out`
+;
+; :ref:`tropflux_profile.sh`
+; :ref:`tropflux_init.pro`
+;
+; :func:`report <saxo:report>`
+; :func:`initncdf <saxo:initncdf>`
+; :func:`read_ncdf <saxo:read_ncdf>`
+; :func:`monthname <saxo:monthname>`
+; :func:`isadirectory <saxo:isadirectory>`
+; :func:`isafile <saxo:isafile>`
+;
+; TODO
+; ====
+;
+; make it work. when ok set debug to 0 or add a keyword
+; same for overwrite
+;
+; lecture du mask oaflux pour initcdf
+;
+; coding rules
+;
+; parametre date debu date fin ?
+;
+; parametre version ?
+;
+; parametre pour website
+; ref to tip on mouse on mac (cf mail seb)
+;
+; add parameter interactif or debug pour tvplus
+;
+; add parameter saveimage
+;
+; add parameter overwrite
+;
+; ajuster le format à la dynamique de la variable
+; check arg
+;
+; pourquoi read_ncdf n'ouvre pas tout de suite le ficher sans passer par la case widget !!
+;
+; loop on month : min and max values for same color scale
+; 6x2 pose un pb car la legende est trop grande ce qui laisse peu de 
+; place pour le dessin
+;
+; 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 20110408T101102Z cratos.locean-ipsl.upmc.fr (Linux)
+;
+;   * creation
+;
+;-
+;
+function plot_tropflux, $
+         tropflux_varname
+;
+compile_opt idl2, strictarrsubs
+;
+@cm_4cal
+@cm_4data
+@cm_4mesh
+@cm_4data
+;
+status=-1
+;
+debug=1
+overwrite=1
+;
+
+; check for tropflux_varname
+; and build input filename
+CASE tropflux_varname OF
+    'q2m': BEGIN
+               filename_in='TropFlux_q2m_19890101_20091231.nc'
+           END
+    't2m': BEGIN
+               filename_in='TropFlux_t2m_19890101_20091231.nc'
+           END
+    'sst': BEGIN
+               filename_in='TropFlux_sst_19890101_20091231.nc'
+           END
+    'ws' : BEGIN
+               filename_in='TropFlux_ws_19890101_20091231.nc'
+           END
+    'swr' : BEGIN
+               filename_in='TropFlux_19890101_20091231.nc'
+           END
+    'lwr' : BEGIN
+               filename_in='TropFlux_19890101_20091231.nc'
+           END
+    'lhf' : BEGIN
+               filename_in='TropFlux_19890101_20091231.nc'
+           END
+    'shf' : BEGIN
+               filename_in='TropFlux_19890101_20091231.nc'
+           END
+ELSE: BEGIN
+     msg = 'eee : ' + tropflux_varname + ' unknown or not handled here'
+     ras = report(msg)
+       END
+ENDCASE
+;
+; 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
+;
+; check if this file exists
+fullfilename_in = isafile(iodirin + filename_in, NEW=0, /MUST_EXIST)
+print, fullfilename_in
+IF fullfilename_in[0] EQ '' THEN BEGIN
+   msg = 'eee : the file ' + fullfilename_in + ' was not found.'
+   ras = report(msg)
+   STOP
+ENDIF
+print, fullfilename_in[0]
+;
+; 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_year=iodirout+'plot_tropflux' + tropflux_varname + '_year.png'
+print, fullfilename_out_year
+; in order to avoid unexpected overwritten
+IF (FILE_TEST(fullfilename_out_year) EQ 1) THEN BEGIN
+   msg = 'eee : the file ' + fullfilename_out_year  + ' already exists.'
+   IF overwrite EQ 0 THEN BEGIN
+       ras = report(msg)
+       STOP
+   ENDIF
+ENDIF
+;
+fullfilename_out_month=iodirout+'plot_tropflux' + tropflux_varname + '_month.png'
+print, fullfilename_out_month
+; in order to avoid unexpected overwritten
+IF (FILE_TEST(fullfilename_out_month) EQ 1) THEN BEGIN
+   IF overwrite EQ 0 THEN BEGIN
+       msg = 'eee : the file ' + fullfilename_out_month  + ' already exists.'
+       ras = report(msg)
+       STOP
+   ENDIF
+ENDIF
+;
+; Read grid and mask
+print, fullfilename_in[0]
+initncdf, fullfilename_in[0]
+;++ missing value
+
+IF debug EQ 1 THEN BEGIN
+   ; afficher ce que l'on veut verifier : tmask values should be 1.e20 on earth
+   ; and ++ an ocean
+   ; ++ pb souris mac tvplus, tmask[*,*,0]
+ENDIF
+;
+; Read data
+tropflux_var=read_ncdf(tropflux_varname,19890101L,19891231L,fullfilename_in[0],/nostruct)
+;
+IF debug EQ 1 THEN BEGIN
+   ; afficher ce que l'on veut vérifier : tropflux_var missing are NaN, values on earth are 1.e20
+   ; ++ pb souris mac tvplus, tropflux_var[*,*,0]
+ENDIF
+;
+; plot year mean
+plt, tropflux_var, format='(f6.1)', window=0, /landscape, /map
+saveimage, fullfilename_out_year, /png
+;
+; ++ defintion des types d'images
+plot_month=0
+IF plot_month EQ 1 THEN BEGIN
+   ; plot monthes on one page (6x2)
+   nl=4
+   nc=2
+   ; ++ watinfg for final plot do be done
+   jpt=nc*nl
+   FOR itime = 0L, jpt - 1 DO BEGIN
+       vardate=monthname(itime + 1)
+       plt, tropflux_var[*,*,itime], noerase = (itime GT 0), small= [nc, nl, itime + 1] , format='(f6.1)',  /landscape, window=1
+   ENDFOR
+   saveimage, fullfilename_out_month, /png
+ENDIF
+;
+status=0
+;
+return, status
+;
+END
Index: /trunk/src/tropflux_init.pro
===================================================================
--- /trunk/src/tropflux_init.pro	(revision 39)
+++ /trunk/src/tropflux_init.pro	(revision 39)
@@ -0,0 +1,96 @@
+;+
+;
+; =================
+; tropflux_init.pro
+; =================
+;
+; DESCRIPTION
+; ===========
+;
+; This is the SAXO initialisation file.
+; it defines the !path and the defaut values of some of the common variables
+;
+; 
+; It ++::
+;
+;   $ idl -IDL_STARTUP tropflux_init.pro
+;
+; or::
+;
+;  $ IDL
+;  IDL> @tropflux_init
+;
+;
+; TODO
+; ====
+;
+; 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 20110408T131625Z cratos.locean-ipsl.upmc.fr (Linux)
+;
+;   * creation using buildinit on cratos
+;
+;-
+;
+; 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_sep(/search_path) + expand_path('+' + !dir)
+;
+; compatibility with the old version
+;
+keep_compatibility, 0
+;
+; define all the commons
+;
+@all_cm
+;
+; 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')
+;
+; define printer parameters
+;
+printer_human_names = ''
+printer_machine_names = ''
+print_command = ''
+;
+; colors ...
+;
+device, decomposed = 0
+device, retain = 2
+lct, 39
+;
+; postscript parameters ...
+;
+key_portrait = 0
+page_size = [20.9903, 29.7039]
+windowsize_scale = 1.00000
+archive_ps = 0
+;
+;========================================================
+; end of the part that should be modified by the users...
+;========================================================
+;
+; if needed, keep compatibility with the old version
+;
+@updateold
+;
