[Tutor] Loops and matrices'

Reed DA (Danny) at Aera DAReed at aeraenergy.com
Tue Aug 30 00:28:22 CEST 2011


Hi all,

I have a matrix which contains temperatures. The columns are time, spaced 33 seconds apart, and the rows are depth intervals. What I'm trying to do is create another matrix that contains the rate of change of temperature for each depth. The array is called LS_JULY_11 and the output array should be delta_temp

What I have so far is:-


import numpy

#determine the existing matrix size
columnsize = LS_JULY_11.columnSize()
matrixsize = LS_JULY_11.size()
rowsize = matrixsize/columnsize

#define time step
TIME_STEP = 33


#create matrix size of the same size
delta_temp = numpy.zeros((rowsize,columnsize))

#cycle through all indicies in temperature matrix
for i in rowsize:
                for j in columnsize:
                                delta_temp(i,j) = (LS_JULY_11(i,j) - LS_JULY_11(i,j-1))/TIME_STEP
                                j = j+1
                i = i + 1

the error I get is:-

  File "<string>", line 18 (33)
SyntaxError: can't assign to function call

Help would be greatly appreciated
Thanks
Danny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110829/e1dacb54/attachment-0001.html>


More information about the Tutor mailing list