| 
	I am not sure what you mean by "IDL is taking into account zero values that are used to define NaN pixels".  Are the '0's' set to NaN?  0 is a valid value so in order to ignore pixels in ENVI_STATS_DOIT, you need to use a Mask (m_fid, m_pos) or set the 0's to NaN.  Then those pixels will be ignored in your statistics calculation.  I would use a mask since NaN pixels can cause issues in other processes.
 |