parameters: (data, missing_value)
return_statement: return newdata
docstring: Applies the given missing value to the data array.
  
          Returns a numpy.ma array, with any value equal to missing_value masked
          out (unless missing_value is None, in which case the original array is
          returned).
docstring_summary: Applies the given missing value to the data array.
docstring_tokens: Applies the given missing value to the data array .
function: def _apply_missing_value(data, missing_value):
          """
          Applies the given missing value to the data array.
  
          Returns a numpy.ma array, with any value equal to missing_value masked
          out (unless missing_value is None, in which case the original array is
          returned).
          """
  
          if missing_value is None:
              newdata = data
          else:
              try:
                  missing_value_isnan = np.isnan(missing_value)
              except (TypeError, NotImplementedError):
                  # some data types (e.g., characters) cannot be tested for NaN
                  missing_value_isnan = False
  
              if missing_value_isnan:
                  mymask = np.isnan(data)
              else:
                  mymask = (data == missing_value)
  
              newdata = np.ma.masked_where(mymask, data)
  
          return newdata
function_tokens: def _apply_missing_value ( data , missing_value ) : if missing_value is None : newdata = data else : try : missing_value_isnan = np . isnan ( missing_value ) except ( TypeError , NotImplementedError ) : # some data types (e.g., characters) cannot be tested for NaN missing_value_isnan = False if missing_value_isnan : mymask = np . isnan ( data ) else : mymask = ( data == missing_value ) newdata = np . ma . masked_where ( mymask , data ) return newdata