<div dir="ltr">Thanks for replay David, <div><br></div><div>The variable used in your example had lat,lon dimension, but in my case (GFS grib2 file) variables had point grid index as dimension.</div><div>here is the summary of one variable.</div>
<div><br></div><div> ncl 4&gt; printVarSummary(uu)</div><div><br></div><div>Variable: uu</div><div>Type: float</div><div>Total Size: 1039680 bytes</div><div>            259920 values</div><div>Number of Dimensions: 2</div>
<div>Dimensions and sizes:   [lat_0 | 361] x [lon_0 | 720]</div><div>Coordinates:</div><div>            lat_0: [90..-90]</div><div>            lon_0: [ 0..359.5]</div><div>Number Of Attributes: 13</div><div>  center :      US National Weather Service - NCEP (WMC)</div>
<div>  production_status :   Operational products</div><div>  long_name :   U-component of wind</div><div>  units :       m s-1</div><div>  _FillValue :  1e+20</div><div>  grid_type :   Latitude/longitude</div><div>  parameter_discipline_and_category :   Meteorological products, Momentum</div>
<div>  parameter_template_discipline_category_number :       ( 0, 0, 2, 2 )</div><div>  level_type :  Maximum wind level</div><div>  level :        0</div><div>  forecast_time :       0</div><div>  forecast_time_units : hours</div>
<div>  initial_time :        07/23/2014 (00:00)</div><div><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-23 21:06 GMT-04:00 David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I imagine your &quot;trick&quot; can work, but it seems like a bit of overkill in terms of the processing required for the problem you posed initially. But then again I do not know what your ultimate goal is. <div>

 -dave</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 3:43 PM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David,<div><br></div><div>Thanks for your replay ,</div><div>I think i solved my problem by using a regridding my data , i used this function <strong style="font-size:13px;margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif;line-height:16px;background:rgb(205,232,251)"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/area_conserve_remap_Wrap.shtml" style="font-size:13px;margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif;line-height:16px;background:rgb(205,232,251)" target="_blank">area_conserve_remap_Wrap</a></strong></div>


<div>to transform the native grid (720X361) to a new grid regarding my distance requested for my case (8 X 5) </div><div>and it seems work.<br></div><div><br></div><div>What do you think about this trick. </div><div><br>

</div>
<div>Rabah</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-23 17:26 GMT-04:00 David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>&gt;</span>:<div>

<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Rabah,<div>The vcMinDistanceF resource is really designed to even out the spacing of (usually more dense) grids of vectors where the map projection leads to crowding in some areas of the plot.</div>


<div><br>
</div><div>In your case, where you want to draw only a very sparse number of vectors, it would make more sense to use vector subscripting on the arrays.</div><div>The NCL function that could help you is &#39;ind_nearest_coord&#39;.</div>



<div>I am attaching a modified version of the example barb_1.ncl that should do what you want. If you want to run this script you can download the data file &#39;<a href="http://83.nc" target="_blank">83.nc</a>&#39; from the data link in the NCL example page. </div>



<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 5:38 PM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><br><div dir="ltr">Hi NCL users, <div><br></div><div>I am using &quot;vcMinDistanceF&quot;  to control wind barb spacing from GFS data.</div>



<div>according to my understanding when i want plot the whole world map </div>
<div><br>
</div><div>-180 to 180 longitude is mapped to 0-1 in NDC space</div><div>and -90 to 90 latitude is mapped to 0-1 in NDC space</div><div><br></div><div>if so and if i want to draw a wind barb each 45°, vcMinDistanceF should be 0.125</div>





<div>and when testing this i get a kind of random spacing (please see attached image)</div><div><br></div><div>So is there any solution to control barb spacing according geographical distance (in degrees). <br clear="all">





<div><br></div><div>Thank you for help.</div><div>below is you find my ncl script used : </div><div><br></div><div><div>;************************************************</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot; </div>





<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;    </div><div>;************************************************</div><div>begin</div><div><br></div><div>;************************************************</div>





<div>; read in GRIB2 file</div><div>;************************************************</div><div>  a = addfile(&quot;gfs.t00z.pgrb2f00.grib2&quot;,&quot;r&quot;)</div><div>;************************************************</div>





<div>;;; get variables: temperature, longitude, latitude</div><div> </div><div>    t2m = a-&gt;TMP_P0_2L108_GLL0(:,:)</div><div>    lon = a-&gt;lon_0</div><div>    lat = a-&gt;lat_0</div><div>    uu= a-&gt;UGRD_P0_L6_GLL0</div>





<div>    vv= a-&gt;VGRD_P0_L6_GLL0</div><div><br></div><div><br></div><div>if (any(uu.lt.1000.)) then</div><div>       x1D      = ndtooned (uu)                  ; convert to 1D array</div><div>       i50      = ind(x1D.lt.1000.)               ; all indices x1D &gt; 50</div>





<div>       x1D(i50) = -30                          ; set all  array syntax</div><div>       uu        = onedtond(x1D, dimsizes(uu)); return to the original array</div><div>       delete (x1D)                             ; x1D no longer needed</div>





<div>       delete (i50)                             ; i50 no longer needed</div><div>   end if</div><div><br></div><div>if (any(vv.lt.1000.)) then</div><div>       x1D      = ndtooned (vv)                  ; convert to 1D array</div>





<div>       i50      = ind(x1D.lt.1000.)               ; all indices x1D &gt; 50</div><div>       x1D(i50) = -30                           ; set all  array syntax</div><div>       vv        = onedtond(x1D, dimsizes(vv)); return to the original array</div>





<div>       delete (x1D)                             ; x1D no longer needed</div><div>       delete (i50)                             ; i50 no longer needed</div><div>   end if</div><div><br></div><div>;</div><div><br></div>





<div>; create plot</div><div>;************************************************</div><div>wks_type=&quot;png&quot;</div><div><br></div><div>  wks_type@wkWidth = 1384</div><div>   wks_type@wkHeight = 1384</div><div>  wks_type@wkBackgroundOpacityF = 1.0</div>





<div><br></div><div><br></div><div>  wks = gsn_open_wks(wks_type,&quot;wind_barb&quot;)          ; open a ncgm file</div><div>  gsn_define_colormap(wks,&quot;gui_default&quot;)</div><div> </div><div>setvalues wks</div><div>





 &quot;wkBackgroundColor&quot; : (/1.,1.,1./)</div><div>end setvalues</div><div><br></div><div><br></div><div>  res                         = True               ; plot mods desired</div><div>res@pmTickMarkDisplayMode = &quot;Always&quot;</div>





<div>  res@mpProjection      = &quot;Mercator&quot;       ; choose projection</div><div>  res@mpGridAndLimbOn   = True             ; turn on lat/lon lines</div><div>  res@mpPerimOn         = True             ; turn off box around plot</div>





<div>  res@mpGridLatSpacingF = 45.               ; spacing for lat lines</div><div>  res@mpGridLonSpacingF = 45.               ; spacing for lon lines</div><div>  res@mpFillOn          = False</div><div>   res@mpLimitMode  = &quot;LatLon&quot;</div>





<div>    res@mpMinLatF            =   85.0</div><div>    res@mpMaxLatF            = -85.0 </div><div>    res@mpMinLonF            = -180</div><div>    res@mpMaxLonF            = 180</div><div> </div><div>  res@cnFillOn          = False              ; color plot desired</div>





<div>  res@cnLineLabelsOn    = False             ; turn off contour lines</div><div><br></div><div>  res@vpXF            = 0                 ; make plot bigger</div><div>  res@vpYF            = 1  </div><div>  res@vpWidthF        = 1</div>





<div>  res@vpHeightF       = 1</div><div><br></div><div><br></div><div>  res@vcGlyphStyle            = &quot;WindBarb&quot;         ; select wind barbs </div><div>  res@vcRefMagnitudeF         = 1                ; make vectors larger</div>





<div>  res@vcRefLengthF            = 0.03              ; ref vec length</div><div>  res@vcWindBarbLineThicknessF = 8.0        ;Thickness</div><div><br></div><div><br></div><div>  res@vcWindBarbTickSpacingF  = 0.125   ;</div>





<div><br></div><div>  res@vcMinDistanceF          = 0.125            ; thin out windbarbs</div><div>  res@vcMonoWindBarbColor = True</div><div>  res@vcWindBarbColor<span style="white-space:pre-wrap">        </span> =  1</div>
<div><br></div><div>  res@mpOutlineOn             = True            ; turn on map outline</div><div>   plot1=gsn_csm_vector_map(wks,uu,vv,res)<br></div></div><div><br></div><div><br></div><br><div dir="ltr"><div>------------------------------</div>





Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>     ____   <br>    (       )<br>   (        )                       <br>  (___ __)                      <br>   /////////      <br><br></div>
</div></div>
<br></div><br><br clear="all"><div><br></div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>
</div>
</div></font></span></div>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br></div>
</div>