I imagine your "trick" 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.
 -dave
On Wed, Jul 23, 2014 at 3:43 PM, Rabah Hachelaf <hachelaf@sca.uqam.ca>
wrote:
> Hi David,
>
> Thanks for your replay ,
> I think i solved my problem by using a regridding my data , i used this
> function *area_conserve_remap_Wrap
> <https://www.ncl.ucar.edu/Document/Functions/Contributed/area_conserve_re=
map_Wrap.shtml>*
> to transform the native grid (720X361) to a new grid regarding my distanc=
e
> requested for my case (8 X 5)
> and it seems work.
>
> What do you think about this trick.
>
> Rabah
>
>
> 2014-07-23 17:26 GMT-04:00 David Brown <dbrown@ucar.edu>:
>
> Hi Rabah,
>> The vcMinDistanceF resource is really designed to even out the spacing o=
f
>> (usually more dense) grids of vectors where the map projection leads to
>> crowding in some areas of the plot.
>>
>> 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 arra=
ys.
>> The NCL function that could help you is 'ind_nearest_coord'.
>> 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 da=
ta
>> file '83.nc' from the data link in the NCL example page.
>>
>>
>>
>>
>> On Tue, Jul 22, 2014 at 5:38 PM, Rabah Hachelaf <hachelaf@sca.uqam.ca>
>> wrote:
>>
>>>
>>> Hi NCL users,
>>>
>>> I am using "vcMinDistanceF"  to control wind barb spacing from GFS data=
.
>>> according to my understanding when i want plot the whole world map
>>>
>>> -180 to 180 longitude is mapped to 0-1 in NDC space
>>> and -90 to 90 latitude is mapped to 0-1 in NDC space
>>>
>>> if so and if i want to draw a wind barb each 45°, vcMinDistanceF s=
hould
>>> be 0.125
>>> and when testing this i get a kind of random spacing (please see
>>> attached image)
>>>
>>> So is there any solution to control barb spacing according geographical
>>> distance (in degrees).
>>>
>>> Thank you for help.
>>> below is you find my ncl script used :
>>>
>>> ;************************************************
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> ;************************************************
>>> begin
>>>
>>> ;************************************************
>>> ; read in GRIB2 file
>>> ;************************************************
>>>   a = addfile("gfs.t00z.pgrb2f00.grib2","r")
>>> ;************************************************
>>> ;;; get variables: temperature, longitude, latitude
>>>
>>>     t2m = a->TMP_P0_2L108_GLL0(:,:)
>>>     lon = a->lon_0
>>>     lat = a->lat_0
>>>     uu= a->UGRD_P0_L6_GLL0
>>>     vv= a->VGRD_P0_L6_GLL0
>>>
>>>
>>> if (any(uu.lt.1000.)) then
>>>        x1D      = ndtooned (uu)                  ; convert to 1D arra=
y
>>>        i50      = ind(x1D.lt.1000.)               ; all indices x1D >=
 50
>>>        x1D(i50) = -30                          ; set all  array synta=
x
>>>        uu        = onedtond(x1D, dimsizes(uu)); return to the origina=
l
>>> array
>>>        delete (x1D)                             ; x1D no longer needed
>>>        delete (i50)                             ; i50 no longer needed
>>>    end if
>>>
>>> if (any(vv.lt.1000.)) then
>>>        x1D      = ndtooned (vv)                  ; convert to 1D arra=
y
>>>        i50      = ind(x1D.lt.1000.)               ; all indices x1D >=
 50
>>>        x1D(i50) = -30                           ; set all  array synt=
ax
>>>        vv        = onedtond(x1D, dimsizes(vv)); return to the origina=
l
>>> array
>>>        delete (x1D)                             ; x1D no longer needed
>>>        delete (i50)                             ; i50 no longer needed
>>>    end if
>>>
>>> ;
>>>
>>> ; create plot
>>> ;************************************************
>>> wks_type="png"
>>>
>>>   wks_type@wkWidth = 1384
>>>    wks_type@wkHeight = 1384
>>>   wks_type@wkBackgroundOpacityF = 1.0
>>>
>>>
>>>   wks = gsn_open_wks(wks_type,"wind_barb")          ; open a ncgm fil=
e
>>>   gsn_define_colormap(wks,"gui_default")
>>>
>>> setvalues wks
>>>  "wkBackgroundColor" : (/1.,1.,1./)
>>> end setvalues
>>>
>>>
>>>   res                         = True               ; plot mods desire=
d
>>> res@pmTickMarkDisplayMode = "Always"
>>>   res@mpProjection      = "Mercator"       ; choose projection
>>>   res@mpGridAndLimbOn   = True             ; turn on lat/lon lines
>>>   res@mpPerimOn         = True             ; turn off box around plot
>>>   res@mpGridLatSpacingF = 45.               ; spacing for lat lines
>>>   res@mpGridLonSpacingF = 45.               ; spacing for lon lines
>>>   res@mpFillOn          = False
>>>    res@mpLimitMode  = "LatLon"
>>>     res@mpMinLatF            =   85.0
>>>     res@mpMaxLatF            = -85.0
>>>     res@mpMinLonF            = -180
>>>     res@mpMaxLonF            = 180
>>>
>>>   res@cnFillOn          = False              ; color plot desired
>>>   res@cnLineLabelsOn    = False             ; turn off contour lines
>>>
>>>   res@vpXF            = 0                 ; make plot bigger
>>>   res@vpYF            = 1
>>>   res@vpWidthF        = 1
>>>   res@vpHeightF       = 1
>>>
>>>
>>>   res@vcGlyphStyle            = "WindBarb"         ; select wind barb=
s
>>>   res@vcRefMagnitudeF         = 1                ; make vectors large=
r
>>>   res@vcRefLengthF            = 0.03              ; ref vec length
>>>   res@vcWindBarbLineThicknessF = 8.0        ;Thickness
>>>
>>>
>>>   res@vcWindBarbTickSpacingF  = 0.125   ;
>>>
>>>   res@vcMinDistanceF          = 0.125            ; thin out windbarbs
>>>   res@vcMonoWindBarbColor = True
>>>   res@vcWindBarbColor =  1
>>>
>>>   res@mpOutlineOn             = True            ; turn on map outline
>>>    plot1=gsn_csm_vector_map(wks,uu,vv,res)
>>>
>>>
>>>
>>> ------------------------------
>>> Cordialement,
>>> Best regards,
>>> Rabah Hachelaf
>>>      ____
>>>     (       )
>>>    (        )
>>>   (___ __)
>>>    /////////
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> ------------------------------
> Cordialement,
> Best regards,
> Rabah Hachelaf
>
Received on Thu Jul 24 01:06:11 2014
This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT