[ncl-talk] Time axis in Hovmueller plot
Toni Klemm
toni-klemm at tamu.edu
Tue Jan 29 07:25:20 MST 2019
Hi Saran,
That’s for two reasons:
(1) You are only using the first time dimension of your data, but all latitude and all longitude dimensions, so by your own setting you're plotting latitude/longitude, not time/longitude:
u = f->cur_vort(0,:,:)
(2) You need to prepare the data in the correct way first, so that you can plot it. Your code below only does the plotting, but not the data manipulation so that you can actually plot what you need. Average the latitude dimension (y axis) for each longitudinal grid cell “column” and each time step, and then plot the data.
This might work (though, it might not. I didn’t test it. Please read through it and try to understand it. Don’t just plug it into your script. Also, there might be an easier way to do this):
u = f->cur_vort(:,:,:) ; u contains all your (3-dimensional) curvature vorticity data
vort_timeseries = new((/dimsizes(time),dimsizes(lon)/),float) ; this is the 2-dimensional variable you use for the Hovmoeller diagram
do time_step = 0,dimsizes(time)
do lon_step = 0,dimsizes(lon)
vort_timeseries(time_step,lon_step) = avg(u(time_step,:,lon_step)) ; a loop to average the data by latitude for each time step and longitudinal step
end do ; lon_step loop
end do ; time_step loop
vort_timeseries should be the data you need for your Hovmoeller diagram.
Good luck,
Toni
Toni Klemm, Ph.D.
Postdoctoral Research Associate
Department of Ecosystem Science and Management
College of Agriculture and Life Sciences
Texas A&M University, College Station, TX
Contributor to the Early Career Climate Forum <https://www.eccforum.org/>
www.toni-klemm.de <http://www.toni-klemm.de/> | @toniklemm <https://twitter.com/ToniKlemm>
> On Jan 29, 2019, at 5:16 AM, Saran Rajendran <happysaran.raj at gmail.com> wrote:
>
> Dear NCL users,
>
> When I tried this script to plot hovmueller diagram
> (time vs longitude) of curvature vorticity, the code runs. But instead
> of time in y-axis, it shows latitude. I want time in the y-axis.
>
>
> f = addfile("curv_vort_lat_lon_925hPa_20150101_20151231.nc","r")
>
> u = f->cur_vort(0,:,:)
>
> wks = gsn_open_wks("png","hovmueller_cv_2015")
>
> res=True
>
> res at cnFillOn = True ; turn on color fill
>
> res at cnFillPalette = "BlWhRe"
>
> res at gsnLeftString="cv"
>
> plot = gsn_csm_hov(wks, u(:,{60:120}), res )
> _______________________________________________
> 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/20190129/ac9011ac/attachment.html>
More information about the ncl-talk
mailing list