[Numpy-discussion] Getting masked array boundary indices

Sudheer Joseph sudheer.joseph at yahoo.com
Wed Nov 27 07:01:10 EST 2013


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.

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 at gmail.com;sudheer.joseph at yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************



More information about the NumPy-Discussion mailing list