;+ ; ; ============ ; tropflux.pro ; ============ ; ; .. function:: tropflux(yyyymmddb,yyyymmdde) ; ; DESCRITION ; ========== ; ; This program computes net heat flux components on the 1° oaflux grid. ; ; all input variables are corrected for mean bias and variability. ; ; gustiness correction is applied for wind speed based on cronin's climatological ; gustiness values. ; ; :file:`${PROJECT_ID}/mask_oaflux_30N30S.nc` ; containing ; OAFLUX grid ; has been produced by ; :func:`oaflux_mask_30n30s`. ; ; :file:`${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc` ; containing ; sst corrected on OAFLUX grid ; has been produced by ; :func:`sst_correction_ncdf`. ; ; :file:`${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc` ; containing ; ws corrected on OAFLUX grid ; has been produced by ; :func:`ws_correction_ncdf`. ; ; :file:`${PROJECT_OD}/TropFlux_gustiness_{yyyymmdd}_{yyyymmdd}.nc` ; containing ; ++ ; has been produced by ; :func:`cronin_gustiness_ncdf`. ; ; :file:`${PROJECT_OD}/TropFlux_swr_{yyyymmdd}_{yyyymmdd}_BLND.nc` ; containing ; ws corrected on OAFLUX grid ; has been produced by ; :func:`tropflux_swr_blnd`. ; ; :file:`${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc` ; containing ; lwr corrected on OAFLUX grid ; has been produced by ; :func:`lwr_correction_ncdf`. ; ; containing ; t2m corrected on OAFLUX grid ; has been produced by ; :func:`t2m_correction_ncdf`. ; ; :file:`${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc` ; containing ; q2m corrected on OAFLUX grid ; has been produced by ; :func:`d2m_to_q2m_erai`. ; ; net heat flux components are written ; in :file:`${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc` ; if this file not already exists. ; ; This output file ; :file:`${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc` ; will be used by ; :ref:`TropFlux_NRT_ncdf.pro`. ; ; .. graphviz:: ; ; digraph tropflux { ; ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; ; file_sst [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc"]; ; file_ws [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc"]; ; file_wg [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_{yyyymmdd}_{yyyymmdd}.nc"]; ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_{yyyymmdd}_{yyyymmdd}_BLND.nc"]; ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc"]; ; file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_{yyyymmdd}_{yyyymmdd}.nc"]; ; file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc"]; ; ; file_out[shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc"]; ; ; tropflux [shape=box, ; fontname=Courier, ; color=blue, ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/tropflux.pro", ; label="${PROJECT}/src/tropflux.pro"]; ; ; {mask file_sst file_ws file_wg file_swr file_lwr file_t2m file_q2m} -> {tropflux} -> {file_out} ; ; } ; ; SEE ALSO ; ======== ; ; :ref:`project_profile.sh` ; ; Used by :ref:`tropflux.sh` ; ; :func:`report ` ; :func:`isadirectory ` ; :func:`isafile ` ; :func:`initncdf ` ; :func:`ncdf_lec ` ; :func:`read_ncdf ` ; :func:`caldat ` ; :func:`julday ` ; :func:`ncdf_quickwrite ` ; ; :func:`qsee` ; :func:`lwnet_clark` ; :func:`calc_claud_vlat` ; :func:`cor30a` ; ; .. note:: ; ; :func:`lwdown_clark` is not used here but available. ; ; EXAMPLES ; ======== ; ; :: ; ; IDL> yyyymmddb = 20000101L ; IDL> yyyymmdde = 20001231L ; IDL> result = tropflux(yyyymmddb, yyyymmdde) ; IDL> print, result ; TODO ; ==== ; ; describe usage of tau ; ; compare time between all inputs after reading ; ; make it work :: ; ; % Compiled module: EXTRAPOLATE. ; % Attempt to subscript LAND with OK is out of range. ; % Execution halted at: EXTRAPOLATE 176 ; /usr/home/fplod/SAXO_DIR/SRC/Interpolation/extrapolate.pro ; % TROPFLUX_19890101_20091231 450 ; /usr/home/fplod/incas/tropflux/tropflux_ws/src/TropFlux_19890101_20091231.p ; ro ; % $MAIN$ ; % Program caused arithmetic error: Floating overflow ; % Program caused arithmetic error: Floating illegal operand ; ; the incriminated line is :: ; ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,1)) & tab(ocean)=x & m=fi nite(tab) & tab=extrapolate(tab,m) & lwr(*,*,jt)=tab*msk+valmask*(1-msk) ; ; to make progress I DO NOT extrapolate anymore lwr, sen and lat ; !!!!! must be reactivated ; ; when I DO NOT extrapolate lwr, sen and lat , program end with :: ; ; Written to ; !/usr/work/incas/fplod/tropflux_d/TropFlux_19890101_20091231_coarev3.nc ; ------------------------- ; % Program caused arithmetic error: Floating divide by 0 ; % Program caused arithmetic error: Floating underflow ; % Program caused arithmetic error: Floating overflow ; % Program caused arithmetic error: Floating illegal operand ; ; explain why :func:`lwdown_clark` is not used ; ; check if K or °C in input ; ; get rid of:: ; ; % date 1: 19880101 is not found in the time axis. ; ; why :: ; ; da1=19880101 ; ; 1st date 19890101 no ? ; ; why da1-1 (with da1=19880101) when reading gustiness file :: ; ; wg=read_ncdf('wg',da1-1,da2,file=fullfilename_wg,/nostr) ; ; coding rules ; ; KNOWN ISSUES ; ============ ; ; test of existence of fullfilename_msk not very efficient because ; MUST_EXIST keyword of :func:`isafile ` not yet implemented ; ; EVOLUTIONS ; ========== ; ; $Id ; ; $URL$ ; ; - fplod 20120322 ; ; * pro -> func ; * rename with lower case TropFlux_19890101_20091231 become tropflux ; * taking project_overwite into account ; * try to add compile_opt ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters ; * get rid of timegen ; ; - fplod 20110830T135832Z cratos (Linux) ; ; * replace tt by time ; ; - fplod 20110830T084129Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add tau in ouptut file ; ; - fplod 20110822T090838Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * split some multiple lines statement to investigate ; pb of extropalation for lwr ; ; - fplod 20110819T144332Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add _coarev3 to filename output ; * check if filename output exists ; ; - fplod 20110809T110911Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * complete descritption ; * remove v* from filenames (in and out) ; * usage of ${PROJECT_OD} ; * remove return statement ; * add test on IO files ; ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * remove hard coded directory for mask_oaflux_30N30S.nc ; ; - fplod 20101214T112131Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * add graph ; ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) ; ; * minimal header ; ; - pbk 2008 ; ; * creation ; ;- ; function tropflux $ , yyyymmddb $ , yyyymmdde ; compile_opt idl2, strictarrsubs, logical_predicate ; @cm_4cal @cm_4data @cm_4mesh @cm_4data @cm_project ; ; Return to caller if errors ON_ERROR, 2 ; result = -1 ; usage = 'result = tropflux_swr_nrt(yyyymmddb, yyyymmdde)' nparam = N_PARAMS() IF (nparam NE 2) THEN BEGIN ras = report(['Incorrect number of arguments.' $ + '!C' $ + 'Usage : ' + usage]) return, result ENDIF ; ; 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) return, result 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) return, result ENDIF ; ; build mask filename filename_msk='mask_oaflux_30N30S.nc' ; ; check if this file exists msg='iii : looking for ' + filename_msk ras = report(msg) 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) return, result ENDIF ; ; test if ${PROJECT_OD} defined CASE project_od_env OF '' : BEGIN msg = 'eee : ${PROJECT_OD} is not defined' ras = report(msg) return, result 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) return, result 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) return, result ENDIF ; ; build sst data filename filename_sst='TropFlux_sst_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' ; ; check if this file exists msg='iii : looking for ' + filename_sst ras = report(msg) fullfilename_sst = isafile(iodirout + filename_sst, NEW=0, /MUST_EXIST) IF fullfilename_sst[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_sst + ' was not found.' ras = report(msg) return, result ENDIF ; ; build ws data filename filename_ws='TropFlux_ws_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' ; ; check if this file exists msg='iii : looking for ' + filename_ws ras = report(msg) fullfilename_ws = isafile(iodirout + filename_ws, NEW=0, /MUST_EXIST) IF fullfilename_ws[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_ws + ' was not found.' ras = report(msg) return, result ENDIF ; ; build swr data filename filename_swr='TropFlux_swr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_BLND.nc' ; ; check if this file exists msg='iii : looking for ' + filename_swr ras = report(msg) fullfilename_swr = isafile(iodirout + filename_swr, NEW=0, /MUST_EXIST) IF fullfilename_swr[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_swr + ' was not found.' ras = report(msg) return, result ENDIF ; ; build lwr data filename filename_lwr='TropFlux_lwr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.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) return, result ENDIF ; ; build t2m data filename filename_t2m='TropFlux_t2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' ; ; check if this file exists msg='iii : looking for ' + filename_t2m ras = report(msg) fullfilename_t2m = isafile(iodirout + filename_t2m, NEW=0, /MUST_EXIST) IF fullfilename_t2m[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_t2m + ' was not found.' ras = report(msg) return, result ENDIF ; ; build q2m data filename filename_q2m='TropFlux_q2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' ; ; check if this file exists msg='iii : looking for ' + filename_q2m ras = report(msg) fullfilename_q2m = isafile(iodirout + filename_q2m, NEW=0, /MUST_EXIST) IF fullfilename_q2m[0] EQ '' THEN BEGIN msg = 'eee : the file ' + fullfilename_q2m + ' was not found.' ras = report(msg) return, result ENDIF ; ; build wg data filename filename_wg='TropFlux_gustiness_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.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) return, result ENDIF ; ; build output filename filename_out = 'TropFlux_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_coarev3.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) return, result ENDIF ; initncdf, fullfilename_msk msk=ncdf_lec(fullfilename_msk,var='msk') ; initncdf, fullfilename_sst ; ws=read_ncdf('ws',yyyymmddb-.5d,yyyymmdde,file=fullfilename_ws,/nostr) timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'ws in tropflux first date ', cda0 print, 'ws in ws_correction_ncdf last date ' , cda1 ; wg=read_ncdf('wg',yyyymmddb-.5d-1,yyyymmdde,file=fullfilename_wg,/nostr) timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'wg in tropflux first date ', cda0 print, 'wg in ws_correction_ncdf last date ' , cda1 tt=time jpt=n_elements(time) sst=read_ncdf('sst',yyyymmddb-.5d,yyyymmdde,file=fullfilename_sst,/nostr) timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'sst in tropflux first date ', cda0 print, 'sst in ws_correction_ncdf last date ' , cda1 sst=reform(sst-273.15) swd=read_ncdf('swr',yyyymmddb-.5d,yyyymmdde,file=fullfilename_swr,/nostr) timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'swr in tropflux first date ', cda0 print, 'swr in ws_correction_ncdf last date ' , cda1 lw=read_ncdf('lwr',yyyymmddb-.5d,yyyymmdde,file=fullfilename_lwr,/nostr) timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'lwr in tropflux first date ', cda0 print, 'lwr in ws_correction_ncdf last date ' , cda1 swd=swd/0.94 ; converting from net swr to downward swr ; t2m=read_ncdf('t2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename_t2m,/nostr)-273.15 ; in C timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 't2m in tropflux first date ', cda0 print, 't2m in ws_correction_ncdf last date ' , cda1 q2m=read_ncdf('q2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename_q2m,/nostr) ; in g/kg timein=24.d*(time-julday(1,1,1957,0,0,0)) jpt=n_elements(timein) da=jul2date(time[0]) cda0=string(da,format='(i8.8)') da=jul2date(time[jpt-1]) cda1=string(da,format='(i8.8)') print, 'q2m in tropflux first date ', cda0 print, 'q2m in ws_correction_ncdf last date ' , cda1 ; w=sqrt(ws*ws+wg*wg) ; wind corrected for gustiness w=ws tmask=msk help, ws,w,wg,u,sst,swd,t2m,q2m ocean=where(msk eq 1,compl=land) valmask=1.e20 time=tt jpt=n_elements(time) ; ; Constants for flux computation ; zu=10. ; height of wind speed measurement (m) us=0. ; surf current (m/s) zt=2. ; Height of air T measurement (m) zq=2. ; height of humidity measurement (m) P=1008. ; Pressure zi=600. ; Inversion height (m) jcool=0 ; Compute cool-skin jwave=0 ; No waves twave=5. hwave=1. ; caldat, time,mon,day,yea swr=fltarr(jpi,jpj,jpt)+1.e20 lwr=fltarr(jpi,jpj,jpt)+1.e20 lat=fltarr(jpi,jpj,jpt)+1.e20 sen=fltarr(jpi,jpj,jpt)+1.e20 lwnet_clrk=fltarr(jpi,jpj,jpt)+1.e20 ;Ch=fltarr(jpi,jpj,jpt)+1.e20 ;Ce=fltarr(jpi,jpj,jpt)+1.e20 junk=fltarr(jpi,jpj,jpt)+1.e20 ; for jt=0,jpt-1 do begin jday=time[jt]-julday(1,1,yea[jt]) print, 'Computing Fluxes ',jt,' / ',jpt-1 ; ; P=msl(*,*,jt) ; P=P(ocean) ; ; wind speed (m/s) wn=w[*,*,jt] wn=wn[ocean] ; Bulk sst (°C) ts=sst[*,*,jt] ts=ts[ocean] ; 2m Air T (°C) t=t2m[*,*,jt] t=t[ocean] ; Sea surface sat. spec. humidity (g/kg) qs=qsee(ts,P) ; 2m AIr specific humidity (g/kg) q=q2m[*,*,jt] q=q[ocean] ; Downward solar flux (W/m2) Rs=swd[*,*,jt] Rs=Rs[ocean] ylat=gphit[ocean] ; cld=calc_cloud(jday,Rs,ylat) cld=calc_cloud_vlat(jday,Rs,ylat) ; Downward IR flux (W/m2) ; Rl=lwdown_clark(ts,q,cld,t,P) Rl=lw[*,*,jt] Rl=Rl[ocean] rain=0. lw_clrk=-lwnet_clark(ts,q,cld,t,P) ; junk[*,*,jt]=lw_clrk ; ;stop y=cor30a(wn,us,ts,t,Qs,Q,Rs,Rl,rain,zi,P,zu,zt,zq,ylat,jcool,jwave,twave,hwave) ; A few punctual missing values (coare does not converge): filled by spatial extrapolation tab=fltarr(jpi,jpj)+!values.f_nan x=reform(y[*,0]) tab[ocean]=x m=finite(tab) help, tab, m, swr tab=extrapolate(tab,m) swr[*,*,jt]=tab*msk+valmask*(1-msk) ; tab=fltarr(jpi,jpj)+!values.f_nan x=reform(y[*,1]) tab[ocean]=x m=finite(tab) help, tab, m, lwr ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) print, 'www : extrapolation for lwr is not done' tab=tab lwr[*,*,jt]=tab*msk+valmask*(1-msk) ; tab=fltarr(jpi,jpj)+!values.f_nan x=reform(y[*,2]) tab[ocean]=x m=finite(tab) help, tab, m, lat ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) print, 'www : extrapolation for lat is not done' tab=tab lat[*,*,jt]=tab*msk+valmask*(1-msk) tab=fltarr(jpi,jpj)+!values.f_nan x=reform(y[*,3]) tab[ocean]=x m=finite(tab) help, tab, m, sen ;!!!!!!!!!!!!+++++++++++++++ tab=extrapolate(tab,m) print, 'www : extrapolation for sen is not done' tab=tab sen[*,*,jt]=tab*msk+valmask*(1-msk) ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(lw_clrk) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & lwnet_clrk[*,*,jt]=tab*msk+valmask*(1-msk) tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,5]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & tau[*,*,jt]=tab*msk+valmask*(1-msk) ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,6]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & Ch[*,*,jt]=tab*msk+valmask*(1-msk) ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,7]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & Ce[*,*,jt]=tab*msk+valmask*(1-msk) tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,8]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & wg[*,*,jt]=tab*msk+valmask*(1-msk) endfor 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,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'} globattr={source:'Fluxes for the Global Tropical Ocean - TropFlux',timerange:cda0+' - '+cda1} swr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net shortwave radiation',short_name:'swr',axis:'TYX'} lwr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation',short_name:'lwr',axis:'TYX'} lwr_clrk_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation from clark',short_name:'lwr',axis:'TYX'} lhf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface latent flux',short_name:'lhf',axis:'TYX'} shf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface sensible flux',short_name:'shf',axis:'TYX'} wg_attr={units:'m/s',missing_value:valmask,long_name:'COARE convective gustiness',short_name:'wg',axis:'TYX'} tau_attr={units:'N/m2',missing_value:valmask,long_name:'Wind stress magnitude',short_name:'tau',axis:'TYX'} ; help, swr,lwr,lat,sen,time,xlon,ylat ; ncfields = 'tau[longitude,latitude,time]=tau:tau_attr; ' $ + 'wg[longitude,latitude,time]=wg:wg_attr; ' $ + 'swr[longitude,latitude,time]=swr:swr_attr; ' $ ; +'lwr_coare[longitude,latitude,time]=lwr:lwr_attr; ' $ +'lwr[longitude,latitude,time]=lwnet_clrk:lwr_clrk_attr; ' $ +'lhf[longitude,latitude,time]=lat:lhf_attr; ' $ +'shf[longitude,latitude,time]=sen:shf_attr; ' $ ; +'Ch[longitude,latitude,time]=Ch:Ch_attr; ' $ ; +'Ce[longitude,latitude,time]=Ce:Ce_attr; ' $ + 'longitude[]=xlon:lon_attr; ' $ + 'latitude[]=ylat:lat_attr; ' $ + 'time[*time]=time:time_attr ' $ + ' @ globattr' ; @ncdf_quickwrite ; result = 0 return, result ; end