1D to 3D array conversion

From: Nick Guy <nick.guy_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 01 2012 - 09:10:05 MDT

Hello,

I am trying to convert a 1D array to a 3D array. I thought I could do this in two simple steps according to examples online. However, when I check values it appears incorrect. Am I getting row-column messed up in my head?
I have brute forced around via a do loop, but I'd like to avoid that if possible.
The code is as below:
;===========================================================
; Create a 1D array ranging form 0.5 to 30 in 0.5 increments
Ht=fspan(0.5,15.,30)

; Resize to 3D
Ht3D=onedtond(Ht,(/30,150,150/))
;===========================================================
So I expect to see 0.5…30 in 0.5 increments when issuing:

print(Ht3D(:,0,0))

But the output is:

Variable: Ht3D (subsection)
Type: float
Total Size: 120 bytes
            30 values
Number of Dimensions: 1
Dimensions and sizes: [30]
Coordinates:
(0) 0.5
(1) 5.5
(2) 10.5
(3) 0.5
(4) 5.5
(5) 10.5
(6) 0.5
(7) 5.5
(8) 10.5
(9) 0.5
(10) 5.5
(11) 10.5
(12) 0.5
(13) 5.5
(14) 10.5
(15) 0.5
(16) 5.5
(17) 10.5
(18) 0.5
(19) 5.5
(20) 10.5
(21) 0.5
(22) 5.5
(23) 10.5
(24) 0.5
(25) 5.5
(26) 10.5
(27) 0.5
(28) 5.5
(29) 10.5

Thanks so much!

Nick Guy
nick.guy@noaa.gov

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 1 17:10:08 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 02 2012 - 13:38:41 MDT