[vtkusers] Can vtkArrayCalculator handle NAN values?
sean.ziegeler at nrlssc.navy.mil
Tue Aug 30 14:10:13 EDT 2011
Numpy has a few functions, like nansum that perform operations that ignore NaN's. See:
However, if you are simply subtracting two arrays, e.g., C=A-B, and A has NaN's in positions where B does not, you will have to decide how to treat the NaN's based on your application. By default, the array values in C where A was NaN will be set to NaN. If you want to do something else, I suggest replacing all NaNs with a value that makes sense for your application. You can do that using the numpy isnan() function:
On 08/29/11 22:32, rakesh patil wrote:
> I have two vtkDoubleArray objects. Say A and B. I need to perform A-B
> operation and store the resultant in suppose C.
> I use vtkArrayCalculator in order to do this. Now the problem is my
> array A contains some NAN values or say bad values. which I obviously
> want to avoid. And therefore I am not getting the expected results.
> So is there any way out to handle NAN's in vtkArrayCalculator..???
> Rakesh Patil
> Powered by www.kitware.com
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers