1 | pro d2m_to_q2m_erai |
---|
2 | @common |
---|
3 | ;---------------------------------------------------------------------- |
---|
4 | ;; reading erai dew point temperature |
---|
5 | d1=19881001 & d2=20101231 |
---|
6 | |
---|
7 | file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc' |
---|
8 | initncdf, file |
---|
9 | td=read_ncdf("d2m", d1,d2, file=file,/nostr) |
---|
10 | |
---|
11 | ;; reading erai air temperature |
---|
12 | file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc' |
---|
13 | initncdf, file |
---|
14 | t=read_ncdf("t2m", d1,d2, file=file,/nostr) |
---|
15 | tt=time &jpt=n_elements(time) |
---|
16 | help, t, td |
---|
17 | |
---|
18 | ;;since the t2m and d2m are already in K, no need for conversion |
---|
19 | |
---|
20 | e=es0*exp((25.e5/461.5)*((1/273.15)-(1/td))) |
---|
21 | es=es0*exp((25.e5/461.5)*((1/273.15)-(1/t))) |
---|
22 | |
---|
23 | rh=(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 | |
---|
30 | t=t-273.15 |
---|
31 | |
---|
32 | file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc' |
---|
33 | initncdf, file |
---|
34 | P=read_ncdf("msl", d1, d2, file=file,/nostr) |
---|
35 | help, P |
---|
36 | q2m=rh_to_spechum(rh,t,P) |
---|
37 | |
---|
38 | ;---------------------------------------------------------------------- |
---|
39 | ;;writing field |
---|
40 | ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc' |
---|
41 | time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time) |
---|
42 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
43 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
44 | |
---|
45 | |
---|
46 | tt=time-julday(1,1,1950,00,00,00) |
---|
47 | xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) |
---|
48 | valmask=1.e20 |
---|
49 | |
---|
50 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
51 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
52 | q2m_attr={units:'kg/kg',missing_value:valmask,long_name:'Surface specific humidity at 2m ',short_name:'q2m',axis:'TYX'} |
---|
53 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
54 | globattr={source:'Surface specific humidity at 2m calculated from dew point temperature',timerange:cda0+' - '+cda1} |
---|
55 | |
---|
56 | ncfields = '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 |
---|
63 | return |
---|
64 | ;---------------------------------------------------------------------- |
---|
65 | end |
---|