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

2014-07-16 Thread Chao YUE
threshold: return int(math.ceil(pint)+1) else: return int(math.ceil(pint)) On Wed, Jul 16, 2014 at 3:18 PM, Chao YUE chaoyue...@gmail.com wrote: Dear all, I have two arrays with both float type, let's say X and Y. I want to round the X to integers (intX

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 chaoyue...@gmail.com wrote: Dear all, I have two arrays with both float type, let's say X

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

2014-07-16 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.77.16

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

2014-06-04 Thread Chao YUE
-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion -- please visit: http://www.globalcarbonatlas.org/ *** Chao YUE Laboratoire des Sciences du Climat et de

[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 - Pe

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

2014-05-29 Thread Chao YUE
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 119 91191 GIF Sur YVETTE

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 dave.hirschf...@gmail.com wrote: Chao YUE chaoyuejoy at gmail.com writes: Dear all, I have a simple question. Is there a way to denote the unchanged dimension in the reshape function? like

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

2013-07-09 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.77.16

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

2013-07-09 Thread Chao YUE
wrote: On Jul 9, 2013, at 16:08 , Sebastian Berg sebast...@sipsolutions.net 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 chaoyue...@gmail.com wrote: I am using 1.7.1 version of numpy and np.ma.argmax is not repecting

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 pgmdevl...@gmail.com wrote: On Jul 9, 2013, at 16:38 , Chao YUE chaoyue...@gmail.com wrote: Sorry I didn't the docs very carefully. there is no doc for np.ma.argmax

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

2013-06-03 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.77.16

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 sebast...@sipsolutions.netwrote: 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) I would like to collapse

[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 chaoyue...@gmail.com Date: Sat, Mar 16, 2013 at 5:40 PM Subject: indexing of arbitrary axis and arbitrary slice? To: Discussion of Numerical Python numpy

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

2013-03-26 Thread Chao YUE
the question. On Tue, Mar 26, 2013 at 10:23 AM, Chao YUE chaoyue...@gmail.com wrote: Hi Neal, I forward you this mail which I think might be of help to your question. Chao -- Forwarded message -- From: Chao YUE chaoyue...@gmail.com Date: Sat, Mar 16, 2013 at 5:40 PM Subject

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 n...@pobox.com wrote: On 16 Mar 2013 16:41, Chao YUE chaoyue...@gmail.com wrote: Dear all, Is there some way to index the numpy array

[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 -- *** Chao YUE

[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 Batiment

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 ralf.gomm...@gmail.comwrote: from numpy.ma import testutils -- *** Chao YUE Laboratoire des Sciences du Climat et de

[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.77.16

[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 Cedex

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

2012-12-14 Thread Chao YUE
, 2012 at 3:15 PM, Robert Kern robert.k...@gmail.com wrote: On Fri, Dec 14, 2012 at 1:57 PM, Chao YUE chaoyue...@gmail.com 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? when I do

Re: [Numpy-discussion] pandas dataframe memory layout

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

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

2012-11-22 Thread Chao YUE
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 91191 GIF Sur

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 franc...@continuum.iowrote: On 11/22/12 1:41 PM, Chao YUE wrote: Dear all

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

2012-11-20 Thread Chao YUE
(Ray) Jones tho...@gmail.comwrote: On Sat, Nov 17, 2012 at 8:28 AM, Chao YUE chaoyue...@gmail.com 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 target, then I check for each ndarray

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

2012-11-17 Thread Chao YUE
12.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 -- *** Chao YUE Laboratoire des Sciences du Climat et

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 ben.r...@ou.edu wrote: On Saturday, November 17, 2012, Chao YUE wrote: Dear all, I need to make a linear contrast of the 2D numpy array data from an interval to another

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

2012-09-15 Thread Chao YUE
, 2012 at 5:24 PM, Chao YUE chaoyue...@gmail.com wrote: Dear Richard, this is what I want. Thanks! Chao On Tue, Sep 11, 2012 at 3:19 PM, Richard Hattersley rhatters...@gmail.com wrote: Hi Chao, If you don't mind modifying masked values, then if you write to the underlying ndarray

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

2012-09-11 Thread Chao YUE
) 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 Hattersley On 10 September 2012 17:43, Chao YUE chaoyue...@gmail.com wrote: Dear all

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

2012-09-10 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.77.16

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

2012-09-02 Thread Chao YUE
-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 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191

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 dani...@grinta.net On 12/07/2012 23:32, 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
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 robert.k...@gmail.com On Thu, Jul 12, 2012 at 10:32 PM, Chao YUE chaoyue...@gmail.com wrote: Thanks all

[Numpy-discussion] use slicing as argument values?

2012-07-12 Thread Chao YUE
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 91191 GIF Sur

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 ben.r...@ou.edu On Thu, Jul 12, 2012 at 3:38 PM, Chao YUE chaoyue...@gmail.com wrote

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

2012-07-12 Thread Chao YUE
...@ou.edu On Thu, Jul 12, 2012 at 4:46 PM, Chao YUE chaoyue...@gmail.com wrote: Hi Ben, it helps a lot. I am nearly finishing a function in a way I think pythonic. Just one more question, I have: In [24]: b=np.arange(1,11) In [25]: b Out[25]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9

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

2012-05-27 Thread Chao YUE
-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 Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

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

2012-05-27 Thread Chao YUE
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 jsw...@fastmail.fm On 5/26/12 5:51 AM, Chao YUE wrote: Dear all, Previously I am able to run a script on our server but now it gave me

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

2012-05-27 Thread Chao YUE
. 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 chaoyue...@gmail.com 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 suggested, I

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

2012-05-26 Thread Chao YUE
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 -- *** Chao YUE Laboratoire

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 sh...@keba.be Should be dt3.compressed() -=- Olivier 2012/5/23 Chao YUE chaoyue...@gmail.com Dear all, is there a command for retrieving unmasked data from a mask array? excepting using dt3[~dt3.mask].flatten()? thanks

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

2012-05-22 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.77.16

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 chris.bar...@noaa.gov On Tue, May 22, 2012 at 6:33 AM, Chao YUE chaoyue...@gmail.com 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] why not zerodivision error?

2012-05-20 Thread Chao YUE
-523760448f92 in module() 1 1./0 ZeroDivisionError: float division 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

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

2012-05-20 Thread Chao YUE
thanks for this information. Chao 2012/5/20 eat e.antero.ta...@gmail.com Hi, On Sun, May 20, 2012 at 10:21 AM, Chao YUE chaoyue...@gmail.com 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 this, I get

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 t...@cerazone.net On Fri, May 18, 2012 at 5:49 PM, Chao YUE chaoyue...@gmail.com wrote: Previously

[Numpy-discussion] python import question

2012-05-18 Thread Chao YUE
the import, I get the version 1.6.1 This means that import will try to find the first occurrence of the module and will ignore the ones with same name in later occurrences? cheers, Chao -- *** Chao YUE Laboratoire des

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

2012-05-10 Thread Chao YUE
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'Environnement (LSCE

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

2012-04-12 Thread Chao YUE
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 Sur YVETTE Cedex Tel: (33) 01

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

2012-04-12 Thread Chao YUE
/12, Chao YUE chaoyue...@gmail.com wrote: Dear all numpy users, I am using numpy 1.6.1 I find that if you want to change some member values in a masked array according to some conditional selection. suppose a is a masked array, you want to change all value below zero to zero. you

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

2012-04-05 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.77.16

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

2012-04-05 Thread Chao YUE
___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion -- *** Chao YUE Laboratoire des Sciences du Climat

[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]: type 'numpy.ndarray' In [76]: a.dtype Out[76]: dtype('int32') a.dtype=='int32'? thanks! Chao -- *** Chao YUE

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

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

[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; Fax

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

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

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

2012-03-16 Thread Chao YUE
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-UVSQ Batiment 712

[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.77.16

[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

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

2012-02-18 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.77.16

Re: [Numpy-discussion] Addressing arrays

2012-01-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.77.16

Re: [Numpy-discussion] Addressing arrays

2012-01-30 Thread Chao YUE
-Discussion mailing 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 CEA-CNRS-UVSQ

[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] how to cite 1Xn array as nX1 array?

2012-01-27 Thread Chao YUE
Thanks all. chao 2012/1/27 Tony Yu tsy...@gmail.com 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 a ndarray a: In [66]: a Out[66]: array([0, 1, 2, 3, 4]) how can

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

2012-01-18 Thread Chao YUE
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 CEA-CNRS-UVSQ Batiment 712

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

2012-01-13 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.77.16

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

2012-01-03 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.77.16

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 chaoyue...@gmail.com Dear all numpy users, I have 10 90X720 arrays. let's say they are in a list 'a' with each element a 90X720 numpy

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

2011-12-22 Thread Chao YUE
','%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 -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement

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 aronne.merre...@gmail.com On Thu, Dec 22, 2011 at 10:27 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, Just a small question, how can I output different columns of ndarray

[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.77.16

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 josef.p...@gmail.com On Wed, Nov 30, 2011 at 1:16 PM, Chao YUE chaoyue...@gmail.com wrote: Hi all, I just want to broadly ask what statistical package are you guys using? I mean routine statistical function like linear regression

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

2011-11-18 Thread Chao YUE
% (val.shape, out) save( out, val, **kwargs ) 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, Chao YUE chaoyue...@gmail.com

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

2011-11-10 Thread Chao YUE
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 -- *** Chao YUE Laboratoire des

[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] index the last several members of a ndarray

2011-10-18 Thread Chao YUE
], [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 Climat et de l'Environnement (LSCE-IPSL) UMR 1572

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 chaoyue...@gmail.com Thanks Jean I just want the last several numbers by indexing from the end. In [400]: b=np.arange(20).reshape(2,10) In [401]: b Out

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

2011-10-18 Thread Chao YUE
.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 -- *** Chao YUE Laboratoire des

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

2011-10-18 Thread Chao YUE
also check if it is an instance of numpy.ma.core.MaskedArray. -=- Olivier Le 18 octobre 2011 08:49, Chao YUE chaoyue...@gmail.com a écrit : Just one more question, how can I check a ndarray is a masked array or not? Chao

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 sh...@keba.be if hasattr(a, 'mask'): # or if isinstance(a, numpy.ma.core.MaskedArray.) code 1 else code 2 -=- Olivier 2011/10/18 Chao YUE chaoyue...@gmail.com Thanks Olivier. but I don't know how can I check

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

2011-10-18 Thread Chao YUE
= 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) -=- Olivier 2011/10/18 Chao YUE chaoyue...@gmail.com Dear

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 scott.sinclair...@gmail.com On 18 October 2011 13:56, Chao YUE chaoyue...@gmail.com wrote: but it's strange that if you use b[...,-1], you get: In [402]: b[...,-1] Out[402]: array([ 9, 19]) if use b[...,-4

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

2011-10-18 Thread Chao YUE
Thanks Bruce. 2011/10/18 Bruce Southey bsout...@gmail.com ** On 10/18/2011 09:12 AM, Chao YUE wrote: thanks. Olivier. I see. Chao 2011/10/18 Olivier Delalleau sh...@keba.be As far as I can tell ma.mean() is working as expected here: it computes the mean only over non-masked values

Re: [Numpy-discussion] ndarray with double comparison

2011-10-15 Thread Chao YUE
___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion -- *** Chao YUE Laboratoire des Sciences du Climat et de

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

2011-10-14 Thread Chao YUE
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 josef.p...@gmail.com On Thu, Oct 13, 2011 at 1:17 PM, Chao YUE chaoyue...@gmail.com wrote: Dear all, I use numpy version 1.5.1 which is installed by default when I

[Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 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.77.16

Re: [Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread Chao YUE
Yes, np.unique() is exactly what I want. thanks. chao 2011/10/13 Benjamin Root ben.r...@ou.edu On Thursday, October 13, 2011, Chao YUE chaoyue...@gmail.com wrote: Dear all, if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3]) containing some values that are flag for data

[Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
, False, False, False, True, True, True, True, True, True], dtype=bool) how can I have boolean index like 4 a 8 np.where(a4 and a8);or plainly input a4 and a8 doesn't work. thanks, Chao -- *** Chao YUE

Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
Thanks. I starts to use python do some real data processing and has bunch of questions. Chao 2011/10/13 Benjamin Root ben.r...@ou.edu On Thu, Oct 13, 2011 at 11:13 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, sorry for this stupid question but I cannot find it in numpy tutorial

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

2011-10-13 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.77.16

Re: [Numpy-discussion] what python module to modify NetCDF data?

2011-10-09 Thread Chao YUE
. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion -- *** Chao YUE Laboratoire des Sciences du Climat et de

[Numpy-discussion] what python module to modify NetCDF data?

2011-10-08 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.69.08.77.16

[Numpy-discussion] how to count Nan occurrence in a ndarray?

2011-10-07 Thread Chao YUE
Dear all, I have an ndarray with dimension of 4X62500. is there anyway I can count the number of missing value (NaN)? because I want to know how many observations are missing? Thanks for any idea, Chao -- *** Chao

Re: [Numpy-discussion] how to count Nan occurrence in a ndarray?

2011-10-07 Thread Chao YUE
The data is read from a .mat file. 2011/10/7 Chao YUE chaoyue...@gmail.com Dear all, I have an ndarray with dimension of 4X62500. is there anyway I can count the number of missing value (NaN)? because I want to know how many observations are missing? Thanks for any idea, Chao

Re: [Numpy-discussion] how to count Nan occurrence in a ndarray?

2011-10-07 Thread Chao YUE
Thanks Olivier. Chao 2011/10/7 Olivier Delalleau sh...@keba.be You can use numpy.isnan(array).sum() -=- Olivier 2011/10/7 Chao YUE chaoyue...@gmail.com The data is read from a .mat file. 2011/10/7 Chao YUE chaoyue...@gmail.com Dear all, I have an ndarray with dimension of 4X62500

Re: [Numpy-discussion] import

2011-07-19 Thread Chao YUE
-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 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur

Re: [Numpy-discussion] data type specification when using numpy.genfromtxt

2011-06-28 Thread Chao YUE
, at 10:30PM, Chao YUE wrote: Hi Derek! I tried with the lastest version of python(x,y) package with numpy version of 1.6.0. I gave the data to you with reduced columns (10 column) and rows. b=np.genfromtxt('99Burn2003all_new.csv',delimiter=';',names=True,usecols=tuple(range(10)),dtype

Re: [Numpy-discussion] data type specification when using numpy.genfromtxt

2011-06-27 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 77 30; Fax:01.69.08.77.16

[Numpy-discussion] data type specification when using numpy.genfromtxt

2011-06-26 Thread Chao YUE
is tring and the remaing float? how can I do that? 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 91191 GIF Sur

Re: [Numpy-discussion] data type specification when using numpy.genfromtxt

2011-06-26 Thread Chao YUE
')])* Can you give me some suggestion? Thanks in advance~~* * Chao * 2011/6/26 Derek Homeier de...@astro.physik.uni-goettingen.de On 26.06.2011, at 8:48PM, Chao YUE wrote: I want to read a csv file with many (49) columns, the first column is string and remaning can be float. how can I avoid type

  1   2   >