[Numpy-discussion] Rounding float to integer while minizing the difference between the two arrays?

2014-07-16 Thread Chao YUE
lot in advance. Best, Chao -- please visit: http://www.globalcarbonatlas.org/ ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batimen

Re: [Numpy-discussion] Rounding float to integer while minizing the difference between the two arrays?

2014-07-16 Thread Chao YUE
ec,pint = math.modf(x) if pdec > threshold: return int(math.ceil(pint)+1) else: return int(math.ceil(pint)) On Wed, Jul 16, 2014 at 3:18 PM, Chao YUE wrote: > Dear all, > > I have two arrays with both float type, let's say X and Y. I wan

Re: [Numpy-discussion] Rounding float to integer while minizing the difference between the two arrays?

2014-07-16 Thread Chao YUE
Dear all, A bit sorry, this is not difficult. scipy.optimize.minimize_scalar seems to solve my problem. Thanks anyway, for this great tool. Cheers, Chao On Wed, Jul 16, 2014 at 3:18 PM, Chao YUE wrote: > Dear all, > > I have two arrays with both float type, let's say X an

Re: [Numpy-discussion] percentile function for masked array?

2014-06-04 Thread Chao YUE
self grow mask attribute one day which will be equivalent to isnan. > Bit views, anyone?) > > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- please visit: http://www.globalcarbonatla

[Numpy-discussion] percentile function for masked array?

2014-06-02 Thread Chao YUE
guess. Thanks for any comments. Best, Chao -- please visit: http://www.globalcarbonatlas.org/ *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712

Re: [Numpy-discussion] simple way to denote unchanged dimension in reshape?

2014-05-29 Thread Chao YUE
Oh, I didn't think it out. thanks. Chao On Thu, May 29, 2014 at 11:59 AM, Dave Hirschfeld wrote: > Chao YUE gmail.com> writes: > > > > > > > > > Dear all, > > I have a simple question. Is there a way to denote the unchanged > dimension > in

[Numpy-discussion] simple way to denote unchanged dimension in reshape?

2014-05-29 Thread Chao YUE
.)? thanks a lot in advance, best, Chao -- please visit: http://www.globalcarbonatlas.org/ ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe

Re: [Numpy-discussion] np.ma.argmax not respecting the mask?

2013-07-09 Thread Chao YUE
Thanks Pierre, good to know there are so many tricks available. Chao On Tue, Jul 9, 2013 at 4:55 PM, Pierre Gerard-Marchant wrote: > > On Jul 9, 2013, at 16:38 , Chao YUE wrote: > > > Sorry I didn't the docs very carefully. there is no doc for np.ma.argmax >

Re: [Numpy-discussion] np.ma.argmax not respecting the mask?

2013-07-09 Thread Chao YUE
t; > On Jul 9, 2013, at 16:08 , Sebastian Berg > wrote: > > > On Tue, 2013-07-09 at 15:14 +0200, Stéfan van der Walt wrote: > >> On Tue, Jul 9, 2013 at 2:55 PM, Chao YUE wrote: > >>> I am using 1.7.1 version of numpy and np.ma.argmax is not repecting the

[Numpy-discussion] np.ma.argmax not respecting the mask?

2013-07-09 Thread Chao YUE
nks, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax

Re: [Numpy-discussion] easy way to collapse the last two dimension of an array?

2013-06-03 Thread Chao YUE
Thanks to the two of you!! Chao On Mon, Jun 3, 2013 at 11:53 AM, Sebastian Berg wrote: > On Mon, 2013-06-03 at 10:44 +0200, Chao YUE wrote: > > Dear all, > > > > I have an array with 4 dim: > > > > In [24]: dd.shape > > Out[24]: (12, 13, 120, 170) > &

[Numpy-discussion] easy way to collapse the last two dimension of an array?

2013-06-03 Thread Chao YUE
ers, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax

Re: [Numpy-discussion] howto reduce along arbitrary axis

2013-03-26 Thread Chao YUE
estion. > > > On Tue, Mar 26, 2013 at 10:23 AM, Chao YUE wrote: > >> Hi Neal, >> >> I forward you this mail which I think might be of help to your question. >> >> Chao >> >> -- Forwarded message -- >> From: Chao YUE >

[Numpy-discussion] howto reduce along arbitrary axis

2013-03-26 Thread Chao YUE
Hi Neal, I forward you this mail which I think might be of help to your question. Chao -- Forwarded message -- From: Chao YUE Date: Sat, Mar 16, 2013 at 5:40 PM Subject: indexing of arbitrary axis and arbitrary slice? To: Discussion of Numerical Python Dear all, Is there

Re: [Numpy-discussion] indexing of arbitrary axis and arbitrary slice?

2013-03-18 Thread Chao YUE
Hi Nathaniel, thanks for your reply, it works fine and suffice for my purpose. cheers, Chao On Sat, Mar 16, 2013 at 5:49 PM, Nathaniel Smith wrote: > On 16 Mar 2013 16:41, "Chao YUE" wrote: > > > > Dear all, > > > > Is there some way to index the num

[Numpy-discussion] indexing of arbitrary axis and arbitrary slice?

2013-03-16 Thread Chao YUE
,slice=0), by this way you don't have to know the actual shape of the array. for for 4-dim data, np.retrieve_data(data,axis=2,slice=0) will actually be data[:,0,:,:] thanks in advance, Chao -- *** Cha

Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Chao YUE
,3,4) to extract the maximum value. I doubt this is really useful.. too complicated.. Chao On Fri, Jan 11, 2013 at 11:00 PM, Nathaniel Smith wrote: > On Thu, Jan 10, 2013 at 9:40 AM, Chao YUE wrote: > > Dear all, > > > > Are we going to consider returning the inde

[Numpy-discussion] return index of maximum value in an array easily?

2013-01-10 Thread Chao YUE
://stackoverflow.com/questions/4150542/determine-index-of-highest-value-in-pythons-numpy cheers, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Bat

Re: [Numpy-discussion] numpy.testing.asserts and masked array

2012-12-27 Thread Chao YUE
Thanks. I tried again, it works. On Thu, Dec 27, 2012 at 10:35 PM, Ralf Gommers wrote: > from numpy.ma import testutils > -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSC

[Numpy-discussion] numpy.testing.asserts and masked array

2012-12-26 Thread Chao YUE
-- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.

Re: [Numpy-discussion] np.seterr doesn't work for masked array?

2012-12-14 Thread Chao YUE
ri, Dec 14, 2012 at 3:15 PM, Robert Kern wrote: > On Fri, Dec 14, 2012 at 1:57 PM, Chao YUE wrote: > > Dear all, > > > > I tried to capture the zero divide error when I divide a masked array by > > another. It seems that np.seterr is not working for masked array? > >

[Numpy-discussion] an easy way to know if a functions works or not for masked array?

2012-12-14 Thread Chao YUE
consuming. Does anyone have similar situation? thanks! Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE

[Numpy-discussion] np.seterr doesn't work for masked array?

2012-12-14 Thread Chao YUE
lse True True]], fill_value = 1e+20) In [96]: np.divide(a,c) Warning: divide by zero encountered in divide Out[96]: array([[ nan, 1., 1., 1.], [ 1., 1., inf, inf]]) Chao -- *** Chao YUE L

Re: [Numpy-discussion] pandas dataframe memory layout

2012-12-08 Thread Chao YUE
in > numpy array? > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- *******

Re: [Numpy-discussion] Is apply_over_axes working for np.ma function?

2012-11-22 Thread Chao YUE
I am using version 1.6.2 In [77]: np.__version__ Out[77]: '1.6.2' On Thu, Nov 22, 2012 at 10:08 PM, Chao YUE wrote: > Dear all, > > I tried the np.apply_over_axes and np.ma.apply_over_axes, it seems that > they are not working for the masked array? > I searched t

[Numpy-discussion] Is apply_over_axes working for np.ma function?

2012-11-22 Thread Chao YUE
array([[[ 190.]], [[ 590.]], [[ 990.]]]) thanks, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF

Re: [Numpy-discussion] the difference between "+" and np.add?

2012-11-22 Thread Chao YUE
Thanks for the explanations. Yes, what I am thinking is basically the same but I didn't test the time. I never try numexpr, but it would be nice to try it. Chao On Thu, Nov 22, 2012 at 3:20 PM, Francesc Alted wrote: > On 11/22/12 1:41 PM, Chao YUE wrote: > > Dear all, > &g

[Numpy-discussion] the difference between "+" and np.add?

2012-11-22 Thread Chao YUE
like directly arr1/arr2, rather than np.divide(arr1,arr2). best regards, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 911

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-20 Thread Chao YUE
PM, Thouis (Ray) Jones wrote: > On Sat, Nov 17, 2012 at 8:28 AM, Chao YUE wrote: > > Dear all, > > > > I need to make a linear contrast of the 2D numpy array "data" from an > > interval to another, the approach is: > > I have another two list: "base&qu

Re: [Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
Yes, both the "base" and "target" are ascending. Thanks! Chao On Sat, Nov 17, 2012 at 2:40 PM, Benjamin Root wrote: > > > On Saturday, November 17, 2012, Chao YUE wrote: > >> Dear all, >> >> I need to make a linear contrast of the 2D nump

[Numpy-discussion] the fast way to loop over ndarray elements?

2012-11-17 Thread Chao YUE
ename:lineno(function) 180470.1100.000 0.1100.000 mathex.py:132(lintrans) 112.495 12.495 19.061 19.061 mathex.py:196(plot_array_transg) so is there anyway I can speed up this loop? Thanks for any suggestions!! best, Chao -- ******

Re: [Numpy-discussion] easy way to change part of only unmasked elements value?

2012-09-15 Thread Chao YUE
ue, Sep 11, 2012 at 5:24 PM, Chao YUE wrote: > Dear Richard, > > this is what I want. Thanks! > > Chao > > > On Tue, Sep 11, 2012 at 3:19 PM, Richard Hattersley > wrote: > >> Hi Chao, >> >> If you don't mind modifying masked values, then if

Re: [Numpy-discussion] easy way to change part of only unmasked elements value?

2012-09-11 Thread Chao YUE
a = np.ma.masked_less(np.arange(10),5) > >>> a.base[3:6] = 1 > >>> a > > masked_array(data = [-- -- -- -- -- 1 6 7 8 9], > mask = [ True True True True True False False False False > False], >fill_value = 99) > > Regards, > Richard Ha

[Numpy-discussion] easy way to change part of only unmasked elements value?

2012-09-10 Thread Chao YUE
Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.6

Re: [Numpy-discussion] encounter many warnings while it's installing scipy

2012-09-02 Thread Chao YUE
__ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- ******* Chao YUE Laboratoire des Sciences

Re: [Numpy-discussion] use slicing as argument values?

2012-07-13 Thread Chao YUE
Thanks Robert. This is exactly what I want. I have a feeling that there must be something in numpy that can do the job and I didn't know. Thanks again, Chao 2012/7/13 Robert Kern > On Thu, Jul 12, 2012 at 10:32 PM, Chao YUE wrote: > > Thanks all for the discussion. Actually I am

Re: [Numpy-discussion] use slicing as argument values?

2012-07-13 Thread Chao YUE
that I can pick any variables I want to plot as long as they have the same dimension. otherwise, I have to change the index_range for every variable. cheers, Chao 2012/7/13 Daniele Nicolodi > On 12/07/2012 23:32, Chao YUE wrote: > > Thanks all for the discussion. Actually I am tryi

Re: [Numpy-discussion] use slicing as argument values?

2012-07-12 Thread Chao YUE
^ SyntaxError: invalid syntax I hope it's not too long, please comment as you like. Thanks a lot Chao 2012/7/12 Benjamin Root > > On Thu, Jul 12, 2012 at 4:46 PM, Chao YUE wrote: > >> Hi Ben, >> >> it helps a lot. I am nearly finishing a function in a way I

Re: [Numpy-discussion] use slicing as argument values?

2012-07-12 Thread Chao YUE
, 3, 4]) In [28]: b[slice(None,4)] Out[28]: array([1, 2, 3, 4]) so slice(4) is actually slice(None,4), how can I exactly want retrieve a[4] using slice object? thanks again! Chao 2012/7/12 Benjamin Root > > > On Thu, Jul 12, 2012 at 3:38 PM, Chao YUE wrote: > >> Dear al

[Numpy-discussion] use slicing as argument values?

2012-07-12 Thread Chao YUE
umber array I want by giving values to function arguments. thanks a lot, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 911

Re: [Numpy-discussion] Ubuntu PPA for NumPy / SciPy / ...

2012-06-07 Thread Chao YUE
ing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 157

Re: [Numpy-discussion] why Segmentation fault (core dumped)?

2012-05-27 Thread Chao YUE
fine. The cal_cmi_big.py did work several days ago, I still have the file generated by this script in my directory. cheers, Chao 2012/5/27 Chao YUE > Dear Jeff, > > Thanks a lot for your reply. I think it might be related with the memory > management on our sever. But anyway, as you suggest

Re: [Numpy-discussion] why Segmentation fault (core dumped)?

2012-05-27 Thread Chao YUE
n also find this function in ncfunc.py. I tested all the script and data before I upload on our ftp. thanks again for your help, cheers, Chao 2012/5/26 Jeff Whitaker > On 5/26/12 5:51 AM, Chao YUE wrote: > > Dear all, > > Previously I am able to run a script on our server

Re: [Numpy-discussion] indexes in an array where value is greater than 1?

2012-05-27 Thread Chao YUE
cipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - P

[Numpy-discussion] why Segmentation fault (core dumped)?

2012-05-26 Thread Chao YUE
descriptors 1024 memorylocked 64 kbytes maxproc 1024 would anybody be able to give me a short explanation or direct me to some webpage which can help to understand the problem? thanks et cheers, Chao -- ******

Re: [Numpy-discussion] command for retrieving unmasked data from a mask array?

2012-05-23 Thread Chao YUE
Thanks Olivier. it works. chao 2012/5/23 Olivier Delalleau > Should be dt3.compressed() > > -=- Olivier > > 2012/5/23 Chao YUE > >> Dear all, >> >> is there a command for retrieving unmasked data from a mask array? >> excepting using dt3[~dt3

[Numpy-discussion] command for retrieving unmasked data from a mask array?

2012-05-23 Thread Chao YUE
Dear all, is there a command for retrieving unmasked data from a mask array? excepting using dt3[~dt3.mask].flatten()? thanks, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement

Re: [Numpy-discussion] assign a float number to a member of integer array always return integer

2012-05-22 Thread Chao YUE
Thanks Chris for informative post. cheers, Chao 2012/5/22 Chris Barker > On Tue, May 22, 2012 at 6:33 AM, Chao YUE wrote: > > > Just in case some one didn't know this. Assign a float number to an > integer > > array element will always return integer. > >

[Numpy-discussion] assign a float number to a member of integer array always return integer

2012-05-22 Thread Chao YUE
Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.6

Re: [Numpy-discussion] why not zerodivision error?

2012-05-20 Thread Chao YUE
thanks for this information. Chao 2012/5/20 eat > Hi, > > On Sun, May 20, 2012 at 10:21 AM, Chao YUE wrote: > >> Dear all, >> >> could anybody give one sentence about this? why in the loop I didn't get >> zerodivision error by when I explicitly do th

[Numpy-discussion] why not zerodivision error?

2012-05-20 Thread Chao YUE
by zero Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02;

Re: [Numpy-discussion] python import question

2012-05-19 Thread Chao YUE
I forgot whether I installed numpy 1.5.1 by esay_install or manually. But anyway, I had the same issue with you that I cannot use pip uninstall numpy to remove 1.5.1. chao 2012/5/19 Tim Cera > > > On Fri, May 18, 2012 at 5:49 PM, Chao YUE wrote: > >> Previously I have ins

[Numpy-discussion] python import question

2012-05-18 Thread Chao YUE
/lib/python2.7/dist-packages/numpy/ but because the first path is before the second one in sys.path, so ipython imports only the first one and ignore the second one. Then I delete the directory of /usr/lib/pymodules/python2.7/numpy and redo the import, I get the version 1.6.1 This means that impo

[Numpy-discussion] read line mixed with string and number?

2012-05-10 Thread Chao YUE
is line by blank space, and replace special flag. but during this process, I need to do type conversion. any suggestion would be appreciated. Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Envi

Re: [Numpy-discussion] change masked array member values with conditional selection

2012-04-12 Thread Chao YUE
27;ll find a little warning that I > commented (because numpy.ma is already slow enough that I didn't want > to make it even slower)... > > On 4/12/12, Chao YUE wrote: > > Dear all numpy users, > > > > I am using numpy 1.6.1 > > > > I find that if you wan

[Numpy-discussion] change masked array member values with conditional selection

2012-04-12 Thread Chao YUE
False False False False False], fill_value = 1e+20) cheers, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Su

Re: [Numpy-discussion] small bug in ndarray.flatten()?

2012-04-05 Thread Chao YUE
_version__ > Out[5]: '1.5.1' > > Now if the bug is fixed in 1.6, there's nothing more to do than just > wait for the update ! > (Debian testing in my case) > > Best, > Pierre > > > > _______ > NumPy-Discussion mailing list &g

Re: [Numpy-discussion] small bug in ndarray.flatten()?

2012-04-05 Thread Chao YUE
#x27;F') array([1, 3, 2, 4]) cheers, Chao 2012/4/5 Olivier Delalleau > It works for me, which version of numpy are you using? > What do you get when you type help(b.flatten)? > > -=- Olivier > > Le 5 avril 2012 04:45, Chao YUE a écrit : > >> Dear all, >>

[Numpy-discussion] small bug in ndarray.flatten()?

2012-04-05 Thread Chao YUE
x27;C') --- TypeError Traceback (most recent call last) /mnt/f/ in () TypeError: flatten() takes no keyword arguments order='F' gave tha same. cheers, chao -- *******

Re: [Numpy-discussion] how to check type of array?

2012-03-29 Thread Chao YUE
ssubdtype(np.int16, np.integer) would not work, but > they do. > > Cheers, >Derek > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- *

[Numpy-discussion] how to check type of array?

2012-03-29 Thread Chao YUE
Dear all, how can I check type of array in if condition expression? In [75]: type(a) Out[75]: In [76]: a.dtype Out[76]: dtype('int32') a.dtype=='int32'? thanks! Chao -- ******* Chao YUE Labo

Re: [Numpy-discussion] Trying to read 500M txt file using numpy.genfromtxt within ipython shell

2012-03-20 Thread Chao YUE
, > > > > Chao > > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- **

[Numpy-discussion] Trying to read 500M txt file using numpy.genfromtxt within ipython shell

2012-03-20 Thread Chao YUE
thanks and cheers, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02

[Numpy-discussion] remove redundant dimension in a ndarray?

2012-03-16 Thread Chao YUE
1]. but I just would like to know maybe there is already something which can do this there ? cheers, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UV

Re: [Numpy-discussion] verbose output when running python script?

2012-03-05 Thread Chao YUE
thanks. I am using ubuntu (for my local computer) and on our server we have only ipython or shell... but I think I can try your suggestion on my own computer. Chao 2012/3/5 > On Mon, Mar 5, 2012 at 10:27 AM, Chao YUE wrote: > > Dear all, > > > > Sorry this is not the go

[Numpy-discussion] verbose output when running python script?

2012-03-05 Thread Chao YUE
script? thanks to all, cheers, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08

[Numpy-discussion] copy mask from existing masked array?

2012-03-04 Thread Chao YUE
-- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.

[Numpy-discussion] python geospatial package?

2012-02-22 Thread Chao YUE
Hi all, Is anyone using some python geospatial package that can do jobs like intersection, etc. the job is like you automatically extract a region on a global map etc. thanks and cheers, Chao -- *** Chao YUE

Re: [Numpy-discussion] change the mask state of one element in a masked array

2012-02-19 Thread Chao YUE
thanks. 2012/2/18 Eric Firing > On 02/18/2012 05:52 AM, Chao YUE wrote: > > Dear all, > > > > I built a new empty masked array: > > > > In [91]: a=np.ma.empty((2,5)) > > Of course this only makes sense if you are going to immediately populate >

[Numpy-discussion] change the mask state of one element in a masked array

2012-02-18 Thread Chao YUE
rs, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:

Re: [Numpy-discussion] Addressing arrays

2012-01-30 Thread Chao YUE
n mailing list > > NumPy-Discussion@scipy.org > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- **

Re: [Numpy-discussion] Addressing arrays

2012-01-30 Thread Chao YUE
y.org/mailman/listinfo/numpy-discussion > -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Ced

Re: [Numpy-discussion] how to cite 1Xn array as nX1 array?

2012-01-27 Thread Chao YUE
Thanks all. chao 2012/1/27 Tony Yu > > > On Fri, Jan 27, 2012 at 9:28 AM, Paul Anton Letnes < > paul.anton.let...@gmail.com> wrote: > >> >> On 27. jan. 2012, at 14:52, Chao YUE wrote: >> >> > Dear all, >> > >> > suppose I have

[Numpy-discussion] how to cite 1Xn array as nX1 array?

2012-01-27 Thread Chao YUE
Dear all, suppose I have a ndarray a: In [66]: a Out[66]: array([0, 1, 2, 3, 4]) how can use it as 5X1 array without doing a=a.reshape(5,1)? thanks Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de

Re: [Numpy-discussion] NumPy / SciPy related tutorials at PyCon 2012

2012-01-18 Thread Chao YUE
t; The early birds rate for the PyCOn ends on Jan 25. > > See you in PyCon in March, > > -- > Olivier > http://twitter.com/ogrisel - http://github.com/ogrisel > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/num

Re: [Numpy-discussion] [JOB] Extracting subset of dataset using latitude and longitude

2012-01-13 Thread Chao YUE
ng list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572

Re: [Numpy-discussion] strange nan in np.ma.average

2012-01-03 Thread Chao YUE
the problem is here, data=np.empty([10,90,720]) you should always use np.ma.empty if you want to construct a masked empty array. Chao 2012/1/3 Chao YUE > Dear all numpy users, > > I have 10 90X720 arrays. let's say they are in a list 'a' with each > element a 90X720

[Numpy-discussion] strange nan in np.ma.average

2012-01-03 Thread Chao YUE
228, 159, 194, thanks, Chao -- ******* Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33)

Re: [Numpy-discussion] output different columns of ndarray in different formats

2011-12-22 Thread Chao YUE
O Yes You're right... It's fine now. Merry Christmas to all! Chao 2011/12/22 Aronne Merrelli > > > On Thu, Dec 22, 2011 at 10:27 AM, Chao YUE wrote: > >> Dear all, >> >> Just a small question, how can I output different columns of ndarray in

[Numpy-discussion] output different columns of ndarray in different formats

2011-12-22 Thread Chao YUE
or np.savetxt('new.csv',data,fmt=('%i4','%f6.3')) give strange results. In [33]: data.shape Out[33]: (6506, 2) I want the first column integer and second column float. cheers, Chao -- *******

Re: [Numpy-discussion] what statistical module to use for python?

2011-11-30 Thread Chao YUE
thanks, I should do it but I forgot chao 2011/12/1 > On Wed, Nov 30, 2011 at 1:16 PM, Chao YUE wrote: > > Hi all, > > > > I just want to broadly ask what statistical package are you guys using? I > > mean routine statistical function like linear regression, GLM

[Numpy-discussion] what statistical module to use for python?

2011-11-30 Thread Chao YUE
-- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.

Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-18 Thread Chao YUE
; d.info = "2011-11-18 nov kilroy" # From() > savedotdict( d, "d.", fmt="%.3g" ) > > cheers > -- denis > > (If you use this, could you post it to the numpy-discussion group > please ? > It rejects me, grr.) > > > On Nov 10, 11:17 am, C

[Numpy-discussion] how to use the name of a ndarray as a string

2011-11-10 Thread Chao YUE
array variables that need to be included in the dictionary. is there something like: d3[index.name()]=index while index.name() would equal the string 'index'? I hope my question is clear. thanks to all. Chao -- ******

Re: [Numpy-discussion] np.ma.mean is not working?

2011-10-18 Thread Chao YUE
I would say pandas is really cool. More people need to know it. and we should have better documentation. cheers, Chao 2011/10/18 Bruce Southey > ** > On 10/18/2011 09:12 AM, Chao YUE wrote: > > thanks. Olivier. I see. > > Chao > > 2011/10/18 Olivier Delalleau &

Re: [Numpy-discussion] np.ma.mean is not working?

2011-10-18 Thread Chao YUE
Thanks Bruce. 2011/10/18 Bruce Southey > ** > On 10/18/2011 09:12 AM, Chao YUE wrote: > > thanks. Olivier. I see. > > Chao > > 2011/10/18 Olivier Delalleau > >> As far as I can tell ma.mean() is working as expected here: it computes >> the mean only ov

Re: [Numpy-discussion] index the last several members of a ndarray

2011-10-18 Thread Chao YUE
thanks Scott. very good explanation. cheers, Chao 2011/10/18 Scott Sinclair > On 18 October 2011 13:56, Chao YUE wrote: > > but it's strange that if you use b[...,-1], > > you get: > > In [402]: b[...,-1] > > Out[402]: array([ 9, 19]) > > > > i

Re: [Numpy-discussion] np.ma.mean is not working?

2011-10-18 Thread Chao YUE
t; > b = a.mean(0) > b.mask[a.mask.any(0)] = True > > Then b will be: > > masked_array(data = [5.0 -- -- 8.0 9.0 -- 11.0 12.0 -- 14.0], > mask = [False True True False False True False False True > False], >fill_value = 1e+20) > > -=

Re: [Numpy-discussion] anyway to check a ndarray is a mased array or not?

2011-10-18 Thread Chao YUE
really cool, thanks. Chao 2011/10/18 Olivier Delalleau > if hasattr(a, 'mask'): # or if isinstance(a, numpy.ma.core.MaskedArray.) > > code 1 > else > code 2 > > -=- Olivier > > > 2011/10/18 Chao YUE > >> Thanks Olivier. but I don

Re: [Numpy-discussion] anyway to check a ndarray is a mased array or not?

2011-10-18 Thread Chao YUE
You can also check if > it is an instance of numpy.ma.core.MaskedArray. > > -=- Olivier > > Le 18 octobre 2011 08:49, Chao YUE a écrit : > >> Just one more question, how can I check a ndarr

[Numpy-discussion] anyway to check a ndarray is a mased array or not?

2011-10-18 Thread Chao YUE
Just one more question, how can I check a ndarray is a masked array or not? Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119

[Numpy-discussion] np.ma.mean is not working?

2011-10-18 Thread Chao YUE
99]: masked_array(data = [[ 0.1.1.5 2.5 3.5 4.5 5.5 6.5 7.5 9. ] [ 10. 11. 11.5 12.5 13.5 14.5 15.5 16.5 17.5 19. ]], mask = False, fill_value = 1e+20) thanks, Chao -- *****

Re: [Numpy-discussion] index the last several members of a ndarray

2011-10-18 Thread Chao YUE
you are right Eric, In [405]: b[...,-4:] Out[405]: array([[ 6, 7, 8, 9], [16, 17, 18, 19]]) cheers, Chao 2011/10/18 Chao YUE > Thanks Jean > I just want the last several numbers by indexing from the end. > > In [400]: b=np.arange(20).reshape(2,10) > > In

Re: [Numpy-discussion] index the last several members of a ndarray

2011-10-18 Thread Chao YUE
t;>[6, 7, 8, 9]]) >> > > > I'm not sure to understand, should not a[:,1:] be sufficient ? > Did I miss something in your message ? > > -- ******* Chao YUE Laboratoire des Sciences du

[Numpy-discussion] index the last several members of a ndarray

2011-10-18 Thread Chao YUE
something like: array([[1, 2, 3, 4], [6, 7, 8, 9]]) I want to index the final 4 rows. I cannot figure out how to do this? Thanks for any help, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de

Re: [Numpy-discussion] ndarray with double comparison

2011-10-15 Thread Chao YUE
lt; a) & (a < 8), > > which I find less readable and more difficult to type. > > Neil > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > --

Re: [Numpy-discussion] the difference of np.nan, np.NaN, np.NAN?

2011-10-14 Thread Chao YUE
good answer 2011/10/14 Matthew Brett > Hi, > > On Fri, Oct 14, 2011 at 4:33 AM, Chao YUE wrote: > > Dear all, > > > > is there any difference between np.nan, np.NaN and np.NAN? they really > > confuse me > > they are all Not a Number? > > &

[Numpy-discussion] the difference of np.nan, np.NaN, np.NAN?

2011-10-14 Thread Chao YUE
-- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.

Re: [Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

2011-10-14 Thread Chao YUE
shows the original value, so what 's the usage of fill_value in masked array? can I set a fill_value as np.nan? Thanks, Chao 2011/10/13 > On Thu, Oct 13, 2011 at 1:17 PM, Chao YUE wrote: > > Dear all, > > > > I use numpy version 1.5.1 which is installed by default when

[Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

2011-10-13 Thread Chao YUE
Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.

  1   2   >