Re: 1D to 3D array conversion

From: <brownrig_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 01 2012 - 10:03:04 MDT

Hi Nick,

The rightmost index varies the fastest stepping through consecutive
memory locations, and the onedtond() function repeats the values of
the input array if the output array is larger. I'm not clear what you
are after, but what about something like:

Ht3D(:,0,0) = Ht

Hope that helps...
Rick

On Mon, 1 Oct 2012 10 :10:05 -0500
  Nick Guy <nick.guy@noaa.gov> wrote:
> 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 3DR
> 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

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

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