[ncl-talk] compare the wind data of wrfout with observations

Mary Haley haley at ucar.edu
Fri Sep 2 10:07:30 MDT 2016


Hi Grace,

We had a similar question a few days ago. See:

http://mailman.ucar.edu/pipermail/ncl-talk/2016-August/006681.html

You are setting vcRefMagnitudeF to 0.5 and vcRefLengthF to 10, which means
all vectors of magnitude 10 will be drawn in length 0.5 NDC units, which is
half of the plotting area. That's why your vectors are so large.

As I suggested in the previous email, you should start by commenting these
two resources out initially, to let NCL pick the reference length and the
magnitude vector. You can then make a better decision about what size to
use for the these two resources.

I usually start by only changing the vcRefLengthF resource to see how it
affects the plot. For example, try a value of 0.02. Depending on how the
vectors look, you may want to increase or decrease this value slightly.

If this still doesn't look good, then try changing the vcRefMagnitudeF value.
The reference annotation box on the plot will tell you what default NCL chose,
so you can use this value as a base for determining how much to change it.

--Mary



On Thu, Sep 1, 2016 at 8:05 PM, grace <313695096 at qq.com> wrote:

> Hi:
>   All,I am trying to compare the wind data of wrfout with observations of
> one station,like the picture below,
> Here is my strategy:
> First, I extracted the data and put them into two different arrys,draw two
> differert xy plot with same manual timelabels on X axis,but arrowline with
> different color.
> Then I overlay them.
> But the picture I drawed is like this:
> The error massage is :
> warning:TickMarkSetValues: tmXBLabels has fewer elements than tmXBValues;
> the labels will be ignored
> warning:TickMarkSetValues: tmXTLabels has fewer elements than tmXTValues;
> the labels will be ignored
> warning:["PlotManager.c":4210]:PlotManagerSetValues: Error setting
> TickMark values
> fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT
> fatal:VectorPlotDraw: error drawing vectors
> fatal:VectorPlotDraw: draw error
> fatal:PlotManagerDraw: error in plot draw
> fatal:_NhlPlotManagerDraw: Draw error
>
> This is my script:
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
>   a = addfile("/backup/hl/wrfout201508/wrfout_d03_2015-08-01_12:00:00.nc","r")
>
>
>     ij = wrf_user_ll_to_ij(a, 108.966667,34.433333,True)
>
>     print("lon location is: " +ij(0))
>
>     print("lat location is: " + ij(1))
> ; First get the variables we will need
> u10_2=new((/31,24/),float,"No_FillValue")
> v10_2=new((/31,24/),float,"No_FillValue")
>
>
>  filename1=systemfunc("ls /backup/hl/wrfout201508/wrfout_d03_2015-05*.nc")
>          fin1=addfiles(filename1,"r")
>          do i=0,30
>
>                  u10_1=fin1[i]->U10(0:23,ij(1)-1, ij(0)-1)
>                  v10_1=fin1[i]->V10(0:23,ij(1)-1, ij(0)-1)
>                  u10_2 (i,:)= u10_1
>                  v10_2 (i,:)= v10_1
> end do
>  u10=ndtooned(u10_2)
>  v10=ndtooned(v10_2)
>
>  u10_d=u10(0:724)
>  v10_d=v10(0:724)
>  printVarSummary(u10_d(0))
>  printVarSummary(v10_d(0))
>
> ;;;;;;;;;;;;;;;get obs data;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>   ascii_filename = "/public/home/huanglei/txt_obs/obs.txt"
>   seismic = asciiread(ascii_filename,(/725,6/),"float")
>   seismic at _FillValue = -999
>      wdir = seismic(:,4)
>      wspd = seismic(:,5)
>      tmp = (270.0-wdir)*0.01745329
>      u_o = wspd*cos(tmp)
>      v_o = wspd*sin(tmp)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;data for plot1;;;;;;;;;;;;;;;;a is model data ; b
> is obs data;;;;;;;;;;;;;;;;;;;;;;;
>  u10_new1a=new((/25,220/),float)
>  u10_new1a=0
>  u10_new1a(8,:)=u10_d(0:219)
>  v10_new1a=new((/25,220/),float)
>  v10_new1a=0
>  v10_new1a(8,:)=v10_d(0:219)
>
>  u10_new1b=new((/25,220/),float)
>  u10_new1b=0
>  u10_new1b(8,:)=u_o(0:219)
>  v10_new1b=new((/25,220/),float)
>  v10_new1b=0
>  v10_new1b(8,:)=v_o(0:219)
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;
> wks  = gsn_open_wks("pdf","gsn_vector_panel")          ; open a Graphic
> wkStation
>   res  = True                                      ; plot mods desired
>   res at gsnFrame  = False
>   res at gsnDraw   = False                          ; don't draw
>
>   res at vcGlyphStyle     = "LineArrow"             ; turn on LineArrow
>   res at gsnMaximize = True
>   res at vpHeightF   = 0.15
>   res at vpWidthF    = 0.8
>
>   res at pmLegendWidthF         = 0.10                  ; Change width and
>   res at pmLegendHeightF        = 0.10                  ; height of legend.
>   res at tmYLOn             = False        ; Don't draw labels for left
>   res at tmYLLabelsOn       = False        ;  Y axes
>   res at tmYROn             = False        ; Don't draw labels for right
>   res at tmYRLabelsOn       = False        ;  Y axes
>   res at tmXBLabelFontHeightF = 0.01
>   res at vcRefAnnoOrthogonalPosF = -0.258             ; move ref vector up
>   res at vcRefMagnitudeF         = 0.5             ; define vector ref mag
>   res at vcRefLengthF            = 0.025            ; define length of vec
> ref
>   res at vcRefAnnoParallelPosF     = 0.999
>   res at vcRefAnnoFontHeightF =0.005
>   res at vcRefAnnoString2   =" "
>   res at vpHeightF   = 0.15
>   res at vpWidthF   = 0.8
>
>  ;res at tmYLLabelFontColor = line_col1    ;
>
> ;;;;;;;;;;;;;;;;;;;;add text TEST / OBS;;;;;;;
>     res_text               = True
>     res_text at txFontHeightF = 0.01
>
>     m1 = "TEST"
>     m2 = "OBS"
>
>  ;;;;;;;;;;;;;;;;;resources for plot(0);;;;;;;;;;;;;;
>
>   res0a=res
>   res0a at tmXBMode ="Explicit"
>   res0a at tmXBValues  =(/5,29,53,77,101,125,149,173,197/)
>   res0a at tmXBLabels = (/"5/2","5/3"," 5/4","5/5",
> "5/6","5/7","5/8","5/9","5/10"/)
>
>   res0a at vcMonoLineArrowColor = True
>   res0a at vcLineArrowColor = "black"
>   plotA = gsn_csm_vector(wks, u10_new1a, v10_new1a,res0a)
>
>   res0b=res
>   res0b at tmXBMode ="Explicit"
>   res0b at tmXBValues  =(/5,29,53,77,101,125,149,173,197/)
>   res0b at tmXBLabels = (/"5/2","5/3"," 5/4","5/5",
> "5/6","5/7","5/8","5/9","5/10"/)
>
>   res0b at vcMonoLineArrowColor = True
>   res0b at vcLineArrowColor = "red"
>   plotB = gsn_csm_vector(wks, u10_new1b, u10_new1b,res0b)
>
>    overlay(plotA,plotB)                      ; result will be plotA
>    plot = plotA                           ; now assign plotA to array
>
>  gsn_text(wks,plot(0),m1,190,10,res_text)
>  gsn_text(wks,plot(0),m2,190,35,res_text)
>
>  draw(plot)
> ;frame(wks)
> end
>
>  How can I slove the problem?
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160902/ae7e901f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8DC29D09 at F1156864.51DEC857.jpg
Type: image/jpeg
Size: 202579 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160902/ae7e901f/attachment-0002.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9FEF6EE2 at F1156864.51DEC857.jpg
Type: image/jpeg
Size: 115159 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160902/ae7e901f/attachment-0003.jpg 


More information about the ncl-talk mailing list