[ncl-talk] how to plot divergent winds, divergence and velocity potential in one single plot?

Vyankatesh Manoj Mundhada vyankatesh at iiserb.ac.in
Wed Feb 21 02:20:22 MST 2018


Hello,

I am new to NCL and I am trying to plot divergent winds (vectors),
divergence (contours) and velocity potential (contours) in a single plot
using velocities u and v only.

When i am trying to plot divergent velocities using the following script:


begin
;*************************************************
; open file and read in data: data are on a gaussian grid
;*************************************************
  f    = addfile ("uv300.nc", "r")
  u    = f->u                 ; (time,lat,lon)
  v    = f->v
  d    = f->d
;*************************************************
; calculate divergence on a gaussian grid
;*************************************************
  div = uv2dvG_Wrap(u,v)                ; u,v ==> divergence
  div at long_name  = "Divergence"
  div at units      = "s-1"
;*************************************************
; calculate velocity potential
;*************************************************
  chi = ilapsG_Wrap ( div , 0)
  chi = (/chi/1e8/)                     ; arbitrary scale
  chi at long_name = "velocity potential"
  chi at units     = "m/s"
;*************************************************
; calculate divergent wind component
; --
; note: the calculation uses a procedure, so memory
; must be preallocated.
;*************************************************
  ud    = new ( dimsizes(u), float, u at _FillValue )
  vd    = new ( dimsizes(v), float, v at _FillValue )

  dv2uvg(div,ud,vd) ; div  ==> divergent  wind components

  copy_VarCoords(u, ud )
  copy_VarCoords(u, vd )
  ud at long_name  = "Zonal Divergent Wind"
  ud at units      = u at units
  vd at long_name  = "Meridional Divergent Wind"
  vd at units      = v at units
;*************************************************
; plot results
;*************************************************
  wks  = gsn_open_wks("png","dv")             ; send graphics to PNG file
  cmap = read_colormap_file("BlAqGrYeOrReVi200")
  nc   = dimsizes(cmap(:,0))

    res                          = True
    res at gsnDraw                                 = False
    res at gsnFrame                             = False
    cnres1                                        = res
    cnres2                                        = res
    vcres                                            = res

  cnres1 at cnFillOn           = True               ; color on
  cnres1 at cnLinesOn          = False              ; turn off contour lines
    cnres1 at cnFillPalette      = cmap(:nc-4,:)
    cnres1 at tiMainString       = "Divergent Winds, Divergence and Velocity
Potential"
    cnres1 at lbOrientation           = "vertical"

    vcres at vcRefMagnitudeF     = 10.                 ; make vectors larger
  vcres at vcRefLengthF        = 0.05              ; ref vector length
  vcres at vcGlyphStyle        = "CurlyVector"      ; turn on curly vectors
  vcres at vcMinDistanceF      = 0.012              ; thin the vectors
  vcres at vcRefAnnoOrthogonalPosF  = -1.185         ; Move ref anno into plot
    vcres at vcRefAnnoBackgroundColor = "Background"
    vcres at vcRefAnnoString2On    = False
    ;vcres at vcRefAnnoSide                =    "Right"

  ;cnres2 at gsnCenterString    = "Chi scaled by 1e8"
    cnres2 at cnFillOn                        = False
    cnres2 at cnLinesOn                    = True

    plot1 =
gsn_csm_vector_map(wks,0.001*ud(0,0,:,:),0.001*vd(0,0,:,:),vcres)
    ;plot2    =
gsn_csm_contour_map_overlay(wks,div(0,0,:,:),chi(0,0,:,:),cnres1,cnres2)

    ;overlay(plot2,plot1)

    draw(plot1)
    frame(wks)

end


Using this script, i am getting global plot and following error.

(0)    check_for_y_lat_coord: Warning: Data either does not contain a valid
latitude coordinate array or doesn't contain one at all.
(0)    A valid latitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0)        'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0)    check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.
(0)    A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0)        'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'


But when I am plotting all three together using the above script I am
getting no error and a global plot with velocity vectors showing only on
certain region. I am attaching both output png files.

Please help me to plot all three together in global file. I am expecting
humble reply from your side.

Thanking you

 Vyankatesh Mundhada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180221/801ad70f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dv.png
Type: image/png
Size: 227289 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180221/801ad70f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vp_dv_d.png
Type: image/png
Size: 242089 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180221/801ad70f/attachment-0003.png>


More information about the ncl-talk mailing list