act.utils.get_missing_value(data_object, variable, default=-9999, add_if_missing_in_obj=False, use_FillValue=False, nodefault=False)[source]

Function to get missing value from missing_value or _FillValue attribute. Works well with catching errors and allows for a default value when a missing value is not listed in the object. You may get strange results becaus xarray will automatically convert all missing_value or _FillValue to NaN and then remove the missing_value and _FillValue variable attribute when reading data with default settings.

  • data_object (xarray dataset) – Xarray dataset containing data variable.

  • variable (str) – Variable name to use for getting missing value.

  • default (int or float) – Default value to use if missing value attribute is not in data object.

  • add_if_missing_in_obj (bool) – Boolean to add to object if does not exist. Default is False.

  • use_FillValue (bool) – Boolean to use _FillValue instead of missing_value. If missing_value does exist and _FillValue does not will add _FillValue set to missing_value value.

  • nodefault (bool) – Option to use this to check if the varible has a missing value set and do not want to get default as return. If the missing value is found will return, else will return None.


missing (scalar int or float (or None)) – Value used to indicate missing value matching type of data or None if nodefault keyword set to True.


from act.utils import get_missing_value

missing = get_missing_value(dq_object, "temp_mean")