act.utils.calculate_percentages#
- act.utils.calculate_percentages(ds, fields, time=None, time_slice=None, threshold=None, fill_value=0.0)[source]#
This function calculates percentages of different fields of a dataset.
- Parameters:
ds (ACT Dataset) – The ACT dataset to calculate the percentages on.
fields (list) – A list of all the fields to use in the percentage calculations.
time (datetime) – A single datetime to calculate percentages on if desired. Default is None and all data will be included.
time_slice (tuple) – A tuple of two datetimes to grab all data between those two datatimes. Default is None and all data will be included.
threshold (float) – Threshold in which anything below will be considered invalid. Default is None.
fill_value (float) – Fill value for invalid data. Only used if a threshold is provided.
- Returns:
percentages (dict) – A dictionary containing the fields provided and their corresponding percentage that was calculated.