numerix.nan?

I think a numpy-ism crept into the code-base (not that I particularly mind as I will welcome the day matplotlib jettisons it's 3-array support).

In quiver.py, nx.nan is attempted, which raises an error, unless I'm missing the definition of nan somewhere.

In SVN, I have imported nan from numpy explicitly

Best,

-Travis

Travis E. Oliphant wrote:

I think a numpy-ism crept into the code-base (not that I particularly mind as I will welcome the day matplotlib jettisons it's 3-array support).

So will I! I don't have John's saintly patience, although I understand his rationale. My error in this case was failing to test a change I made with all three packages, although I try to do that whenever I think there might be a problem.

In quiver.py, nx.nan is attempted, which raises an error, unless I'm missing the definition of nan somewhere.

Well, it was working at least with the version of numpy I had when I made the change in quiver to use nan internally as a mechanism for supporting masked array input. I have updated to svn, and it works with your change of course, so all is well. I added nan definitions for Numeric and numarray which work on my linux box, but I have not tested them on other platforms; I guess in the worst case, if it doesn't work on Mac or Windows I will have to change quiver.py to use masked arrays internally instead of nans. (The definition I used is "nan = float('nan')".) I used nan here because it considerably simplifies the code, now that nan is supported in the primary backends.

Eric

Eric Firing wrote:

I added nan definitions for
Numeric and numarray which work on my linux box, but I have not tested them on other platforms; I guess in the worst case, if it doesn't work on Mac or Windows I will have to change quiver.py to use masked arrays internally instead of nans. (The definition I used is "nan = float('nan')".)

That will certainly not work on Windows.

···

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

Robert Kern wrote:

Eric Firing wrote:

I added nan definitions for
Numeric and numarray which work on my linux box, but I have not tested them on other platforms; I guess in the worst case, if it doesn't work on Mac or Windows I will have to change quiver.py to use masked arrays internally instead of nans. (The definition I used is "nan = float('nan')".)

That will certainly not work on Windows.

Thanks for the quick info.

I think the following (now in svn) should be OK; it seems to work on Windows, at least in the sense that it doesn't trigger an exception.

nan = struct.unpack('d', struct.pack('Q', 0x7ff8000000000000))[0]

Eric

Eric Firing wrote:

I think the following (now in svn) should be OK; it seems to work on Windows, at least in the sense that it doesn't trigger an exception.

nan = struct.unpack('d', struct.pack('Q', 0x7ff8000000000000))[0]

It works on OS-X PPC also. I was wondering about endian issues.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...236...