From: Christopher B. <Chr...@no...> - 2009-02-24 23:27:14
|
Ken, I've found Numerix used in wxmpl, but it's been deprecated, so I've replaced all the calls with direct numpy calls. However, I can't pretend that I've tested well at all -- all I know is that it's working for me. In particular, I haven't tested plotit beyond making sure it complies. I've enclosed a zip archive with my modifications. If you have it in SVN somewhere I could give you a diff -- just let me know if I can help further. Also, I see this a lot in your plotit code: if not isinstance(x, (np.ndarray, np.ma.masked_array)): (though you had Numerix equivalent) What I like to do instead is call: try: x = asarray(x, dtype=np.float) except ValueError: raise your error here... (and maybe a reshape call, too, to make sure it can be converted into that shape) I usually don't care if I'm getting an array, as long as it can be turned into one... If you do want to check the type, np.ma is a subclass of ndarray, so: isinstance(x, np.ndarray) should do it. That's what I've put in the code for now. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |