[ncl-talk] Regarding my previous mail
Mary Haley
haley at ucar.edu
Mon Jan 8 10:59:31 MST 2018
Dear Ankita,
In general, it is hard for us to simply look at a script and determine what
the problem is without information about what is wrong. That is, are you
getting an error? Are you getting a bad plot?
However, I see you are trying to overlay a pressure/hgt plot, which is
pressure versus latitude, and overlay this on a map (lat/lon) plot, which
doesn't make sense. These are two different coordinate systems and it
simply won't work.
Please explain in more detail about what you are trying to plot. It would
also help if you can provide the data.
Thanks,
--Mary
On Sat, Jan 6, 2018 at 12:11 AM, Ankita Sharma via ncl-talk <
ncl-talk at ucar.edu> wrote:
> 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
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180108/29fa7837/attachment.html>
More information about the ncl-talk
mailing list