source: trunk/src/d2m_to_q2m_erai.pro @ 7

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

add some graph - io - in headers

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