[ncl-talk] Overlay plot of vertical cross section of WRF derived U and precipitation using NCL

Dennis Shea shea at ucar.edu
Mon Mar 1 19:13:12 MST 2021


A variation

*http://www.ncl.ucar.edu/Applications/2Dvertcoord.shtml*
<http://www.ncl.ucar.edu/Applications/2Dvertcoord.shtml>

On Mon, Mar 1, 2021 at 11:07 AM Rashed Mahmood via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Ahh...Ok now I see one example on NCL page:
> https://www.ncl.ucar.edu/Applications/overlay.shtml
> See Overlay_14.ncl.
>
>
> On Mon, Mar 1, 2021 at 7:03 PM Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> Can you share your latest script and the data files? You can send
>> directly to me, if you want.
>>
>> On Mon, Mar 1, 2021 at 6:26 PM Prasad Kunjeer <pskunjeer at gmail.com>
>> wrote:
>>
>>> My utimate aim is to create plot as attached in enclosed image
>>>
>>> On Mon, 1 Mar, 2021, 9:29 PM Rashed Mahmood, <rashidcomsis at gmail.com>
>>> wrote:
>>>
>>>> My mistake. I did not realize that you are trying to overlay an xy plot
>>>> on top of a contour plot which would not work as it is. Can you be more
>>>> specific what you are trying to do (what is the end goal here)?
>>>>
>>>> On Mon, Mar 1, 2021 at 11:24 AM Prasad Kunjeer <pskunjeer at gmail.com>
>>>> wrote:
>>>>
>>>>> Sir,
>>>>>
>>>>> I have tried the solution, now there is single figure but
>>>>> precipitation is not plotted over it.
>>>>>
>>>>> Regards
>>>>> प्रसाद कुंजीर / Prasad Kunjeer
>>>>> वैज्ञानिक - सी / Scientist - C
>>>>> केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power
>>>>> Research Station
>>>>> पुणे 411 024/ Pune 411 024
>>>>>
>>>>>
>>>>> On Mon, Mar 1, 2021 at 12:38 AM Rashed Mahmood <rashidcomsis at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> You need set the following in the respective resources list:
>>>>>>
>>>>>> res at gsnDraw              = False             ; do not draw the plot
>>>>>> res at gsnFrame             = False             ; do not advance the
>>>>>> frame
>>>>>>
>>>>>>
>>>>>> res_z at gsnDraw              = False             ; do not draw the plot
>>>>>> res_z at gsnFrame             = False             ; do not advance the
>>>>>> frame
>>>>>>
>>>>>>
>>>>>> On Sun, Feb 28, 2021 at 7:47 PM Prasad Kunjeer via ncl-talk <
>>>>>> ncl-talk at mailman.ucar.edu> wrote:
>>>>>>
>>>>>>> I am writing a script to overlay U wind and precipitation from the
>>>>>>> wrf run. My script is as below.
>>>>>>>
>>>>>>>
>>>>>>> ;----------------------------------------------------------------------
>>>>>>> ; wrf_interp_3.ncl
>>>>>>>
>>>>>>> ;----------------------------------------------------------------------
>>>>>>> ; Concepts illustrated:
>>>>>>> ;   - Interpolating a vertical cross-section from a 3D WRF-ARW field.
>>>>>>>
>>>>>>> ;----------------------------------------------------------------------
>>>>>>> ; wrf_user_vert_cross and wrf_user_interp_level replace the
>>>>>>> ; deprecated wrf_user_intrp3d function.
>>>>>>> ;
>>>>>>> ; NCL V6.6.0 or higher is required to run this example.
>>>>>>>
>>>>>>> ;----------------------------------------------------------------------
>>>>>>>
>>>>>>> begin
>>>>>>>   dir = "/media/prasad/C_Drive/2016/res/regrid_exp/"
>>>>>>>   a   = addfile(dir+"wrfout_d03_2016-06-30_17_00_00.nc","r")
>>>>>>>
>>>>>>>   z    = wrf_user_getvar(a, "z",0)          ; grid point height
>>>>>>>   qv   = wrf_user_getvar(a, "QVAPOR",0)     ; cloud field
>>>>>>>   lats = wrf_user_getvar(a, "lat",0)
>>>>>>>   lons = wrf_user_getvar(a, "lon",0)
>>>>>>>   pr   = wrf_user_getvar(a, "pressure",0)
>>>>>>>   ua   = wrf_user_getvar(a, "ua",0)
>>>>>>>   va   = wrf_user_getvar(a, "va",0)
>>>>>>>   wa   = wrf_user_getvar(a, "wa",0)
>>>>>>>
>>>>>>>   rain_exp = wrf_user_getvar(a,"RAINNC",0) / 25.4
>>>>>>>   rain_con = wrf_user_getvar(a,"RAINC", 0) / 25.4
>>>>>>>   rain_tot = (rain_exp + rain_con)
>>>>>>>   copy_VarMeta(rain_exp,rain_tot)
>>>>>>>
>>>>>>>   printVarSummary(rain_tot)
>>>>>>>   printVarSummary(rain_exp)
>>>>>>>   printMinMax(rain_tot,0)
>>>>>>>
>>>>>>>   xlon = wrf_user_getvar(a, "XLONG",0)
>>>>>>>
>>>>>>>   start_lat       = 29.75
>>>>>>>   end_lat         = 29.75
>>>>>>>   start_lon       = 77
>>>>>>>   end_lon         = 83
>>>>>>>   opt             = True
>>>>>>>   opt at latlon      = True
>>>>>>>   opt at linecoords  = True
>>>>>>>   opt at file_handle = a
>>>>>>>   qv_latlon       =
>>>>>>> wrf_user_vert_cross(ua,pr,(/start_lon,start_lat,end_lon,end_lat/),opt)
>>>>>>>
>>>>>>>   printVarSummary(ua)          ; [bottom_top | 31] x [south_north |
>>>>>>> 546] x [west_east | 480]
>>>>>>>   printVarSummary(qv_latlon)   ; [vertical | 100] x [cross_line_idx
>>>>>>> | 171]
>>>>>>>   printMinMax(ua,0)          ; [bottom_top | 31] x [south_north |
>>>>>>> 546] x [west_east | 480]
>>>>>>>   printMinMax(qv_latlon,0)   ; [vertical | 100] x [cross_line_idx |
>>>>>>> 171]
>>>>>>>
>>>>>>>
>>>>>>> ;---Interpolate the 2D Rain field to the lat/lon line
>>>>>>>   t2_line  =
>>>>>>> wrf_user_interp_line(rain_tot,(/start_lon,start_lat,end_lon,end_lat/),opt)
>>>>>>>   printVarSummary(t2_line)
>>>>>>>   long_line  =
>>>>>>> wrf_user_interp_line(xlon,(/start_lon,start_lat,end_lon,end_lat/),opt)
>>>>>>>
>>>>>>>   printMinMax(qv_latlon,0)
>>>>>>>   printMinMax(t2_line,0)
>>>>>>>   printMinMax(long_line,0)
>>>>>>>
>>>>>>>   wks = gsn_open_wks("png","wrf_interp_u_wind")
>>>>>>>
>>>>>>>   res                      = True
>>>>>>>   res at gsnMaximize          = True     ; maximize plot in frame
>>>>>>>   res at cnFillOn             = True     ; turn on contour fill
>>>>>>>   res at cnFillOpacityF       = 0.4
>>>>>>>   res at cnLinesOn            = False   ; turn off contour lines
>>>>>>>   res at cnLineLabelsOn       = False    ; turn off line labels
>>>>>>>   res at lbOrientation        = "Vertical"
>>>>>>>   res at lbLabelFontHeightF   = 0.01
>>>>>>>   res at tiMainString         = "Cross section from
>>>>>>> ("+start_lat+","+start_lon+ \
>>>>>>>                                            ") to ("+end_lat +
>>>>>>> ","+end_lon+")"
>>>>>>>   res at gsnStringFontHeightF = 0.015
>>>>>>>   res at tmXBLabelFontHeightF = 0.01
>>>>>>>   res at tmXBLabelAngleF      = 45.
>>>>>>>   res at trYReverse = True
>>>>>>>   ;res at gsnDraw              = False             ; do not draw the
>>>>>>> plot
>>>>>>>   ;res at gsnFrame             = False             ; do not advance
>>>>>>> the frame
>>>>>>>
>>>>>>> ;--Explicitly set lat/lon labels for X axis
>>>>>>>   xvalues = ispan(0,dimsizes(qv_latlon(0,:))-1,1)
>>>>>>>   ll_step = 15                                       ; step interval
>>>>>>> for tickmarks
>>>>>>>   res at tmXBMode          = "Explicit"
>>>>>>>   res at tmXBValues        = xvalues(::ll_step)
>>>>>>>   res at tmXBLabels        = sprintf("%6.2f",qv_latlon at lats(::ll_step))
>>>>>>> + "~S~o~N~N~C~" + \
>>>>>>>                           sprintf("%6.2f",qv_latlon at lons(::ll_step))
>>>>>>> + "~S~o~N~E"
>>>>>>>
>>>>>>>   plot = gsn_csm_contour(wks,qv_latlon,res)
>>>>>>>
>>>>>>>   res_z                      = res
>>>>>>>   res_z at cnFillOn             = False    ; turn on contour fill
>>>>>>>   res_z at cnLinesOn            = True   ; turn off contour lines
>>>>>>>   res_z at cnLineLabelsOn       = False    ; turn off line labels
>>>>>>>   res_z at trYReverse           = False
>>>>>>>   ;res_z at xyLineColors         = "blue"
>>>>>>>   res_z at xyLineThicknesses   = (/3.0/)              ; make line
>>>>>>> thicker
>>>>>>>   res_z at xyLineColors        = (/"green"/)          ; change line
>>>>>>> color
>>>>>>>
>>>>>>> ;--Explicitly set lat/lon labels for X axis
>>>>>>>   xvalues = ispan(0,dimsizes(long_line(:))-1,1)
>>>>>>>   ll_step = 15                                       ; step interval
>>>>>>> for tickmarks
>>>>>>>   res_z at tmXBMode          = "Explicit"
>>>>>>>   res_z at tmXBValues        = xvalues(::ll_step)
>>>>>>>   res_z at tmXBLabels        = sprintf("%6.2f",qv_latlon at lats(::ll_step))
>>>>>>> + "~S~o~N~N~C~" + \
>>>>>>>                           sprintf("%6.2f",qv_latlon at lons(::ll_step))
>>>>>>> + "~S~o~N~E"
>>>>>>>
>>>>>>>   plot_ov = gsn_csm_xy(wks,long_line,t2_line,res_z)
>>>>>>>
>>>>>>>
>>>>>>>   overlay(plot,plot_ov)                       ; overlay the U-wind
>>>>>>> plot on the temperature plot
>>>>>>>   draw(plot)                                  ; draw the temperature
>>>>>>> plot (with the rh plot overlaid)
>>>>>>>   frame(wks)                                  ; advance the frame
>>>>>>>
>>>>>>> end
>>>>>>>
>>>>>>>
>>>>>>> I am getting both precipitation and U wind plot but both on
>>>>>>> separate pages. I want to overlay them. The help is really appreciated
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> प्रसाद कुंजीर / Prasad Kunjeer
>>>>>>> वैज्ञानिक - सी / Scientist - C
>>>>>>> केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power
>>>>>>> Research Station
>>>>>>> पुणे 411 024/ Pune 411 024
>>>>>>> _______________________________________________
>>>>>>> ncl-talk mailing list
>>>>>>> ncl-talk at mailman.ucar.edu
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210301/a2ae8534/attachment.html>


More information about the ncl-talk mailing list