Re: [Numpy-discussion] netcdf lat lon to coord - ValueError: need more than 1 value to unpack

2015-03-24 Thread questions anon
perfect, thank you! On Tue, Mar 24, 2015 at 9:14 PM, Kiko wrote: > > > 2015-03-24 11:02 GMT+01:00 questions anon : > >> I would like to find the nearest coord in a netcdf from a given latitude >> and longitude. >> I found some fantastic code that does this -

[Numpy-discussion] netcdf lat lon to coord - ValueError: need more than 1 value to unpack

2015-03-24 Thread questions anon
I would like to find the nearest coord in a netcdf from a given latitude and longitude. I found some fantastic code that does this - http://nbviewer.ipython.org/github/Unidata/unidata-python-workshop/blob/master/netcdf-by-coordinates.ipynb but I keep receiving this error - I am receiving a ValueErr

Re: [Numpy-discussion] Find Daily max - create lists using date and add hourly data to that list for the day

2014-05-21 Thread questions anon
#x27;time.hour').max() > > It also might be worth looking at other more data analysis packages, > either more generic (e.g., pandas, http://pandas.pydata.org/) or > weather/climate data specific (e.g., Iris, http://scitools.org.uk/iris/and > CDAT, > http://www2-pcmdi.llnl.gov/cdat

[Numpy-discussion] Find Daily max - create lists using date and add hourly data to that list for the day

2014-05-21 Thread questions anon
I have hourly 2D temperature data in a monthly netcdf and I would like to find the daily maximum temperature. The shape of the netcdf is (744, 106, 193) I would like to use the year-month-day as a new list name (i.e. 2009-03-01, 2009-03-022009-03-31) and then add each of the hours worth of tem

[Numpy-discussion] numpy sum each month and then numpy mean of all months

2014-03-23 Thread questions anon
Hello all, I have netcdf files that contain hourly rainfall data. Each netcdf file includes one months worth of hours and I have 10 years worth of data. I would like to calculate the sum of each month and then the mean of these summed months across all of the years. I have no problem firstly calc

Re: [Numpy-discussion] sum of array for masked area

2013-11-29 Thread questions anon
Thank you Scott for your prompt response. Your suggestion has fixed the problem and thank you for your clear explanation of how it works. thanks!! On Thu, Nov 28, 2013 at 7:20 PM, Scott Sinclair wrote: > On 28 November 2013 09:06, questions anon > wrote: > > I have a separate t

[Numpy-discussion] sum of array for masked area

2013-11-27 Thread questions anon
Hi All, I just posted this on the SciPy forum but realised it might be more appropriate here? I have a separate text file for daily rainfall data that covers the whole country. I would like to calculate the monthly mean, min, max and the mean of the sum for one state. The mean, max and min are jus

Re: [Numpy-discussion] mask array and add to list

2012-04-18 Thread questions anon
excellent thank you, that worked perfectly. I just need to remember this feature next time I need it. Thanks again On Thu, Apr 12, 2012 at 11:41 PM, Tim Cera wrote: > Use 'ma.max' instead of 'np.max'. This might be a bug OR an undocumented > feature. :-) > > import numpy.ma as ma > mar

[Numpy-discussion] mask array and add to list

2012-04-11 Thread questions anon
I am trying to mask an array and then add the array to a list, so I can then go on and calculate the max, min and mean of that list. The mask seems to work when I check each array. I check each array by finding the max, mean and mean and comparing with the unmasked array (they are different). Howev

Re: [Numpy-discussion] numpy.percentile multiple arrays

2012-01-24 Thread questions anon
sure I understand how to write the second suggestion about the iterative approach but will have a go. Thanks again On Wed, Jan 25, 2012 at 1:26 PM, Brett Olsen wrote: > On Tue, Jan 24, 2012 at 6:22 PM, questions anon > wrote: > > I need some help understanding how to loop through ma

[Numpy-discussion] numpy.percentile multiple arrays

2012-01-24 Thread questions anon
I need some help understanding how to loop through many arrays to calculate the 95th percentile. I can easily do this by using numpy.concatenate to make one big array and then finding the 95th percentile using numpy.percentile but this causes a memory error when I want to run this on 100's of netcd

Re: [Numpy-discussion] find location of maximum values

2012-01-09 Thread questions anon
rint ncfiletime On Tue, Jan 10, 2012 at 3:28 PM, Aronne Merrelli wrote: > > > On Mon, Jan 9, 2012 at 7:59 PM, questions anon > wrote: > >> thank you, I seem to have made some progress (with lots of help)!! >> I still seem to be having trouble with the time. Because it is

Re: [Numpy-discussion] find location of maximum values

2012-01-09 Thread questions anon
print ncfiletime On Tue, Jan 10, 2012 at 10:22 AM, Benjamin Root wrote: > > > On Monday, January 9, 2012, questions anon > wrote: > > thanks for the responses. > > Unfortunately they are not matching shapes > >>>> print TSFC.shape, TIME.shape, LAT.shape,

Re: [Numpy-discussion] find location of maximum values

2012-01-09 Thread questions anon
hanks On Wed, Jan 4, 2012 at 10:29 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 04.01.2012, at 5:10AM, questions anon wrote: > > > Thanks for your responses but I am still having difficuties with this > problem. Using argmax gives me one very large value

Re: [Numpy-discussion] find location of maximum values

2012-01-03 Thread questions anon
(TSFC) data are hourly for a whole month. Are there any other ideas for finding the location and time of the maximum value in an array? Thanks On Wed, Dec 21, 2011 at 3:38 PM, Benjamin Root wrote: > > > On Tuesday, December 20, 2011, questions anon > wrote: > > ok thanks,

Re: [Numpy-discussion] find location of maximum values

2011-12-20 Thread questions anon
this may not > be helpful, but just in case... I find it suspicious that you *seem* (by > quickly glancing at the code) to be taking TIME[max(temperature)] instead > of TIME[argmax(temperature)]. > > -=- Olivier > > 2011/12/20 questions anon > >> I have a netcdf file

[Numpy-discussion] find location of maximum values

2011-12-20 Thread questions anon
I have a netcdf file that contains hourly temperature data for a whole month. I would like to find the maximum temperature within that file and also the corresponding Latitude and Longitude and Time and then plot this. Below is the code I have so far. I think everything is working except for identi

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
.close() for b in TSFC[:]: N.maximum(a,b, out=a) print a On Wed, Dec 7, 2011 at 4:11 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 07.12.2011, at 5:54AM, questions anon wrote: > > > sorry the 'all_TSFC' is for m

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
a) > > Not 100% sure that would work though, as I'm not entirely confident I > understand your code. > > > -=- Olivier > > 2011/12/6 questions anon > >> Something fancier I think, >> I am able to compare the result with my previous method so I can easily >

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
max(axis=0) print "max is", Max,"a is", a On Wed, Dec 7, 2011 at 2:34 PM, Olivier Delalleau wrote: > Is 'a' a regular numpy array or something fancier? > > > -=- Olivier > > 2011/12/6 questions anon > >> thanks again my only problem thou

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
numpy.maximum(a, b, out=a) > > I didn't think of the out argument which makes it more efficient, but > in my example I used Python's reduce which takes an iterable and not > one huge array. > > Josef > > > > > > -=- Olivier > > > > 2011/12/6 que

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
iel's one seems to be the ideal one anyway). > > -=- Olivier > > > 2011/12/6 Nathaniel Smith > >> I think you want >> np.maximum(a, b, out=a) >> >> - Nathaniel >> On Dec 6, 2011 9:04 PM, "questions anon" >> wrote: >> >>

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
t; -=- Olivier > > 2011/12/6 questions anon > >> Hi Olivier, >> No that does not seem to do anything >> am I missing another step whereever b is greater than a replace b with a? >> thanks >> >> >> On Wed, Dec 7, 2011 at 11:55 AM, Olivier Delalle

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
eau wrote: > > It may not be the most efficient way to do this, but you can do: > > mask = b > a > > a[mask] = b[mask] > > > > -=- Olivier > > > > 2011/12/6 questions anon > >> > >> I would like to produce an array with the maxim

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
sk] = b[mask] > > -=- Olivier > > 2011/12/6 questions anon > >> I would like to produce an array with the maximum values out of many >> (1s) of arrays. >> I need to loop through many multidimentional arrays and if a value is >> larger (in the same place as the

[Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread questions anon
I would like to produce an array with the maximum values out of many (1s) of arrays. I need to loop through many multidimentional arrays and if a value is larger (in the same place as the previous array) then I would like that value to replace it. e.g. a=[1,1,2,2 11,2,2 1,1,2,2] b=[1,1,3,2 2,1

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
running_sum=N.array(TSFC[i]) >> >> TSFC_avg=N.true_divide(running_sum, slice_counter) >> N.set_printoptions(threshold='nan') >> print "the TSFC_avg is:", TSFC_avg >> >> >> >> >> On Tue, Dec 6, 2011 at 9:50

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
de: > > for each slice: > indexnonNaN=np.isfinite(SliceOf Toto) > SliceOf TotoWithoutNan= SliceOf Toto [indexnonNaN] > > and then perform all operation I want o on the last array. > > i hope it does answer your question > > Xavier > > > 2011/12/6 questions anon

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
ce_counter) N.set_printoptions(threshold='nan') print "the TSFC_avg is:", TSFC_avg On Tue, Dec 6, 2011 at 9:45 AM, David Cournapeau wrote: > On Mon, Dec 5, 2011 at 5:29 PM, questions anon > wrote: > > Maybe I am asking the wrong question or could go about this anot

Re: [Numpy-discussion] ignore NAN in numpy.true_divide()

2011-12-05 Thread questions anon
Dec 1, 2011 at 12:16 PM, questions anon wrote: > I am trying to calculate the mean across many netcdf files. I cannot use > numpy.mean because there are too many files to concatenate and I end up > with a memory error. I have enabled the below code to do what I need but I > have a few n

[Numpy-discussion] loop through arrays and find numpy maximum

2011-11-30 Thread questions anon
I would like to calculate the max and min of many netcdf files. I know how to create one big array and then concatenate and find the numpy.max but when I run this on 1000's of arrays I have a memory error. What I would prefer is to loop through the arrays and produce the maximum without having the

[Numpy-discussion] ignore NAN in numpy.true_divide()

2011-11-30 Thread questions anon
I am trying to calculate the mean across many netcdf files. I cannot use numpy.mean because there are too many files to concatenate and I end up with a memory error. I have enabled the below code to do what I need but I have a few nan values in some of my arrays. Is there a way to ignore these some

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
> numpy.tile(mask.mask, [number_of_repeats] + [1] * len(mask.mask.shape)) > > (not sure that's the most elegant way to do it, but it should work) > > > -=- Olivier > > 2011/11/21 questions anon > >> Excellent, thank you. >> I just realised this does not wor

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
new array is x, you can use: > > numpy.ma.masked_array(x, mask=mask.mask) > > -=- Olivier > > 2011/11/21 questions anon > >> I am trying to mask one array using another array. >> >> I have created a masked array using >> mask=MA.masked_equal(myarray, >> 0), &g

[Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
I am trying to mask one array using another array. I have created a masked array using mask=MA.masked_equal(myarray, 0), that looks something like: [1 - - 1, 1 1 - 1, 1 1 1 1, - 1 - 1] I have an array of values that I want to mask whereever my mask has a a '-'. how do I do this? I