;+ ; ; ================= ; plot_tropflux.pro ; ================= ; ; .. function:: plot_tropflux(tropflux_varname) ; ; :param tropflux_varname: variable name to be plot ; q2m t2m sst ws swr lwr lhf shf ; ; Produce +todo+ figures with PROJECT data ; ; .. graphviz:: ; ; digraph plot_tropflux { ; ; file_tropflux_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_q2m_19890101_20091231.nc"]; ; file_tropflux_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/tropFlux_t2m_19890101_20091231.nc"]; ; file_tropflux_ws [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_ws_19890101_20091231.nc"]; ; file_tropflux_sst [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_sst_19890101_20091231.nc"]; ; file_tropflux [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/TropFlux_19890101_20091231.nc"]; ; figure_tropflux_year [shape=ellipse,fontname=Courier,label="${PROJECT_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="${PROJECT}/src/plot_tropflux.pro"]; ; ; {file_tropflux_q2m file_tropflux_t2m file_tropflux_sst file_tropflux_ws file_tropflux} -> {plot_tropflux} -> {figure_tropflux_year} ; ; } ; ; EXAMPLES ; ======== ; ; To plot ++ of q2m from :file:`${PROJECT}/TropFlux_q2m_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='q2m' ; IDL> status = plot_tropflux(tropflux_varname) ; ; **status** is 0 if everything is ok, -1 otherwise ; ; :file:`${PROJECT_OD}/plot_tropflux_q2m_year.png` and ; :file:`${PROJECT_OD}/plot_tropflux_q2m_month.png` have been created. ; ; Same idea for t2m from :file:`${PROJECT}/TropFlux_t2m_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='t2m' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for sst from :file:`${PROJECT}/TropFlux_sst_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='sst' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for ws from :file:`${PROJECT}/TropFlux_ws_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='ws' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for swr from :file:`${PROJECT}/TropFlux_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='swr' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for lwr from :file:`${PROJECT}/TropFlux_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='lwr' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for lhf from :file:`${PROJECT}/TropFlux_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='lhf' ; IDL> status = plot_tropflux(tropflux_varname) ; ; Same idea for shf from :file:`${PROJECT}/TropFlux_19890101_20091231.nc`:: ; ; IDL> @project_init ; IDL> tropflux_varname='shf' ; IDL> status = plot_tropflux(tropflux_varname) ; ; SEE ALSO ; ======== ; ; :ref:`data_out` ; ; :ref:`project_profile.sh` ; :ref:`project_init.pro` ; ; :func:`report ` ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`monthname ` ; :func:`isadirectory ` ; :func:`isafile ` ; ; TODO ; ==== ; ; define plots to be put on the website ; ; add a keyword debug ; add a keyworf overwrite ; ; lecture du mask oaflux pour initcdf ; ; coding rules ; ; parametre date debut 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 ; ; ajuster le format ŕ la dynamique de la variable ; ; check arg ; ; 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 ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; $Id$ ; ; - fplod 20110422T095159Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * fix read_ncdf call ; * improve example ; * fix typo ; ; - 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 @cm_project ; status=-1 ; debug=0 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 ${PROJECT_ID} defined CASE project_id_env OF '' : BEGIN msg = 'eee : ${PROJECT_ID} is not defined' ras = report(msg) STOP END ELSE: BEGIN msg = 'iii : ${PROJECT_ID} is ' + project_id_env ras = report(msg) END ENDCASE ; iodirin = isadirectory(project_id_env) ; ; existence and protection of ${PROJECT_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 ${PROJECT_OD} defined CASE project_od_env OF '' : BEGIN msg = 'eee : ${PROJECT_OD} is not defined' ras = report(msg) STOP END ELSE: BEGIN msg = 'iii : ${PROJECT_OD} is ' + project_od_env ras = report(msg) END ENDCASE ; ; check if output data will be possible iodirout = isadirectory(project_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,filename=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 ; ++ wating 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