Skip to content
Snippets Groups Projects
Commit 0c0f7e4a authored by Sebastian Müller's avatar Sebastian Müller 🐈
Browse files

Info: add 'is_masked' property

parent b62a1a08
No related branches found
No related tags found
1 merge request!260Masked array support
......@@ -20,6 +20,8 @@ UNITS = pint.application_registry
_UNIT_PAIRS_CACHE = {}
_MASK_INDICATORS = ["_FillValue", "missing_value"]
def prepare(data, info, time_entries=1, force_copy=False, report_conversion=False):
"""
......@@ -667,6 +669,11 @@ class Info:
units = None if units is None else UNITS.Unit(units)
self.meta["units"] = units
@property
def is_masked(self):
"""bool: whether info indicates masked data ("_FillValue" or "missing_value" in meta)."""
return any(v in self.meta for v in _MASK_INDICATORS)
def copy(self):
"""Copies the info object"""
return copy.copy(self)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment