[SciPy-user] help assigning arrays - global model output

John [H2O] washakie at gmail.com
Fri Jul 18 01:37:31 EDT 2008


Hello, I am trying to fill an array reading in unformatted binary data :-/

I actually have most the code working now, and I have a F2Py module which
reads the binary efficiently. My problem is assigning the arrays into the
python multidimensional array.

This works:
G={}
for date in dates:
    data = F2Py.module.getdata()
    # data is shape (180,360,3)
    G[date] = data

What I WANT is this:

G=zeros((180,360,3,len(dates)))
for i in range(len(dates)):
    data = F2Py.module.getdata()
    # data is shape (180,360,3)
    G[:,:,:,i] = data

But I get a shape mismatch error, something about not broadcasting an
array.... 

Could someone please provide comment on how I need to do this assignment?

Thank you.
-- 
View this message in context: http://www.nabble.com/help-assigning-arrays---global-model-output-tp18522938p18522938.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list