Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
thanks again for you response. I must still be doing something wrong!! both options resulted in : the TSFC_avg is: [-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread Xavier Barthelemy
Well, I would see solutions: 1- to keep how your code is, withj a python list (you can stack numpy arrays if they have the same dimensions): for filename in netCDF_list: ncfile=netCDF4.Dataset(filename) TSFC=ncfile.variables['T_SFC'][:] fillvalue=ncfile.variables['T_SFC'].

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
I have also tried Xavier's suggestion but only end up with one value as my average (instead of an array). I used: for a in TSFC: indexnonNaN=N.isfinite(a) SliceofTotoWithoutNan=a[indexnonNaN] print SliceofTotoWithoutNan TSFC=SliceofTo

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
Thanks for responding. I have tried several ways of adding the command, one of which is: for i in TSFC: if N.any(N.isnan(TSFC)): break else: pass but nothing is happening, is there some particular way I need to

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread Xavier Barthelemy
Hi, I don't know if it is the best choice, but this is what I do in my code: for each slice: indexnonNaN=np.isfinite(SliceOf Toto) SliceOf TotoWithoutNan= SliceOf Toto [indexnonNaN] and then perform all operation I want o on the last array. i hope it does answer your question Xavier 2011/

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread David Cournapeau
On Mon, Dec 5, 2011 at 5:29 PM, questions anon wrote: > Maybe I am asking the wrong question or could go about this another way. > I have thousands of numpy arrays to flick through, could I just identify > which arrays have NAN's and for now ignore the entire array. is there a > simple way to do t

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
Maybe I am asking the wrong question or could go about this another way. I have thousands of numpy arrays to flick through, could I just identify which arrays have NAN's and for now ignore the entire array. is there a simple way to do this? any feedback will be greatly appreciated. On Thu, Dec 1,

[Numpy-discussion] ignore NAN in numpy.true_divide()

2011-11-30 Thread questions anon
I am trying to calculate the mean across many netcdf files. I cannot use numpy.mean because there are too many files to concatenate and I end up with a memory error. I have enabled the below code to do what I need but I have a few nan values in some of my arrays. Is there a way to ignore these some