[ncl-talk] Regarding my previous mail

Ankita Sharma ankita at iiserb.ac.in
Sat Jan 6 00:11:43 MST 2018


Hello,

I have seen scripts regarding my issues and also tried to correct my
scripts using concepts of that scripts. I am new to NCL and have tried
every possible measure to plot Hovmueller diagram but still, I'm stuck into
it.
It's my humble request to NCL committee that please have a look at my
script and help me with my issues in plotting vector Hovmueller diagram.
I am sending you the script upon which I have been working from last one
month.


begin

;---File handling

    fn  = "omega.mon.mean.nc" ; define filename
    omega  = addfile(fn,"r")     ; open netcdf file
fn  = "uwnd.mon.mean.nc" ; define filename
    uwnd  = addfile(fn,"r")                          ; open netcdf file

;---Read needed variables from file

    U = uwnd->uwnd
    W = omega->omega
    P0mb = 1000.
hyam = uwnd->uwnd                              ; get a coefficiants
    hybm = omega->omega                              ; get b coefficiants

;---Define other arguments required
   interp = 2
   pnew   = (/ 1000,900,850,800,750,700,550,500,250,200,150,100/)
   pnew at units = "mb"
;
; Omega is significantly smaller than u, so we will scale it so that some
vertical motion is visible
;

wAve   = avg(W(0,:,:,{170}))            ; used for scaling
  uAve   = avg(U(0,:,:,{170}))
  scale  = fabs(uAve/wAve)
  wscale = W*scale                        ; now scale

  copy_VarCoords(W, wscale)              ; copy coordinate variables


;*************************************************
; calculate divergence: Use Wrap to include meta data
;*************************************************

f    = addfile ("uwnd.mon.mean.nc", "r")
  u    = f->uwnd
f    = addfile ("vwnd.mon.mean.nc", "r")
  v    = f->vwnd

  div = uv2dvG_Wrap(u,v)                ; u,v ==> divergence

;*************************************************
; calculate divergent wind components
;*************************************************
  ud    = new ( dimsizes(u), typeof(u), u at _FillValue )
vd    = new ( dimsizes(v), typeof(v), 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

;---Create plot

wks   = gsn_open_wks ("png", "Vector" )        ; send graphics to PNG file

  res                 = True                      ; plot mods desired
  res at tiMainString    = "Vector Hovmoller" ; title

  res at cnLineLabelsOn  = True                ; turn off line labels
  res at cnFillOn        = True                  ; turn on color fill
  res at cnFillPalette   = "GMT_polar"  ; choose color map

  res at lbLabelStride   = 2                    ; every other color

  res at vcRefMagnitudeF = 3.0                ; define vector ref mag
  res at vcRefLengthF    = 0.045              ; define length of vec ref
  res at vcGlyphStyle    = "CurlyVector"      ; turn on curly vectors
  res at vcMinDistanceF  = 0.01                ; thin out vectors
  res at vcMapDirection  = True

res                 = True
  res at vcRefMagnitudeF = 4.                    ; make vectors larger
  res at vcRefLengthF    = 0.050                 ; reference vector length
  res at vcGlyphStyle    = "CurlyVector"         ; turn on curly vectors
  res at vcMinDistanceF  = 0.012                 ; thin the vectors



;---Draw plot from pole to pole at 180E

plot    =
gsn_csm_pres_hgt_vector(wks,U(0,:,:,{170}),W(0,:,:,{170}),wscale(0,:,:,{170}),res
)
plot_ov = gsn_csm_vector_map(wks,ud(0,1,:,:),vd(0,1,:,:),res)

overlay(plot,plot_ov)                       ; overlay the U-wind plot on
the hovmoller plot
  draw(plot)                                  ; draw the temperature plot
(with the U-wind plot overlaid)
  frame(wks)                                  ; advance the frame

end


Thank you,
Ankita Sharma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180106/b9b1ec3e/attachment.html>


More information about the ncl-talk mailing list