;+ ; .. _read_lw.pro: ; ; =========== ; read_lw.pro ; =========== ; ; DESCRIPTION ; =========== ; ; .. graphviz:: ; ; digraph read_lw { ; ; lwnet [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/lwnet*_dy.cdf"]; ; lw [shape=tab,fontname=Courier,label="lw"] ; ; read_lw [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/paper01/fig2/read_lw.pro", ; label="${TROPFLUX}/src/paper01/fig2/read_lw.pro"]; ; ; {lwnet} -> {read_lw} -> {lw} ; } ; ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; :ref:`project_init.pro` ; ; :func:`time_lec` ; ; :ref:`fig2_timeline_diagram.pro` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> csite='8s67e' ; IDL> date1=19890101L ; IDL> date2=20091231L ; IDL> box=[ 249.500,250.500,-0.500000,0.500000] ; IDL> read_lw, csite, date1, date2, box, lw ; ; TODO ; ==== ; ; make it work with a file : now nsmooth pb, missing input file ; ; confirm example parameters values ; ; EVOLUTIONS ; ========== ; ; $Id$ ; ; $URL$ ; ; - fplod 20110412T093250Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * externalize function ; * remove hard coding path ; * add graphviz ; * remove "smooth" lines (no nsmooth parameter here) ; ; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ;- pro read_lw, csite, date1, date2, box, lw ; @cm_project ;; DEFINE THE OUTPUT TIME AXIS ; jda1=date2jul(date1) jda2=date2jul(date2) jpt=(jda2-jda1+1l) time=jda1+dindgen(jpt) ; ;; FIRST READ ALL DATA FROM SITE ;; - if file exists, extract correct time axis ;; - if not, fill variable with missing values ; ;; LWR fi=project_id_env+'lwnet'+csite+'_dy.cdf' f=file_test(fi) lw=fltarr(jpt)+!values.f_nan if (f) then begin tt0=time_lec(fi) lw0=ncdf_lec(fi,var='LWN_1136') tt0=tt0-time(0) ind=where((tt0 ge -1e-5) and (tt0 le jpt-1+1e-5)) if (ind(0) ne -1) then begin lw(tt0(ind))=lw0(ind) endif endif else begin print, fi, ' not found' endelse ; ;; Replace missing values by "NaN" ; ;tsvars=['at','bf','bp','dyn','emp','evap','heat','iso','lw','lwnet','qlat','qsen','sw', $ ; 'swnet','rain','rf','rh','ssd','sss','sst','swnet','tx','ty','wu','wv','ws','lat','lon'] ;depvars=['u','v','d','t','s'] vars=['lw'] nn=n_elements(vars) for n=0,nn-1 do begin var=vars(n) com='ind=where('+var+' ge 1.e20) & if (ind(0) ne -1) then '+var+'(ind)=!values.f_nan' r=execute(com) endfor ;++nsmooth=nsmooth ;++lw=smooth(lw,nsmooth,/nan) end