act.qc.CleanDataset.handle_missing_values#

CleanDataset.handle_missing_values(default_missing_value=np.int32(-9999))[source]#

Correctly handle missing_value and _FillValue in the dataset. xarray will automatically replace missing_value and _FillValue in the data with NaN. This is great for data set as type float but not great for int data. Can cause issues with QC and state fields. This will loop through the array looking for state and QC fields and revert them back to int data type if upconverted to float to handle NaNs. Issue is that xarray will convert data type to float if the attribute is defined even if no data are set as missing value. xarray will also then remove the missing_value or _FillValue variable attribute. This will put the missing_value attribute back if needed.

Parameters:

default_missing_value (numpy int or float) – The default missing value to use if a missing_value attribute is not defined but one is needed.