source: trunk/src/d2m_to_q2m_erai.pro @ 6

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

minimal header in .pro

File size: 2.6 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; EXAMPLES
13; ========
14;
15; ::
16;
17;  IDL> d2m_to_q2m_erai
18;
19; TODO
20; ====
21;
22; hard coded directory - usage of ${TROPFLUX_ID}
23;
24; coding rules
25;
26; EVOLUTIONS
27; ==========
28;
29; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
30;
31;   * minimal header
32;
33; - pbk 2008
34;
35;   * creation
36;
37;-
38pro d2m_to_q2m_erai
39@common
40;; reading erai dew point temperature
41d1=19881001 & d2=20101231
42
43file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc'
44initncdf, file
45td=read_ncdf("d2m", d1,d2, file=file,/nostr)
46
47;; reading erai air temperature
48file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
49initncdf, file
50t=read_ncdf("t2m", d1,d2, file=file,/nostr)
51tt=time &jpt=n_elements(time)
52help, t, td
53
54;;since the t2m and d2m are already in K, no need for conversion
55
56e=es0*exp((25.e5/461.5)*((1/273.15)-(1/td)))
57es=es0*exp((25.e5/461.5)*((1/273.15)-(1/t)))
58
59rh=(e/es)*100
60
61;----------------------------------------------------------------------
62;; conversion of relative humidity to sp. humidity
63;; Ref.1 -  Gill, Appendix 4,
64;; Ref.2 - http://efdl.cims.nyu.edu/project_aomip/forcing_data/atmosphere/humidity.html
65
66t=t-273.15
67
68file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc'
69initncdf, file
70P=read_ncdf("msl", d1, d2, file=file,/nostr)
71help, P
72q2m=rh_to_spechum(rh,t,P)
73
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.