Re: [Numpy-discussion] saving 3d array
Thank you Camilo, It is indeed an easy way and also the link is a ready to use save method. Thanks a lot for sharing it 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.in...@gmail.com;sudheer.jos...@yahoo.com Web- http://oppamthadathil.tripod.com *** > > From: Camilo Andrés Jimenez Cruz >To: Discussion of Numerical Python >Sent: Sunday, 16 June 2013 11:37 PM >Subject: Re: [Numpy-discussion] saving 3d array > > > >Hi! > > >I know it is pretty much the same as you did before, but has been useful for >me in the past. Instead of saving each array separately, just create a >dictionary and save the it, something like > > >d= {put_all_your_arrays_here} >savez_compressed('file.npz', **d) > > > >-- Camilo Jiménez > > > >On Sat, Jun 15, 2013 at 2:11 PM, Eric Firing wrote: > >On 2013/06/15 6:06 AM, Pierre GM wrote: >>> >>> On Jun 15, 2013, at 17:35 , Matthew Brett wrote: >>> Hi, On Sat, Jun 15, 2013 at 2:51 PM, Sudheer Joseph wrote: > > Thank you very much for this tip. > Is there a typical way to save masked and the rest separately?. Not much > familiar with array handling in numpy. I don't use masked array myself, but it looks like it would be something like: eof1_unmasked = np.array(eof1) eof1_mask = eof1.mask then you could save those two. Maybe a more maskey person could comment? >>> >>> Instead of `eof1_unmasked=np.array(eof1)`, you could do `eof1_unmasked = >>> eof1.data`. The '.data' attribute points to a view of the masked array as >>> a simple ndarray. >>> >>> You may also wanna try `eof1.torecords()` that will return a structured >>> array with dtype `[('_data',type_of_eof1),('_mask', bool)]`. >> >>For automated saving and restoring, try this: >> >>http://currents.soest.hawaii.edu/hgstage/pycurrents/file/686c2802a6c4/file/npzfile.py >> >>Eric >> >> >>___ >>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
Re: [Numpy-discussion] please close 611, 629, 2490, 2264
On Sun, Jun 16, 2013 at 6:40 PM, Eric Firing wrote: > Github issues 611, 629, and 2490 are duplicates. 611 included patches > with a test and a fix, both of which were committed long ago, so all > three issues should be closed. > > Please see my comment on 2264 as to why that should be closed. > > On 1417, please remove the "component:numpy.ma" label and add the > "component:matrixlib" label. > Done. Thanks. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] please close 611, 629, 2490, 2264
Github issues 611, 629, and 2490 are duplicates. 611 included patches with a test and a fix, both of which were committed long ago, so all three issues should be closed. Please see my comment on 2264 as to why that should be closed. On 1417, please remove the "component:numpy.ma" label and add the "component:matrixlib" label. Eric ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] bug fixes: which branch?
On Sun, Jun 16, 2013 at 10:57 PM, Eric Firing wrote: > What is the preferred strategy for handling bug fix PRs? Initial fix on > master, and then a separate PR to backport to v1.7.x? Or the reverse? > It doesn't look like v1.7.x is being merged into master regularly, so > the matplotlib pattern (fix on maintenance, merge maintenance into > master) seems not to be used here. Fix on master then backport is the current strategy. -n ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] bug fixes: which branch?
What is the preferred strategy for handling bug fix PRs? Initial fix on master, and then a separate PR to backport to v1.7.x? Or the reverse? It doesn't look like v1.7.x is being merged into master regularly, so the matplotlib pattern (fix on maintenance, merge maintenance into master) seems not to be used here. Thanks. Eric ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] saving 3d array
Hi! I know it is pretty much the same as you did before, but has been useful for me in the past. Instead of saving each array separately, just create a dictionary and save the it, something like d= {put_all_your_arrays_here} savez_compressed('file.npz', **d) -- Camilo Jiménez On Sat, Jun 15, 2013 at 2:11 PM, Eric Firing wrote: > On 2013/06/15 6:06 AM, Pierre GM wrote: > > > > On Jun 15, 2013, at 17:35 , Matthew Brett > wrote: > > > >> Hi, > >> > >> On Sat, Jun 15, 2013 at 2:51 PM, Sudheer Joseph > >> wrote: > >>> > >>> Thank you very much for this tip. > >>> Is there a typical way to save masked and the rest separately?. Not > much familiar with array handling in numpy. > >> > >> I don't use masked array myself, but it looks like it would be > something like: > >> > >> eof1_unmasked = np.array(eof1) > >> eof1_mask = eof1.mask > >> > >> then you could save those two. Maybe a more maskey person could > comment? > > > > Instead of `eof1_unmasked=np.array(eof1)`, you could do `eof1_unmasked = > eof1.data`. The '.data' attribute points to a view of the masked array as > a simple ndarray. > > > > You may also wanna try `eof1.torecords()` that will return a structured > array with dtype `[('_data',type_of_eof1),('_mask', bool)]`. > > For automated saving and restoring, try this: > > > http://currents.soest.hawaii.edu/hgstage/pycurrents/file/686c2802a6c4/file/npzfile.py > > Eric > > ___ > 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
Re: [Numpy-discussion] TypeError when multiplying float64 and a big integer in Python 3.
On Sun, Jun 16, 2013 at 12:56 PM, Warren Weckesser < warren.weckes...@gmail.com> wrote: > With Python 3.3.2 (64 bit), and numpy master: > > >>> import numpy as np > >>> np.__version__ > '1.8.0.dev-2a5c2c8' > > >>> f = np.float64(1.0) > >>> i = 2**65 > >>> f*i > Traceback (most recent call last): > File "", line 1, in > TypeError: unsupported operand type(s) for *: 'numpy.float64' and 'int' > > Is this the expected behavior? > > The error does not occur with integers that fit in 64 bits: > > >>> f*10 > 10.0 > > It also does not occur in numpy 1.7.1. > > I should have checked the issues on github before mailing the list: https://github.com/numpy/numpy/issues/3442 Warren > Warren > > ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] TypeError when multiplying float64 and a big integer in Python 3.
With Python 3.3.2 (64 bit), and numpy master: >>> import numpy as np >>> np.__version__ '1.8.0.dev-2a5c2c8' >>> f = np.float64(1.0) >>> i = 2**65 >>> f*i Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for *: 'numpy.float64' and 'int' Is this the expected behavior? The error does not occur with integers that fit in 64 bits: >>> f*10 10.0 It also does not occur in numpy 1.7.1. Warren ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] sampling arrays
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.RectBivariateSpline.html#scipy.interpolate.RectBivariateSpline 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.in...@gmail.com;sudheer.jos...@yahoo.com Web- http://oppamthadathil.tripod.com *** - Original Message - > From: Sudheer Joseph > To: Discussion of Numerical Python > 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 >> To: Discussion of Numerical Python >> 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
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 - Original Message - > From: Henry Gomersall > To: Discussion of Numerical Python > 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
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