[ncl-talk] Regarding my previous mail
Mary Haley
haley at ucar.edu
Thu Jan 11 09:18:09 MST 2018
You said you are getting a bad plot, but you need to provide more
information than this. Please attach the PNG images so we can see what
they look like. Even better, can you provide me with your data files? You
can use our ftp, if the files are not too large:
http://www.ncl.ucar.edu/ftp_files.shtml
I'm not sure exactly what you are trying to do, since you are creating two
completely different plots, both with vectors:
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)
The gsn_csm_pres_hgt_vector function is what draws the Hovmueller vector
plot. Since you didn't set gsnDraw and gsnFrame to False for this plot,
the first PNG image should be this plot. Does it look correct at all?
Then with your second plot, you are plotting vectors over a map. This
should be the second PNG image. Does this look correct?
In order for the gsn_csm_pres_hgt_vector plot function to work, the first
data array must be the one you want to contour, and the second two data
arrays must be the U/V vector arrays. Did you double-check that this is
what you have?
Please read the documentation at:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_pres_hgt_vector.shtml
to make sure you are calling this function correctly. You can also see a
couple of examples at:
h_lat_7.ncl
http://www.ncl.ucar.edu/Applications/height_lat.shtml#ex7
vector_5.ncl
http://www.ncl.ucar.edu/Applications/vector.shtml#ex5
--Mary
On Wed, Jan 10, 2018 at 11:30 PM, Ankita Sharma <ankita at iiserb.ac.in> wrote:
> Dear Mary,
>
> Thank you for your time and reply.
> As I have said earlier, I was trying to plot hovmoller vector
> (pressure/height vs longitude) since last several weeks but still not able
> to do that. I just want to ask shall I give up NCL and plot the diagram for
> the same in GRADS or ArcGIS?
>
> Thanking you
>
> On Wed, Jan 10, 2018 at 8:00 PM, Mary Haley <haley at ucar.edu> wrote:
>
>>
>> As I said before, you are trying to overlay a pressure/latitude plot on a
>> lat/lon plot.
>>
>> You cannot call overlay on two plots that have different coordinate
>> systems. The Hovmueller plot is a plot that is pressure versus latitude, at
>> a single specified longitude. You are then trying to overlay this on a map
>> plot that is latitude versus longitude. You simply cannot do this, as NCL
>> has no idea how to transform data in pressure / latitude space to latitude
>> / longitude space.
>>
>> Do you really need to overlay the Hovmueller plot on a map? Why not just
>> draw the Hovmueller plot as-is?
>>
>> --Mary
>>
>>
>> On Tue, Jan 9, 2018 at 4:01 AM, Ankita Sharma <ankita at iiserb.ac.in>
>> wrote:
>>
>>> I am getting a bad plot, and I am not able to plot the vector winds in
>>> Hovmoller plot.
>>>
>>> On Mon, Jan 8, 2018 at 11:29 PM, Mary Haley <haley at ucar.edu> wrote:
>>>
>>>> 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/20180111/df9f0622/attachment.html>
More information about the ncl-talk
mailing list