source: trunk/src/d2m_to_q2m_erai.pro @ 70

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

replace TROPFLUX by PROJECT

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