masked_array#
- metpy.units.masked_array(data, data_units=None, **kwargs)[source]#
Create a
numpy.ma.MaskedArray
with units attached.This is a thin wrapper around
numpy.ma.MaskedArray
that ensures that units are properly attached to the result (otherwise units are silently lost). Units are taken from thedata_units
argument, or if this isNone
, the units ondata
are used.- Parameters:
data (array-like) – The source data. If
data_units
is None, this should be apint.Quantity
with the desired units.data_units (str or
pint.Unit
, optional) – The units for the resultingpint.Quantity
kwargs – Arbitrary keyword arguments passed to
numpy.ma.masked_array
, optional
- Returns: