[ncl-talk] hovmoller diagrams for vectors and swap x/y axes
LI Qi
liqi123sh at qq.com
Thu Jul 23 21:29:05 MDT 2015
Hi Dave,
It works like a charm! Thank you very much!
Hi Adam,
Sorry for my misleading expression...what I really want is to swap the X/Y axes, i.e., to make the Time-latitude plot to a Latitude-time plot.
Then I reorder the variable's dimensions, like:
; variable's original order (time, lat, lon)
qu = in->quz(:,:,0)
; reorder (lat, time)
qu_new = qu(lat | :, time | :)
But the figure's coordinate doesn't show latitudes and timeline (shown below). What do I do? Or is there any other way to swap the axis?
Thanks again!
Qi
------------------ Original ------------------
From: "Adam Phillips";<asphilli at ucar.edu>;
Date: Fri, Jul 24, 2015 02:28 AM
To: "David Brown"<dbrown at ucar.edu>;
Cc: "LI Qi"<liqi123sh at qq.com>; "ncl-talk"<ncl-talk at ucar.edu>;
Subject: Re: [ncl-talk] hovmoller diagrams for vectors
Hi Qi,
Adding to Dave's email: If you want to reverse your X/Y axes you can set trYReverse / trXReverse:
www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trXReverse
www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trYReverse
Adam
On Thu, Jul 23, 2015 at 11:58 AM, David Brown <dbrown at ucar.edu> wrote:
Hi Qi,I am guessing you need to set vcMapDirection to False. This needs to be set when you plot vectors with axes with coordinates that are not geographic.
-dave
On Thu, Jul 23, 2015 at 4:01 AM, LI Qi <liqi123sh at qq.com> wrote:
Hi Adam,
Thank you very much! The example is very helpful! I use the function "overlay" to superimpose vectors over contours.
However, the vectors seem different with the one I plot using GrADS (see below), and I don't know why. Could you help me look at my script? One more question is, how to reverse the X-Y coordinates?
Attached is the data if it is needed.
Much appreciated and best regards,
Qi
ncl plot:
my script:
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
;************************************************
begin
;************************************************
; variable and file handling
;************************************************
in = addfile("erai-qvint-zonmean.nc","r")
qu = in->quz(:,:,0)
qv = in->qvz(:,:,0)
qdiv = in->qflxdiv(:,:,0)
time = in->time
lat = in->lat
;************************************************
; plotting
;************************************************
wks = gsn_open_wks("eps","eri-qhov") ; Opens a eps file
;gsn_define_colormap(wks,"WhiteBlueGreenYellowRed") ; choose colormap
res = True
res at gsnDraw = False
res at gsnFrame = False
;
; Set up some contour resources.
;
; Turn on contour fill, and turn other things off.
;
res at cnFillOn = True
res at cnLinesOn = False
res at cnInfoLabelOn = False
;
; Define contour levels and their colors.
;
;cnres at cnLevelSelectionMode = "ManualLevels"
;cnres at cnMinLevelValF = 980.0
;cnres at cnMaxLevelValF = 1040.0
;cnres at cnLevelSpacingF = 5.0
;cnres at cnFillPalette = "StepSeq25" ; assign color map to contours
res at trYReverse = True ; time from top to bottom, small to big
; Set special resources for the time axis
resTick = True
resTick at ttmFormat = "%d %c" ; form like "1 Jun", %d means day, %c means calendar
resTick at ttmAxis = "YL" ; Y axis, Left
; Set resources necessary to customize Y axis labels
time_axis_labels( time, res, resTick )
vecres = True ; vector only resources
vecres at gsnDraw = False
vecres at gsnFrame = False
vecres at vcRefMagnitudeF = 600000 ; define vector ref mag
vecres at vcRefAnnoOrthogonalPosF = -.535 ; move ref vector into plot
cnid = gsn_csm_contour(wks,qdiv,res)
vcid = gsn_csm_vector(wks,qu,qv,vecres)
overlay(cnid,vcid)
maximize_output(wks,True)
end
------------------ Original ------------------
From: "Adam Phillips";<asphilli at ucar.edu>;
Date: Tue, Jul 21, 2015 04:02 AM
To: "LI Qi"<liqi123sh at qq.com>;
Cc: "ncl-talk"<ncl-talk at ucar.edu>;
Subject: Re: [ncl-talk] hovmoller diagrams for vectors
Hi Qi,
I believe you will want to use the gsn_csm_vector_scalar plotting function. For an example showing how this function is used see example #6 here:
http://www.ncl.ucar.edu/Applications/overlay.shtml#ex6
(see the overlay_6_new.ncl script)
This example does not show a latitude/time plot but gsn_csm_vector_scalar should still work for your needs.
Hope that helps. If not or if you have further questions please respond to ncl-talk.
Adam
On Sat, Jul 18, 2015 at 7:29 PM, LI Qi <liqi123sh at qq.com> wrote:
Dear NCL community,
I would like to create latitude vs. time plot for moisture flux in vectors.
But the function gsn_csm_lat_time seems to be used for scalar fieids.
The data I have contains (qu,qv) over a limited area.
Below is a figure I plotted using GrADS for reference. How could I plot it using NCL?
Any suggestion would be much appreciated!
Best,
Qi
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150724/ceeffb13/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 270167 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150724/ceeffb13/attachment-0003.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 109813 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150724/ceeffb13/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 110658 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150724/ceeffb13/attachment-0005.obj
More information about the ncl-talk
mailing list