Re: [Numpy-discussion] nan division warnings

2011-08-30 Thread mdekauwe
Perfect that works how I envisaged, I am an idiot, I clearly overcomplicated my solution. thanks. -- View this message in context: http://old.nabble.com/nan-division-warnings-tp32369310p32369517.html Sent from the Numpy-discussion mailing list archive at Nabble.com. ___

[Numpy-discussion] nan division warnings

2011-08-30 Thread mdekauwe
Hi, this is probably my lack of understanding...when i set up some masks for 2 arrays and try to divide one by the other I get a runtime warning. Seemingly this is when I am asking python to divide one nan by the other, however I thought by masking the array numpy would then know to ignore these

Re: [Numpy-discussion] segmentation fault when installing with pip and python2.7

2010-07-23 Thread mdekauwe
Hi, I don't know about pip but if you use macports all the python 2.6, scipy et al libs all set up fine with problems on snow leopard. If you really want 2.7 then not sure what to say. Martin celil wrote: > > Hello, > > I just installed numpy on Snow Leopard using pip. However, running the

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Yep that will do nicely, code becomes import sys, os, glob import numpy as np def averageEightDays(files, numrows, numcols, year, doy): """ Read in 8 files at a time, sum the valid LST, keep a count of the valid pixels and average the result every 8days. """

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Vincent Schut-2 wrote: > > Oh, and minor issue: creating a array of zeros and then multiplying with > -999 still makes an array of zeros... I'd incorporated an array of > *ones* multiplied with -999, because for the last chunk of days you > could end up with a 8day array only partly filled wi

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Thanks...I have adopted that and as you said it is a lot neater! Though I need to keep the pixel count for a weighting in another piece of code so have amended your logic slightly. #!/usr/bin/env python import sys, os, glob import numpy as np def averageEightDays(filenamesList, numrows, numcol

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
= np.zeros((numrows, numcols), dtype=np.float32) count = np.zeros((numrows, numcols), dtype=np.int) averageEightDays('lst_scr_2007*.gra', lst, count, numrows, numcols) Pierre GM-2 wrote: > > On Nov 25, 2009, at 4:13 PM, mdekauwe wrote: &g

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-25 Thread mdekauwe
Does anyone have any suggestions on how to match up the logic? mdekauwe wrote: > > Hi I have written some code and I would appreciate any suggestions to make > better use of the numpy arrays functions to make it a bit more efficient > and less of a port from C. Any tricks are thoughts

[Numpy-discussion] Help making better use of numpy array functions

2009-11-24 Thread mdekauwe
Hi I have written some code and I would appreciate any suggestions to make better use of the numpy arrays functions to make it a bit more efficient and less of a port from C. Any tricks are thoughts would be much appreciated. The code reads in a series of images, collects a running total if the v