;+ ; ; .. _TropFlux_swr_DT_19890101_20071231.pro: ; ; ===================================== ; TropFlux_swr_DT_19890101_20071231.pro ; ===================================== ; ; DESCRIPTION ; =========== ; ; Correction of swr delay time on OAFLUX grid ; ; :file:`${PROJECT_OD}/swr_oafluxgrid_1985_2007.nc` ; have been produced ++by pk ; ; Corrected swr delay on OAFLUX grid ; is written in ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc` ; if this file not already exists. ; ; This file will be used by :ref:`TropFlux_swr_BLND_19890101_20091231.pro`. ; ; .. graphviz:: ; ; digraph tropflux_swr_dt_19890101_20071231 { ; ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/swr_oafluxgrid_1985_2007.nc"]; ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc"]; ; ; tropflux_swr_dt_19890101_20071231 [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_swr_DT_19890101_20071231.pro", ; label="${PROJECT}/src/TropFlux_swr_DT_19890101_20071231.pro"]; ; ; {file_in}-> {tropflux_swr_dt_19890101_20071231} -> {file_out} ; ; } ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; ; :ref:`mooring_corrections` ; ; :ref:`data_in_swr` ; ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`grossemoyenne ` ; :func:`julday ` ; :func:`caldat ` ; :func:`ncdf_quickwrite ` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> .compile TropFlux_swr_DT_19890101_20071231 ; IDL> tropflux_swr_dt_19890101_20071231 ; ; TODO ; ==== ; ; NaNf values in ouptut file while 1.e20 in input file !! ; ; coding rules ; ; why compile is needed ? uppercase in file name ; ; any way change the name to swr_dt_correction_ndcf.pro ; to homogenize names of tools ; ; use the output of concat_swr.sh to be written. ; now use swr_oafluxgrid_1985_2007.nc provided by pk 20110811 ; ; KNOWN ISSUES ; ============ ; ; test of existence of fullfilename not very efficient because ; MUST_EXIST keyword of :func:`isafile ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; $Id$ ; ; $URL$ ; ; - fplod 20110812T073138Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * usage of ${PROJECT_OD} ; * complete description ; * remove v50 in output filename ; ; - fplod 20101215T091726Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph in header ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- pro TropFlux_swr_DT_19890101_20071231 ; @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 data filename filename='swr_oafluxgrid_1985_2007.nc' ; ; check if this file exists msg='iii : looking for ' + filename ras = report(msg) fullfilename = isafile(iodirout + filename, NEW=0, /MUST_EXIST) IF fullfilename[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename + ' was not found.' ras = report(msg) STOP ENDIF ; ; build output filename filename_out = 'TropFlux_swr_19890101_20071231_DT.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 ; initncdf, filename sw=read_ncdf("swr", 19890101, 20071231, file=filename,/nostr) help, sw sw_mean=grossemoyenne(sw, 't',/nan) help, sw_mean tt=time & jpt=n_elements(time) caldat, time,mon,day,yea sw_m=sw*0. & sw_bias=sw*0. for jt=0,jpt-1 do begin jtt=(time(jt)-julday(1,1,yea(jt))) < 364 swr=reform(sw_mean(*,*)) sw_m(*,*,jt)=swr sw_bias(*,*,jt)=(((swr-295.4)*18.36/(200.-295.4)) > 0.) < 18.37 endfor help, sw_m, sw_bias swa=sw-sw_m swa=swa/(0.901273) ;; variability correction (seasonal_cycle_swr_isccp.pro) swr=sw_m+swa-sw_bias ;; new swr, corrected for bias and variability ;writing field ;time=julday(1,1,1989)+lindgen(7670) cda0=string(jul2date(tt(0)),format='(i8.8)') cda1=string(jul2date(tt(jpt-1)),format='(i8.8)') lat=reform(gphit(0,0:jpj-1)) lon=reform(glamt(0:jpi-1,0)) time=time-julday(1,1,1950) & jpt=n_elements(time) 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'} sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} globattr={source:'Obtained from ISCCP. Corrections has been done on mean bias and variability',timerange:cda0+' - '+cda1} ncfields = 'swr[longitude,latitude,time]=swr:sw_attr; ' $ + 'longitude[]=lon:lon_attr; ' $ + 'latitude[]=lat:lat_attr; ' $ + 'time[*time]=time:time_attr ' $ + ' @ globattr' @ncdf_quickwrite end