source: trunk/src/d2m_to_q2m_erai.pro @ 5

Last change on this file since 5 was 5, checked in by pinsard, 14 years ago

first commit with original work of Praveen

File size: 2.4 KB
Line 
1pro d2m_to_q2m_erai
2@common
3;----------------------------------------------------------------------
4;; reading erai dew point temperature
5d1=19881001 & d2=20101231
6
7file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc'
8initncdf, file
9td=read_ncdf("d2m", d1,d2, file=file,/nostr)
10
11;; reading erai air temperature
12file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
13initncdf, file
14t=read_ncdf("t2m", d1,d2, file=file,/nostr)
15tt=time &jpt=n_elements(time)
16help, t, td
17
18;;since the t2m and d2m are already in K, no need for conversion
19
20e=es0*exp((25.e5/461.5)*((1/273.15)-(1/td)))
21es=es0*exp((25.e5/461.5)*((1/273.15)-(1/t)))
22
23rh=(e/es)*100
24
25;----------------------------------------------------------------------
26;; conversion of relative humidity to sp. humidity
27;; Ref.1 -  Gill, Appendix 4,
28;; Ref.2 - http://efdl.cims.nyu.edu/project_aomip/forcing_data/atmosphere/humidity.html
29
30t=t-273.15
31
32file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc'
33initncdf, file
34P=read_ncdf("msl", d1, d2, file=file,/nostr)
35help, P
36q2m=rh_to_spechum(rh,t,P)
37
38;----------------------------------------------------------------------
39;;writing field
40ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc'
41time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time)
42cda0=string(jul2date(time(0)),format='(i8.8)')
43cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
44
45
46tt=time-julday(1,1,1950,00,00,00)
47xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*))
48valmask=1.e20
49
50lon_attr={units:'degrees_east',long_name:'Longitude'}
51lat_attr={units:'degrees_north',long_name:'Latitude'}
52q2m_attr={units:'kg/kg',missing_value:valmask,long_name:'Surface specific humidity at 2m ',short_name:'q2m',axis:'TYX'}
53time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
54globattr={source:'Surface specific humidity at 2m calculated from dew point temperature',timerange:cda0+' - '+cda1}
55
56ncfields = 'q2m[longitude,latitude,time]=q2m:q2m_attr; ' $
57                      + 'longitude[]=xlon:lon_attr; ' $
58                      + 'latitude[]=ylat:lat_attr; ' $
59                      + 'tt[*time]=tt:time_attr ' $
60                      + ' @ globattr'
61
62@ncdf_quickwrite
63return
64;----------------------------------------------------------------------
65end
Note: See TracBrowser for help on using the repository browser.