[SciPy-User] re[SciPy-user] moving for loops...
josef.pktd at gmail.com
josef.pktd at gmail.com
Tue Jun 8 15:02:24 EDT 2010
On Tue, Jun 8, 2010 at 12:00 PM, mdekauwe <mdekauwe at gmail.com> wrote:
>
> Similarly,
>
> mths = np.arange(12)
> pts = np.arange(numpts)
> out_array[mths, pts] = array[mths, 0, r, c]
If you want all months, this should work
out_array = array[:, 0, r, c]
or
mths, r, c are all 1d but mths has different length, so needs broadcasting
out_array = array[mths[:,np.newaxis], 0, r, c]
or I guess
out_array[mths[:,np.newaxis], pts] = array[mths[:,np.newaxis], 0, r, c]
Josef
>
> Does not work either...
> --
> View this message in context: http://old.nabble.com/removing-for-loops...-tp28633477p28819859.html
> Sent from the Scipy-User mailing list archive at Nabble.com.
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list