Skip to content

Instantly share code, notes, and snippets.

View tatarinova's full-sized avatar

Natalia tatarinova

  • Meteo France
  • France
View GitHub Profile
import numpy
def get_masked_arr(arr, fill_val):
'''
If a masked array is passed, this function does nothing.
If a filled array is passed (fill_value must be passed also), it will be transformed into a masked array.
'''
if isinstance(arr, numpy.ma.MaskedArray): # numpy.ma.MaskedArray