[ncl-talk] Question regarding array indexing
Prashanth Bhalachandran
prashanth.bhalachandran at gmail.com
Tue Oct 17 13:19:27 MDT 2017
Hello all,
I have a relatively simple question on array indexing.
Say, I have an array that is cyclic that contains values from 0 to 360 in steps of 5 degrees (dimension [72]). And I am trying to divide into four quadrants starting from a given theta. Say that the index of the given theta is 13 (out of 73), I define my quadrants that are each 90 degrees as follows :
Array : theta [73]
Quadrant 1 : theta(13:31)
Quadrant 2: theta(31:49)
Quadrant 3: theta(49:67)
Quadrant 4: theta(67:13)
Now, as you’ll notice, having an index of 67:13 doesn’t imply 67:72 and 0:13, it simply implies 13:67 backwards. How do I index the array such that it takes it in a cyclic fashion? For example (what I don’t want is), in a simpler array of just five dimensions : Variable: a
Type: integer
Total Size: 20 bytes
5 values
Number of Dimensions: 1
Dimensions and sizes: [5]
Coordinates:
(0) 1
(1) 2
(2) 3
(3) 4
(4) 5
ncl 3> print(a(4:2))
Variable: a (subsection)
Type: integer
Total Size: 12 bytes
3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
(0) 5
(1) 4
(2) 3
What I would have liked it is for it to display 5 1 2 3.
Please let me know how this is possible.
Thank you all,
Prashanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171017/e6251daf/attachment.html>
More information about the ncl-talk
mailing list