;+ ; ; .. _cronin_gustiness_ncdf.pro: ; ; ========================= ; cronin_gustiness_ncdf.pro ; ========================= ; ; Cronin gustiness correction on corrected sst on OAFLUX grid ; ; :file:`${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc` have been produced by ; :ref:`sst_correction_ncdf.pro`. ; ; Cronin gustiness corrected ++ on corrected sst on OAFLUX grid ; is written in ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` ; if this file not already exists. ; ; This file will be used by :ref:`TropFlux_swr_BLND_19890101_20091231.pro` and ; :ref:`TropFlux_19890101_20091231.pro`. ; ; .. graphviz:: ; ; digraph cronin_gustiness_ncdf { ; graph [ ; rankdir="LR", ; ] ; ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc"]; ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; ; ; cronin_gustiness_ncdf [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/cronin_gustiness_ncdf.pro", ; label="${PROJECT}/src/cronin_gustiness_ncdf.pro"]; ; ; {file_in} -> {cronin_gustiness_ncdf} -> {file_out} ; } ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> cronin_gustiness_ncdf ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; ; :ref:`mooring_corrections` ; ; :ref:`sst_correction_ncdf.pro`. ; ; :func:`initncdf ` ; :func:`julday ` ; :func:`ncdf_quickwrite ` ; ; TODO ; ==== ; ; coding rules ; ; why writing more than 1 timestep ? ; ; KNOWN ISSUES ; ============ ; ; test of existence of fullfilename_in not very efficient because ; MUST_EXIST keyword of :func:`isafile ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; - fplod 20110808T144208Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * usage of ${PROJECT_OD} ; * complete description ; * remove v50 in output filename ; * remove return statement ; ; - fplod 20101215T092619Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph in header ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- pro cronin_gustiness_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 ; da1=19880101 & da2=20101231 date1=19890101 & date2=20081231 ; ; build data filename filename='TropFlux_sst_19890101_20091231.nc' ; ; check if this file exists 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_gustiness_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 ; initncdf, fullfilename sst=read_ncdf('sst',da1,da2,file=fullfilename,/nostr) & sst=reform(sst-273.15) help, sst sst_clim=grossemoyenne(sst, 't',/nan) ;wg=0.175*sst_clim-3.17 ;; line fit obtained from the scatter (Cronin gustiness Vs ERAI SST) ;help, wg jpt=n_elements(time) wg_tot=sst*0. for jt=0, jpt-1 do begin wg_tot(*,*,jt)=(((sst_clim(*,*)-23.7)*2.1/(29.8-23.7)) > 1.) <2.1 endfor help, wg_tot ;; writing field time=timegen(7670, units='days', start=julday(1,1,1989,0)) & 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,*)) 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'} gust_attr={units:'m/s',missing_value:valmask,long_name:'Climatological gustiness',short_name:'wg',axis:'TYX'} globattr={source:'Climatological wind gustiness obtained by fitting cronins gustiness values against sst ',timerange:cda0+' - '+cda1} ncfields = 'wg[longitude,latitude,time]=wg_tot:gust_attr; ' $ + 'longitude[]=xlon:lon_attr; ' $ + 'latitude[]=ylat:lat_attr; ' $ + 'tt[*time]=tt:time_attr ' $ + ' @ globattr' @ncdf_quickwrite end