I am new to the world of Python and numpy
Welcome.
I have successfully imported the data into lists and then created a
single array from the lists.
I think putting each quantity in a 1D array is more practical in this
case.
I can get the rainfall total over the entire period using:
<snip>
But what i would like to do is get an average rainfall for each
month and also
the ability to get rainfall totals for any month and Year
Assuming that yr, mth and rain are 1D arrays, you may try something
along
[[average(rain[(yr == y) & (mth == m)]) for m in unique(mth[yr==y])]
for y in unique(yr)]
which gives you the monthly average rainfalls stored in lists, one for
each year.
The rain data cannot be reshaped in a 3D numpy array, because not all
months have the same number of days, and not all years have the same
number of months. If they could, numpy would allow you to do something
like:
average(rain.reshape(Nyear, Nmonth, Nday), axis =-1)
to get the same result.
J.
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion