thanks again for you response. I must still be doing something wrong!!
both options resulted in :
the TSFC_avg is: [-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -
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'].
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
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
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/
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
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,
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