Re: Any NCL function or script that can generate vertical profiles of area averaged mean for WRF variables

From: <mmkamal_at_nyahnyahspammersnyahnyah>
Date: Sun Feb 02 2014 - 02:31:26 MST

Dear Mary,

Thanks you for your mail. Unfortunately I have tried only using Google
search. However I also come across the XY plot shortly after sending
the mail and tried using examples xy_3.ncl and xy_16.ncl for WRF data.
But I failed to generate the vertical profile of potential
temperature. I am including the my code for your suggestion.

Thanks
Kamal

==============================================

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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"

begin
;-----------------

   f = addfile("/scratch/j/wrfout_d01_2002-07-01.nc","r")

;------------------------------------
   lats = (/ 42.48, 44.73 /)
   lons = (/ -82.30, -79.48 /)

   loc = wrf_user_ll_to_ij(f, lons, lats, True)

   x_start = loc(0,0) - 1
   x_end = loc(0,1) - 1
   y_start = loc(1,0) - 1
   y_end = loc(1,1) - 1

;-----------------------------------

   t1 = f->T + 300 ; get T data
   t2 = dim_avg_n_Wrap(t1,0) ; Time average
   t3 = t2(:,y_start:y_end,x_start:x_end)

   theta = dim_avg_n_Wrap(t3,(/1,2/)) ; calculate area average

; printVarSummary(theta)

   p1 = wrf_user_getvar(f, "pressure",-1)
   p2 = dim_avg_n_Wrap(p1,0)
   p3 = p2(:,y_start:y_end,x_start:x_end)
   pres = dim_avg_n_Wrap(p3,(/1,2/))

; printVarSummary(pres)

;----------------------------
; create plot
;----------------------------

  wks = gsn_open_wks ("png","theta_pres") ; open png file

   res = True

   res@gsnMaximize = True

   res@gsnDraw = False
   res@gsnFrame = False

   res@vpWidthF = 0.9
   res@vpHeightF = 0.5

   res@pmLegendDisplayMode = "Always" ; turn on legend

  res@pmLegendSide = "Top" ; Change location of

  plot = gsn_csm_xy (wks,theta,pres,res) ; create plot

  gsn_polyline(wks,plot,(/0,0/),(/0,1000/),False)
  frame(wks)

end

===========================================

Quoting Mary Haley <haley@ucar.edu>:

> Hi,
>
> What you are doing is a basic XY plot with a legend. Did you visit
> our XY plot examples page?
>
> http://www.ncl.ucar.edu/Applications/xy.shtml
>
> See examples xy_3.ncl and xy_16.ncl
>
> Also, see the CALIPSO page which has a panel plot of vertical profiles:
>
> http://www.ncl.ucar.edu/Applications/calipso.shtml
>
> This is the kind of question that you can get several answers to if
> you go to any NCL web page: www.ncl.ucar.edu, and type "vertical
> profile" in the "advanced" search window on the right side just
> under the black bar.
>
> I just did this, and got back a number of hits:
>
> http://www.ncl.ucar.edu/Support/talk_archives/2011/2096.html
> http://www.ncl.ucar.edu/Support/talk_archives/2010/1823.html
>
>
> Also, sometimes you get a hit if you go to the "tips" link at the
> top of our Applications page:
>
> http://www.ncl.ucar.edu/Applications/
> http://www.ncl.ucar.edu/Applications/concepts_list.shtml
>
> Then, use your browser "search" to look for the word "profile" or "vertical".
>
> --Mary
>
>
> On Jan 31, 2014, at 11:29 AM, mmkamal@uwaterloo.ca wrote:
>
>> Hi,
>>
>> I was wondering is there any NCL function or example script that
>> can generate vertical profiles of area averaged mean for
>> temperature or moisture variable from WRF or any other model
>> output. I am attaching an example image that I want to generate.
>> Any help would be greatly appreciated!
>>
>>
>> Thanks
>> Kamal
>>
>>
>>
>>
>>
>> <Domain Averaged Moisture
>> Profile.PNG>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
Received on Sun Feb 2 02:31:37 2014

This archive was generated by hypermail 2.1.8 : Fri Feb 07 2014 - 16:39:11 MST