Re: reshape consist with Fortran

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 19 2010 - 08:34:54 MDT

I would have thought they are the same.
Please state why they are not the same.

fortran is column major
NCL (like C) is row major

fortran

      REAL, DIMENSION(6) :: B
      REAL, DIMENSION(2,3) :: C1
      B = (/ 1, 1, 2, 3, 5, 8 /)
      C1= RESHAPE( B, (/ 2,3 /) )

      print *, C1
      end

1.000000
1.000000
2.000000
3.000000
5.000000
8.000000

NCL
      B = (/ 1, 1, 2, 3, 5, 8 /)*1.0
      C2= onedtond( B, (/ 2,3 /) )

      print(C2)

Variable: C2
Type: float
Total Size: 24 bytes
             6 values
Number of Dimensions: 2
Dimensions and sizes: [2] x [3]
Coordinates:
(0,0) 1
(0,1) 1
(0,2) 2
(1,0) 3
(1,1) 5
(1,2) 8

On 10/19/10 5:29 AM, Mehmet Coskun wrote:
> Dear All
>
> Is there any build in function to converts a one-dimensional array to a
> multi-dimensional array,which is consistent with Fortran reshape,
> onedtond is not same fortran reshape,
> mehmet
> thank you
>
>
>
> _______________________________________________
> 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 Tue Oct 19 08:35:02 2010

This archive was generated by hypermail 2.1.8 : Tue Oct 19 2010 - 14:38:00 MDT