Re: array dimension change

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 06 2010 - 21:23:44 MDT

WHen you defined "sm" it has no meta data.

The " dble2flt( smm(i,j,k)) " maintains meta data.
This includes named dimensions. The right hand side which
has 3 named dimensions is trying to place all 3 dimensions
into a 2 dimensional array.

I suggest the following:

     dims = dimsizes(smm)
     sm = onedtond( ndtooned(smm), (/ dims(0)*dims(1), dims(2) /) )
     printVarSummary(sm)

On 9/6/10 5:39 PM, Yang Yang wrote:
> Hello:
>
> In a NCL script, I have the following block to change the dims of an array from 3 to 2:
>
> sm = new((/365*24,55/),float)
> do k = 0, 54
> do i = 0, 364
> do j = 0, 23
> sm(i*24+j,k)= dble2flt( smm(i,j,k))
> end do
> end do
> end do
> printVarSummary(smm)
>
> However, I got the many warning information:
>
> warning:Dimension (0) has not been defined
> warning:Dimension (0) has not been defined
> warning:Dimension (0) has not been defined
>
> Variable: smm
> Type: double
> Total Size: 3854400 bytes
> 481800 values
> Number of Dimensions: 3
> Dimensions and sizes: [365] x [24] x [55]
> Coordinates:
>
> Can you please tell me why NCL had the warning for me? Anything wrong?
>
> Thank you very much!
>
> Cheers!
> Ed
>
>
>
> _______________________________________________
> 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 Sep 6 21:23:49 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 09 2010 - 05:56:39 MDT