source: trunk/src/d2m_to_q2m_erai.pro @ 11

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

add some graph - io - in headers (cont.)

File size: 3.5 KB
Line 
1;+
2;
3; .. _d2m_to_q2m_erai.pro:
4;
5; ===================
6; d2m_to_q2m_erai.pro
7; ===================
8;
9; .. only:: man
10;
11; Figure is visible on PDF and HTML documents only.
12;
13; .. only:: html
14;
15;     .. graphviz::
16;
17;        digraph d2m_to_q2m_erai {
18;           graph [
19;           rankdir="LR",
20;           ]
21;           file_d2m [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc"];
22;           file_t2m [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc"];
23;           file_msl [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc"];
24;
25;           d2m_to_q2m_erai [shape=box,
26;           fontname=Courier,
27;           color=blue,
28;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/d2m_to_q2m_erai.pro",
29;           label="${TROPFLUX}/src/d2m_to_q2m_erai.pro"];
30;           {file_d2m file_t2m} -> {d2m_to_q2m_erai} -> {file_msl}
31;        }
32;
33; SEE ALSO
34; ========
35;
36; :func:`rh_to_spechum(rh,t,P)`
37;
38; EXAMPLES
39; ========
40;
41; ::
42;
43;  IDL> d2m_to_q2m_erai
44;
45; TODO
46; ====
47;
48; hard coded directory - usage of ${TROPFLUX_ID}
49;
50; coding rules
51;
52; EVOLUTIONS
53; ==========
54;
55; - fplod 20101215T093141Z aedon.locean-ipsl.upmc.fr (Darwin)
56;
57;   * add graph in header
58;
59; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
60;
61;   * minimal header
62;
63; - pbk 2008
64;
65;   * creation
66;
67;-
68pro d2m_to_q2m_erai
69@common
70;; reading erai dew point temperature
71d1=19881001 & d2=20101231
72
73file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc'
74initncdf, file
75td=read_ncdf("d2m", d1,d2, file=file,/nostr)
76
77;; reading erai air temperature
78file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
79initncdf, file
80t=read_ncdf("t2m", d1,d2, file=file,/nostr)
81tt=time &jpt=n_elements(time)
82help, t, td
83
84;;since the t2m and d2m are already in K, no need for conversion
85
86e=es0*exp((25.e5/461.5)*((1/273.15)-(1/td)))
87es=es0*exp((25.e5/461.5)*((1/273.15)-(1/t)))
88
89rh=(e/es)*100
90
91;; conversion of relative humidity to sp. humidity
92;; Ref.1 -  Gill, Appendix 4,
93;; Ref.2 - http://efdl.cims.nyu.edu/project_aomip/forcing_data/atmosphere/humidity.html
94
95t=t-273.15
96
97file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc'
98initncdf, file
99P=read_ncdf("msl", d1, d2, file=file,/nostr)
100help, P
101q2m=rh_to_spechum(rh,t,P)
102
103;;writing field
104ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc'
105time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time)
106cda0=string(jul2date(time(0)),format='(i8.8)')
107cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
108
109
110tt=time-julday(1,1,1950,00,00,00)
111xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*))
112valmask=1.e20
113
114lon_attr={units:'degrees_east',long_name:'Longitude'}
115lat_attr={units:'degrees_north',long_name:'Latitude'}
116q2m_attr={units:'kg/kg',missing_value:valmask,long_name:'Surface specific humidity at 2m ',short_name:'q2m',axis:'TYX'}
117time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
118globattr={source:'Surface specific humidity at 2m calculated from dew point temperature',timerange:cda0+' - '+cda1}
119
120ncfields = 'q2m[longitude,latitude,time]=q2m:q2m_attr; ' $
121                      + 'longitude[]=xlon:lon_attr; ' $
122                      + 'latitude[]=ylat:lat_attr; ' $
123                      + 'tt[*time]=tt:time_attr ' $
124                      + ' @ globattr'
125
126@ncdf_quickwrite
127return
128end
Note: See TracBrowser for help on using the repository browser.