;+ ; ; .. _TropFlux_NRT_ncdf.pro: ; ; ===================== ; TropFlux_NRT_ncdf.pro ; ===================== ; ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc` ; containing ; ws corrected on OAFLUX grid ; has been produced by ; :ref:`TropFlux_swr_BLND_19890101_20091231.pro`. ; ; :file:`${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc` ; containing ; lwr corrected on OAFLUX grid ; has been produced by ; :ref:`lwr_correction_ncdf.pro`. ; ; :file:`${PROJECT_OD}/TropFlux_19890101_20091231_coare3.nc` ; containing ; ++ ; has been produced by ; :ref:`TropFlux_19890101_20091231.pro`. ; ; ++ are written ; in :file:`${PROJECT_OD}/TropFlux_19890101_20091231.nc` ; if this file not already exists. ; ; .. graphviz:: ; ; digraph tropflux_nrt_ncdf { ; ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc"]; ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_19890101_200912310.nc"]; ; file_coare [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_19890101_20091231_coarev3.nc"]; ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_19890101_20091231.nc"]; ; ; tropflux_nrt_ncdf [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_NRT_ncdf.pro", ; label="${PROJECT}/src/TropFlux_NRT_ncdf.pro" ]; ; ; {file_swr file_lwr file_coare} -> {tropflux_nrt_ncdf} -> {file_out} ; ; } ; ; SEE ALSO ; ======== ; ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`julday ` ; :func:`jul2date ` ; :func:`ncdf_quickwrite ` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> .compile TropFlux_NRT_ncdf ; IDL> tropflux_nrt_ncdf ; ; TODO ; ==== ; ; coding rules ; ; get rid of uppercase to avoid compile ; ; create 4 files instead of one now ; ; EVOLUTIONS ; ========== ; ; $Id: TropFlux_NRT_ncdf.pro 88 2011-08-19 15:40:14Z pinsard $ ; ; $URL$ ; ; - fplod 20110809T133815Z cratos (Linux) ; ; * remove v50 from pro name and in the graph ; * add coarev3 to the file coming from TropFlux_19890101_20091231.pro ; * use $PROJECT_OD ; ; - fplod 20101214T112526Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- pro TropFlux_NRT_ncdf ; @cm_4cal @cm_4data @cm_4mesh @cm_4data @cm_project ; ; test if ${PROJECT_OD} defined CASE project_od_env OF '' : BEGIN msg = 'eee : ${PROJECT_OD} is not defined' ras = report(msg) STOP END ELSE: BEGIN msg = 'iii : ${PROJECT_OD} is ' + project_od_env ras = report(msg) END ENDCASE ; ; check if output data will be possible iodirout = isadirectory(project_od_env) ; ; existence and protection for reading IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN msg = 'eee : the directory' + iodirout + ' is not accessible.' ras = report(msg) STOP ENDIF ; ; existence and protection for writing IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN msg = 'eee : the directory' + iodirout + ' was not found.' ras = report(msg) STOP ENDIF ; ; build SWR blnd data filename filename_swr_blnd="TropFlux_swr_19890101_20091231_BLND.nc" ; ; check if this file exists msg='iii : looking for ' + filename_swr_blnd ras = report(msg) fullfilename_swr_blnd = isafile(iodirout + filename_swr_blnd, NEW=0, /MUST_EXIST) IF fullfilename_swr_blnd[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_swr_blnd + ' was not found.' ras = report(msg) STOP ENDIF ; ; build LWR data filename filename_lwr="TropFlux_lwr_19890101_20091231.nc" ; ; check if this file exists msg='iii : looking for ' + filename_lwr ras = report(msg) fullfilename_lwr = isafile(iodirout + filename_lwr, NEW=0, /MUST_EXIST) IF fullfilename_lwr[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_lwr + ' was not found.' ras = report(msg) STOP ENDIF ; ; build COARE data filename filename_coare="TropFlux_19890101_20091231_coarev3.nc" ; ; check if this file exists msg='iii : looking for ' + filename_lwr ras = report(msg) fullfilename_coare = isafile(iodirout + filename_coare, NEW=0, /MUST_EXIST) IF fullfilename_coare[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_coare + ' was not found.' ras = report(msg) STOP ENDIF ; filename_out='TropFlux_19890101_20091231.nc' fullfilename_out = iodirout + filename_out ; in order to avoid unexpected overwritten IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN msg = 'eee : the file ' + fullfilename_out + ' already exists.' ras = report(msg) STOP ENDIF ; st=19800101 en=20101231 ; initncdf, fullfilename_swr_blnd ; swr=read_ncdf("swr", st, en, file=fullfilename_swr_blnd,/nostr) ; initncdf, fullfilename_lwr lwr=read_ncdf("lwr", st, en, file=fullfilename_lwr,/nostr) ; initncdf, fullfilename_coare lhf=read_ncdf("lhf", st, en, file=fullfilename_coare,/nostr) shf=read_ncdf("shf", st, en, file=fullfilename_coare,/nostr) ; help, swr, lwr, lhf, shf ; time=timegen(7670, start=julday(1,1,1989,0), units='days') jpt=n_elements(time) ; cda0=string(jul2date(time(0)),format='(i8.8)') cda1=string(jul2date(time(jpt-1)),format='(i8.8)') ; time=time-julday(1,1,1950,00,00) ; lat=reform(gphit(0,0:jpj-1)) lon=reform(glamt(0:jpi-1,0)) ; ncfile='!' + fullfilename_out 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'} globattr={Source:'TropFlux - Air-Sea Fluxes for the Global Tropics', Resolution:'1 x 1 degree and daily', IDL_program_name:'TropFlux_ncdf.pro',Timerange:cda0+' - '+cda1, More_Info:'ISCCP based SWR until 2007 and OLR based SWR after that with a 90 day linear transition between the two'} sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} lw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Longwave Radiation',short_name:'lwr',axis:'TYX'} sh_attr={units:'w/m^2',missing_value:1.e20,long_name:'Sensible Heat Flux',short_name:'shf',axis:'TYX'} lh_attr={units:'w/m^2',missing_value:1.e20,long_name:'Latent Heat Flux',short_name:'lhf',axis:'TYX'} ; ncfields = 'swr[longitude,latitude,time]=swr:sw_attr; ' $ +'lwr[longitude,latitude,time]=lwr:lw_attr; ' $ +'lhf[longitude,latitude,time]=lhf:lh_attr; ' $ +'shf[longitude,latitude,time]=shf:sh_attr; ' $ + 'longitude[]=lon:lon_attr; ' $ + 'latitude[]=lat:lat_attr; ' $ + 'time[*time]=time:time_attr ' $ + ' @ globattr' ; @ncdf_quickwrite ; end