From 97ababc8e4400c11b7a854693f095a22c768d806 Mon Sep 17 00:00:00 2001 From: Douglas Nehme <9803272+douglasnehme@users.noreply.github.com> Date: Thu, 16 Sep 2021 18:17:10 -0300 Subject: [PATCH] Reproduce matplotlib.mlab.find Apply https://github.com/kthyng/tracpy/issues/12#issuecomment-555493595 --- tracpy/tools.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tracpy/tools.py b/tracpy/tools.py index bde2781..19fe394 100755 --- a/tracpy/tools.py +++ b/tracpy/tools.py @@ -9,6 +9,7 @@ * convert_indices * check_points * seed +* find """ import numpy as np @@ -476,3 +477,13 @@ def make_proj(setup='nwgom', usebasemap=True, **kwargs): proj = Proj(**inputs) return proj + + +def find(condition): + """ + https://github.com/kthyng/tracpy/issues/12#issuecomment-555493595 + """ + + res, = np.nonzero(np.ravel(condition)) + + return res