frequency bar plot

From: Ammu Priya <ammu9016_at_nyahnyahspammersnyahnyah>
Date: Sun Oct 03 2010 - 22:57:28 MDT

Hai!,,
i read dennis reply.i am really sorry.I just removed all my commented lines.Actually this script doesn't give me any error.the only thing is am not sure about the calculation part .I want the frequency count for all the three data(june,july,Aug,Sep) sets.in the range of 0-0.001 ,0.001-2,.....till 40. precipitation counts for all the three data sets.I hope graphical resources is fine.i am not sure whether pdfx function gives the number counts.that s the only thing has to be clarified.here nothing is unappropriate..
Thank you.
 

load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$HOME/ncl/lib/scripts/my_scripts.ncl"

begin

eps = 0

 fps = "Precbar_GPCP-TRMM-IMD_june98_frequency_col"
 fps@OverWrite = True
 fps@View = True
 diragpcp="/user1/akila/plot/frequncydistribution/gpcp1deg/"
 diraimd="/user1/akila/plot/frequncydistribution/imd1deg/"
 diratrmm="/user1/akila/plot/frequncydistribution/trmm1deg/"
 filesgpcp = systemfunc("ls "+diragpcp+"prec.gpcp.1dd.p1d.1998*")
 filesimd = systemfunc("ls "+diraimd+"prec.imd.mo.360x180.1998*")
 filestrmm = systemfunc("ls "+diratrmm+"prec.trmm.3b42.360x180.1998*")
print(filesgpcp)
print(filesimd)
print(filestrmm)

 fgpcp = addfiles(filesgpcp,"r")
 ListSetType (fgpcp,"cat")

 fimd = addfiles(filesimd,"r")
 ListSetType (fimd,"cat")

 ftrmm = addfiles(filestrmm,"r")
 ListSetType (ftrmm,"cat")

 precgpcp = addfiles_GetVar(fgpcp,filesgpcp,"prec")
 precimd = addfiles_GetVar(fimd,filesimd,"prec")
 prectrmm = addfiles_GetVar(ftrmm,filestrmm,"prec")

 printVarSummary(precgpcp)
 printVarSummary(precimd)
 printVarSummary(prectrmm)

 gpcpjjas= precgpcp(time|151:272,lat|:,lon|:)
 gpcpjune= precgpcp(time|151:180,lat|:,lon|:)
 gpcpjuly= precgpcp(time|181:211,lat|:,lon|:) gpcpsep= precgpcp(time|243:272,lat|:,lon|:)
printVarSummary(gpcpjune)
t=gpcpjune(:,{8:28},{70:90})
printVarSummary(t)
print(t)
printVarSummary(gpcpjuly)
printVarSummary(gpcpaug)
printVarSummary(gpcpsep)
 imdjjas =precimd(time|151:272,lat|:,lon|:)
 imdjune =precimd(time|151:180,lat|:,lon|:)
 imdjuly=precimd(time|181:211,lat|:,lon|:)
 imdaug= precimd(time|212:242,lat|:,lon|:)
 imdsep=precimd(time|243:272,lat|:,lon|:)
printVarSummary(imdjune)
printVarSummary(imdjuly)
printVarSummary(imdaug)
printVarSummary(imdsep)
 trmmjjas =prectrmm(time|151:272,lat|:,lon|:)
 trmmjune =prectrmm(time|151:180,lat|:,lon|:)
 trmmjuly=prectrmm(time|181:211,lat|:,lon|:)
 trmmaug=prectrmm(time|212:242,lat|:,lon|:)
 trmmsep=prectrmm(time|243:272,lat|:,lon|:)
printVarSummary(trmmjune)
printVarSummary(trmmjuly)
printVarSummary(trmmaug)
printVarSummary(trmmsep)
x1=ndtooned(gpcpjune(:,{8:28},{70:90}))
printMinMax(x1,0)
y1=ndtooned(imdjune(:,{8:28},{70:90}))
z1=ndtooned(trmmjune(:,{8:28},{70:90}))
printVarSummary(x1)
printVarSummary(y1)
printVarSummary(z1)
printMinMax(x1,0)
printMinMax(y1,0)
printMinMax(z1,0)
print(x1)
printVarSummary(y1)
printMinMax(y1,0)
printVarSummary(z1)
printMinMax(z1,0)
opt=True
opt@bin_min =0
opt@bin_max =50
ry=pdfx(gpcpjune(:,{8:28},{70:90}),0,opt)
opt1         = True
opt1@bin_min =0.4
opt1@bin_max =50
ry1=pdfx(imdjune(:,{8:28},{70:90}),0,opt1)
opt2         = True
opt2@bin_min =0.7
opt2@bin_max =50
ry2=pdfx(imdjune(:,{8:28},{70:90}),0,opt2)
print(ry@bin_center+" "+ry)
printVarSummary(ry)
printVarSummary(ry1)
print(ry1@bin_center+" "+ry1)
printVarSummary(ry2)
print(ry2@bin_center+" "+ry2)

 if(eps .eq. 1)then
  wks = gsn_open_wks("eps",fps);
 else
  wks = gsn_open_wks("x11",fps);
 end if

     sres = True
     sres@gsnMaximize           = True
     sres@vpWidthF = 0.7
     sres@vpHeightF = 0.5
     sres@vpXF = .10
     sres@trXMinF = 0
     sres@trXMaxF = 40
     sres@trYMinF = 0
     sres@trYMaxF = 61
     sres@gsnDraw = True
     sres@gsnFrame = False
     sres@gsnXYBarChart = True
     sres@gsnXYBarChartBarWidth = 0.55
                                             
  sres@tmXBMode          = "Explicit"
;     sres@tmXBValues        = ispan(2,40,2)
     sres@tmXBValues        = fspan(1.45,40.55,20)
     sres@tmXBLabelAngleF            = 315
     sres@tmXBLabels = (/"0-0.001","0.001-2","2-4","4-6","6-8","8-10","10-12","12-14","14-16","16-18","18-20","20-22","22-24","24-26","26-28","28-30","30-32","32-34","34-36","36-38","38-40"/)
     sres@tmXBLabelFont=0.4
     sres@tmXBLabelFontHeightF = 0.0100
     sres@tmXTLabelFontHeightF = 0.0110
     sres@tmYLLabelFontAspectF =1.0
     sres@tmYLLabelFontHeightF = 0.0105
     sres@tiMainFontHeightF = 0.015
     sres@tiMainFont = "helvetica"
     sres@tiMainString = "Frequency distribution,JUNE-98"
     sres@tiYAxisFont          = "helvetica"
     sres@tiYAxisString = "count(%)"

     sres@gsnXYBarChartColors = (/"red"/)
     plot1=gsn_csm_xy(wks,ry@bin_center,ry,sres)
     sres@gsnXYBarChartColors = (/"blue"/)
     plot2=gsn_csm_xy(wks,ry1@bin_center,ry1,sres)
     sres@gsnXYBarChartColors = (/"green"/)
     plot2=gsn_csm_xy(wks,ry2@bin_center,ry2,sres)

     lbres                    = True          ; labelbar only resources
     lbres@vpWidthF           = 0.25           ; labelbar width
     lbres@vpHeightF          = 0.05           ; labelbar height
     lbres@lbBoxMajorExtentF  = 0.36          ; puts space between color boxes
     lbres@lbFillColors       = (/"red"/)
      lbres@lbMonoFillPattern  = True          ; Solid fill pattern
     lbres@lbLabelFontHeightF = 0.015         ; font height. default is small
     lbres@lbLabelJust        = "CenterLeft"  ; left justify labels
     lbres@lbPerimOn          = False

     labels = (/"GPCP"/)
     gsn_labelbar_ndc(wks,1,labels,0.66,0.80,lbres)
     lbres@lbFillColors       = (/"blue"/)
     labels = (/"IMD"/)
     gsn_labelbar_ndc(wks,1,labels,0.65,0.76,lbres)     ; draw right labelbar column
     lbres@lbFillColors       = (/"green"/)
     labels = (/"TRMM"/)
     gsn_labelbar_ndc(wks,1,labels,0.665,0.72,lbres)     ; draw right labelbar column

     frame(wks)
 if(eps .eq. 1)then
  mkpdf(fps)
 end if

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Oct 3 22:57:36 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT