On Wed, Nov 27, 2013 at 7:01 AM, Sudheer Joseph <[email protected]> wrote: > Hi, > I have a numpy array which is masked ( bathymetry), as seen > below > > [ True] > [ True] > [ True] > [ True]], > fill_value = -9999.0) > > > In [10]: depth[:,1130:1131] > > I need to find the indices where land(mask) is there along the boundaries and > where water(value) is there along the boundaries, the above listing is along > eastern boundary. > Please help if there is a way to get starting and ending index of mask. > I tried np.where but it gives another array as there are several mask points > are there, I need to use some thing like "if neighbouring points are True > and False then" index =i, but I am not getting the pythonic way to get this > done.
if I understand correctly np.nonzero(np.diff(depth.mask))[0] Josef > > 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:[email protected];[email protected] > Web- http://oppamthadathil.tripod.com > *************************************************************** > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
