# [ncl-talk] Time axis in Hovmueller plot

Toni Klemm toni-klemm at tamu.edu
Tue Jan 29 13:55:46 MST 2019

```Hi Saran,

I'm really sorry, but I don’t know what that means. Maybe someone else can chime in and help.

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 <http://www.eccforum.org/>

> On Jan 29, 2019, at 2:52 PM, Saran Rajendran <happysaran.raj at gmail.com> wrote:
>
> Hi Toni,
>
>            yeah, that worked. Thank You very much. But one more error still exists. Could you please check that also.
>
>
> fatal:Dimension (1) of (vort_hov) is not named and therefore
> doesn't have an associated coordinate variable
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in
> file hov_sv2cv_2015_test.ncl
>
>
> 2  time=f->time
>
> 3  lon=f->longitude
>
> 4   lat=f->latitude
>
> 5   u  = f->cur_vort(:,:,:)
>
> 6   printVarSummary(u)
>
> 7   vort_hov = new((/dimsizes(time),dimsizes(lon)/),float)  ; this is
> the 2-dimensional variable you use for the Hovmoeller diagram
>
> 8  printVarSummary(vot_hov)
>
> 9  do time_step = 0,dimsizes(time)-1
>
> 10  do lon_step = 0,dimsizes(lon)-1
>
> 11  vort_timeseries = avg(u(time_step,:,lon_step))   ; a loop to
> average the data by latitude for each time step and longitudinal step
> 12    end do
> 13    end do
>
> 14      res=True
>
> 15          res at cnFillOn             = True               ; turn on color fill
>
> 16  res at cnFillPalette        = "BlWhRe"
>
> 17    res at gsnLeftString="cv"
>
> 18      plot = gsn_csm_hov(wks, vort_timeseries(:,{60:120}), res )
>
>
> On Wed, Jan 30, 2019 at 2:05 AM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
> Hi Saran,
>
> I think the errors all occurred because of the first one. Change
>
>> 9 do time_step = 0,dimsizes(time)
> and
>> 10 do lon_step = 0,dimsizes(lon)
>
> to
>
> do time_step = 0,dimsizes(time)-1
> and
> do lon_step = 0,dimsizes(lon)-1
>
> This should let you run the do-loops without crashing.
>
> To explain the “-1”, the position of the first item in a list in NCL is zero, not one. So the position of the last item in a list is not the length of the list (“dimsizes()”), but “dimsizes()-1”. Without “-1” you were trying to call on a list item that wasn’t there, which is what “subscript out of range” means.
>
> Best,
> 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://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=W-QvsDoYO7hFbIaZEIuVBbFGSsIU_w6WGMf7vmMSzJg&s=KNj58GpzXFCwnt_JwRK5sleYBL3FFNDNz1TrCTlfrd4&e=>
> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=W-QvsDoYO7hFbIaZEIuVBbFGSsIU_w6WGMf7vmMSzJg&s=F2lth45vqfNAks0ZhaAEmoXDImE9VQG-FJvmHXg2U0o&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=W-QvsDoYO7hFbIaZEIuVBbFGSsIU_w6WGMf7vmMSzJg&s=qL2Z7fw70StzaGTY4Q5gfJOhrqMEYTMpRA2ksg8MdKg&e=>
>
>
>
>
>
>
>
>
>> On Jan 29, 2019, at 2:09 PM, Saran Rajendran <happysaran.raj at gmail.com <mailto:happysaran.raj at gmail.com>> wrote:
>>
>> Hi Toni
>>
>>           Thank You for that valuable information. I thoroughly read
>> your code and I understood my mistake. I modified my code as per your
>> correction, but I'm getting some errors again.
>>
>> These are the errors:
>>
>> fatal:Subscript out of range, error in subscript #2
>>
>> fatal:An error occurred reading u
>>
>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 11 in
>> file hov_sv2cv_2015_test.ncl
>>
>>
>> fatal:Dimension (1) of (vort_timeseries) is not named and therefore
>> doesn't have an associated coordinate variable
>>
>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in
>> file hov_sv2cv_2015_test.ncl
>>
>>
>>
>> And the modified code is
>>
>>
>> 2  time=f->time
>>
>> 3  lon=f->longitude
>>
>> 4   lat=f->latitude
>>
>> 5   u  = f->cur_vort(:,:,:)
>>
>> 6   printVarSummary(u)
>>
>> 7   vort_hov = new((/dimsizes(time),dimsizes(lon)/),float)  ; this is
>> the 2-dimensional variable you use for the Hovmoeller diagram
>>
>> 8  printVarSummary(vot_hov)
>>
>> 9  do time_step = 0,dimsizes(time)
>>
>> 10  do lon_step = 0,dimsizes(lon)
>>
>> 11  vort_timeseries = avg(u(time_step,:,lon_step))   ; a loop to
>> average the data by latitude for each time step and longitudinal step
>> 12    end do
>> 13    end do
>>
>> 14      res=True
>>
>> 15          res at cnFillOn             = True               ; turn on color fill
>>
>> 16  res at cnFillPalette        = "BlWhRe"
>>
>> 17    res at gsnLeftString="cv"
>>
>> 18      plot = gsn_csm_hov(wks, vort_timeseries(:,{60:120}), res )
>>
>> On Tue, Jan 29, 2019 at 7:55 PM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
>>>
>>> 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
>>> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=W-QvsDoYO7hFbIaZEIuVBbFGSsIU_w6WGMf7vmMSzJg&s=F2lth45vqfNAks0ZhaAEmoXDImE9VQG-FJvmHXg2U0o&e=> | @toniklemm
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Jan 29, 2019, at 5:16 AM, Saran Rajendran <happysaran.raj at gmail.com <mailto: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.
>>>
>>>
>>>
>>> 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 <mailto:ncl-talk at ucar.edu>
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=W-QvsDoYO7hFbIaZEIuVBbFGSsIU_w6WGMf7vmMSzJg&s=NzkcRJNdkfJii8eSqxc3JZUsDUQPNQHS04MnftQk6z0&e=>
>>>
>>>
>>
>>
>> --
>> Saran Rajendran
>> Junior Research Fellow
>> Centre for Atmospheric Science
>> Indian Institute of Technology Delhi
>
>
>
> --
> Saran Rajendran
> Junior Research Fellow
> Centre for Atmospheric Science
> Indian Institute of Technology Delhi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190129/611a13e4/attachment.html>
```