1 | ;+ |
---|
2 | ; .. _read_lh.pro: |
---|
3 | ; |
---|
4 | ; =========== |
---|
5 | ; read_lh.pro |
---|
6 | ; =========== |
---|
7 | ; |
---|
8 | ; DESCRIPTION |
---|
9 | ; =========== |
---|
10 | ; |
---|
11 | ; .. graphviz:: |
---|
12 | ; |
---|
13 | ; digraph read_lh { |
---|
14 | ; |
---|
15 | ; qlat [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/qlat*_dy.cdf"]; |
---|
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 | ; |
---|
28 | ; SEE ALSO |
---|
29 | ; ======== |
---|
30 | ; |
---|
31 | ; :ref:`project_profile.sh` |
---|
32 | ; :ref:`project_init.pro` |
---|
33 | ; :ref:`cm_project.pro` |
---|
34 | ; |
---|
35 | ; :func:`time_lec` |
---|
36 | ; |
---|
37 | ; :ref:`fig2_timeline_diagram.pro` |
---|
38 | ; |
---|
39 | ; EXAMPLES |
---|
40 | ; ======== |
---|
41 | ; |
---|
42 | ; .. code-block:: idl |
---|
43 | ; |
---|
44 | ; csite = '8s67e' |
---|
45 | ; date1 = 19890101L |
---|
46 | ; date2 = 20091231L |
---|
47 | ; nsmooth = 1. |
---|
48 | ; read_lh, csite, date1, date2, nsmooth, lh |
---|
49 | ; |
---|
50 | ; TODO |
---|
51 | ; ==== |
---|
52 | ; |
---|
53 | ; missing input files |
---|
54 | ; |
---|
55 | ; coding rules |
---|
56 | ; |
---|
57 | ; EVOLUTIONS |
---|
58 | ; ========== |
---|
59 | ; |
---|
60 | ; $Id$ |
---|
61 | ; |
---|
62 | ; $URL$ |
---|
63 | ; |
---|
64 | ; - fplod 20110412T093201Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
65 | ; |
---|
66 | ; * externalize function |
---|
67 | ; * remove hard coding path |
---|
68 | ; * add graphviz |
---|
69 | ; |
---|
70 | ; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
71 | ; |
---|
72 | ; * minimal header |
---|
73 | ; |
---|
74 | ;- |
---|
75 | pro read_lh, csite, date1, date2, nsmooth, lh |
---|
76 | ; |
---|
77 | @cm_project |
---|
78 | ; |
---|
79 | ; DEFINE THE OUTPUT TIME AXIS |
---|
80 | ; |
---|
81 | jda1=date2jul(date1) |
---|
82 | jda2=date2jul(date2) |
---|
83 | jpt=(jda2-jda1+1l) |
---|
84 | time=jda1+dindgen(jpt) |
---|
85 | ; |
---|
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 |
---|
91 | fi=project_id_env+'qlat'+csite+'_dy.cdf' |
---|
92 | f=file_test(fi) |
---|
93 | lh=fltarr(jpt)+!values.f_nan |
---|
94 | lh_q=fltarr(jpt)+!values.f_nan |
---|
95 | if (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 |
---|
102 | lh(tt0(ind))=lh0(ind) |
---|
103 | lh_q(tt0(ind))=lh_q0(ind) |
---|
104 | endif |
---|
105 | endif else begin |
---|
106 | print, fi, ' not found' |
---|
107 | endelse |
---|
108 | ; |
---|
109 | ind=where(lh_q ne 1 and lh_q ne 2) |
---|
110 | ; |
---|
111 | if (ind(0) ne -1) then begin |
---|
112 | lh(ind)=!Values.f_nan |
---|
113 | endif |
---|
114 | ; |
---|
115 | ; Replace missing values by "NaN" |
---|
116 | ; |
---|
117 | tsvars=['lh'] |
---|
118 | vars=[tsvars] |
---|
119 | nn=n_elements(vars) |
---|
120 | for n=0,nn-1 do begin |
---|
121 | var=vars(n) |
---|
122 | com='ind=where('+var+' ge 1.e20) |
---|
123 | if (ind(0) ne -1) then '+var+'(ind)=!values.f_nan' |
---|
124 | r=execute(com) |
---|
125 | endfor |
---|
126 | ; |
---|
127 | nsmooth=nsmooth |
---|
128 | lh=smooth(lh,nsmooth,/nan) |
---|
129 | ; |
---|
130 | end |
---|