source: trunk/src/paper01/fig2/read_sw.pro @ 99

Last change on this file since 99 was 99, checked in by pinsard, 13 years ago

suppress successive semi-column lines

  • Property svn:executable set to *
  • Property svn:keywords set to URL
File size: 2.6 KB
RevLine 
[43]1;+
[41]2;
[44]3; .. _read_sw.pro:
4;
[43]5; ===========
6; read_sw.pro
7; ===========
8;
9; DESCRIPTION
10; ===========
11;
[44]12; .. graphviz::
13;
14;    digraph read_sw {
[85]15;
[50]16;       swnet [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/swnet*_dy.cdf"];
[44]17;       sw [shape=tab,fontname=Courier,label="sw"]
18;
19;       read_sw [shape=box,
20;       fontname=Courier,
21;       color=blue,
22;       URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/paper01/fig2/read_sw.pro",
23;       label="${TROPFLUX}/src/paper01/fig2/read_sw.pro"];
24;
25;       {swnet} -> {read_sw} -> {sw}
26;    }
[97]27;
[43]28; SEE ALSO
29; ========
30;
[50]31; :ref:`project_profile.sh`
[43]32;
[47]33; :func:`time_lec`
[44]34;
35; :ref:`fig2_timeline_diagram.pro`
36;
[43]37; EXAMPLES
38; ========
39;
40; ::
41;
[44]42;  IDL> csite='8s67e'
43;  IDL> date1=19890101L
44;  IDL> date2=20091231L
45;  IDL> box=++
[43]46;  IDL> read_sw, csite, date1, date2, box, sw
47;
[44]48; TODO
49; ====
50;
[85]51; make it work with a file : missing input file
[44]52;
[43]53; EVOLUTIONS
54; ==========
55;
56; $Id$
57;
[85]58; $URL$
59;
[47]60; - pinsard 2011-04-20T15:15:12Z loholt1.ipsl.polytechnique.fr (Linux)
61;
62;   * typo
63;
[44]64; - fplod 20110412T093325Z aedon.locean-ipsl.upmc.fr (Darwin)
65;
66;   * externalize function
67;   * remove hard coding path
68;   * add graphviz
69;   * remove smooth call (unreacheable statement after end !!)
70;
[43]71; - fplod 20110411T142955Z aedon.locean-ipsl.upmc.fr (Darwin)
72;
73;   * minimal header
74;
75;-
76pro read_sw, csite, date1, date2, box, sw
77;
[50]78@cm_project
[41]79;
[97]80; DEFINE THE OUTPUT TIME AXIS
[41]81;
82jda1=date2jul(date1)
83jda2=date2jul(date2)
84jpt=(jda2-jda1+1l)
85time=jda1+dindgen(jpt)
86;
[97]87; FIRST READ ALL DATA FROM SITE
88;   - if file exists, extract correct time axis
89;   - if not, fill variable with missing values
90;
91; SWR
[50]92fi=project_id_env+'swnet'+csite+'_dy.cdf'
[41]93f=file_test(fi)
[97]94sw=fltarr(jpt)+!values.f_nan    ; swr
95sw_q=fltarr(jpt)+!values.f_nan  ; swr quality flag
96;
[41]97if (f) then begin
98  tt0=time_lec(fi)
99  sw0=ncdf_lec(fi,var='SWN_1495')
100  sw_q0=ncdf_lec(fi,var='QSW_5495')
101  tt0=tt0-time(0)
102  ind=where((tt0 ge -1e-5) and (tt0 le jpt-1+1e-5))
103  if (ind(0) ne -1) then begin
104    sw(tt0(ind))=sw0(ind)
105    sw_q(tt0(ind))=sw_q0(ind)
106  endif
[46]107endif else begin
[44]108  print, fi, ' not found'
109endelse
[97]110;
[41]111ind1=where((sw_q ne 1) and (sw_q ne 2))
112sw(ind1)=!Values.f_nan
113;
[97]114; Replace missing values by "NaN"
115;
[41]116;tsvars=['at','bf','bp','dyn','emp','evap','heat','iso','sw','swnet','qlat','qsen','sw', $
[43]117;        'swnet','rain','rf','rh','ssd','sss','sst','swnet','tx','ty','wu','wv','ws','lat','lon']
[41]118;depvars=['u','v','d','t','s']
119vars=['sw']
[97]120;
[41]121nn=n_elements(vars)
122for n=0,nn-1 do begin
123  var=vars(n)
[97]124  com='ind=where('+var+' ge 1.e20)
[94]125  if (ind(0) ne -1) then '+var+'(ind)=!values.f_nan'
[41]126  r=execute(com)
127endfor
[97]128;
[41]129end
Note: See TracBrowser for help on using the repository browser.