;The procedure tablemain_wc.pro takes the mastercal files created using ;calibrate_wc.pro and makes calibration tables usable by getcalmat_wc.pro. ;This program allows the user to look at the data that has been flagged ;as good in calibrate_wc.pro, as well as to selectively remove any other point ;the user desires. When a point is removed, the running average is recalculated ;and the remaining data and corrected fit is displayed. The program scrolls ;through each instrument. ; The program first displays slope data for a given level. If a slope data ;point is removed, the corresponding intercept value is also removed. Once the ;slope data is acceptable, the program displays the intercept data. Just as ;with the slope, if an intercept value is deleted, the corresponding slope ;data point is removed too. ; ;Use is as follows: ; tablemain_wc,year,num,full,sav ;Where ; input: year = integer value for full year (i.e., 1997) ; num = the number of half days to average over ; (this is the width of the averaging window ; and should be an odd number) ; full = 1 to fill in missing beginning and end of year ; values based on averaged values - see code below ; 0 to only show dates of points used in mastercal ; sav = 1 to save calibration tables (the ones used ; by getcalmat2.pro), plots of the data ; and curves corresponding to the cal tables, and ; lists of the dates that data were rejected. ; ;Example of saved cal table file name: ;/data/davis/cheas/wcreek/data/cal/tables/1997/mandb1999_c.dat ;Format of cal table: [Julian day, slope, intercept] ; ;Example of saved plot file name: ;/data/davis/cheas/wcreek/data/cal/plots/averaged/avg1997_29_c2.ps' ; ;Example bad-date list file name: ;/data/davis/cheas/wcreek/data/cal/tables/averaged/baddates1997_29_c2.dat' ;Format of bad date list: [yyyy, mm, dd, flag] ;If flag=0, fit for date was flagged bad by user of calibrate.pro ;=1, fit for date was rejected by user of tablemain during slope selection ;=2, fit for date was rejected by user of tablemain during intercept selection ; ;BWBerger 1/19/99 ;Modified by BWBerger 7/12/99 to make program y2k compatible. To do ;this, the mastercal format was changed from having the first column ;with a yymmdd date format to a three column date having yyyy mm dd ;format. All other columns then get shifted over by two. ;Note: All mastercal files have been changed to the new format so that ;this code should work with old and new mastercal files. ; ;Modified by weiguo wang 11/3/99 for wcreek ;Modified by BWB 2/23/00 to use /data/davis/cheas/wcreek/data/cal/mastercal/ ; instead of /data/davis2/wcreek/data/cal/mastercal/ ;Modeified by Weiguo Wang 9/9/2000 to use ;/davis/s1/cheas/wcreek/data/cal/mastercal ; instead of /data/davis/cheas/wcreek/data/cal/mastercal/ ; modified for LCreek, Dec, 18 2000 pro tablemain_lc,year,num,full,sav;,$ ; mcalc2,mcalc4,mcalc6,mcalq2,mcalq4,mcalq6,$ ; mcalc6i,mcalq6i,$ ; mcalc4i,mcalq4i ;Get strings for long year and short year names yrls=strtrim(string(year),2) yrss=strmid(yrls,2,2) nums=strtrim(string(num),2) ;Load necessary data ;Change s2 to s4 , 2/18/2003, since all Lcreek data are moved to s4 ;load,'/davis/s2/lcreek/data/cal/mastercal/'+yrls+'/mastercal_lc_c.dat',mcalc ;load,'/davis/s2/lcreek/data/cal/mastercal/'+yrls+'/mastercal_lc_q.dat',mcalq load,'/eddy/s4/lcreek/data/cal/mastercal/'+yrls+'/mastercal_lc_c.dat',mcalc load,'/eddy/s4/lcreek/data/cal/mastercal/'+yrls+'/mastercal_lc_q.dat',mcalq ;%%%%%%%%%%%%%%%%%%%% ;Call routine that interactively weeds out bad cal values and calculates ;the long term average based on num. ;%%%%%%%%%%%%%%%%%%%% ;co2 tablemake_wc,year,'c',num,mcalc,mandbfits_c,baddates_c,mandbavg_c,$ xrng_c,yrngm_c,yrngb_c,refdates ;%%%%%%%%%%%%%%%%%%%% ;h2o tablemake_wc,year,'q',num,mcalq,mandbfits_q,baddates_q,mandbavg_q,$ xrng_q,yrngm_q,yrngb_q,refdates ;%%%%%%%%%%%%%%%%%%%%%%%% ;Now finish off yearly plot if requested (full=1), that is, add leading ;and/or trailing m and b values to year-long plots that are missing ends. ;%%%%%%%%%%%%%%%%%%%%%%%% if full eq 1 then begin tablefinish_lc,mandbavg_c,'c',year,mandbavg_c tablefinish_lc,mandbavg_q,'q',year,mandbavg_q endif ;++++++++++++++++++++++++++++++++++ ;Now save the tables and baddates if sav eq 1 then begin ;save tables and plots ;First save tables and baddate lists ; saveascii,mandbavg_c,'/davis/s1/cheas/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_c.dat' ; saveascii,baddates_c,'/davis/s1/cheas/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_c.dat' ; saveascii,mandbavg_q,'/davis/s1/cheas/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_q.dat' ; saveascii,baddates_q,'/davis/s1/cheas/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_q.dat' ; change s2 to s4 ;; saveascii,mandbavg_c,'/davis/s2/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_c.dat' ;; saveascii,baddates_c,'/davis/s2/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_c.dat' ;; saveascii,mandbavg_q,'/davis/s2/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_q.dat' ;; saveascii,baddates_q,'/davis/s2/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_q.dat' saveascii,mandbavg_c,'/eddy/s4/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_c.dat' saveascii,baddates_c,'/eddy/s4/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_c.dat' saveascii,mandbavg_q,'/eddy/s4/lcreek/data/cal/tables/'+yrls+'/mandb'+yrls+'_q.dat' saveascii,baddates_q,'/eddy/s4/lcreek/data/cal/plots/averaged/baddates'+yrls+'_'+nums+'_q.dat' ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;Next, save plots ;Start with co2 tableplot_lc,full,yrls,nums,'c',$ mandbfits_c,mandbavg_c,xrng_c,yrngm_c,yrngb_c,refdates ;Next, do h2o tableplot_lc,full,yrls,nums,'q',$ mandbfits_q,mandbavg_q,xrng_q,yrngm_q,yrngb_q,refdates endif return end