I suspect I am trying to do something similar... I would like to create a
mask where I have data. In essence, I need to return True where x,y is equal
to lon,lat....
I suppose a setmember solution may somehow be more elegant, but this is what
I've worked up for now... suggestions?
def genDataMask(x,y, xbounds=(-180,180), ybounds=(-90,90), res=(0.5,0.5) ):
""" generate a data mask
no data = False
data = True
"""
xy = numpy.column_stack((x,y))
newx = np.arange(xbounds[0],xbound[1],res[0])
newy = np.arange(ybounds[0],ybounds[1],res[1])
#create datamask
dm = np.empty(len(newx),len(newy))
dm.fill(np.nan)
for _xy in xy:
dm[np.where(_xy[0]=newx),np.where(_xy[1]==newy) ] = True
--
View this message in context: http://www.nabble.com/Masking-an-array-with-another-array-tp23185887p24943419.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.