Re: CAPE problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 24 2010 - 20:13:00 MST

Hello

It looks fine to me. It might be helpful
to print out the values at one grid point.

After
  cinfo= wrf_cape_3d(pres,t,q,z,ter,psur,True)

Add
  print("---")
  ii =
  jj =
  print ( sprintf("%9.2f", pres(0,:,jj,ii)) +" " \
           +sprintf("%9.2f", t(0,:,jj,ii)) +" " \
           +sprintf("%9.5f", q(0,:,jj,ii)) +" " \
           +sprintf("%9.1f", z(0,:,jj,ii)) )
  print("---")
  print ( sprintf("%9.2f", ter(0,jj,ii)) +" " \
           +sprintf("%9.2f", psur(0,jj,ii)) )

==
Make sure the units are correct and the ordering is consistent.

Also, I will work half day then I will go on vacation.
I try not to get too involved with wrf functions.
WRF created all of them and I am not familiar
with the actual code.

Good lucK
D

z3303149@unsw.edu.au wrote:
> Hi Dennis
>
> this is the program of CAPE by using the wrf_cape_3d function and the
> result from this program shows in attachment, so do you think the problem in my
> program or in the function because different models.
>
> Thanks
>
> Ali
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> begin
>
>
>
> class = 4
>
>
>
> diri = "/srv/science/maths1/z3236814/data02/swap/co2/fc/"
>
>
>
> f = addfile(diri+"evb_minclass_200noev_2095.nc","r")
>
>
> topo = f->terrain
> t = f->t(class-1,:,:,:,:)
> q = f->q(class-1,:,:,:,:)
> pp = f->pp(class-1,:,:,:,:)
> sigma = f->sigma_level
> ps = f->pstarcrs
> ptop = f->ptop
> lon2d= f->longicrs
> lat2d=f->latitcrs
> time = f->time
>
>
>
>
> dsize = dimsizes(q)
>
> pres = new(dsize,float)
>
> ;calculate the pressure for each grid point
> pres = pp + ptop +conform(pp,ps,(/2,3/))*conform(pp,sigma,1)
>
>
> ; to define the pres
> pres!0 = "time"
> pres!1 = "sigma_level"
> pres!2 = "i_cross"
> pres!3 = "j_cross"
>
>
>
> new_rel = relhum(t,q,pres)
>
>
>
> ;to calculate the specific humidity
> spec_hum = mixhum_ptrh(pres*0.01,t,new_rel,2)
>
>
>
>
> ;calculate virtual temperature
> vir_temp = t*(1.+spec_hum*0.61)
>
>
>
>
> ; to define the virtual temperature
> vir_temp!0 = "time"
> vir_temp!1 = "sigma_level"
> vir_temp!2 = "i_cross"
> vir_temp!3 = "j_cross"
>
>
>
>
> ;calculate the geopotential height
> gh = hydro(pres(time|:,i_cross|:,j_cross|:,sigma_level|::-1)*0.01, \
> vir_temp(time|:,i_cross|:,j_cross|:,sigma_level|::-1), \
> conform(vir_temp(:,0,:,:),topo,(/1,2/)))
>
>
>
> ; to define the geopotential height
> gh!0 = "time"
> gh!1 = "i_cross"
> gh!2 = "j_cross"
> gh!3 = "sigma_level"
>
>
>
>
> ; to reorder it from (bottom to top) to (top to bottom) like in q,t and pres
> z = gh(time|:,sigma_level|::-1,i_cross|:,j_cross|:)
>
>
>
> ; to calculate surface pressure
> psur=conform(pp(:,0,:,:),ps,(/1,2/))+ptop+pp(:,dsize(1)-1,:,:)
> psur = psur*0.01
>
>
>
> ter = conform(psur,topo,(/1,2/))
>
> cinfo= wrf_cape_3d(pres,t,q,z,ter,psur,True)
>
> cape = cinfo(0,:,:,:,:)
>
>
> ; to calculate the average of the CAPE
> avCape = dim_avg(dim_avg(dim_avg(cape(time|:,sigma_level|:,i_cross|:,j_cross|:))))
>
>
> wks = gsn_open_wks("x11","cape")
>
>
> res = True
> res@tiMainString = "Convective Available Potential Energy (class 4)"
> res@tiMainFontHeightF = 0.015
> res@tiXAxisString = "Time Steps"
> res@tiXAxisFontHeightF = 0.015
> res@tiYAxisFontHeightF = 0.015
> res@tiYAxisString = "CAPE (J/kg)"
> res@xyLineThicknessF = 1.5
> res@tmXBMinorValues = ispan(1,25,1)
>
> plot= gsn_xy(wks,ispan(1,25,1),avCape,res)
>
>
>
> end
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 24 20:13:05 2010

This archive was generated by hypermail 2.1.8 : Thu Feb 25 2010 - 09:38:32 MST