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