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 for the discussion. Actually I am trying to use something like > > numpy ndarray indexing in the function. Like when I call: > > > > func(a,'1:3,:,2:4'), it knows I want to retrieve a[1:3,:,2:4], and > > func(a,'1:3,:,4') for a[1:3,:,4] ect. > > I am very close now. > > [~] > |1> from numpy import index_exp > > [~] > |2> index_exp[1:3,:,2:4] > (slice(1, 3, None), slice(None, None, None), slice(2, 4, None)) > > -- > Robert Kern > _______________________________________________ > 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 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 mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion