;+ ; ; .. _interp_erai_ws_1989_2009.pro: ; ; ============================ ; interp_erai_ws_1989_2009.pro ; ============================ ; ; .. graphviz:: ; ; digraph interp_erai_ws_1989_2009 { ; graph [ ; rankdir="LR", ; ] ; file_u10 [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_u10_TROP_1989_2009.nc"]; ; file_v10 [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_v10_TROP_1989_2009.nc"]; ; ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; ; ; ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc"]; ; ; interp_erai_ws_1989_2009 [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_ws_1989_2009.pro", ; label="${PROJECT}/src/interp_erai_ws_1989_2009.pro"]; ; ; {file_u10 file_v10 mask} -> {interp_erai_ws_1989_2009} -> {ncfile} ; ; } ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; ; :func:`report ` ; :func:`isadirectory ` ; :func:`isafile ` ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`domdef ` ; :func:`call_interp2d ` ; :func:`ncdf_quickwrite ` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> interp_erai_ws_1989_2009 ; ; ; TODO ; ==== ; ; hard coded directory - usage of ${PROJECT_ID} ; ; coding rules ; ; KNOWN ISSUES ; ============ ; ; test of existence of fullfilename_msk not very efficient because ; MUST_EXIST keyword of :func:`isafile ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * remove hard coded directory for mask_oaflux_30N30S.nc ; ; - fplod 20101215T112657Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph in header ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- pro interp_erai_ws_1989_2009 @common @cm_project ; ; check for input directory ; ; test if ${PROJECT_ID} defined CASE project_id_env OF '' : BEGIN msg = 'eee : ${PROJECT_ID} is not defined' ras = report(msg) STOP END ELSE: BEGIN msg = 'iii : ${PROJECT_ID} is ' + project_id_env ras = report(msg) END ENDCASE ; iodirin = isadirectory(project_id_env) ; ; existence and protection of ${PROJECT_ID} IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN msg = 'eee : the directory' + iodirin + ' is not accessible.' ras = report(msg) STOP ENDIF ; ; build mask filename filename_msk='mask_oaflux_30N30S.nc' ; ; check if this file exists fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST) IF fullfilename_msk[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_msk + ' was not found.' ras = report(msg) STOP ENDIF st=19880101 & en=20100930 filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_u10_TROP_1989_2009.nc' initncdf, filein u10in=read_ncdf("u10",st, en,file=filein,/nostr) filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_v10_TROP_1989_2009.nc' initncdf, filein v10in=read_ncdf("v10",st, en,file=filein,/nostr) initncdf, filein domdef latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) timein=time & jptin=jpt tab=u10in(*,*,0) mskin=glamt*0.+1. initncdf, fullfilename_msk domdef latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) help, u10in, v10in,lonin,latin,mskin,lonout,latout,mskout si=size(u10in) u10out=fltarr(jpi,jpj,jptin) v10out=fltarr(jpi,jpj,jptin) for jt=0,jptin-1 do begin print, 'Interpolation jt=',jt,' / ',jptin-1 tab=reform(u10in(*,*,jt)) u10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear') u10out(*,*,jt)=u10out(*,*,jt)*mskout+(1.-mskout)*1.e20 tab=reform(v10in(*,*,jt)) v10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear') v10out(*,*,jt)=v10out(*,*,jt)*mskout+(1.-mskout)*1.e20 endfor time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time) tt=time & jptin=jpt cda0=string(jul2date(tt(0)),format='(i8.8)') cda1=string(jul2date(tt(jpt-1)),format='(i8.8)') tt=tt-julday(1,1,1950,00,00,00) xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) initncdf, fullfilename_msk valmask=1.e20 ylat=latout xlon=lonout ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc' lon_attr={units:'degrees_east',long_name:'Longitude'} lat_attr={units:'degrees_north',long_name:'Latitude'} time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} u10_attr={units:'m/s',missing_value:valmask,long_name:'10 metre u wind component',short_name:'u10',axis:'TYX'} v10_attr={units:'m/s',missing_value:valmask,long_name:'10 metre v wind component',short_name:'v10',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:'Tropical ocean winds obtained from ERA Interim',timerange:cda0+' - '+cda1} help, u10out,v10out,tt,xlon,ylat ncfields = 'u10[longitude,latitude,time]=u10out:u10_attr; ' $ +'v10[longitude,latitude,time]=v10out:v10_attr; ' $ + 'longitude[]=xlon:lon_attr; ' $ + 'latitude[]=ylat:lat_attr; ' $ + 'tt[*time]=tt:time_attr ' $ + ' @ globattr' @ncdf_quickwrite return end