[Thread Prev][Thread Next][Index]

Re: Vector into array...



Hi Gary,

The RESHAPE function is the hot ticket for this. An example to illustrate -->
reshape a "vector" of length 50 into a 2D array that is 5x10:

     let my_one_D = i[i=1:50]
     define axis/x=1:5:1 xax
     define axis/y=1:10:1 yax
     let my_2D = RESHAPE(my_one_D, x[gx=xax]+y[gy=yax])
     list my_2D

    - steve

========================================================

Gary Strand wrote:

> I've looked in the documentation and I'm stymied. Not unusual for me, but here
> goes:
>
> How do I make a 1-D variable look 2-D? For example:
>
> use dataset.nc
> show d
>      currently SET data sets:
>     1> ./dataset.nc  (default)
>  name     title                             I         J         K         L
>  ONED_DATA
>                                            1:442368  ...       ...       ...
> !
> define axis/x=1:768:1 xx
> define axis/y=1:576:1 yy
> define grid/x=xx/y=yy gg
> let twod_data = oned_data[g=gg@asn]
> shade twod_data
>  **ERROR: dimensions improperly specified: can only contour or vector a 2D region
>           shade twod_data
> shade twod_data
> Command file, command group, or REPEAT execution aborted
>
> gg is defined to have the correct number of points...
>
> "reshape" doesn't work since I don't already have a variable with the proper
> size and shape to transform.
>
> Thanks.
> --
> Gary Strand
> strandwg@ucar.edu                          http://www.cgd.ucar.edu/ccr/strandwg

--

                |  NOAA/PMEL               |  ph. (206) 526-6080
Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
                |  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement