Hi everyone,
I am trying for several days to plot some wind barbs on wind intensity
contour field. Using the barb_3.ncl script was quite easy, but I
encountered a problem trying to remove the legend "v-component of wind
m/s". (see barb.ps enclosed)
I tried every label or legend or title related ressources, but
everything failed..
Could you advise me something?
I don't know if this is related but I can't remove the black rectangular
contour either...
Last but not least: I read on emails archive that PNG output was a
current challenge; is that possiblity available in 5.1.1 version?
because when I try I get a very surprising result! (see barb.png attached)
Furthermore, is it possible to launch NCL for PNG output in total batch
mode, because if I run a script typing ncl script.ncl in a putty window,
so no X server, for PS output, everything is ok, but for PNG, it asks
for the DISPLAY environment variable: but I don't want my plot to be
printed on screen, just created and saved in a PNG format. My ncl script
has to be run automatically in cron, so I have to be X-server independant..
I have enclosed my PS and PNG outputs as well as my script..
Any remark would be very helpful!!
Thanks in advance for your time
Caroline
-- Caroline Serraud - Ingénieur Développement ------------------------------------------------------ METEO CONSULT / La Chaine Météo - Groupe Figaro Département Informatique Domaine de Marsinval F-78540 Vernouillet, FRANCE Tél : 01 39 28 1990 - Fax : 01 39 71 85 31 e-mail : cs@meteoconsult.fr ------------------------------------------------------ Toute la météo sur le Web : http://www.meteoconsult.fr Toute la météo par téléphone : 3201
;*************************************************
; barb_3.ncl
;
; Concepts illustrated:
; - Drawing colored wind barbs vectors over a cylindrical equidistant map
; - Changing the length of the wind barbs
; - Changing the size of the wind barbs
; - Decreasing the number of vectors drawn
; - Adding a color to an existing color map
; - Using the full color map for colored wind barbs
; - Changing the length of a wind barb tick
; - Changing the distance between wind barb ticks
; - Turning off the vector reference annotation label
; - Drawing a map using the medium resolution map outlines
; - Thinning vectors using a minimum distance resource
;
;************************************************
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/csm/contributed.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
a = addfile("/home/mc/meteo/images/sh/marine_ncl/gblav.T06Z.PGrbF24.nc","r")
;************************************************
; read in zonal [u] and meridional [v] winds
;************************************************
u = a->U_GRD_GDS0_HTGL_10(:,:)
v = a->V_GRD_GDS0_HTGL_10(:,:)
printVarSummary(u)
t = new(dimsizes(v), typeof(v))
t = v(g0_lat_0|:,g0_lon_1|:)
t = sqrt(u^2+v^2)*1.944
printVarSummary(t)
;************************************************
; create plot
;************************************************
wks_type = "png"
wks_type_at_wkWidth = 720
wks_type_at_wkHeight = 576
wks =gsn_open_wks(wks_type,"barb")
cnLevels=(/0,4,6,8,10,12,14,16,18,20,22,24,26,28,32,36,40,44,48,52,70,100/)
cmap = RGBtoCmap ("/opt/ncl/lib/ncarg/colormaps/marine.rgb")
gsn_define_colormap(wks,cmap) ; choose color map
i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colormap
res = True ; plot mods desired
res@gsnSpreadColors = True ; use full colormap
res@gsnSpreadColorEnd = -2 ; don't use added gray
res@gsnMaximize = True
res@gsnPaperOrientation = "portrait"
res@gsnBoxMargin = 0.0
res@lbLabelBarOn = False
res@tmXBOn = False ; don't draw axis nor axis labels
res@tmXTOn = False
res@tmYLOn = False
res@tmYROn = False
res@cnFillOn = True ; turn on color for contours
res@cnLinesOn = True ; turn off contour lines
res@cnLineLabelsOn = True ; turn off contour line labels
res@gsnScalarContour = True ; contours desired
res@cnInfoLabelOn = False
res@vcRefMagnitudeF = 10. ; make vectors larger
res@vcRefLengthF = 0.030 ; ref vec length
res@vcMinDistanceF = 0.17 ; thin out vectors
res@vcGlyphStyle = "WindBarb" ; choose wind barbs
res@vcMonoWindBarbColor = True ; don't color barbs by scalar
res@vcWindBarbColor = 0
res@vcMinDistanceF = 0.03 ; thin out windbarbs
res@vcWindBarbTickLengthF = 0.4 ; length of the barb tick
res@vcWindBarbTickSpacingF = 0.3 ; distance between ticks
res@vcWindBarbLineThicknessF = 4.0 ; line thickness
res@vcRefAnnoOn = False ; turn off ref wind barb
res@gsnAddCyclic = False ; regional data
; zoom in on map
minlat = 38.2
maxlat = 45.62
minlon = 0.5
maxlon = 12
res@mpMinLatF = minlat
res@mpMaxLatF = maxlat
res@mpMinLonF = minlon
res@mpMaxLonF = maxlon
res@mpDataBaseVersion = "RANGS_GSHHS" ; high resolution coastline
res@mpDataResolution = "FinestResolution"
res@mpFillOn = False
res@mpShapeMode = "FixedAspectNoFitBB"
; if we want the color bar to reflect only those values within our chosen
; subregion, then we need to pass the plot template the subset of the data
; in addition to zooming in on the map.
plot=gsn_csm_vector_scalar_map_ce(wks,u({minlat:maxlat},{minlon:maxlon}),\
v({minlat:maxlat},{minlon:maxlon}),t({minlat:maxlat},{minlon:maxlon}),res)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Nov 23 2009 - 12:24:02 MST