Changeset 120


Ignore:
Timestamp:
09/11/08 15:59:55 (16 years ago)
Author:
ericg
Message:

Added +/- 1 stddev curves in bining plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/procs/ybinx.pro

    r109 r120  
    55         ; ---------------------- 
    66         ; 
     7               IF debug_w THEN print, "    " 
    78               IF debug_w THEN print, "    Enter ybinx..." 
     9               IF debug_w THEN print, "    " 
    810                
    911               ; organise density bins: either read array or build form single number and min/max in fld_glo_mmx.def 
     
    1921 
    2022               IF debug_w THEN print, '    bin_plt= ', bin_plt  
     23               IF debug_w THEN print, '      nbins= ', nbins 
    2124 
    2225               ; 3rd field to bin regression ? 
     
    2730 
    2831               IF sw3 THEN BEGIN  
    29                   idxmsk = where(fld GT valmask/20.) 
     32                  idxmsk = where(fld GT valmask/10.) 
    3033                  IF idxmsk(0) NE -1 THEN fld(idxmsk) = valmask 
    3134                  IF idxmsk(0) NE -1 THEN fld3(idxmsk) = valmask 
    3235               ENDIF  
     36 
     37               ; print min/max of field for debug 
     38               idxmskp = where(fld LE valmask/10.) 
     39               IF debug_w THEN print, '    Min/max fld= ', min(fld(idxmskp)), max(fld(idxmskp)) 
     40               IF debug_w THEN print, '    Min/max fld2= ', min(fld2(idxmskp)), max(fld2(idxmskp)) 
    3341 
    3442               ; remove mean seasonal cycle if required 
     
    102110               max_idx = max(binpop) 
    103111 
    104                IF debug_w THEN print, '  max bin size ', max_idx 
    105  
     112               IF debug_w THEN print, '    Max bin size ', max_idx 
    106113               fldy = fltarr(nbins+1, max_idx) 
    107114               fldy[*, *] = !values.f_nan  
     
    152159                  WHILE ib LE nbins DO BEGIN  
    153160                      
     161                     binsz = binpop(ib) 
    154162                      
    155                      binsz = binpop(ib) 
    156                      sfc_tot = total(surfb(ib, 0:binsz-1)) 
    157                      IF sfc_tot GT 0 THEN BEGIN   
     163                     IF binsz GT 1 THEN BEGIN   
     164 
     165                        sfc_tot = total(surfb(ib, 0:binsz-1)) 
    158166                        yplt(ib) = total(fldys(ib, 0:binsz-1))/sfc_tot 
     167                        yerr(ib) = sqrt((moment(fldy(ib, 0:binsz-1)))[1]) 
     168 
    159169                        mean_fld = mean_fld + yplt(ib)*float(binpop(ib))  
     170 
     171                        ; print bin info 
     172                        IF ib GT 0 AND ib LT nbins THEN print, '    Bin size, occurence, average: ', bin_interval(ib-1), bin_interval(ib), binpop(ib), (binpop(ib)/total(binpop))*100., yplt(ib) 
     173                        IF ib EQ 0 THEN print, '    Bin size, occurence, average:      min' , bin_interval(ib), binpop(ib), (binpop(ib)/total(binpop))*100. , yplt(ib) 
     174                        IF ib EQ nbins THEN print, '    Bin size, occurence, average: ', bin_interval(ib-1),'     max ', binpop(ib), (binpop(ib)/total(binpop))*100. , yplt(ib) 
    160175                     ENDIF ELSE yplt(ib) = !values.f_nan 
    161176                   
     
    184199 
    185200                     IF binsz GT 1 THEN BEGIN  
     201 
    186202                        idx1 = where(fldy(ib, 0:binsz-1) NE valmask) 
    187203                        idx2 = where(fldy2(ib, 0:binsz-1) NE valmask) 
     
    193209 
    194210                        mean_fld = mean_fld + yplt(ib)*float(binpop(ib))  
     211 
     212                        ; print bin info 
    195213                        IF ib GT 0 AND ib LT nbins THEN print, '    Bin size, occurence, regress.: ', bin_interval(ib-1), bin_interval(ib), binpop(ib), (binpop(ib)/total(binpop))*100., yplt(ib) 
    196214                        IF ib EQ 0 THEN print, '    Bin size, occurence, regress.:      min' , bin_interval(ib), binpop(ib), (binpop(ib)/total(binpop))*100. , yplt(ib) 
     
    228246               res = execute(pltcmd)       
    229247 
    230                ; plot error bars for regression 
    231  
    232                IF sw3 THEN BEGIN  
    233                   pltcmd = 'pltsc,yplt-yerr,bin_plt,minc,maxc,minc2,maxc2,varlegend'+com_strplt+',ov1d=1,COLOR=1, thick=1, STY1D=-1,subtitle=""' 
    234                   res = execute(pltcmd)       
    235                   pltcmd = 'pltsc,yplt+yerr,bin_plt,minc,maxc,minc2,maxc2,varlegend'+com_strplt+',ov1d=1,COLOR=1, thick=1, STY1D=-1,subtitle=""' 
    236                   res = execute(pltcmd)       
    237                ENDIF  
     248               ; plot +/- 1 stdedv for field binnig 
     249 
     250               pltcmd = 'pltsc,yplt-yerr,bin_plt,minc,maxc,minc2,maxc2,varlegend'+com_strplt+',ov1d=1,COLOR=1, thick=1, STY1D=-1,subtitle=""' 
     251               res = execute(pltcmd)       
     252               pltcmd = 'pltsc,yplt+yerr,bin_plt,minc,maxc,minc2,maxc2,varlegend'+com_strplt+',ov1d=1,COLOR=1, thick=1, STY1D=-1,subtitle=""' 
     253               res = execute(pltcmd)       
    238254 
    239255               IF debug_w THEN print, "    ... Exit ybinx" 
Note: See TracChangeset for help on using the changeset viewer.