[ncl-talk] Please help me, I can not turn off contour line label bar

Tao Lu hakufu.asano at gmail.com
Sun Feb 19 06:45:28 MST 2017


Thank you,

Actually, I have another question about this script.
When I took some two points to get the cross section, like "X_plane =
wrf_user_intrp2d(xvalue,plane,0,opts)"
Normally the X_plane will give me a ascending results like "35.0, 36.0,
37.0, 38.0".
But sometimes it gives me descending results like "38.0, 37.0, 36.0, 35.0"

It confused me a lot.

Tao

On Sun, Feb 19, 2017 at 8:59 PM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Glad to hear it...!
>
> On Sun, Feb 19, 2017 at 1:26 PM, Tao Lu <hakufu.asano at gmail.com> wrote:
>
>> Barry,
>>
>> Thank you.
>> I have solved the problem.
>>
>> This script is to plot cross section (given two points) for specific
>> humidity and wind vector.
>>
>> I will make codes clear later.
>>
>> Tao,
>>
>> [image: Inline image 1]
>>
>> PS: if anyone need this, please use it. I will update it.
>>
>>
>> On Sun, Feb 19, 2017 at 3:37 PM, Barry Lynn <barry.h.lynn at gmail.com>
>> wrote:
>>
>>> Hi:
>>>
>>> Can you please send a picture/map...
>>>
>>> On Sun, Feb 19, 2017 at 7:55 AM, Tao Lu <hakufu.asano at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I occurred a problem when I plot contour.
>>>>
>>>> Even though I turn off contour line label bar the graph also shows it.
>>>> "    opts_rh = opts_xy
>>>>     opts_rh at cnLineLabelsOn = False
>>>>     opts_rh at cnFillOn                = True
>>>> "
>>>>
>>>> Is there anyone know why?
>>>>
>>>> Thank you,
>>>> Tao
>>>>
>>>>
>>>> Here is my codes:
>>>> ############################################################
>>>> ###############################
>>>> begin
>>>> ;
>>>> ;---Read wrf file
>>>>   ;a = addfile("../../wrfout_d01_2015-09-08_12:00:00","r")  ; small
>>>> domain ouput 5
>>>>   a = addfile("../wrfout_d01_2015-09-08_12:00:00_big2","r") ; big
>>>> domain ouput 10
>>>>
>>>> ; read need data
>>>>   xlat = wrf_user_getvar(a, "XLAT",0)
>>>>   xlon = wrf_user_getvar(a, "XLONG",0)
>>>>   ter = wrf_user_getvar(a, "HGT",0)
>>>>
>>>> ;--Set up workstation
>>>>   type = "x11"
>>>> ; type = "pdf"
>>>> ; type = "ps"
>>>> ; type = "ncgm"
>>>>   type at wkWidth = 3000                        ; Increase size for a
>>>> slightly
>>>>   type at wkHeight = 3000
>>>>
>>>> ; Output folder
>>>>   folder="./clean_vertical_wind"
>>>>   mkdir = systemfunc ("mkdir -p " + folder)
>>>>   wks = gsn_open_wks(type,folder+"/plt_CrossSection_3")
>>>>
>>>>
>>>> ;---Set some basic resources
>>>>   res = True
>>>>   res at gsnMaximize =True
>>>>   res at gsnDraw = False
>>>>   res at gsnFrame = False
>>>>
>>>>
>>>>
>>>> ;-----------------------------------------------------------
>>>> -------------------
>>>> ;---Set bounding box
>>>> ; C->C' WE
>>>>   lats         = (/ 36.59845, 36.59845 /)
>>>>   lons         = (/ 138.50, 141.0 /)
>>>>
>>>> ; X-axis label
>>>>   xoption=0
>>>>
>>>> ;0 means lon X-axis, 1 means lat X-axis
>>>>   if (xoption .eq. 0) then
>>>>     X_desc = "longitude"
>>>>     xvalue=xlon
>>>>     px = 0.2
>>>>   end if
>>>>
>>>>   if (xoption .eq. 1) then
>>>>     X_desc = "latitude"
>>>>     xvalue = xlat
>>>>     px = 0.5
>>>>   end if
>>>>
>>>>
>>>> ;---Set zoomin indices
>>>> ; loc(0,;) is west-east (x) ; loc(1,:) is south-north (y)
>>>> ; subtract one since we want to use it as an index in NCL
>>>>   loc = wrf_user_ll_to_ij(a, lons, lats, True)
>>>>   loc = loc - 1
>>>>   x_start = loc(0,0)
>>>>   x_end = loc(0,1)
>>>>   y_start = loc(1,0)
>>>>   y_end = loc(1,1)
>>>>
>>>>
>>>> ;---Read time
>>>>
>>>>   times  = wrf_user_getvar(a,"times",-1) ; get times in the file
>>>>   ntimes = dimsizes(times)          ; number of times in the file
>>>>   FirstTime = True
>>>>
>>>>   mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the
>>>> file
>>>>   nd = dimsizes(mdims)
>>>>
>>>>
>>>> ;-----------------------------------------------------------
>>>> ---------------
>>>> ; Loop of time to do plot
>>>> ;---------------------------------------------------------------
>>>>
>>>>   ;do it = 356,356;ntimes-1,18                  ; for output5 when need
>>>> 0909_1740 (UTC)
>>>>   do it = 178,178;ntimes-1,18                 ; for output10 when need
>>>> 0909_1740 (UTC)
>>>>
>>>>
>>>>     print("Working on time: " + times(it) )
>>>>
>>>>     rh = wrf_user_getvar(a,"rh",it)      ; relative humidity
>>>>     z   = wrf_user_getvar(a, "z",it)     ; grid point height
>>>>     u    = wrf_user_getvar(a,"ua",it)      ; u in m/s
>>>>     w    = wrf_user_getvar(a,"wa",it)      ; w in m/s
>>>>
>>>>
>>>>     if ( FirstTime ) then                ; get height info for labels
>>>>       zmin = 0.
>>>>       zmax = 12;max(z)/1000.
>>>>       nz   = floattoint(zmax + 1)
>>>>       FirstTime = False
>>>>     end if
>>>>
>>>> ;---------------------------------------------------------------
>>>>
>>>> ; Plot a cross session that run from point A to point B
>>>>
>>>>     plane = new(4,float)
>>>>     plane = (/ x_start,x_end, y_start,y_end /)    ; start x;y & end x;y
>>>> point
>>>>     opts = True                                        ; start and end
>>>> points specified
>>>>
>>>>     rh_plane = wrf_user_intrp3d(rh,z,"v",plane,0.,opts)
>>>>     u_plane = wrf_user_intrp3d(u,z,"v",plane,0.,opts)
>>>>     w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
>>>>     X_plane = wrf_user_intrp2d(xvalue,plane,0,opts)
>>>>
>>>>
>>>>     dim = dimsizes(rh_plane)                      ; Find the data span
>>>> - for use in labels
>>>>     zspan = dim(0)
>>>>
>>>>     ; Options for XY Plots
>>>>     ; X-axis lables
>>>>     dimsX = dimsizes(X_plane)
>>>>     xmin  = X_plane(0)
>>>>     xmax  = X_plane(dimsX(0)-1)
>>>>     xspan = dimsX(0)-1
>>>>     nx    = floattoint( (xmax-xmin)/px + 1)
>>>>     print ("dimsX= "+dimsX+"   xmin= "+xmin+"   xmax= "+xmax+"   xspan=
>>>> "+xspan+ "   nx="+nx)
>>>>
>>>>
>>>>     ;---------------------------------------------------------------
>>>>
>>>>     ; Options for XY Plots
>>>>     opts_xy                         = res
>>>>     opts_xy at tiXAxisString           = X_desc
>>>>     opts_xy at tiYAxisString           = "Height (km)"
>>>>     opts_xy at tmXTOn                  = False
>>>>     opts_xy at tmYROn                  = False
>>>>     opts_xy at tmXBMode                = "Explicit"
>>>>     if (nx .lt. 0) then
>>>>       nx = -nx
>>>>     end if
>>>>     opts_xy at tmXBValues              = fspan(0,xspan,nx)
>>>>      ; Create tick marks
>>>>     opts_xy at tmXBLabels              = sprintf("%.1f",fspan(xmin,xmax,nx))
>>>>  ; Create labels
>>>>     opts_xy at tmXBLabelFontHeightF    = 0.015
>>>>     opts_xy at tmYLMode                = "Explicit"
>>>>     opts_xy at tmYLValues              = fspan(0,zspan,nz)
>>>>      ; Create tick marks
>>>>     opts_xy at tmYLLabels              = sprintf("%.1f",fspan(zmin,zmax,nz))
>>>>  ; Create labels
>>>>     opts_xy at tiXAxisFontHeightF      = 0.020
>>>>     opts_xy at tiYAxisFontHeightF      = 0.020
>>>>     opts_xy at tmXBMajorLengthF        = 0.02
>>>>     opts_xy at tmYLMajorLengthF        = 0.02
>>>>     opts_xy at tmYLLabelFontHeightF    = 0.015
>>>>
>>>>
>>>>     ; Plotting options for RH
>>>>     opts_rh = opts_xy
>>>>     opts_rh at cnLineLabelsOn = False
>>>>     opts_rh at cnFillOn                = True
>>>>     opts_rh at lbOrientation           = "vertical"
>>>>     opts_rh at ContourParameters       = (/ 10., 90., 10. /)
>>>>     opts_rh at cnFillColors            = (/"White","White","White", \
>>>>
>>>> "White","Chartreuse","Green", \
>>>>                                             "Green3","Green4", \
>>>>
>>>> "ForestGreen","PaleGreen4"/)
>>>>     ; Set contour title
>>>>     mainstring = times(it) + " (UTC)"
>>>>     leftstring = "Relative humidity %"
>>>>     rightstring = "Wind (m/s)"
>>>>     size = 0.02
>>>>
>>>>     opts_rh at tiMainString = mainstring
>>>>     opts_rh at gsnLeftString = leftstring
>>>>     opts_rh at gsnRightString   = rightstring
>>>>     opts_rh at tiMainFontHeightF   = 0.030
>>>>     opts_rh at gsnLeftStringFontHeightF   = size
>>>>     opts_rh at gsnRightStringFontHeightF   = size
>>>>
>>>>
>>>>
>>>>     ; Get the contour info for the rh
>>>>     contour_rh = gsn_csm_contour(wks,rh_plane,opts_rh)
>>>>
>>>>
>>>> ;------------------------------------------------
>>>> ; curly vector plot
>>>> ;------------------------------------------------
>>>>
>>>>     vecres                           = opts_xy            ; vector only
>>>> resources
>>>>     vecres at vcGlyphStyle               = "LineArrow"
>>>>     vecres at vcLineArrowThicknessF      = 2
>>>>     vecres at vcMinDistanceF             = 0.008
>>>>     vecres at vcRefLengthF               = 0.04
>>>>
>>>>
>>>>
>>>>     vecres at gsnLeftString = " " ; add the gsn titles
>>>>     vecres at gsnRightString   = " "
>>>>     vector = gsn_csm_vector(wks,u_plane,w_plane,vecres)
>>>>
>>>>
>>>>     ; MAKE PLOTS
>>>>     overlay(contour_rh,vector)
>>>>     draw(contour_rh)
>>>>     frame(wks)
>>>>
>>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>>
>>>>   end do        ; END OF TIME LOOP
>>>>
>>>> end
>>>> ############################################################
>>>> ###############
>>>>
>>>> --
>>>> ******************************************************
>>>> 盧 涛 (ル タオ) 修士課程2年
>>>>
>>>> 〒112-8551 東京都文京区春日1-13-27
>>>>
>>>> 中央大学理工学研究科都市環境学専攻
>>>>
>>>> 河川・水文研究室(山田正教授)
>>>>
>>>>
>>>> TEL: 03-3817-3406;   Phone: 070-2188-7509
>>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>>> *******************************************************
>>>> ******************************************************
>>>> Tao Lu    (M. Eng)
>>>> Laboratory of River Engineering and Hydrology,
>>>> Dept. of Civil and Environmental Engineering,
>>>> Graduate School of Science and Engineering,
>>>> Chuo University
>>>>
>>>> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
>>>> 112-8551, Japan
>>>> TEL: 03-3817-1805;   Phone: 070-2188-7509
>>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>>> *****************************************************
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>>
>>> --
>>> Barry H. Lynn, Ph.D
>>> Senior Lecturer,
>>> The Institute of the Earth Science,
>>> The Hebrew University of Jerusalem,
>>> Givat Ram, Jerusalem 91904, Israel
>>> Tel: 972 547 231 170
>>> Fax: (972)-25662581
>>>
>>> C.E.O, Weather It Is, LTD
>>> Weather and Climate Focus
>>> http://weather-it-is.com
>>> Jerusalem, Israel
>>> Local: 02 930 9525
>>> Cell: 054 7 231 170
>>> Int-IS: x972 2 930 9525
>>> US 914 432 3108 <(914)%20432-3108>
>>>
>>
>>
>>
>> --
>> ******************************************************
>> 盧 涛 (ル タオ) 修士課程2年
>>
>> 〒112-8551 東京都文京区春日1-13-27
>>
>> 中央大学理工学研究科都市環境学専攻
>>
>> 河川・水文研究室(山田正教授)
>>
>>
>> TEL: 03-3817-3406;   Phone: 070-2188-7509
>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>> *******************************************************
>> ******************************************************
>> Tao Lu    (M. Eng)
>> Laboratory of River Engineering and Hydrology,
>> Dept. of Civil and Environmental Engineering,
>> Graduate School of Science and Engineering,
>> Chuo University
>>
>> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
>> 112-8551, Japan
>> TEL: 03-3817-1805;   Phone: 070-2188-7509
>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>> *****************************************************
>>
>
>
>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108 <(914)%20432-3108>
>



-- 
******************************************************
盧 涛 (ル タオ) 修士課程2年

〒112-8551 東京都文京区春日1-13-27

中央大学理工学研究科都市環境学専攻

河川・水文研究室(山田正教授)


TEL: 03-3817-3406;   Phone: 070-2188-7509
Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
*******************************************************
******************************************************
Tao Lu    (M. Eng)
Laboratory of River Engineering and Hydrology,
Dept. of Civil and Environmental Engineering,
Graduate School of Science and Engineering,
Chuo University

1-13-27,Kasuga,Bunkyo-ku,Tokyo
112-8551, Japan
TEL: 03-3817-1805;   Phone: 070-2188-7509
Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
*****************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170219/64203722/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plt_CrossSection_3.png
Type: image/png
Size: 880984 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170219/64203722/attachment-0001.png 


More information about the ncl-talk mailing list