AnsweredAssumed Answered

Not a number (nan/1.#QNAN) condition testing for a FGDB raster attribute table?

Question asked by csny490 on Sep 17, 2012
Latest reply on Sep 17, 2012 by csny490
I'm cursoring through a FGDB raster attribute table in v10.1... Some of the attribute values are "Null" (aka 1.#QNAN), but when when evaluated in a cursor, they appear as a value called nan, for example:

>>> print updateRow[updateRows.fields.index("HCB")] nan
Unfortunatly nan is not a string but a float value... which is what the HCB field type is.

>>> type(updateRow[updateRows.fields.index("HCB")]) <type 'float'>


And nan isn't the same as None

>>> updateRow[updateRows.fields.index("HCB")] == None False

Problem is, I need a way to test for these nan values and then evaluate them as 0's... Something like:

hcbValue = updateRow[updateRows.fields.index("HCB")]) if hcbValue == None:     hcbValue = 0


If these evaluated as None, then of course it would be easy... but they don't, so it aint.

Anyone know how to do a conditional test for nan values???

Outcomes