[ncl-talk] generate_sample_indices generates index out of prescribed range

Dennis Shea shea at ucar.edu
Mon Aug 31 09:35:38 MDT 2015


THX for the information. A JIRA ticket will be opened.

A 1st glance a simple work around would be:

   newind_PI = generate_sample_indices(dims_PI(0),1)  - 1

Since NCL indexing start at 0

Cheers


On Mon, Aug 31, 2015 at 9:08 AM, Lejeune  Quentin Gaël Léo
<quentin.lejeune at env.ethz.ch> wrote:
> Hello,
>
>
> I am facing a problem while using the function generate_sample_indices with
> NCL/6.3.0.
>
> Here is an extract from my code:
>
> newind_PI = generate_sample_indices(dims_PI(0),1)   ; line1
> print(dims_PI(0))                                                       ;
> line2
> printMinMax(newind_PI,True)                                     ; line3
> printVarSummary(data_PI(:,j,i))                                  ; line4
> rsdata_PI(:,j,i) = data_PI(newind_PI,j,i)                       ; line5
>
>
> I get the following message:
>
> Variable: dims_PI (subsection)
> Type: integer
> Total Size: 4 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> (0)     32850
> (0)
> (0)     min=1   max=32850
>
> Variable: data_PI (subsection)
> Type: float
> Total Size: 131400 bytes
>             32850 values
> Number of Dimensions: 1
> Dimensions and sizes:   [time | 32850]
>
> fatal:Subscript out of range, error in subscript #0
>
>
> So although I ask for the generation of indices within the [0:32849] range
> on line 1, it seems that I get an index equal to 32850, which causes the
> error on line 5. I precise that I got this error when repeating this
> operation for the 595th time in a row.
>
> Have you already encountered this problem? Do you think there is a bug with
> this new function?
>
> Here is what I get with uname -a:
> Linux pilatus01 3.0.101-0.46-default #1 SMP Wed Dec 17 11:04:10 UTC 2014
> (8356111) x86_64 x86_64 x86_64 GNU/Linux
>
>
> Thanks for your help.
> Best regards,
>
>
> Quentin Lejeune
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list