;+ ; ; .. _d2m_to_q2m_erai.pro: ; ; =================== ; d2m_to_q2m_erai.pro ; =================== ; ; .. graphviz:: ; ; digraph d2m_to_q2m_erai { ; graph [ ; rankdir="LR", ; ] ; file_d2m [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc"]; ; file_t2m [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc"]; ; file_msl [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc"]; ; file_q2m [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc"]; ; ; d2m_to_q2m_erai [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/d2m_to_q2m_erai.pro", ; label="${PROJECT}/src/d2m_to_q2m_erai.pro"]; ; {file_d2m file_t2m file_msl} -> {d2m_to_q2m_erai} -> {file_q2m} ; } ; ; SEE ALSO ; ======== ; ; :func:`rh_to_spechum` ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`julday ` ; :func:`ncdf_quickwrite ` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> d2m_to_q2m_erai ; ; TODO ; ==== ; ; hard coded directory - usage of ${PROJECT_ID} ; ; coding rules ; ; EVOLUTIONS ; ========== ; ; - fplod 20101215T162933Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * graph correction ; ; - fplod 20101215T093141Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph in header ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- pro d2m_to_q2m_erai @common ;; reading erai dew point temperature d1=19881001 & d2=20101231 file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_d2m_19890101_20091231_oafluxgrid.nc' initncdf, file td=read_ncdf("d2m", d1,d2, file=file,/nostr) ;; reading erai air temperature file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc' initncdf, file t=read_ncdf("t2m", d1,d2, file=file,/nostr) tt=time &jpt=n_elements(time) help, t, td ;;since the t2m and d2m are already in K, no need for conversion e=es0*exp((25.e5/461.5)*((1/273.15)-(1/td))) es=es0*exp((25.e5/461.5)*((1/273.15)-(1/t))) rh=(e/es)*100 ;; conversion of relative humidity to sp. humidity ;; Ref.1 - Gill, Appendix 4, ;; Ref.2 - http://efdl.cims.nyu.edu/project_aomip/forcing_data/atmosphere/humidity.html t=t-273.15 file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_msl_19890101_20091231_oafluxgrid.nc' initncdf, file P=read_ncdf("msl", d1, d2, file=file,/nostr) help, P q2m=rh_to_spechum(rh,t,P) ;;writing field ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/q2m_erai_19890101_20091231_oafluxgrid.nc' time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time) cda0=string(jul2date(time(0)),format='(i8.8)') cda1=string(jul2date(time(jpt-1)),format='(i8.8)') tt=time-julday(1,1,1950,00,00,00) xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) valmask=1.e20 lon_attr={units:'degrees_east',long_name:'Longitude'} lat_attr={units:'degrees_north',long_name:'Latitude'} q2m_attr={units:'kg/kg',missing_value:valmask,long_name:'Surface specific humidity at 2m ',short_name:'q2m',axis:'TYX'} time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} globattr={source:'Surface specific humidity at 2m calculated from dew point temperature',timerange:cda0+' - '+cda1} ncfields = 'q2m[longitude,latitude,time]=q2m:q2m_attr; ' $ + 'longitude[]=xlon:lon_attr; ' $ + 'latitude[]=ylat:lat_attr; ' $ + 'tt[*time]=tt:time_attr ' $ + ' @ globattr' @ncdf_quickwrite return end