source: trunk/src/paper01/fig2/read_lh.pro @ 204

Last change on this file since 204 was 203, checked in by pinsard, 10 years ago

fix thanks to coding rules

  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 2.3 KB
RevLine 
[43]1;+
[44]2; .. _read_lh.pro:
[41]3;
[43]4; ===========
5; read_lh.pro
6; ===========
7;
8; DESCRIPTION
9; ===========
10;
[44]11; .. graphviz::
12;
13;    digraph read_lh {
[85]14;
[50]15;       qlat [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/qlat*_dy.cdf"];
[44]16;
17;       lh [shape=tab,fontname=Courier,label="lh"]
18;
19;       read_lh [shape=box,
20;       fontname=Courier,
21;       color=blue,
22;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/paper01/fig2/read_lh.pro",
23;       label="${TROPFLUX}/src/paper01/fig2/read_lh.pro"];
24;
25;       {qlat} -> {read_lh} -> {lh}
26;    }
27;
[43]28; SEE ALSO
29; ========
30;
[50]31; :ref:`project_profile.sh`
32; :ref:`project_init.pro`
33; :ref:`cm_project.pro`
[43]34;
[44]35; :func:`time_lec`
36;
37; :ref:`fig2_timeline_diagram.pro`
38;
[43]39; EXAMPLES
40; ========
41;
[203]42; .. code-block:: idl
[43]43;
[203]44;    csite = '8s67e'
45;    date1 = 19890101L
46;    date2 = 20091231L
47;    nsmooth = 1.
48;    read_lh, csite, date1, date2, nsmooth, lh
[43]49;
[44]50; TODO
51; ====
52;
[85]53; missing input files
54;
[44]55; coding rules
56;
[43]57; EVOLUTIONS
58; ==========
59;
60; $Id$
61;
[85]62; $URL$
63;
[44]64; - fplod 20110412T093201Z aedon.locean-ipsl.upmc.fr (Darwin)
65;
66;   * externalize function
67;   * remove hard coding path
68;   * add graphviz
69;
[43]70; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin)
71;
72;   * minimal header
73;
74;-
75pro read_lh, csite, date1, date2, nsmooth, lh
76;
[50]77@cm_project
[41]78;
[97]79; DEFINE THE OUTPUT TIME AXIS
80;
[41]81jda1=date2jul(date1)
82jda2=date2jul(date2)
83jpt=(jda2-jda1+1l)
84time=jda1+dindgen(jpt)
85;
[97]86; FIRST READ ALL DATA FROM SITE
87;   - if file exists, extract correct time axis
88;   - if not, fill variable with missing values
89;
90;LHF
[50]91fi=project_id_env+'qlat'+csite+'_dy.cdf'
[41]92f=file_test(fi)
93lh=fltarr(jpt)+!values.f_nan
94lh_q=fltarr(jpt)+!values.f_nan
95if (f) then begin
96  tt0=time_lec(fi)
97  lh0=ncdf_lec(fi,var='QL_137')
98  lh_q0=ncdf_lec(fi,var='QQL_5137')
99  tt0=tt0-time(0)
100  ind=where((tt0 ge -1e-5) and (tt0 le jpt-1+1e-5))
101  if (ind(0) ne -1) then begin
[44]102     lh(tt0(ind))=lh0(ind)
103     lh_q(tt0(ind))=lh_q0(ind)
[41]104  endif
[44]105endif else begin
106  print, fi, ' not found'
107endelse
[97]108;
[41]109ind=where(lh_q ne 1 and lh_q ne 2)
[97]110;
[41]111if (ind(0) ne -1) then begin
112  lh(ind)=!Values.f_nan
113endif
114;
[97]115; Replace missing values by "NaN"
[41]116;
[43]117tsvars=['lh']
[41]118vars=[tsvars]
119nn=n_elements(vars)
120for n=0,nn-1 do begin
121  var=vars(n)
[97]122  com='ind=where('+var+' ge 1.e20)
[94]123  if (ind(0) ne -1) then '+var+'(ind)=!values.f_nan'
[41]124  r=execute(com)
125endfor
[97]126;
[41]127nsmooth=nsmooth
[43]128lh=smooth(lh,nsmooth,/nan)
[97]129;
[41]130end
Note: See TracBrowser for help on using the repository browser.