
Dear experts, Is it possible to sample a 4D array of numpy at given dimensions with out writing loops? ie a smart python way? for example, I have a data cube with cube=c(x,y,z,t) dimensions which are essentially latitude longitude depth and time. Is it possible to sample this array at a given dimensions ie sample1= sample(c,:,:,1,1) this is sample at surface at time 1 sample2= sample(c,:,:,1,:) this is time series of surface data sample3= sample(c,1,1,:,1) this is a profile at given location and time sample4= sample(c,1,1,:,:) this is time series at given location at all depths with best regards, Sudheer *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.India@gmail.com;sudheer.joseph@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************

Thank you, No if the location ( space time or depth) of choice is not available then the function I was looking for should give an interpolated value at the choice. with best regards, Sudheer ----- Original Message -----
From: Henry Gomersall <heng@cantab.net> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Cc: Sent: Sunday, 16 June 2013 2:49 PM Subject: Re: [Numpy-discussion] sampling arrays
On Sun, 2013-06-16 at 14:48 +0800, Sudheer Joseph wrote:
Is it possible to sample a 4D array of numpy at given dimensions with out writing loops? ie a smart python way?
It's not clear how what you want to do is different from simply indexing the array...?
Henry
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Here is a solution I got. I think I need to do the rest with loop. Though I am seeing an interpnd I could not find a documentation on that or example. http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RectBi... Thank you with best regards, Sudheer *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.India@gmail.com;sudheer.joseph@yahoo.com Web- http://oppamthadathil.tripod.com *************************************************************** ----- Original Message -----
From: Sudheer Joseph <sudheer.joseph@yahoo.com> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Cc: Sent: Sunday, 16 June 2013 2:56 PM Subject: Re: [Numpy-discussion] sampling arrays
T hank you, No if the location ( space time or depth) of choice is not available then the function I was looking for should give an interpolated value at the choice. with best regards, Sudheer ----- Original Message -----
From: Henry Gomersall <heng@cantab.net> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Cc: Sent: Sunday, 16 June 2013 2:49 PM Subject: Re: [Numpy-discussion] sampling arrays
On Sun, 2013-06-16 at 14:48 +0800, Sudheer Joseph wrote:
Is it possible to sample a 4D array of numpy at given dimensions with out writing loops? ie a smart python way?
It's not clear how what you want to do is different from simply indexing the array...?
Henry
_______________________________________________ NumPy-Discussion 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

Thank you, No if the location ( space time or depth) of choice is not available then the function I was looking for should give an interpolated value at the choice. with best regards, Sudheer
scipy.ndimage.map_coordinates may be exactly what you want.
----- Original Message -----
From: Henry Gomersall <heng@cantab.net> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Cc: Sent: Sunday, 16 June 2013 2:49 PM Subject: Re: [Numpy-discussion] sampling arrays
On Sun, 2013-06-16 at 14:48 +0800, Sudheer Joseph wrote:
Is it possible to sample a 4D array of numpy at given dimensions with out writing loops? ie a smart python way?
It's not clear how what you want to do is different from simply indexing the array...?
Henry
_______________________________________________ NumPy-Discussion 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

Thank you Zachary, I will try this and see how this goes. with best regards, Sudheer *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.India@gmail.com;sudheer.joseph@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************
________________________________ From: Zachary Pincus <zachary.pincus@yale.edu> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Sent: Tuesday, 18 June 2013 6:10 PM Subject: Re: [Numpy-discussion] sampling arrays
Thank you, No if the location ( space time or depth) of choice is not available then the function I was looking for should give an interpolated value at the choice. with best regards, Sudheer
scipy.ndimage.map_coordinates may be exactly what you want.
----- Original Message -----
From: Henry Gomersall <heng@cantab.net> To: Discussion of Numerical Python <numpy-discussion@scipy.org> Cc: Sent: Sunday, 16 June 2013 2:49 PM Subject: Re: [Numpy-discussion] sampling arrays
On Sun, 2013-06-16 at 14:48 +0800, Sudheer Joseph wrote:
Is it possible to sample a 4D array of numpy at given dimensions with out writing loops? ie a smart python way?
It's not clear how what you want to do is different from simply indexing the array...?
Henry
_______________________________________________ NumPy-Discussion 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
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Henry Gomersall
-
Sudheer Joseph
-
Zachary Pincus