pro nee_lc ;this program is used to calculate the NEE of CO2 ;Nee=flux of co2 + RCS (rate of change of CO2 storage) print,'Enter the year in yyyy format' yrls='' read,yrls print,'Do you wish to save plots: y/n?' pltc='' read,pltc if pltc eq 'y' then begin plt=1 endif else begin plt=0 endelse print,'Do you wish to save results to NEE files: y/n?' sav='' read,sav if sav eq 'y' then begin sav=1 endif else begin sav=0 endelse print,'Need spectrum correction? (y/n)' corr='' ff='' read,corr if corr eq 'y' then begin corr=7 ff='spec_corr' endif else begin corr=6 ff='no_spec_corr' endelse ;load file of flux of CO2 ;load_wc,'/data/davis2/wwg/wcreek/output/flx/wc'+yrls+'.sflx', cflx ;load_wc,'/data/davis2/wwg/wcreek/output/flx/wc'+yrls+'.flx', c_cflx ;load_wc,'/data/davis2/wwg/wcreek/output/stor/wc'+yrls+'.stor',stor ; changed on Sep 12 for psu running ; Dec 17 2000 for lcreek ;load_wc,'/davis/s1/wang/d2wwg/lcreek/output/stor/lc'+yrls+'.stor',stor load_wc,'/eddy/s2/wang/d2wwg/lcreek/output/stor/lc'+yrls+'.stor',stor ;load_wc,'/data/davis2/wwg/wcreek/output/flx/wc'+yrls+'.finflx', cflx ; Sep 12,2000 ;load_wc,'/davis/s1/wang/d2wwg/lcreek/output/flx/lc'+yrls+'.finflx', cflx load_wc,'/eddy/s2/wang/d2wwg/lcreek/output/flx/lc'+yrls+'.finflx', cflx ; cyear=cflx(0,*) cday=cflx(4,*) ctime=cflx(3,*) cf=cflx(corr,*) ustar=cflx(12,*) syear=stor(0,*) sday=stor(1,*) stime=stor(2,*) st=stor(3,*) badval=-999. ; modified print,'Are the date and times in flux and stor files same? (y/n)' print,'Note that, usually, length of flux data LT or EQ storage data (a-year run stor)' ;added 11/20/02 ffff='' read,ffff IF ffff EQ 'y' THEN BEGIN nee=fltarr(len(cflx))-999. neeyear=cyear needay=cday neetime=ctime nee_ustar=nee nee_cflx=nee nee_st=nee FOR i=0L,len(cflx)-1 DO BEGIN IF(cf(i) NE badval AND st(i) NE badval) THEN nee(i)=cf(i)+st(i) nee_ustar(i)=ustar(i) nee_cflx(i)=cf(i) nee_st(i)=st(i) ENDFOR ENDIF ELSE BEGIN if(len(cflx) ge len(stor)) then begin nee=fltarr(len(cflx))-999. neeyear=cyear needay=cday neetime=ctime nee_ustar=nee nee_cflx=nee nee_st=nee for i=0L,len(cflx)-1 do begin for j=0L,len(stor)-1 do begin if( cday(i) eq sday(j) and ctime(i) eq stime(j)) then begin if(cf(i) ne badval and st(j) ne badval)then nee(i)=cf(i)+st(j) nee_ustar(i)=ustar(i) nee_cflx(i)=cf(i) nee_st(i)=st(j) ; print,i,needay(i),cf(i),st(j),nee(i) endif endfor endfor endif else begin nee=fltarr(len(stor))-999. neeyear=syear needay=sday neetime=stime nee_ustar=nee nee_cflx=nee nee_st=nee for i=0L,len(stor)-1 do begin for j=0L,len(cflx)-1 do begin if(sday(i) eq cday(j) and stime(i) eq ctime(j)) then begin if(st(i) ne badval and cf(j) ne badval) then nee(i)=st(i)+cf(j) nee_ustar(i)=ustar(j) nee_cflx(i)=cf(j) nee_st(i)=st(i) ; print,i,needay(i),neetime(i),st(i),cf(j),nee(i) endif endfor endfor endelse ENDELSE help,nee_ustar help,ustar if(sav eq 1)then begin nee_save_lc,yrls,ff,neeyear,needay,neetime,nee_ustar,nee_cflx,nee_st,nee endif neeplot=nee if (plt eq 1) then begin name='nee'+yrls+ff+'.ps' ;Sep 12 2000 changed to PSu ;printps1,'/data/davis2/wwg/wcreek/output/plots/nee/'+name,'landscape' printps1,'/eddy/s1/wang/d2wwg/lcreek/output/plots/nee/'+name,'landscape' x=needay+neetime/24.0 y=neeplot plot,x,y,ystyle=1,min_value=-100.0,xtitle='Julian Day',$ ytitle='CO!d2!n NEE (!4l!3mol m!u-2!n s!u-1!n)',$ title='Lost Creek: NEE of CO!d2!n,'+yrls +ff,$ xstyle=1,yrange=[-50,100] printps2 endif return end