;+ ; ; .. _TropFlux_swr_BLND_19890101_20091231.pro: ; ; ======================================= ; TropFlux_swr_BLND_19890101_20091231.pro ; ======================================= ; ; DESCRIPTION ; =========== ; ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc` ; containing ++ ; has been produced by ; :ref:`TropFlux_swr_DT_19890101_20071231.pro`. ; ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_NRT.nc` ; containing ++ ; has been produced by ; :ref:`TropFlux_swr_NRT_19890101_20091231.pro`. ; ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` containing ++ ; has been produced by ; :ref:` cronin_gustiness_ncdf.pro`. ; ; ++ are written ; in :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc` ; if this file not already exists. ; ; This file will be used by ; :ref:`TropFlux_NRT_ncdf.pro`. ; ; .. graphviz:: ; ; digraph tropflux_swr_blnd_19890101_20091231 { ; ; file_dt [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc"]; ; file_nrt [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_NRT.nc"]; ; file_gustiness [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_blnd.nc"]; ; ; tropflux_swr_blnd_19890101_20091231 [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_swr_BLND_19890101_20091231.pro", ; label="${PROJECT}/src/TropFlux_swr_BLND_19890101_20091231.pro"]; ; ; {file_dt file_nrt file_gustiness} -> {tropflux_swr_blnd_19890101_20091231} -> {file_out} ; ; } ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; ; :ref:`mooring_corrections` ; ; :ref:`data_in_swr` ; ; :func:`initncdf ` ; :func:`read_ncdf ` ; :func:`julday ` ; :func:`ncdf_quickwrite ` ; ; :ref:`Tropflux_NRT_ncdf.pro` ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> .compile TropFlux_swr_BLND_19890101_20091231 ; IDL> tropflux_swr_blnd_19890101_20091231 ; ; TODO ; ==== ; ; submit read_ncdf with 19890101 pb to saxo-dev ; ; avoid mix lower/uppercase in pro name to avoid compile ; ; coding rules ; ; complete description ; ; why 20080100, 20100112 as date1 and date2 when readind nrt ; ; why two read_ncdf for nrt ; ; according to pk 20110811 we can include this process in ; TropFlux_swr_NRT_19890101_20091231.pro ... later ; ; KNOWN ISSUES ; ============ ; ; test of existence of fullfilename_in not very efficient because ; MUST_EXIST keyword of :func:`isafile ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; $Id: TropFlux_swr_BLND_19890101_20091231.pro 88 2011-08-19 15:40:14Z pinsard $ ; ; $URL$ ; ; - fplod 20110819T120412Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * change 19890101 to 19890100 to read 6939 timesteps in DT file ; even if uggly and understanted SAXO strange behaviour ; ; this resolve crash on cratos idl7:: ; ; % Attempt to subscript SWR_DT with JT is out of range. ; ; line:: ; ; for jt=0,jpt-1 do swr_merged(*,*,jt)=swr_dt(*,*,jt)*a(jt)+(1-a(jt))*swr_nrt(*,*,jt) ; ; problably because 6938+731=7669 and not 7670 when ; :samp:`dt=read_ncdf("swr", 19890101, 20071231, file=fullfilename_dt,/nostr)` ; was used :: ; ; DT FLOAT = Array[350, 60, 6938] ; NRT FLOAT = Array[350, 60, 731] ; SWR_DT FLOAT = Array[350, 60, 7669] ; SWR_NRT FLOAT = Array[350, 60, 7670] ; ; nb jours 19890101-20071231:: ; ; IDL> print, julday(12,31,2007) - julday(01, 01, 1989) +1 ; 6939 ; ; et ncdump -h $PROJECT_OD/TropFlux_swr_19890101_20071231_DT.nc time = UNLIMITED ; // (6939 currently) ; ; nb jours 19890101-20091231:: ; ; IDL> print, julday(12,31,2009) - julday(01, 01, 1989) +1 ; 7670 ; ; strange behaviour of read_ncdf ... see:: ; ; IDL> fullfilename_dt='TropFlux_swr_19890101_20071231_DT.nc' ; IDL> dt=read_ncdf("swr", 19890100, 20071231, file=fullfilename_dt,/nostr) ; IDL> print, 'first time step (should crash with invalid date)', jul2date(time[0]) ; first time step (should be 19890101) 19890101. ; IDL> dt=read_ncdf("swr", 19890101, 20071231, file=fullfilename_dt,/nostr) ; IDL> print, 'first time step (should be 19890101)', jul2date(time[0]) ; first time step (should be 19890101) 19890102. ; ; * correction for reading gustiness file ; ; - fplod 20110809T115747Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * usage of ${PROJECT_OD} ; * remove v* from filenames (in and out) ; * add test on IO files ; ; - fplod 20101215T085754Z 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_BLND_19890101_20091231 ; @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 dt data filename filename_dt="TropFlux_swr_19890101_20071231_DT.nc" ; ; check if this file exists msg='iii : looking for ' + filename_dt ras = report(msg) fullfilename_dt = isafile(iodirout + filename_dt, NEW=0, /MUST_EXIST) IF fullfilename_dt[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_dt + ' was not found.' ras = report(msg) STOP ENDIF ; ; build nrt data filename filename_nrt="TropFlux_swr_19890101_20091231_NRT.nc" ; ; check if this file exists msg='iii : looking for ' + filename_nrt ras = report(msg) fullfilename_nrt = isafile(iodirout + filename_nrt, NEW=0, /MUST_EXIST) IF fullfilename_nrt[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_nrt + ' was not found.' ras = report(msg) STOP ENDIF ; ; build wg data filename filename_wg="TropFlux_gustiness_19890101_20091231.nc" ; ; check if this file exists msg='iii : looking for ' + filename_wg ras = report(msg) fullfilename_wg = isafile(iodirout + filename_wg, NEW=0, /MUST_EXIST) IF fullfilename_wg[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_wg + ' was not found.' ras = report(msg) STOP ENDIF ; ; build output filename filename_out = 'TropFlux_swr_19890101_20091231_BLND.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, fullfilename_dt dt=read_ncdf("swr", 19890100, 20071231, file=fullfilename_dt,/nostr) print, 'www : should crash with invalide date 19890100' help, dt print, 'first time step (should be 19890101)', jul2date(time[0]) print, 'last time step (should be 20071231)', jul2date(time[jpt-1]) ; initncdf, fullfilename_nrt nrt=read_ncdf("sw", 20080100, 20100112, file=fullfilename_nrt,/nostr) help, nrt ; swr_nrt=read_ncdf("sw", 19880101, 20100112, file=fullfilename_nrt,/nostr) ; swr_dt=[[[dt]],[[nrt]]] help, nrt, swr_dt, swr_nrt ; swr_merged=swr_dt*0. ; time=timegen(7670, start=julday(1,1,1989,0), units='days') jpt=n_elements(time) ; a=interpol([1.,0.],[julday(10,01,2007),julday(12,31,2007)],time) a=((a > 0.) < 1.) for jt=0,jpt-1 do begin swr_merged(*,*,jt)=swr_dt(*,*,jt)*a(jt)+(1-a(jt))*swr_nrt(*,*,jt) endfor ; initncdf, fullfilename_wg time=timegen(7670, units='days', start=julday(1,1,1989,0)) jpt=n_elements(time) lat=reform(gphit(0,0:jpj-1)) lon=reform(glamt(0:jpi-1,0)) 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) 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:'ISCCP based SWR until 2007, after 2007 timeseries is completed with OLR based SWR. A linear transition is applied from ISCCP based SWR to OLR based SWR'} sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} ; ncfields = 'swr[longitude,latitude,time]=swr_merged:sw_attr; ' $ + 'longitude[]=lon:lon_attr; ' $ + 'latitude[]=lat:lat_attr; ' $ + 'time[*time]=time:time_attr ' $ + ' @ globattr' ; @ncdf_quickwrite ; end